summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/expat/xmlwf
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-10-15 04:28:42 +1100
committer Vas Crabb <vas@vastheman.com>2020-10-15 04:28:42 +1100
commitd256f069a5aa30bf5ffcfc4b73047ce0f372ea10 (patch)
tree8df1bd2e70d7e15e59928203d0eb687c82307bff /3rdparty/expat/xmlwf
parent13850f3011e000307925aefd918efe2f0ce6649d (diff)
-3rdparty/expat: Update to 2.2.10."
-Fixed tiny build (missing s11c_bg_device) and unused lambda capture in emu/rendlay.cpp.
Diffstat (limited to '3rdparty/expat/xmlwf')
-rw-r--r--3rdparty/expat/xmlwf/Makefile.am60
-rw-r--r--3rdparty/expat/xmlwf/Makefile.in783
-rw-r--r--3rdparty/expat/xmlwf/codepage.c98
-rw-r--r--3rdparty/expat/xmlwf/codepage.h32
-rw-r--r--3rdparty/expat/xmlwf/ct.c58
-rw-r--r--3rdparty/expat/xmlwf/filemap.h48
-rw-r--r--3rdparty/expat/xmlwf/readfilemap.c116
-rw-r--r--3rdparty/expat/xmlwf/unixfilemap.c68
-rw-r--r--3rdparty/expat/xmlwf/win32filemap.c72
-rw-r--r--3rdparty/expat/xmlwf/xmlfile.c203
-rw-r--r--3rdparty/expat/xmlwf/xmlfile.h43
-rw-r--r--3rdparty/expat/xmlwf/xmlmime.c70
-rw-r--r--3rdparty/expat/xmlwf/xmlmime.h32
-rw-r--r--3rdparty/expat/xmlwf/xmltchar.h104
-rw-r--r--3rdparty/expat/xmlwf/xmlurl.h13
-rw-r--r--3rdparty/expat/xmlwf/xmlwf.c688
-rw-r--r--3rdparty/expat/xmlwf/xmlwf.dsp139
-rwxr-xr-x3rdparty/expat/xmlwf/xmlwf_helpgen.py69
-rwxr-xr-x3rdparty/expat/xmlwf/xmlwf_helpgen.sh35
-rw-r--r--3rdparty/expat/xmlwf/xmlwin32url.cxx395
20 files changed, 2081 insertions, 1045 deletions
diff --git a/3rdparty/expat/xmlwf/Makefile.am b/3rdparty/expat/xmlwf/Makefile.am
new file mode 100644
index 00000000000..f35ade7a77a
--- /dev/null
+++ b/3rdparty/expat/xmlwf/Makefile.am
@@ -0,0 +1,60 @@
+#
+# __ __ _
+# ___\ \/ /_ __ __ _| |_
+# / _ \\ /| '_ \ / _` | __|
+# | __// \| |_) | (_| | |_
+# \___/_/\_\ .__/ \__,_|\__|
+# |_| XML parser
+#
+# Copyright (c) 2017 Expat development team
+# Licensed under the MIT license:
+#
+# 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+# USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+bin_PROGRAMS = xmlwf
+
+xmlwf_LDADD = ../lib/libexpat.la
+xmlwf_SOURCES = \
+ xmlwf.c \
+ xmlfile.c \
+ codepage.c \
+ @FILEMAP@.c
+
+xmlwf_CPPFLAGS = @AM_CPPFLAGS@ -I$(srcdir)/../lib
+xmlwf_LDFLAGS = @AM_LDFLAGS@
+
+if MINGW
+if UNICODE
+xmlwf_CPPFLAGS += -mwindows
+xmlwf_LDFLAGS += -municode
+endif
+endif
+
+EXTRA_DIST = \
+ codepage.h \
+ ct.c \
+ filemap.h \
+ readfilemap.c \
+ unixfilemap.c \
+ win32filemap.c \
+ xmlfile.h \
+ xmlmime.c \
+ xmlmime.h \
+ xmltchar.h
diff --git a/3rdparty/expat/xmlwf/Makefile.in b/3rdparty/expat/xmlwf/Makefile.in
new file mode 100644
index 00000000000..531475ab243
--- /dev/null
+++ b/3rdparty/expat/xmlwf/Makefile.in
@@ -0,0 +1,783 @@
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# __ __ _
+# ___\ \/ /_ __ __ _| |_
+# / _ \\ /| '_ \ / _` | __|
+# | __// \| |_) | (_| | |_
+# \___/_/\_\ .__/ \__,_|\__|
+# |_| XML parser
+#
+# Copyright (c) 2017 Expat development team
+# Licensed under the MIT license:
+#
+# 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+# USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = xmlwf$(EXEEXT)
+@MINGW_TRUE@@UNICODE_TRUE@am__append_1 = -mwindows
+@MINGW_TRUE@@UNICODE_TRUE@am__append_2 = -municode
+subdir = xmlwf
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/conftools/ax-require-defined.m4 \
+ $(top_srcdir)/conftools/ax-check-compile-flag.m4 \
+ $(top_srcdir)/conftools/ax-check-link-flag.m4 \
+ $(top_srcdir)/conftools/ax-append-flag.m4 \
+ $(top_srcdir)/conftools/ax-append-compile-flags.m4 \
+ $(top_srcdir)/conftools/ax-append-link-flags.m4 \
+ $(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/expat_config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_xmlwf_OBJECTS = xmlwf-xmlwf.$(OBJEXT) xmlwf-xmlfile.$(OBJEXT) \
+ xmlwf-codepage.$(OBJEXT) xmlwf-@FILEMAP@.$(OBJEXT)
+xmlwf_OBJECTS = $(am_xmlwf_OBJECTS)
+xmlwf_DEPENDENCIES = ../lib/libexpat.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+xmlwf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(xmlwf_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/xmlwf-@FILEMAP@.Po \
+ ./$(DEPDIR)/xmlwf-codepage.Po ./$(DEPDIR)/xmlwf-xmlfile.Po \
+ ./$(DEPDIR)/xmlwf-xmlwf.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(xmlwf_SOURCES)
+DIST_SOURCES = $(xmlwf_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(top_srcdir)/conftools/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILEMAP = @FILEMAP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBAGE = @LIBAGE@
+LIBCURRENT = @LIBCURRENT@
+LIBOBJS = @LIBOBJS@
+LIBREVISION = @LIBREVISION@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+_EXPAT_OUTPUT_NAME = @_EXPAT_OUTPUT_NAME@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xmlwf_LDADD = ../lib/libexpat.la
+xmlwf_SOURCES = \
+ xmlwf.c \
+ xmlfile.c \
+ codepage.c \
+ @FILEMAP@.c
+
+xmlwf_CPPFLAGS = @AM_CPPFLAGS@ -I$(srcdir)/../lib $(am__append_1)
+xmlwf_LDFLAGS = @AM_LDFLAGS@ $(am__append_2)
+EXTRA_DIST = \
+ codepage.h \
+ ct.c \
+ filemap.h \
+ readfilemap.c \
+ unixfilemap.c \
+ win32filemap.c \
+ xmlfile.h \
+ xmlmime.c \
+ xmlmime.h \
+ xmltchar.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu xmlwf/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu xmlwf/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+xmlwf$(EXEEXT): $(xmlwf_OBJECTS) $(xmlwf_DEPENDENCIES) $(EXTRA_xmlwf_DEPENDENCIES)
+ @rm -f xmlwf$(EXEEXT)
+ $(AM_V_CCLD)$(xmlwf_LINK) $(xmlwf_OBJECTS) $(xmlwf_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-@FILEMAP@.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+xmlwf-xmlwf.o: xmlwf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-xmlwf.o -MD -MP -MF $(DEPDIR)/xmlwf-xmlwf.Tpo -c -o xmlwf-xmlwf.o `test -f 'xmlwf.c' || echo '$(srcdir)/'`xmlwf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-xmlwf.Tpo $(DEPDIR)/xmlwf-xmlwf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xmlwf.c' object='xmlwf-xmlwf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-xmlwf.o `test -f 'xmlwf.c' || echo '$(srcdir)/'`xmlwf.c
+
+xmlwf-xmlwf.obj: xmlwf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-xmlwf.obj -MD -MP -MF $(DEPDIR)/xmlwf-xmlwf.Tpo -c -o xmlwf-xmlwf.obj `if test -f 'xmlwf.c'; then $(CYGPATH_W) 'xmlwf.c'; else $(CYGPATH_W) '$(srcdir)/xmlwf.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-xmlwf.Tpo $(DEPDIR)/xmlwf-xmlwf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xmlwf.c' object='xmlwf-xmlwf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-xmlwf.obj `if test -f 'xmlwf.c'; then $(CYGPATH_W) 'xmlwf.c'; else $(CYGPATH_W) '$(srcdir)/xmlwf.c'; fi`
+
+xmlwf-xmlfile.o: xmlfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-xmlfile.o -MD -MP -MF $(DEPDIR)/xmlwf-xmlfile.Tpo -c -o xmlwf-xmlfile.o `test -f 'xmlfile.c' || echo '$(srcdir)/'`xmlfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-xmlfile.Tpo $(DEPDIR)/xmlwf-xmlfile.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xmlfile.c' object='xmlwf-xmlfile.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-xmlfile.o `test -f 'xmlfile.c' || echo '$(srcdir)/'`xmlfile.c
+
+xmlwf-xmlfile.obj: xmlfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-xmlfile.obj -MD -MP -MF $(DEPDIR)/xmlwf-xmlfile.Tpo -c -o xmlwf-xmlfile.obj `if test -f 'xmlfile.c'; then $(CYGPATH_W) 'xmlfile.c'; else $(CYGPATH_W) '$(srcdir)/xmlfile.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-xmlfile.Tpo $(DEPDIR)/xmlwf-xmlfile.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xmlfile.c' object='xmlwf-xmlfile.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-xmlfile.obj `if test -f 'xmlfile.c'; then $(CYGPATH_W) 'xmlfile.c'; else $(CYGPATH_W) '$(srcdir)/xmlfile.c'; fi`
+
+xmlwf-codepage.o: codepage.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-codepage.o -MD -MP -MF $(DEPDIR)/xmlwf-codepage.Tpo -c -o xmlwf-codepage.o `test -f 'codepage.c' || echo '$(srcdir)/'`codepage.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-codepage.Tpo $(DEPDIR)/xmlwf-codepage.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='codepage.c' object='xmlwf-codepage.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-codepage.o `test -f 'codepage.c' || echo '$(srcdir)/'`codepage.c
+
+xmlwf-codepage.obj: codepage.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-codepage.obj -MD -MP -MF $(DEPDIR)/xmlwf-codepage.Tpo -c -o xmlwf-codepage.obj `if test -f 'codepage.c'; then $(CYGPATH_W) 'codepage.c'; else $(CYGPATH_W) '$(srcdir)/codepage.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-codepage.Tpo $(DEPDIR)/xmlwf-codepage.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='codepage.c' object='xmlwf-codepage.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-codepage.obj `if test -f 'codepage.c'; then $(CYGPATH_W) 'codepage.c'; else $(CYGPATH_W) '$(srcdir)/codepage.c'; fi`
+
+xmlwf-@FILEMAP@.o: @FILEMAP@.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-@FILEMAP@.o -MD -MP -MF $(DEPDIR)/xmlwf-@FILEMAP@.Tpo -c -o xmlwf-@FILEMAP@.o `test -f '@FILEMAP@.c' || echo '$(srcdir)/'`@FILEMAP@.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-@FILEMAP@.Tpo $(DEPDIR)/xmlwf-@FILEMAP@.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='@FILEMAP@.c' object='xmlwf-@FILEMAP@.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-@FILEMAP@.o `test -f '@FILEMAP@.c' || echo '$(srcdir)/'`@FILEMAP@.c
+
+xmlwf-@FILEMAP@.obj: @FILEMAP@.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xmlwf-@FILEMAP@.obj -MD -MP -MF $(DEPDIR)/xmlwf-@FILEMAP@.Tpo -c -o xmlwf-@FILEMAP@.obj `if test -f '@FILEMAP@.c'; then $(CYGPATH_W) '@FILEMAP@.c'; else $(CYGPATH_W) '$(srcdir)/@FILEMAP@.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xmlwf-@FILEMAP@.Tpo $(DEPDIR)/xmlwf-@FILEMAP@.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='@FILEMAP@.c' object='xmlwf-@FILEMAP@.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xmlwf_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xmlwf-@FILEMAP@.obj `if test -f '@FILEMAP@.c'; then $(CYGPATH_W) '@FILEMAP@.c'; else $(CYGPATH_W) '$(srcdir)/@FILEMAP@.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po
+ -rm -f ./$(DEPDIR)/xmlwf-codepage.Po
+ -rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po
+ -rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po
+ -rm -f ./$(DEPDIR)/xmlwf-codepage.Po
+ -rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po
+ -rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/3rdparty/expat/xmlwf/codepage.c b/3rdparty/expat/xmlwf/codepage.c
index 57e48ff2d12..44d2035811d 100644
--- a/3rdparty/expat/xmlwf/codepage.c
+++ b/3rdparty/expat/xmlwf/codepage.c
@@ -1,26 +1,56 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "codepage.h"
+#include "internal.h" /* for UNUSED_P only */
-#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__)))
-#define STRICT 1
-#define WIN32_LEAN_AND_MEAN 1
+#if defined(_WIN32)
+# define STRICT 1
+# define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
+# include <windows.h>
+#endif /* defined(_WIN32) */
int
-codepageMap(int cp, int *map)
-{
+codepageMap(int cp, int *map) {
+#if defined(_WIN32)
int i;
CPINFO info;
- if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2)
+ if (! GetCPInfo(cp, &info) || info.MaxCharSize > 2)
return 0;
for (i = 0; i < 256; i++)
map[i] = -1;
if (info.MaxCharSize > 1) {
- for (i = 0; i < MAX_LEADBYTES; i+=2) {
+ for (i = 0; i < MAX_LEADBYTES; i += 2) {
int j, lim;
if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0)
break;
@@ -30,39 +60,35 @@ codepageMap(int cp, int *map)
}
}
for (i = 0; i < 256; i++) {
- if (map[i] == -1) {
- char c = (char)i;
- unsigned short n;
- if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
- &c, 1, &n, 1) == 1)
- map[i] = n;
- }
+ if (map[i] == -1) {
+ char c = (char)i;
+ unsigned short n;
+ if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, &c, 1,
+ &n, 1)
+ == 1)
+ map[i] = n;
+ }
}
return 1;
+#else
+ UNUSED_P(cp);
+ UNUSED_P(map);
+ return 0;
+#endif
}
int
-codepageConvert(int cp, const char *p)
-{
+codepageConvert(int cp, const char *p) {
+#if defined(_WIN32)
unsigned short c;
- if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
- p, 2, &c, 1) == 1)
+ if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, p, 2, &c,
+ 1)
+ == 1)
return c;
return -1;
-}
-
-#else /* not WIN32 */
-
-int
-codepageMap(int cp, int *map)
-{
- return 0;
-}
-
-int
-codepageConvert(int cp, const char *p)
-{
+#else
+ UNUSED_P(cp);
+ UNUSED_P(p);
return -1;
+#endif
}
-
-#endif /* not WIN32 */
diff --git a/3rdparty/expat/xmlwf/codepage.h b/3rdparty/expat/xmlwf/codepage.h
index 6a4df68883e..1b75d58365f 100644
--- a/3rdparty/expat/xmlwf/codepage.h
+++ b/3rdparty/expat/xmlwf/codepage.h
@@ -1,5 +1,33 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
int codepageMap(int cp, int *map);
diff --git a/3rdparty/expat/xmlwf/ct.c b/3rdparty/expat/xmlwf/ct.c
index 95903a34500..dcf92bab568 100644
--- a/3rdparty/expat/xmlwf/ct.c
+++ b/3rdparty/expat/xmlwf/ct.c
@@ -1,8 +1,39 @@
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
#define CHARSET_MAX 41
static const char *
-getTok(const char **pp)
-{
+getTok(const char **pp) {
enum { inAtom, inString, init, inComment };
int state = init;
const char *tokStart = 0;
@@ -70,9 +101,8 @@ getTok(const char **pp)
/* key must be lowercase ASCII */
static int
-matchkey(const char *start, const char *end, const char *key)
-{
- if (!start)
+matchkey(const char *start, const char *end, const char *key) {
+ if (! start)
return 0;
for (; start != end; start++, key++)
if (*start != *key && *start != 'A' + (*key - 'a'))
@@ -81,8 +111,7 @@ matchkey(const char *start, const char *end, const char *key)
}
void
-getXMLCharset(const char *buf, char *charset)
-{
+getXMLCharset(const char *buf, char *charset) {
const char *next, *p;
charset[0] = '\0';
@@ -90,10 +119,10 @@ getXMLCharset(const char *buf, char *charset)
p = getTok(&next);
if (matchkey(p, next, "text"))
strcpy(charset, "us-ascii");
- else if (!matchkey(p, next, "application"))
+ else if (! matchkey(p, next, "application"))
return;
p = getTok(&next);
- if (!p || *p != '/')
+ if (! p || *p != '/')
return;
p = getTok(&next);
if (matchkey(p, next, "xml"))
@@ -119,8 +148,7 @@ getXMLCharset(const char *buf, char *charset)
*s++ = *p;
}
*s++ = '\0';
- }
- else {
+ } else {
if (next - p > CHARSET_MAX - 1)
break;
while (p != next)
@@ -131,15 +159,13 @@ getXMLCharset(const char *buf, char *charset)
}
}
}
- }
- else
- p = getTok(&next);
+ } else
+ p = getTok(&next);
}
}
int
-main(int argc, char **argv)
-{
+main(int argc, char **argv) {
char buf[CHARSET_MAX];
getXMLCharset(argv[1], buf);
printf("charset = \"%s\"\n", buf);
diff --git a/3rdparty/expat/xmlwf/filemap.h b/3rdparty/expat/xmlwf/filemap.h
index 814edec2528..ef66114422f 100644
--- a/3rdparty/expat/xmlwf/filemap.h
+++ b/3rdparty/expat/xmlwf/filemap.h
@@ -1,17 +1,53 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <limits.h> /* INT_MAX */
#include <stddef.h>
+/* The following limit (for XML_Parse's int len) derives from
+ * this loop in xmparse.c:
+ *
+ * do {
+ * bufferSize = (int) (2U * (unsigned) bufferSize);
+ * } while (bufferSize < neededSize && bufferSize > 0);
+ */
+#define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1)
+
#ifdef XML_UNICODE
int filemap(const wchar_t *name,
- void (*processor)(const void *, size_t,
- const wchar_t *, void *arg),
+ void (*processor)(const void *, size_t, const wchar_t *, void *arg),
void *arg);
#else
int filemap(const char *name,
- void (*processor)(const void *, size_t,
- const char *, void *arg),
+ void (*processor)(const void *, size_t, const char *, void *arg),
void *arg);
#endif
diff --git a/3rdparty/expat/xmlwf/readfilemap.c b/3rdparty/expat/xmlwf/readfilemap.c
index bd32b934147..d5b84f995ad 100644
--- a/3rdparty/expat/xmlwf/readfilemap.c
+++ b/3rdparty/expat/xmlwf/readfilemap.c
@@ -1,5 +1,33 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <sys/types.h>
@@ -8,64 +36,76 @@
#include <stdlib.h>
#include <stdio.h>
-#ifdef __WATCOMC__
-#ifndef __LINUX__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
+/* Functions close(2) and read(2) */
+#if ! defined(_WIN32) && ! defined(_WIN64)
+# include <unistd.h>
#endif
-#ifdef __BEOS__
-#include <unistd.h>
+/* Function "read": */
+#if defined(_MSC_VER)
+# include <io.h>
+/* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */
+# define _EXPAT_read _read
+# define _EXPAT_read_count_t int
+# define _EXPAT_read_req_t unsigned int
+#else /* POSIX */
+/* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */
+# define _EXPAT_read read
+# define _EXPAT_read_count_t ssize_t
+# define _EXPAT_read_req_t size_t
#endif
#ifndef S_ISREG
-#ifndef S_IFREG
-#define S_IFREG _S_IFREG
-#endif
-#ifndef S_IFMT
-#define S_IFMT _S_IFMT
-#endif
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+# ifndef S_IFREG
+# define S_IFREG _S_IFREG
+# endif
+# ifndef S_IFMT
+# define S_IFMT _S_IFMT
+# endif
+# define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
#endif /* not S_ISREG */
#ifndef O_BINARY
-#ifdef _O_BINARY
-#define O_BINARY _O_BINARY
-#else
-#define O_BINARY 0
-#endif
+# ifdef _O_BINARY
+# define O_BINARY _O_BINARY
+# else
+# define O_BINARY 0
+# endif
#endif
+#include "xmltchar.h"
#include "filemap.h"
int
-filemap(const char *name,
- void (*processor)(const void *, size_t, const char *, void *arg),
- void *arg)
-{
+filemap(const tchar *name,
+ void (*processor)(const void *, size_t, const tchar *, void *arg),
+ void *arg) {
size_t nbytes;
int fd;
- int n;
+ _EXPAT_read_count_t n;
struct stat sb;
void *p;
- fd = open(name, O_RDONLY|O_BINARY);
+ fd = topen(name, O_RDONLY | O_BINARY);
if (fd < 0) {
- perror(name);
+ tperror(name);
return 0;
}
if (fstat(fd, &sb) < 0) {
- perror(name);
+ tperror(name);
close(fd);
return 0;
}
- if (!S_ISREG(sb.st_mode)) {
- fprintf(stderr, "%s: not a regular file\n", name);
+ if (! S_ISREG(sb.st_mode)) {
+ ftprintf(stderr, T("%s: not a regular file\n"), name);
close(fd);
return 0;
}
+ if (sb.st_size > XML_MAX_CHUNK_LEN) {
+ close(fd);
+ return 2; /* Cannot be passed to XML_Parse in one go */
+ }
+
nbytes = sb.st_size;
/* malloc will return NULL with nbytes == 0, handle files with size 0 */
if (nbytes == 0) {
@@ -75,20 +115,20 @@ filemap(const char *name,
return 1;
}
p = malloc(nbytes);
- if (!p) {
- fprintf(stderr, "%s: out of memory\n", name);
+ if (! p) {
+ ftprintf(stderr, T("%s: out of memory\n"), name);
close(fd);
return 0;
}
- n = read(fd, p, nbytes);
+ n = _EXPAT_read(fd, p, (_EXPAT_read_req_t)nbytes);
if (n < 0) {
- perror(name);
+ tperror(name);
free(p);
close(fd);
return 0;
}
- if (n != nbytes) {
- fprintf(stderr, "%s: read unexpected number of bytes\n", name);
+ if (n != (_EXPAT_read_count_t)nbytes) {
+ ftprintf(stderr, T("%s: read unexpected number of bytes\n"), name);
free(p);
close(fd);
return 0;
diff --git a/3rdparty/expat/xmlwf/unixfilemap.c b/3rdparty/expat/xmlwf/unixfilemap.c
index e13299da05f..0d0dc0424dc 100644
--- a/3rdparty/expat/xmlwf/unixfilemap.c
+++ b/3rdparty/expat/xmlwf/unixfilemap.c
@@ -1,5 +1,33 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <sys/types.h>
@@ -12,36 +40,46 @@
#include <unistd.h>
#ifndef MAP_FILE
-#define MAP_FILE 0
+# define MAP_FILE 0
#endif
+#include "xmltchar.h"
#include "filemap.h"
+#ifdef XML_UNICODE_WCHAR_T
+# define XML_FMT_STR "ls"
+#else
+# define XML_FMT_STR "s"
+#endif
+
int
-filemap(const char *name,
- void (*processor)(const void *, size_t, const char *, void *arg),
- void *arg)
-{
+filemap(const tchar *name,
+ void (*processor)(const void *, size_t, const tchar *, void *arg),
+ void *arg) {
int fd;
size_t nbytes;
struct stat sb;
void *p;
- fd = open(name, O_RDONLY);
+ fd = topen(name, O_RDONLY);
if (fd < 0) {
- perror(name);
+ tperror(name);
return 0;
}
if (fstat(fd, &sb) < 0) {
- perror(name);
+ tperror(name);
close(fd);
return 0;
}
- if (!S_ISREG(sb.st_mode)) {
+ if (! S_ISREG(sb.st_mode)) {
close(fd);
- fprintf(stderr, "%s: not a regular file\n", name);
+ fprintf(stderr, "%" XML_FMT_STR ": not a regular file\n", name);
return 0;
}
+ if (sb.st_size > XML_MAX_CHUNK_LEN) {
+ close(fd);
+ return 2; /* Cannot be passed to XML_Parse in one go */
+ }
nbytes = sb.st_size;
/* mmap fails for zero length files */
@@ -51,10 +89,10 @@ filemap(const char *name,
close(fd);
return 1;
}
- p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ,
- MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
+ p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, MAP_FILE | MAP_PRIVATE,
+ fd, (off_t)0);
if (p == (void *)-1) {
- perror(name);
+ tperror(name);
close(fd);
return 0;
}
diff --git a/3rdparty/expat/xmlwf/win32filemap.c b/3rdparty/expat/xmlwf/win32filemap.c
index 41dc35b614d..0c9b7ecc5ff 100644
--- a/3rdparty/expat/xmlwf/win32filemap.c
+++ b/3rdparty/expat/xmlwf/win32filemap.c
@@ -1,19 +1,47 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define STRICT 1
#define WIN32_LEAN_AND_MEAN 1
#ifdef XML_UNICODE_WCHAR_T
-#ifndef XML_UNICODE
-#define XML_UNICODE
-#endif
+# ifndef XML_UNICODE
+# define XML_UNICODE
+# endif
#endif
#ifdef XML_UNICODE
-#define UNICODE
-#define _UNICODE
+# define UNICODE
+# define _UNICODE
#endif /* XML_UNICODE */
#include <windows.h>
#include <stdio.h>
@@ -25,8 +53,7 @@ static void win32perror(const TCHAR *);
int
filemap(const TCHAR *name,
void (*processor)(const void *, size_t, const TCHAR *, void *arg),
- void *arg)
-{
+ void *arg) {
HANDLE f;
HANDLE m;
DWORD size;
@@ -34,7 +61,7 @@ filemap(const TCHAR *name,
void *p;
f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
- FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (f == INVALID_HANDLE_VALUE) {
win32perror(name);
return 0;
@@ -42,11 +69,12 @@ filemap(const TCHAR *name,
size = GetFileSize(f, &sizeHi);
if (size == (DWORD)-1) {
win32perror(name);
+ CloseHandle(f);
return 0;
}
- if (sizeHi) {
- _ftprintf(stderr, _T("%s: bigger than 2Gb\n"), name);
- return 0;
+ if (sizeHi || (size > XML_MAX_CHUNK_LEN)) {
+ CloseHandle(f);
+ return 2; /* Cannot be passed to XML_Parse in one go */
}
/* CreateFileMapping barfs on zero length files */
if (size == 0) {
@@ -68,7 +96,7 @@ filemap(const TCHAR *name,
CloseHandle(f);
return 0;
}
- processor(p, size, name, arg);
+ processor(p, size, name, arg);
UnmapViewOfFile(p);
CloseHandle(m);
CloseHandle(f);
@@ -76,21 +104,15 @@ filemap(const TCHAR *name,
}
static void
-win32perror(const TCHAR *s)
-{
+win32perror(const TCHAR *s) {
LPVOID buf;
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
- | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buf,
- 0,
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0,
NULL)) {
_ftprintf(stderr, _T("%s: %s"), s, buf);
fflush(stderr);
LocalFree(buf);
- }
- else
+ } else
_ftprintf(stderr, _T("%s: unknown Windows error\n"), s);
}
diff --git a/3rdparty/expat/xmlwf/xmlfile.c b/3rdparty/expat/xmlwf/xmlfile.c
index 99eeeaaef28..e3d22c574c5 100644
--- a/3rdparty/expat/xmlwf/xmlfile.c
+++ b/3rdparty/expat/xmlwf/xmlfile.c
@@ -1,5 +1,33 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
@@ -8,118 +36,104 @@
#include <string.h>
#include <fcntl.h>
-#ifdef COMPILED_FROM_DSP
-#include "winconfig.h"
-#elif defined(MACOS_CLASSIC)
-#include "macconfig.h"
-#elif defined(__amigaos__)
-#include "amigaconfig.h"
-#elif defined(__WATCOMC__)
-#include "watcomconfig.h"
+#ifdef _WIN32
+# include "winconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H)
-#include <expat_config.h>
-#endif /* ndef COMPILED_FROM_DSP */
+# include <expat_config.h>
+#endif /* ndef _WIN32 */
#include "expat.h"
+#include "internal.h" /* for UNUSED_P only */
#include "xmlfile.h"
#include "xmltchar.h"
#include "filemap.h"
-#if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__)))
-#include <io.h>
-#endif
-
-#if defined(__amigaos__) && defined(__USE_INLINE__)
-#include <proto/expat.h>
+#if defined(_MSC_VER)
+# include <io.h>
#endif
#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
#endif
#ifndef O_BINARY
-#ifdef _O_BINARY
-#define O_BINARY _O_BINARY
-#else
-#define O_BINARY 0
-#endif
+# ifdef _O_BINARY
+# define O_BINARY _O_BINARY
+# else
+# define O_BINARY 0
+# endif
#endif
#ifdef _DEBUG
-#define READ_SIZE 16
+# define READ_SIZE 16
#else
-#define READ_SIZE (1024*8)
+# define READ_SIZE (1024 * 8)
#endif
-
typedef struct {
XML_Parser parser;
int *retPtr;
} PROCESS_ARGS;
+static int processStream(const XML_Char *filename, XML_Parser parser);
+
static void
-reportError(XML_Parser parser, const XML_Char *filename)
-{
+reportError(XML_Parser parser, const XML_Char *filename) {
enum XML_Error code = XML_GetErrorCode(parser);
const XML_Char *message = XML_ErrorString(code);
if (message)
- ftprintf(stdout, T("%s:%" XML_FMT_INT_MOD "u:%" XML_FMT_INT_MOD "u: %s\n"),
- filename,
- XML_GetErrorLineNumber(parser),
- XML_GetErrorColumnNumber(parser),
- message);
+ ftprintf(stdout,
+ T("%s") T(":%") T(XML_FMT_INT_MOD) T("u") T(":%")
+ T(XML_FMT_INT_MOD) T("u") T(": %s\n"),
+ filename, XML_GetErrorLineNumber(parser),
+ XML_GetErrorColumnNumber(parser), message);
else
ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code);
}
-
+
/* This implementation will give problems on files larger than INT_MAX. */
static void
-processFile(const void *data, size_t size,
- const XML_Char *filename, void *args)
-{
+processFile(const void *data, size_t size, const XML_Char *filename,
+ void *args) {
XML_Parser parser = ((PROCESS_ARGS *)args)->parser;
int *retPtr = ((PROCESS_ARGS *)args)->retPtr;
if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) {
reportError(parser, filename);
*retPtr = 0;
- }
- else
+ } else
*retPtr = 1;
}
-#if (defined(WIN32) || defined(__WATCOMC__))
+#if defined(_WIN32)
static int
-isAsciiLetter(XML_Char c)
-{
+isAsciiLetter(XML_Char c) {
return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z'));
}
-#endif /* WIN32 */
+#endif /* _WIN32 */
static const XML_Char *
resolveSystemId(const XML_Char *base, const XML_Char *systemId,
- XML_Char **toFree)
-{
+ XML_Char **toFree) {
XML_Char *s;
*toFree = 0;
- if (!base
- || *systemId == T('/')
-#if (defined(WIN32) || defined(__WATCOMC__))
+ if (! base || *systemId == T('/')
+#if defined(_WIN32)
|| *systemId == T('\\')
|| (isAsciiLetter(systemId[0]) && systemId[1] == T(':'))
#endif
- )
+ )
return systemId;
*toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)
* sizeof(XML_Char));
- if (!*toFree)
+ if (! *toFree)
return systemId;
tcscpy(*toFree, base);
s = *toFree;
if (tcsrchr(s, T('/')))
s = tcsrchr(s, T('/')) + 1;
-#if (defined(WIN32) || defined(__WATCOMC__))
+#if defined(_WIN32)
if (tcsrchr(s, T('\\')))
s = tcsrchr(s, T('\\')) + 1;
#endif
@@ -128,36 +142,45 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId,
}
static int
-externalEntityRefFilemap(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
+externalEntityRefFilemap(XML_Parser parser, const XML_Char *context,
+ const XML_Char *base, const XML_Char *systemId,
+ const XML_Char *publicId) {
int result;
XML_Char *s;
const XML_Char *filename;
XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
+ int filemapRes;
PROCESS_ARGS args;
+ UNUSED_P(publicId);
args.retPtr = &result;
args.parser = entParser;
filename = resolveSystemId(base, systemId, &s);
XML_SetBase(entParser, filename);
- if (!filemap(filename, processFile, &args))
+ filemapRes = filemap(filename, processFile, &args);
+ switch (filemapRes) {
+ case 0:
result = 0;
+ break;
+ case 2:
+ ftprintf(stderr,
+ T("%s: file too large for memory-mapping")
+ T(", switching to streaming\n"),
+ filename);
+ result = processStream(filename, entParser);
+ break;
+ }
free(s);
XML_ParserFree(entParser);
return result;
}
static int
-processStream(const XML_Char *filename, XML_Parser parser)
-{
- /* passing NULL for filename means read intput from stdin */
- int fd = 0; /* 0 is the fileno for stdin */
+processStream(const XML_Char *filename, XML_Parser parser) {
+ /* passing NULL for filename means read input from stdin */
+ int fd = 0; /* 0 is the fileno for stdin */
if (filename != NULL) {
- fd = topen(filename, O_BINARY|O_RDONLY);
+ fd = topen(filename, O_BINARY | O_RDONLY);
if (fd < 0) {
tperror(filename);
return 0;
@@ -166,22 +189,22 @@ processStream(const XML_Char *filename, XML_Parser parser)
for (;;) {
int nread;
char *buf = (char *)XML_GetBuffer(parser, READ_SIZE);
- if (!buf) {
+ if (! buf) {
if (filename != NULL)
close(fd);
ftprintf(stderr, T("%s: out of memory\n"),
- filename != NULL ? filename : "xmlwf");
+ filename != NULL ? filename : T("xmlwf"));
return 0;
}
nread = read(fd, buf, READ_SIZE);
if (nread < 0) {
- tperror(filename != NULL ? filename : "STDIN");
+ tperror(filename != NULL ? filename : T("STDIN"));
if (filename != NULL)
close(fd);
return 0;
}
if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) {
- reportError(parser, filename != NULL ? filename : "STDIN");
+ reportError(parser, filename != NULL ? filename : T("STDIN"));
if (filename != NULL)
close(fd);
return 0;
@@ -189,23 +212,22 @@ processStream(const XML_Char *filename, XML_Parser parser)
if (nread == 0) {
if (filename != NULL)
close(fd);
- break;;
+ break;
+ ;
}
}
return 1;
}
static int
-externalEntityRefStream(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
+externalEntityRefStream(XML_Parser parser, const XML_Char *context,
+ const XML_Char *base, const XML_Char *systemId,
+ const XML_Char *publicId) {
XML_Char *s;
const XML_Char *filename;
int ret;
XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
+ UNUSED_P(publicId);
filename = resolveSystemId(base, systemId, &s);
XML_SetBase(entParser, filename);
ret = processStream(filename, entParser);
@@ -215,30 +237,37 @@ externalEntityRefStream(XML_Parser parser,
}
int
-XML_ProcessFile(XML_Parser parser,
- const XML_Char *filename,
- unsigned flags)
-{
+XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags) {
int result;
- if (!XML_SetBase(parser, filename)) {
+ if (! XML_SetBase(parser, filename)) {
ftprintf(stderr, T("%s: out of memory"), filename);
exit(1);
}
if (flags & XML_EXTERNAL_ENTITIES)
- XML_SetExternalEntityRefHandler(parser,
- (flags & XML_MAP_FILE)
- ? externalEntityRefFilemap
- : externalEntityRefStream);
+ XML_SetExternalEntityRefHandler(parser, (flags & XML_MAP_FILE)
+ ? externalEntityRefFilemap
+ : externalEntityRefStream);
if (flags & XML_MAP_FILE) {
+ int filemapRes;
PROCESS_ARGS args;
args.retPtr = &result;
args.parser = parser;
- if (!filemap(filename, processFile, &args))
+ filemapRes = filemap(filename, processFile, &args);
+ switch (filemapRes) {
+ case 0:
result = 0;
- }
- else
+ break;
+ case 2:
+ ftprintf(stderr,
+ T("%s: file too large for memory-mapping")
+ T(", switching to streaming\n"),
+ filename);
+ result = processStream(filename, parser);
+ break;
+ }
+ } else
result = processStream(filename, parser);
return result;
}
diff --git a/3rdparty/expat/xmlwf/xmlfile.h b/3rdparty/expat/xmlwf/xmlfile.h
index d093ecc06f9..6e5d5b49eb7 100644
--- a/3rdparty/expat/xmlwf/xmlfile.h
+++ b/3rdparty/expat/xmlwf/xmlfile.h
@@ -1,20 +1,43 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define XML_MAP_FILE 01
#define XML_EXTERNAL_ENTITIES 02
#ifdef XML_LARGE_SIZE
-#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
-#define XML_FMT_INT_MOD "I64"
-#else
-#define XML_FMT_INT_MOD "ll"
-#endif
+# define XML_FMT_INT_MOD "ll"
#else
-#define XML_FMT_INT_MOD "l"
+# define XML_FMT_INT_MOD "l"
#endif
-extern int XML_ProcessFile(XML_Parser parser,
- const XML_Char *filename,
+extern int XML_ProcessFile(XML_Parser parser, const XML_Char *filename,
unsigned flags);
diff --git a/3rdparty/expat/xmlwf/xmlmime.c b/3rdparty/expat/xmlwf/xmlmime.c
index 56a0e7f40e4..39160d7198c 100644
--- a/3rdparty/expat/xmlwf/xmlmime.c
+++ b/3rdparty/expat/xmlwf/xmlmime.c
@@ -1,9 +1,40 @@
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
#include <string.h>
#include "xmlmime.h"
static const char *
-getTok(const char **pp)
-{
+getTok(const char **pp) {
/* inComment means one level of nesting; inComment+1 means two levels etc */
enum { inAtom, inString, init, inComment };
int state = init;
@@ -74,9 +105,8 @@ getTok(const char **pp)
/* key must be lowercase ASCII */
static int
-matchkey(const char *start, const char *end, const char *key)
-{
- if (!start)
+matchkey(const char *start, const char *end, const char *key) {
+ if (! start)
return 0;
for (; start != end; start++, key++)
if (*start != *key && *start != 'A' + (*key - 'a'))
@@ -85,8 +115,7 @@ matchkey(const char *start, const char *end, const char *key)
}
void
-getXMLCharset(const char *buf, char *charset)
-{
+getXMLCharset(const char *buf, char *charset) {
const char *next, *p;
charset[0] = '\0';
@@ -94,16 +123,18 @@ getXMLCharset(const char *buf, char *charset)
p = getTok(&next);
if (matchkey(p, next, "text"))
strcpy(charset, "us-ascii");
- else if (!matchkey(p, next, "application"))
+ else if (! matchkey(p, next, "application"))
return;
p = getTok(&next);
- if (!p || *p != '/')
+ if (! p || *p != '/')
return;
p = getTok(&next);
-#if 0
- if (!matchkey(p, next, "xml") && charset[0] == '\0')
- return;
-#endif
+ /* BEGIN disabled code */
+ if (0) {
+ if (! matchkey(p, next, "xml") && charset[0] == '\0')
+ return;
+ }
+ /* END disabled code */
p = getTok(&next);
while (p) {
if (*p == ';') {
@@ -125,8 +156,7 @@ getXMLCharset(const char *buf, char *charset)
*s++ = *p;
}
*s++ = '\0';
- }
- else {
+ } else {
if (next - p > CHARSET_MAX - 1)
break;
while (p != next)
@@ -138,19 +168,17 @@ getXMLCharset(const char *buf, char *charset)
}
break;
}
- }
- else
- p = getTok(&next);
+ } else
+ p = getTok(&next);
}
}
#ifdef TEST
-#include <stdio.h>
+# include <stdio.h>
int
-main(int argc, char *argv[])
-{
+main(int argc, char *argv[]) {
char buf[CHARSET_MAX];
if (argc <= 1)
return 1;
diff --git a/3rdparty/expat/xmlwf/xmlmime.h b/3rdparty/expat/xmlwf/xmlmime.h
index bf0356df0d9..0471286234a 100644
--- a/3rdparty/expat/xmlwf/xmlmime.h
+++ b/3rdparty/expat/xmlwf/xmlmime.h
@@ -1,3 +1,35 @@
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/3rdparty/expat/xmlwf/xmltchar.h b/3rdparty/expat/xmlwf/xmltchar.h
index 1088575512d..d7e7b411b44 100644
--- a/3rdparty/expat/xmlwf/xmltchar.h
+++ b/3rdparty/expat/xmlwf/xmltchar.h
@@ -1,36 +1,74 @@
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+/* Ensures compile-time constants are consistent */
+#include "expat_external.h"
+
#ifdef XML_UNICODE
-#ifndef XML_UNICODE_WCHAR_T
-#error xmlwf requires a 16-bit Unicode-compatible wchar_t
-#endif
-#define T(x) L ## x
-#define ftprintf fwprintf
-#define tfopen _wfopen
-#define fputts fputws
-#define puttc putwc
-#define tcscmp wcscmp
-#define tcscpy wcscpy
-#define tcscat wcscat
-#define tcschr wcschr
-#define tcsrchr wcsrchr
-#define tcslen wcslen
-#define tperror _wperror
-#define topen _wopen
-#define tmain wmain
-#define tremove _wremove
+# ifndef XML_UNICODE_WCHAR_T
+# error xmlwf requires a 16-bit Unicode-compatible wchar_t
+# endif
+# define _PREPEND_BIG_L(x) L##x
+# define T(x) _PREPEND_BIG_L(x)
+# define ftprintf fwprintf
+# define tfopen _wfopen
+# define fputts fputws
+# define puttc putwc
+# define tcscmp wcscmp
+# define tcscpy wcscpy
+# define tcscat wcscat
+# define tcschr wcschr
+# define tcsrchr wcsrchr
+# define tcslen wcslen
+# define tperror _wperror
+# define topen _wopen
+# define tmain wmain
+# define tremove _wremove
+# define tchar wchar_t
#else /* not XML_UNICODE */
-#define T(x) x
-#define ftprintf fprintf
-#define tfopen fopen
-#define fputts fputs
-#define puttc putc
-#define tcscmp strcmp
-#define tcscpy strcpy
-#define tcscat strcat
-#define tcschr strchr
-#define tcsrchr strrchr
-#define tcslen strlen
-#define tperror perror
-#define topen open
-#define tmain main
-#define tremove remove
+# define T(x) x
+# define ftprintf fprintf
+# define tfopen fopen
+# define fputts fputs
+# define puttc putc
+# define tcscmp strcmp
+# define tcscpy strcpy
+# define tcscat strcat
+# define tcschr strchr
+# define tcsrchr strrchr
+# define tcslen strlen
+# define tperror perror
+# define topen open
+# define tmain main
+# define tremove remove
+# define tchar char
#endif /* not XML_UNICODE */
diff --git a/3rdparty/expat/xmlwf/xmlurl.h b/3rdparty/expat/xmlwf/xmlurl.h
deleted file mode 100644
index d329913ac85..00000000000
--- a/3rdparty/expat/xmlwf/xmlurl.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int XML_URLInit();
-void XML_URLUninit();
-int XML_ProcessURL(XML_Parser parser,
- const XML_Char *url,
- unsigned flags);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/3rdparty/expat/xmlwf/xmlwf.c b/3rdparty/expat/xmlwf/xmlwf.c
index c4090b0e406..5121fa1028e 100644
--- a/3rdparty/expat/xmlwf/xmlwf.c
+++ b/3rdparty/expat/xmlwf/xmlwf.c
@@ -1,7 +1,36 @@
-/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
- See the file COPYING for copying permission.
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -9,25 +38,39 @@
#include "expat.h"
#include "codepage.h"
+#include "internal.h" /* for UNUSED_P only */
#include "xmlfile.h"
#include "xmltchar.h"
#ifdef _MSC_VER
-#include <crtdbg.h>
+# include <crtdbg.h>
#endif
-#if defined(__amigaos__) && defined(__USE_INLINE__)
-#include <proto/expat.h>
+#ifdef XML_UNICODE
+# include <wchar.h>
#endif
+/* Structures for handler user data */
+typedef struct NotationList {
+ struct NotationList *next;
+ const XML_Char *notationName;
+ const XML_Char *systemId;
+ const XML_Char *publicId;
+} NotationList;
+
+typedef struct xmlwfUserData {
+ FILE *fp;
+ NotationList *notationListHead;
+ const XML_Char *currentDoctypeName;
+} XmlwfUserData;
+
/* This ensures proper sorting. */
#define NSSEP T('\001')
static void XMLCALL
-characterData(void *userData, const XML_Char *s, int len)
-{
- FILE *fp = (FILE *)userData;
+characterData(void *userData, const XML_Char *s, int len) {
+ FILE *fp = ((XmlwfUserData *)userData)->fp;
for (; len > 0; --len, ++s) {
switch (*s) {
case T('&'):
@@ -61,10 +104,10 @@ characterData(void *userData, const XML_Char *s, int len)
}
static void
-attributeValue(FILE *fp, const XML_Char *s)
-{
+attributeValue(FILE *fp, const XML_Char *s) {
puttc(T('='), fp);
puttc(T('"'), fp);
+ assert(s);
for (;;) {
switch (*s) {
case 0:
@@ -112,17 +155,15 @@ attributeValue(FILE *fp, const XML_Char *s)
is equivalent to lexicographically comparing based on the character number. */
static int
-attcmp(const void *att1, const void *att2)
-{
+attcmp(const void *att1, const void *att2) {
return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);
}
static void XMLCALL
-startElement(void *userData, const XML_Char *name, const XML_Char **atts)
-{
+startElement(void *userData, const XML_Char *name, const XML_Char **atts) {
int nAtts;
const XML_Char **p;
- FILE *fp = (FILE *)userData;
+ FILE *fp = ((XmlwfUserData *)userData)->fp;
puttc(T('<'), fp);
fputts(name, fp);
@@ -142,9 +183,8 @@ startElement(void *userData, const XML_Char *name, const XML_Char **atts)
}
static void XMLCALL
-endElement(void *userData, const XML_Char *name)
-{
- FILE *fp = (FILE *)userData;
+endElement(void *userData, const XML_Char *name) {
+ FILE *fp = ((XmlwfUserData *)userData)->fp;
puttc(T('<'), fp);
puttc(T('/'), fp);
fputts(name, fp);
@@ -152,8 +192,7 @@ endElement(void *userData, const XML_Char *name)
}
static int
-nsattcmp(const void *p1, const void *p2)
-{
+nsattcmp(const void *p1, const void *p2) {
const XML_Char *att1 = *(const XML_Char **)p1;
const XML_Char *att2 = *(const XML_Char **)p2;
int sep1 = (tcsrchr(att1, NSSEP) != 0);
@@ -164,12 +203,11 @@ nsattcmp(const void *p1, const void *p2)
}
static void XMLCALL
-startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
-{
+startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) {
int nAtts;
int nsi;
const XML_Char **p;
- FILE *fp = (FILE *)userData;
+ FILE *fp = ((XmlwfUserData *)userData)->fp;
const XML_Char *sep;
puttc(T('<'), fp);
@@ -180,8 +218,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
fputts(T(" xmlns:n1"), fp);
attributeValue(fp, name);
nsi = 2;
- }
- else {
+ } else {
fputts(name, fp);
nsi = 1;
}
@@ -199,8 +236,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
if (sep) {
ftprintf(fp, T("n%d:"), nsi);
fputts(sep + 1, fp);
- }
- else
+ } else
fputts(name, fp);
attributeValue(fp, *atts);
if (sep) {
@@ -213,9 +249,8 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
}
static void XMLCALL
-endElementNS(void *userData, const XML_Char *name)
-{
- FILE *fp = (FILE *)userData;
+endElementNS(void *userData, const XML_Char *name) {
+ FILE *fp = ((XmlwfUserData *)userData)->fp;
const XML_Char *sep;
puttc(T('<'), fp);
puttc(T('/'), fp);
@@ -223,8 +258,7 @@ endElementNS(void *userData, const XML_Char *name)
if (sep) {
fputts(T("n1:"), fp);
fputts(sep + 1, fp);
- }
- else
+ } else
fputts(name, fp);
puttc(T('>'), fp);
}
@@ -233,9 +267,8 @@ endElementNS(void *userData, const XML_Char *name)
static void XMLCALL
processingInstruction(void *userData, const XML_Char *target,
- const XML_Char *data)
-{
- FILE *fp = (FILE *)userData;
+ const XML_Char *data) {
+ FILE *fp = ((XmlwfUserData *)userData)->fp;
puttc(T('<'), fp);
puttc(T('?'), fp);
fputts(target, fp);
@@ -245,112 +278,302 @@ processingInstruction(void *userData, const XML_Char *target,
puttc(T('>'), fp);
}
+static XML_Char *
+xcsdup(const XML_Char *s) {
+ XML_Char *result;
+ int count = 0;
+ int numBytes;
+
+ /* Get the length of the string, including terminator */
+ while (s[count++] != 0) {
+ /* Do nothing */
+ }
+ numBytes = count * sizeof(XML_Char);
+ result = malloc(numBytes);
+ if (result == NULL)
+ return NULL;
+ memcpy(result, s, numBytes);
+ return result;
+}
+
+static void XMLCALL
+startDoctypeDecl(void *userData, const XML_Char *doctypeName,
+ const XML_Char *sysid, const XML_Char *publid,
+ int has_internal_subset) {
+ XmlwfUserData *data = (XmlwfUserData *)userData;
+ UNUSED_P(sysid);
+ UNUSED_P(publid);
+ UNUSED_P(has_internal_subset);
+ data->currentDoctypeName = xcsdup(doctypeName);
+}
+
+static void
+freeNotations(XmlwfUserData *data) {
+ NotationList *notationListHead = data->notationListHead;
+
+ while (notationListHead != NULL) {
+ NotationList *next = notationListHead->next;
+ free((void *)notationListHead->notationName);
+ free((void *)notationListHead->systemId);
+ free((void *)notationListHead->publicId);
+ free(notationListHead);
+ notationListHead = next;
+ }
+ data->notationListHead = NULL;
+}
+
+static int
+xcscmp(const XML_Char *xs, const XML_Char *xt) {
+ while (*xs != 0 && *xt != 0) {
+ if (*xs < *xt)
+ return -1;
+ if (*xs > *xt)
+ return 1;
+ xs++;
+ xt++;
+ }
+ if (*xs < *xt)
+ return -1;
+ if (*xs > *xt)
+ return 1;
+ return 0;
+}
+
+static int
+notationCmp(const void *a, const void *b) {
+ const NotationList *const n1 = *(NotationList **)a;
+ const NotationList *const n2 = *(NotationList **)b;
+
+ return xcscmp(n1->notationName, n2->notationName);
+}
+
+static void XMLCALL
+endDoctypeDecl(void *userData) {
+ XmlwfUserData *data = (XmlwfUserData *)userData;
+ NotationList **notations;
+ int notationCount = 0;
+ NotationList *p;
+ int i;
+
+ /* How many notations do we have? */
+ for (p = data->notationListHead; p != NULL; p = p->next)
+ notationCount++;
+ if (notationCount == 0) {
+ /* Nothing to report */
+ free((void *)data->currentDoctypeName);
+ data->currentDoctypeName = NULL;
+ return;
+ }
+
+ notations = malloc(notationCount * sizeof(NotationList *));
+ if (notations == NULL) {
+ fprintf(stderr, "Unable to sort notations");
+ freeNotations(data);
+ return;
+ }
+
+ for (p = data->notationListHead, i = 0; i < notationCount; p = p->next, i++) {
+ notations[i] = p;
+ }
+ qsort(notations, notationCount, sizeof(NotationList *), notationCmp);
+
+ /* Output the DOCTYPE header */
+ fputts(T("<!DOCTYPE "), data->fp);
+ fputts(data->currentDoctypeName, data->fp);
+ fputts(T(" [\n"), data->fp);
+
+ /* Now the NOTATIONs */
+ for (i = 0; i < notationCount; i++) {
+ fputts(T("<!NOTATION "), data->fp);
+ fputts(notations[i]->notationName, data->fp);
+ if (notations[i]->publicId != NULL) {
+ fputts(T(" PUBLIC '"), data->fp);
+ fputts(notations[i]->publicId, data->fp);
+ puttc(T('\''), data->fp);
+ if (notations[i]->systemId != NULL) {
+ puttc(T(' '), data->fp);
+ puttc(T('\''), data->fp);
+ fputts(notations[i]->systemId, data->fp);
+ puttc(T('\''), data->fp);
+ }
+ } else if (notations[i]->systemId != NULL) {
+ fputts(T(" SYSTEM '"), data->fp);
+ fputts(notations[i]->systemId, data->fp);
+ puttc(T('\''), data->fp);
+ }
+ puttc(T('>'), data->fp);
+ puttc(T('\n'), data->fp);
+ }
+
+ /* Finally end the DOCTYPE */
+ fputts(T("]>\n"), data->fp);
+
+ free(notations);
+ freeNotations(data);
+ free((void *)data->currentDoctypeName);
+ data->currentDoctypeName = NULL;
+}
+
+static void XMLCALL
+notationDecl(void *userData, const XML_Char *notationName, const XML_Char *base,
+ const XML_Char *systemId, const XML_Char *publicId) {
+ XmlwfUserData *data = (XmlwfUserData *)userData;
+ NotationList *entry = malloc(sizeof(NotationList));
+ const char *errorMessage = "Unable to store NOTATION for output\n";
+
+ UNUSED_P(base);
+ if (entry == NULL) {
+ fputs(errorMessage, stderr);
+ return; /* Nothing we can really do about this */
+ }
+ entry->notationName = xcsdup(notationName);
+ if (entry->notationName == NULL) {
+ fputs(errorMessage, stderr);
+ free(entry);
+ return;
+ }
+ if (systemId != NULL) {
+ entry->systemId = xcsdup(systemId);
+ if (entry->systemId == NULL) {
+ fputs(errorMessage, stderr);
+ free((void *)entry->notationName);
+ free(entry);
+ return;
+ }
+ } else {
+ entry->systemId = NULL;
+ }
+ if (publicId != NULL) {
+ entry->publicId = xcsdup(publicId);
+ if (entry->publicId == NULL) {
+ fputs(errorMessage, stderr);
+ free((void *)entry->systemId); /* Safe if it's NULL */
+ free((void *)entry->notationName);
+ free(entry);
+ return;
+ }
+ } else {
+ entry->publicId = NULL;
+ }
+
+ entry->next = data->notationListHead;
+ data->notationListHead = entry;
+}
+
#endif /* not W3C14N */
static void XMLCALL
-defaultCharacterData(void *userData, const XML_Char *s, int len)
-{
- XML_DefaultCurrent((XML_Parser) userData);
+defaultCharacterData(void *userData, const XML_Char *s, int len) {
+ UNUSED_P(s);
+ UNUSED_P(len);
+ XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
defaultStartElement(void *userData, const XML_Char *name,
- const XML_Char **atts)
-{
- XML_DefaultCurrent((XML_Parser) userData);
+ const XML_Char **atts) {
+ UNUSED_P(name);
+ UNUSED_P(atts);
+ XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
-defaultEndElement(void *userData, const XML_Char *name)
-{
- XML_DefaultCurrent((XML_Parser) userData);
+defaultEndElement(void *userData, const XML_Char *name) {
+ UNUSED_P(name);
+ XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
defaultProcessingInstruction(void *userData, const XML_Char *target,
- const XML_Char *data)
-{
- XML_DefaultCurrent((XML_Parser) userData);
+ const XML_Char *data) {
+ UNUSED_P(target);
+ UNUSED_P(data);
+ XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
-nopCharacterData(void *userData, const XML_Char *s, int len)
-{
+nopCharacterData(void *userData, const XML_Char *s, int len) {
+ UNUSED_P(userData);
+ UNUSED_P(s);
+ UNUSED_P(len);
}
static void XMLCALL
-nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
-{
+nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
+ UNUSED_P(userData);
+ UNUSED_P(name);
+ UNUSED_P(atts);
}
static void XMLCALL
-nopEndElement(void *userData, const XML_Char *name)
-{
+nopEndElement(void *userData, const XML_Char *name) {
+ UNUSED_P(userData);
+ UNUSED_P(name);
}
static void XMLCALL
nopProcessingInstruction(void *userData, const XML_Char *target,
- const XML_Char *data)
-{
+ const XML_Char *data) {
+ UNUSED_P(userData);
+ UNUSED_P(target);
+ UNUSED_P(data);
}
static void XMLCALL
-markup(void *userData, const XML_Char *s, int len)
-{
- FILE *fp = (FILE *)XML_GetUserData((XML_Parser) userData);
+markup(void *userData, const XML_Char *s, int len) {
+ FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp;
for (; len > 0; --len, ++s)
puttc(*s, fp);
}
static void
-metaLocation(XML_Parser parser)
-{
+metaLocation(XML_Parser parser) {
const XML_Char *uri = XML_GetBase(parser);
+ FILE *fp = ((XmlwfUserData *)XML_GetUserData(parser))->fp;
if (uri)
- ftprintf((FILE *)XML_GetUserData(parser), T(" uri=\"%s\""), uri);
- ftprintf((FILE *)XML_GetUserData(parser),
- T(" byte=\"%" XML_FMT_INT_MOD "d\" nbytes=\"%d\" \
- line=\"%" XML_FMT_INT_MOD "u\" col=\"%" XML_FMT_INT_MOD "u\""),
- XML_GetCurrentByteIndex(parser),
- XML_GetCurrentByteCount(parser),
+ ftprintf(fp, T(" uri=\"%s\""), uri);
+ ftprintf(fp,
+ T(" byte=\"%") T(XML_FMT_INT_MOD) T("d\"") T(" nbytes=\"%d\"")
+ T(" line=\"%") T(XML_FMT_INT_MOD) T("u\"") T(" col=\"%")
+ T(XML_FMT_INT_MOD) T("u\""),
+ XML_GetCurrentByteIndex(parser), XML_GetCurrentByteCount(parser),
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser));
}
static void
-metaStartDocument(void *userData)
-{
- fputts(T("<document>\n"), (FILE *)XML_GetUserData((XML_Parser) userData));
+metaStartDocument(void *userData) {
+ fputts(T("<document>\n"),
+ ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp);
}
static void
-metaEndDocument(void *userData)
-{
- fputts(T("</document>\n"), (FILE *)XML_GetUserData((XML_Parser) userData));
+metaEndDocument(void *userData) {
+ fputts(T("</document>\n"),
+ ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp);
}
static void XMLCALL
-metaStartElement(void *userData, const XML_Char *name,
- const XML_Char **atts)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
const XML_Char **specifiedAttsEnd
- = atts + XML_GetSpecifiedAttributeCount(parser);
+ = atts + XML_GetSpecifiedAttributeCount(parser);
const XML_Char **idAttPtr;
int idAttIndex = XML_GetIdAttributeIndex(parser);
if (idAttIndex < 0)
idAttPtr = 0;
else
idAttPtr = atts + idAttIndex;
-
+
ftprintf(fp, T("<starttag name=\"%s\""), name);
metaLocation(parser);
if (*atts) {
fputts(T(">\n"), fp);
do {
ftprintf(fp, T("<attribute name=\"%s\" value=\""), atts[0]);
- characterData(fp, atts[1], (int)tcslen(atts[1]));
+ characterData(data, atts[1], (int)tcslen(atts[1]));
if (atts >= specifiedAttsEnd)
fputts(T("\" defaulted=\"yes\"/>\n"), fp);
else if (atts == idAttPtr)
@@ -359,16 +582,15 @@ metaStartElement(void *userData, const XML_Char *name,
fputts(T("\"/>\n"), fp);
} while (*(atts += 2));
fputts(T("</starttag>\n"), fp);
- }
- else
+ } else
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaEndElement(void *userData, const XML_Char *name)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaEndElement(void *userData, const XML_Char *name) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
ftprintf(fp, T("<endtag name=\"%s\""), name);
metaLocation(parser);
fputts(T("/>\n"), fp);
@@ -376,145 +598,139 @@ metaEndElement(void *userData, const XML_Char *name)
static void XMLCALL
metaProcessingInstruction(void *userData, const XML_Char *target,
- const XML_Char *data)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+ const XML_Char *data) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = usrData->fp;
ftprintf(fp, T("<pi target=\"%s\" data=\""), target);
- characterData(fp, data, (int)tcslen(data));
+ characterData(usrData, data, (int)tcslen(data));
puttc(T('"'), fp);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaComment(void *userData, const XML_Char *data)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaComment(void *userData, const XML_Char *data) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = usrData->fp;
fputts(T("<comment data=\""), fp);
- characterData(fp, data, (int)tcslen(data));
+ characterData(usrData, data, (int)tcslen(data));
puttc(T('"'), fp);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaStartCdataSection(void *userData)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaStartCdataSection(void *userData) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
fputts(T("<startcdata"), fp);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaEndCdataSection(void *userData)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaEndCdataSection(void *userData) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
fputts(T("<endcdata"), fp);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaCharacterData(void *userData, const XML_Char *s, int len)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaCharacterData(void *userData, const XML_Char *s, int len) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
fputts(T("<chars str=\""), fp);
- characterData(fp, s, len);
+ characterData(data, s, len);
puttc(T('"'), fp);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaStartDoctypeDecl(void *userData,
- const XML_Char *doctypeName,
- const XML_Char *sysid,
- const XML_Char *pubid,
- int has_internal_subset)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaStartDoctypeDecl(void *userData, const XML_Char *doctypeName,
+ const XML_Char *sysid, const XML_Char *pubid,
+ int has_internal_subset) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
+ UNUSED_P(sysid);
+ UNUSED_P(pubid);
+ UNUSED_P(has_internal_subset);
ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaEndDoctypeDecl(void *userData)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaEndDoctypeDecl(void *userData) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
fputts(T("<enddoctype"), fp);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaNotationDecl(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaNotationDecl(void *userData, const XML_Char *notationName,
+ const XML_Char *base, const XML_Char *systemId,
+ const XML_Char *publicId) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
+ UNUSED_P(base);
ftprintf(fp, T("<notation name=\"%s\""), notationName);
if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId);
if (systemId) {
fputts(T(" system=\""), fp);
- characterData(fp, systemId, (int)tcslen(systemId));
+ characterData(data, systemId, (int)tcslen(systemId));
puttc(T('"'), fp);
}
metaLocation(parser);
fputts(T("/>\n"), fp);
}
-
static void XMLCALL
-metaEntityDecl(void *userData,
- const XML_Char *entityName,
- int is_param,
- const XML_Char *value,
- int value_length,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaEntityDecl(void *userData, const XML_Char *entityName, int is_param,
+ const XML_Char *value, int value_length, const XML_Char *base,
+ const XML_Char *systemId, const XML_Char *publicId,
+ const XML_Char *notationName) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
+ UNUSED_P(is_param);
+ UNUSED_P(base);
if (value) {
ftprintf(fp, T("<entity name=\"%s\""), entityName);
metaLocation(parser);
puttc(T('>'), fp);
- characterData(fp, value, value_length);
+ characterData(data, value, value_length);
fputts(T("</entity/>\n"), fp);
- }
- else if (notationName) {
+ } else if (notationName) {
ftprintf(fp, T("<entity name=\"%s\""), entityName);
if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId);
fputts(T(" system=\""), fp);
- characterData(fp, systemId, (int)tcslen(systemId));
+ characterData(data, systemId, (int)tcslen(systemId));
puttc(T('"'), fp);
ftprintf(fp, T(" notation=\"%s\""), notationName);
metaLocation(parser);
fputts(T("/>\n"), fp);
- }
- else {
+ } else {
ftprintf(fp, T("<entity name=\"%s\""), entityName);
if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId);
fputts(T(" system=\""), fp);
- characterData(fp, systemId, (int)tcslen(systemId));
+ characterData(data, systemId, (int)tcslen(systemId));
puttc(T('"'), fp);
metaLocation(parser);
fputts(T("/>\n"), fp);
@@ -522,95 +738,91 @@ metaEntityDecl(void *userData,
}
static void XMLCALL
-metaStartNamespaceDecl(void *userData,
- const XML_Char *prefix,
- const XML_Char *uri)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
+metaStartNamespaceDecl(void *userData, const XML_Char *prefix,
+ const XML_Char *uri) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
fputts(T("<startns"), fp);
if (prefix)
ftprintf(fp, T(" prefix=\"%s\""), prefix);
if (uri) {
fputts(T(" ns=\""), fp);
- characterData(fp, uri, (int)tcslen(uri));
+ characterData(data, uri, (int)tcslen(uri));
fputts(T("\"/>\n"), fp);
- }
- else
+ } else
fputts(T("/>\n"), fp);
}
static void XMLCALL
-metaEndNamespaceDecl(void *userData, const XML_Char *prefix)
-{
- XML_Parser parser = (XML_Parser) userData;
- FILE *fp = (FILE *)XML_GetUserData(parser);
- if (!prefix)
+metaEndNamespaceDecl(void *userData, const XML_Char *prefix) {
+ XML_Parser parser = (XML_Parser)userData;
+ XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
+ FILE *fp = data->fp;
+ if (! prefix)
fputts(T("<endns/>\n"), fp);
else
ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
}
static int XMLCALL
-unknownEncodingConvert(void *data, const char *p)
-{
+unknownEncodingConvert(void *data, const char *p) {
return codepageConvert(*(int *)data, p);
}
static int XMLCALL
-unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
-{
+unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) {
int cp;
static const XML_Char prefixL[] = T("windows-");
static const XML_Char prefixU[] = T("WINDOWS-");
int i;
+ UNUSED_P(userData);
for (i = 0; prefixU[i]; i++)
if (name[i] != prefixU[i] && name[i] != prefixL[i])
return 0;
-
+
cp = 0;
for (; name[i]; i++) {
static const XML_Char digits[] = T("0123456789");
const XML_Char *s = tcschr(digits, name[i]);
- if (!s)
+ if (! s)
return 0;
cp *= 10;
cp += (int)(s - digits);
if (cp >= 0x10000)
return 0;
}
- if (!codepageMap(cp, info->map))
+ if (! codepageMap(cp, info->map))
return 0;
info->convert = unknownEncodingConvert;
/* We could just cast the code page integer to a void *,
and avoid the use of release. */
info->release = free;
info->data = malloc(sizeof(int));
- if (!info->data)
+ if (! info->data)
return 0;
*(int *)info->data = cp;
return 1;
}
static int XMLCALL
-notStandalone(void *userData)
-{
+notStandalone(void *userData) {
+ UNUSED_P(userData);
return 0;
}
static void
-showVersion(XML_Char *prog)
-{
+showVersion(XML_Char *prog) {
XML_Char *s = prog;
XML_Char ch;
const XML_Feature *features = XML_GetFeatureList();
while ((ch = *s) != 0) {
if (ch == '/'
-#if (defined(WIN32) || defined(__WATCOMC__))
+#if defined(_WIN32)
|| ch == '\\'
#endif
- )
+ )
prog = s + 1;
++s;
}
@@ -631,16 +843,56 @@ showVersion(XML_Char *prog)
}
static void
-usage(const XML_Char *prog, int rc)
-{
- ftprintf(stderr,
- T("usage: %s [-s] [-n] [-p] [-x] [-e encoding] [-w] [-d output-dir] [-c] [-m] [-r] [-t] [file ...]\n"), prog);
+usage(const XML_Char *prog, int rc) {
+ ftprintf(
+ stderr,
+ /* Generated with:
+ * $ xmlwf/xmlwf_helpgen.sh
+ */
+ /* clang-format off */
+ T("usage: %s [-s] [-n] [-p] [-x] [-e ENCODING] [-w] [-r] [-d DIRECTORY]\n")
+ T(" [-c | -m | -t] [-N]\n")
+ T(" [FILE [FILE ...]]\n")
+ T("\n")
+ T("xmlwf - Determines if an XML document is well-formed\n")
+ T("\n")
+ T("positional arguments:\n")
+ T(" FILE file to process (default: STDIN)\n")
+ T("\n")
+ T("input control arguments:\n")
+ T(" -s print an error if the document is not [s]tandalone\n")
+ T(" -n enable [n]amespace processing\n")
+ T(" -p enable processing external DTDs and [p]arameter entities\n")
+ T(" -x enable processing of e[x]ternal entities\n")
+ T(" -e ENCODING override any in-document [e]ncoding declaration\n")
+ T(" -w enable support for [W]indows code pages\n")
+ T(" -r disable memory-mapping and use normal file [r]ead IO calls instead\n")
+ T("\n")
+ T("output control arguments:\n")
+ T(" -d DIRECTORY output [d]estination directory\n")
+ T(" -c write a [c]opy of input XML, not canonical XML\n")
+ T(" -m write [m]eta XML, not canonical XML\n")
+ T(" -t write no XML output for [t]iming of plain parsing\n")
+ T(" -N enable adding doctype and [n]otation declarations\n")
+ T("\n")
+ T("info arguments:\n")
+ T(" -h show this [h]elp message and exit\n")
+ T(" -v show program's [v]ersion number and exit\n")
+ T("\n")
+ T("xmlwf of libexpat is software libre, licensed under the MIT license.\n")
+ T("Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!\n")
+ , /* clang-format on */
+ prog);
exit(rc);
}
+#if defined(__MINGW32__) && defined(XML_UNICODE)
+/* Silence warning about missing prototype */
+int wmain(int argc, XML_Char **argv);
+#endif
+
int
-tmain(int argc, XML_Char **argv)
-{
+tmain(int argc, XML_Char **argv) {
int i, j;
const XML_Char *outputDir = NULL;
const XML_Char *encoding = NULL;
@@ -649,12 +901,14 @@ tmain(int argc, XML_Char **argv)
int outputType = 0;
int useNamespaces = 0;
int requireStandalone = 0;
- enum XML_ParamEntityParsing paramEntityParsing =
- XML_PARAM_ENTITY_PARSING_NEVER;
+ int requiresNotations = 0;
+ enum XML_ParamEntityParsing paramEntityParsing
+ = XML_PARAM_ENTITY_PARSING_NEVER;
int useStdin = 0;
+ XmlwfUserData userData = {NULL, NULL, NULL};
#ifdef _MSC_VER
- _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
i = 1;
@@ -706,13 +960,16 @@ tmain(int argc, XML_Char **argv)
outputType = 't';
j++;
break;
+ case T('N'):
+ requiresNotations = 1;
+ j++;
+ break;
case T('d'):
if (argv[i][j + 1] == T('\0')) {
if (++i == argc)
usage(argv[0], 2);
outputDir = argv[i];
- }
- else
+ } else
outputDir = argv[i] + j + 1;
i++;
j = 0;
@@ -722,8 +979,7 @@ tmain(int argc, XML_Char **argv)
if (++i == argc)
usage(argv[0], 2);
encoding = argv[i];
- }
- else
+ } else
encoding = argv[i] + j + 1;
i++;
j = 0;
@@ -751,7 +1007,6 @@ tmain(int argc, XML_Char **argv)
i--;
}
for (; i < argc; i++) {
- FILE *fp = 0;
XML_Char *outName = 0;
int result;
XML_Parser parser;
@@ -759,6 +1014,12 @@ tmain(int argc, XML_Char **argv)
parser = XML_ParserCreateNS(encoding, NSSEP);
else
parser = XML_ParserCreate(encoding);
+
+ if (! parser) {
+ tperror(T("Could not instantiate parser"));
+ exit(1);
+ }
+
if (requireStandalone)
XML_SetNotStandaloneHandler(parser, notStandalone);
XML_SetParamEntityParsing(parser, paramEntityParsing);
@@ -769,18 +1030,17 @@ tmain(int argc, XML_Char **argv)
XML_SetElementHandler(parser, nopStartElement, nopEndElement);
XML_SetCharacterDataHandler(parser, nopCharacterData);
XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
- }
- else if (outputDir) {
- const XML_Char * delim = T("/");
+ } else if (outputDir) {
+ const XML_Char *delim = T("/");
const XML_Char *file = useStdin ? T("STDIN") : argv[i];
- if (!useStdin) {
+ if (! useStdin) {
/* Jump after last (back)slash */
- const XML_Char * lastDelim = tcsrchr(file, delim[0]);
+ const XML_Char *lastDelim = tcsrchr(file, delim[0]);
if (lastDelim)
file = lastDelim + 1;
-#if (defined(WIN32) || defined(__WATCOMC__))
+#if defined(_WIN32)
else {
- const XML_Char * winDelim = T("\\");
+ const XML_Char *winDelim = T("\\");
lastDelim = tcsrchr(file, winDelim[0]);
if (lastDelim) {
file = lastDelim + 1;
@@ -790,20 +1050,24 @@ tmain(int argc, XML_Char **argv)
#endif
}
outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2)
- * sizeof(XML_Char));
+ * sizeof(XML_Char));
+ if (! outName) {
+ tperror(T("Could not allocate memory"));
+ exit(1);
+ }
tcscpy(outName, outputDir);
tcscat(outName, delim);
tcscat(outName, file);
- fp = tfopen(outName, T("wb"));
- if (!fp) {
+ userData.fp = tfopen(outName, T("wb"));
+ if (! userData.fp) {
tperror(outName);
- exit(1);
+ exit(3);
}
- setvbuf(fp, NULL, _IOFBF, 16384);
+ setvbuf(userData.fp, NULL, _IOFBF, 16384);
#ifdef XML_UNICODE
- puttc(0xFEFF, fp);
+ puttc(0xFEFF, userData.fp);
#endif
- XML_SetUserData(parser, fp);
+ XML_SetUserData(parser, &userData);
switch (outputType) {
case 'm':
XML_UseParserAsHandlerArg(parser);
@@ -837,6 +1101,10 @@ tmain(int argc, XML_Char **argv)
XML_SetCharacterDataHandler(parser, characterData);
#ifndef W3C14N
XML_SetProcessingInstructionHandler(parser, processingInstruction);
+ if (requiresNotations) {
+ XML_SetDoctypeDeclHandler(parser, startDoctypeDecl, endDoctypeDecl);
+ XML_SetNotationDeclHandler(parser, notationDecl);
+ }
#endif /* not W3C14N */
break;
}
@@ -847,14 +1115,16 @@ tmain(int argc, XML_Char **argv)
if (outputDir) {
if (outputType == 'm')
metaEndDocument(parser);
- fclose(fp);
- if (!result) {
+ fclose(userData.fp);
+ if (! result) {
tremove(outName);
- exit(2);
}
free(outName);
}
XML_ParserFree(parser);
+ if (! result) {
+ exit(2);
+ }
}
return 0;
}
diff --git a/3rdparty/expat/xmlwf/xmlwf.dsp b/3rdparty/expat/xmlwf/xmlwf.dsp
deleted file mode 100644
index eb80c62bea6..00000000000
--- a/3rdparty/expat/xmlwf/xmlwf.dsp
+++ /dev/null
@@ -1,139 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlwf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=xmlwf - Win32 Release
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlwf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlwf.mak" CFG="xmlwf - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlwf - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "xmlwf - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlwf - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ".\Release"
-# PROP BASE Intermediate_Dir ".\Release"
-# PROP BASE Target_Dir "."
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\win32\bin\Release"
-# PROP Intermediate_Dir "..\win32\tmp\Release-xmlwf"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir "."
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x809 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
-# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\xmlwf.exe"
-# SUBTRACT LINK32 /nodefaultlib
-
-!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\Debug"
-# PROP BASE Intermediate_Dir ".\Debug"
-# PROP BASE Target_Dir "."
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\win32\bin\Debug"
-# PROP Intermediate_Dir "..\win32\tmp\Debug-xmlwf"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir "."
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c
-# SUBTRACT CPP /Fr /YX
-# ADD BASE RSC /l 0x809 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\xmlwf.exe"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlwf - Win32 Release"
-# Name "xmlwf - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\codepage.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\readfilemap.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\unixfilemap.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32filemap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\xmlfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\xmlwf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# Begin Source File
-
-SOURCE=.\codepage.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\xmlfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\xmltchar.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/3rdparty/expat/xmlwf/xmlwf_helpgen.py b/3rdparty/expat/xmlwf/xmlwf_helpgen.py
new file mode 100755
index 00000000000..939286e5c2c
--- /dev/null
+++ b/3rdparty/expat/xmlwf/xmlwf_helpgen.py
@@ -0,0 +1,69 @@
+#! /usr/bin/env python3
+# __ __ _
+# ___\ \/ /_ __ __ _| |_
+# / _ \\ /| '_ \ / _` | __|
+# | __// \| |_) | (_| | |_
+# \___/_/\_\ .__/ \__,_|\__|
+# |_| XML parser
+#
+# Copyright (c) 2019 Expat development team
+# Licensed under the MIT license:
+#
+# 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+# USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+import argparse
+
+epilog = """
+xmlwf of libexpat is software libre, licensed under the MIT license.
+Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!
+"""
+
+parser = argparse.ArgumentParser(prog='xmlwf', add_help=False,
+ description='xmlwf - Determines if an XML document is well-formed',
+ formatter_class=argparse.RawTextHelpFormatter,
+ epilog=epilog)
+
+input_related = parser.add_argument_group('input control arguments')
+input_related.add_argument('-s', action='store_true', help='print an error if the document is not [s]tandalone')
+input_related.add_argument('-n', action='store_true', help='enable [n]amespace processing')
+input_related.add_argument('-p', action='store_true', help='enable processing external DTDs and [p]arameter entities')
+input_related.add_argument('-x', action='store_true', help='enable processing of e[x]ternal entities')
+input_related.add_argument('-e', action='store', metavar='ENCODING', help='override any in-document [e]ncoding declaration')
+input_related.add_argument('-w', action='store_true', help='enable support for [W]indows code pages')
+input_related.add_argument('-r', action='store_true', help='disable memory-mapping and use normal file [r]ead IO calls instead')
+
+output_related = parser.add_argument_group('output control arguments')
+output_related.add_argument('-d', action='store', metavar='DIRECTORY', help='output [d]estination directory')
+output_mode = output_related.add_mutually_exclusive_group()
+output_mode.add_argument('-c', action='store_true', help='write a [c]opy of input XML, not canonical XML')
+output_mode.add_argument('-m', action='store_true', help='write [m]eta XML, not canonical XML')
+output_mode.add_argument('-t', action='store_true', help='write no XML output for [t]iming of plain parsing')
+output_related.add_argument('-N', action='store_true', help='enable adding doctype and [n]otation declarations')
+
+parser.add_argument('files', metavar='FILE', nargs='*', help='file to process (default: STDIN)')
+
+info = parser.add_argument_group('info arguments')
+info = info.add_mutually_exclusive_group()
+info.add_argument('-h', action='store_true', help='show this [h]elp message and exit')
+info.add_argument('-v', action='store_true', help='show program\'s [v]ersion number and exit')
+
+
+if __name__ == '__main__':
+ parser.print_help()
diff --git a/3rdparty/expat/xmlwf/xmlwf_helpgen.sh b/3rdparty/expat/xmlwf/xmlwf_helpgen.sh
new file mode 100755
index 00000000000..6b0fbf929a0
--- /dev/null
+++ b/3rdparty/expat/xmlwf/xmlwf_helpgen.sh
@@ -0,0 +1,35 @@
+#! /usr/bin/env bash
+# __ __ _
+# ___\ \/ /_ __ __ _| |_
+# / _ \\ /| '_ \ / _` | __|
+# | __// \| |_) | (_| | |_
+# \___/_/\_\ .__/ \__,_|\__|
+# |_| XML parser
+#
+# Copyright (c) 2019 Expat development team
+# Licensed under the MIT license:
+#
+# 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 furnished 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+# USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+./xmlwf/xmlwf_helpgen.py | sed \
+ -e 's,usage: xmlwf,usage: %s,' \
+ -e 's, \[-h | -v\],,' \
+ -e 's,^, T(",' \
+ -e 's,$,\\n"),'
diff --git a/3rdparty/expat/xmlwf/xmlwin32url.cxx b/3rdparty/expat/xmlwf/xmlwin32url.cxx
deleted file mode 100644
index bbfcce22c96..00000000000
--- a/3rdparty/expat/xmlwf/xmlwin32url.cxx
+++ /dev/null
@@ -1,395 +0,0 @@
-#include "expat.h"
-#ifdef XML_UNICODE
-#define UNICODE
-#endif
-#include <windows.h>
-#include <urlmon.h>
-#include <wininet.h>
-#include <stdio.h>
-#include <tchar.h>
-#include "xmlurl.h"
-#include "xmlmime.h"
-
-static int
-processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url);
-
-typedef void (*StopHandler)(void *, HRESULT);
-
-class Callback : public IBindStatusCallback {
-public:
- // IUnknown methods
- STDMETHODIMP QueryInterface(REFIID,void **);
- STDMETHODIMP_(ULONG) AddRef();
- STDMETHODIMP_(ULONG) Release();
- // IBindStatusCallback methods
- STDMETHODIMP OnStartBinding(DWORD, IBinding *);
- STDMETHODIMP GetPriority(LONG *);
- STDMETHODIMP OnLowResource(DWORD);
- STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR);
- STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR);
- STDMETHODIMP GetBindInfo(DWORD *, BINDINFO *);
- STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC *, STGMEDIUM *);
- STDMETHODIMP OnObjectAvailable(REFIID, IUnknown *);
- Callback(XML_Parser, IMoniker *, StopHandler, void *);
- ~Callback();
- int externalEntityRef(const XML_Char *context,
- const XML_Char *systemId, const XML_Char *publicId);
-private:
- XML_Parser parser_;
- IMoniker *baseMoniker_;
- DWORD totalRead_;
- ULONG ref_;
- IBinding *pBinding_;
- StopHandler stopHandler_;
- void *stopArg_;
-};
-
-STDMETHODIMP_(ULONG)
-Callback::AddRef()
-{
- return ref_++;
-}
-
-STDMETHODIMP_(ULONG)
-Callback::Release()
-{
- if (--ref_ == 0) {
- delete this;
- return 0;
- }
- return ref_;
-}
-
-STDMETHODIMP
-Callback::QueryInterface(REFIID riid, void** ppv)
-{
- if (IsEqualGUID(riid, IID_IUnknown))
- *ppv = (IUnknown *)this;
- else if (IsEqualGUID(riid, IID_IBindStatusCallback))
- *ppv = (IBindStatusCallback *)this;
- else
- return E_NOINTERFACE;
- ((LPUNKNOWN)*ppv)->AddRef();
- return S_OK;
-}
-
-STDMETHODIMP
-Callback::OnStartBinding(DWORD, IBinding* pBinding)
-{
- pBinding_ = pBinding;
- pBinding->AddRef();
- return S_OK;
-}
-
-STDMETHODIMP
-Callback::GetPriority(LONG *)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP
-Callback::OnLowResource(DWORD)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP
-Callback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR)
-{
- return S_OK;
-}
-
-STDMETHODIMP
-Callback::OnStopBinding(HRESULT hr, LPCWSTR szError)
-{
- if (pBinding_) {
- pBinding_->Release();
- pBinding_ = 0;
- }
- if (baseMoniker_) {
- baseMoniker_->Release();
- baseMoniker_ = 0;
- }
- stopHandler_(stopArg_, hr);
- return S_OK;
-}
-
-STDMETHODIMP
-Callback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo)
-{
- *pgrfBINDF = BINDF_ASYNCHRONOUS;
- return S_OK;
-}
-
-static void
-reportError(XML_Parser parser)
-{
- int code = XML_GetErrorCode(parser);
- const XML_Char *message = XML_ErrorString(code);
- if (message)
- _ftprintf(stderr, _T("%s:%d:%ld: %s\n"),
- XML_GetBase(parser),
- XML_GetErrorLineNumber(parser),
- XML_GetErrorColumnNumber(parser),
- message);
- else
- _ftprintf(stderr, _T("%s: (unknown message %d)\n"),
- XML_GetBase(parser), code);
-}
-
-STDMETHODIMP
-Callback::OnDataAvailable(DWORD grfBSCF,
- DWORD dwSize,
- FORMATETC *pfmtetc,
- STGMEDIUM* pstgmed)
-{
- if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) {
- IWinInetHttpInfo *hp;
- HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo,
- (void **)&hp);
- if (SUCCEEDED(hr)) {
- char contentType[1024];
- DWORD bufSize = sizeof(contentType);
- DWORD flags = 0;
- contentType[0] = 0;
- hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType,
- &bufSize, 0, NULL);
- if (SUCCEEDED(hr)) {
- char charset[CHARSET_MAX];
- getXMLCharset(contentType, charset);
- if (charset[0]) {
-#ifdef XML_UNICODE
- XML_Char wcharset[CHARSET_MAX];
- XML_Char *p1 = wcharset;
- const char *p2 = charset;
- while ((*p1++ = (unsigned char)*p2++) != 0)
- ;
- XML_SetEncoding(parser_, wcharset);
-#else
- XML_SetEncoding(parser_, charset);
-#endif
- }
- }
- hp->Release();
- }
- }
- if (!parser_)
- return E_ABORT;
- if (pstgmed->tymed == TYMED_ISTREAM) {
- while (totalRead_ < dwSize) {
-#define READ_MAX (64*1024)
- DWORD nToRead = dwSize - totalRead_;
- if (nToRead > READ_MAX)
- nToRead = READ_MAX;
- void *buf = XML_GetBuffer(parser_, nToRead);
- if (!buf) {
- _ftprintf(stderr, _T("out of memory\n"));
- return E_ABORT;
- }
- DWORD nRead;
- HRESULT hr = pstgmed->pstm->Read(buf, nToRead, &nRead);
- if (SUCCEEDED(hr)) {
- totalRead_ += nRead;
- if (!XML_ParseBuffer(parser_,
- nRead,
- (grfBSCF & BSCF_LASTDATANOTIFICATION) != 0
- && totalRead_ == dwSize)) {
- reportError(parser_);
- return E_ABORT;
- }
- }
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP
-Callback::OnObjectAvailable(REFIID, IUnknown *)
-{
- return S_OK;
-}
-
-int
-Callback::externalEntityRef(const XML_Char *context,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- XML_Parser entParser = XML_ExternalEntityParserCreate(parser_, context, 0);
- XML_SetBase(entParser, systemId);
- int ret = processURL(entParser, baseMoniker_, systemId);
- XML_ParserFree(entParser);
- return ret;
-}
-
-Callback::Callback(XML_Parser parser, IMoniker *baseMoniker,
- StopHandler stopHandler, void *stopArg)
-: parser_(parser),
- baseMoniker_(baseMoniker),
- ref_(0),
- pBinding_(0),
- totalRead_(0),
- stopHandler_(stopHandler),
- stopArg_(stopArg)
-{
- if (baseMoniker_)
- baseMoniker_->AddRef();
-}
-
-Callback::~Callback()
-{
- if (pBinding_)
- pBinding_->Release();
- if (baseMoniker_)
- baseMoniker_->Release();
-}
-
-static int
-externalEntityRef(void *arg,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- return ((Callback *)arg)->externalEntityRef(context, systemId, publicId);
-}
-
-
-static HRESULT
-openStream(XML_Parser parser,
- IMoniker *baseMoniker,
- const XML_Char *uri,
- StopHandler stopHandler, void *stopArg)
-{
- if (!XML_SetBase(parser, uri))
- return E_OUTOFMEMORY;
- HRESULT hr;
- IMoniker *m;
-#ifdef XML_UNICODE
- hr = CreateURLMoniker(0, uri, &m);
-#else
- LPWSTR uriw = new wchar_t[strlen(uri) + 1];
- for (int i = 0;; i++) {
- uriw[i] = uri[i];
- if (uriw[i] == 0)
- break;
- }
- hr = CreateURLMoniker(baseMoniker, uriw, &m);
- delete [] uriw;
-#endif
- if (FAILED(hr))
- return hr;
- IBindStatusCallback *cb = new Callback(parser, m, stopHandler, stopArg);
- XML_SetExternalEntityRefHandler(parser, externalEntityRef);
- XML_SetExternalEntityRefHandlerArg(parser, cb);
- cb->AddRef();
- IBindCtx *b;
- if (FAILED(hr = CreateAsyncBindCtx(0, cb, 0, &b))) {
- cb->Release();
- m->Release();
- return hr;
- }
- cb->Release();
- IStream *pStream;
- hr = m->BindToStorage(b, 0, IID_IStream, (void **)&pStream);
- if (SUCCEEDED(hr)) {
- if (pStream)
- pStream->Release();
- }
- if (hr == MK_S_ASYNCHRONOUS)
- hr = S_OK;
- m->Release();
- b->Release();
- return hr;
-}
-
-struct QuitInfo {
- const XML_Char *url;
- HRESULT hr;
- int stop;
-};
-
-static void
-winPerror(const XML_Char *url, HRESULT hr)
-{
- LPVOID buf;
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
- | FORMAT_MESSAGE_FROM_HMODULE,
- GetModuleHandleA("urlmon.dll"),
- hr,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buf,
- 0,
- NULL)
- || FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
- | FORMAT_MESSAGE_FROM_SYSTEM,
- 0,
- hr,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buf,
- 0,
- NULL)) {
- /* The system error messages seem to end with a newline. */
- _ftprintf(stderr, _T("%s: %s"), url, buf);
- fflush(stderr);
- LocalFree(buf);
- }
- else
- _ftprintf(stderr, _T("%s: error %x\n"), url, hr);
-}
-
-static void
-threadQuit(void *p, HRESULT hr)
-{
- QuitInfo *qi = (QuitInfo *)p;
- qi->hr = hr;
- qi->stop = 1;
-}
-
-extern "C"
-int
-XML_URLInit(void)
-{
- return SUCCEEDED(CoInitialize(0));
-}
-
-extern "C"
-void
-XML_URLUninit(void)
-{
- CoUninitialize();
-}
-
-static int
-processURL(XML_Parser parser, IMoniker *baseMoniker,
- const XML_Char *url)
-{
- QuitInfo qi;
- qi.stop = 0;
- qi.url = url;
-
- XML_SetBase(parser, url);
- HRESULT hr = openStream(parser, baseMoniker, url, threadQuit, &qi);
- if (FAILED(hr)) {
- winPerror(url, hr);
- return 0;
- }
- else if (FAILED(qi.hr)) {
- winPerror(url, qi.hr);
- return 0;
- }
- MSG msg;
- while (!qi.stop && GetMessage (&msg, NULL, 0, 0)) {
- TranslateMessage (&msg);
- DispatchMessage (&msg);
- }
- return 1;
-}
-
-extern "C"
-int
-XML_ProcessURL(XML_Parser parser,
- const XML_Char *url,
- unsigned flags)
-{
- return processURL(parser, 0, url);
-}