diff options
author | Eric van Gyzen <vangyzen@FreeBSD.org> | 2018-11-04 16:08:59 +0000 |
---|---|---|
committer | Eric van Gyzen <vangyzen@FreeBSD.org> | 2018-11-04 16:08:59 +0000 |
commit | 0a48773f8c6108ad8755065c5cdc13fcdc0728b2 (patch) | |
tree | d1f668188b9e1904aa6812a3cd3fefa0d1bc1e13 /contrib/expat/xmlwf | |
parent | 6d080f8660b370f83eb10a840b6d14b6dd84a1de (diff) | |
parent | 77c85705a616126682be274fd54e9c4308083501 (diff) | |
download | src-0a48773f8c6108ad8755065c5cdc13fcdc0728b2.tar.gz src-0a48773f8c6108ad8755065c5cdc13fcdc0728b2.zip |
Update expat to 2.2.6
Update contrib/expat by merging from the vendor branch.
Update expat_config.h manually, using
make -C /usr/ports/textproc/expat2 configure
as a baseline.
MFC after: 1 month
Relnotes: yes
Security: yes; see contrib/expat/Changes since 2.2.0
Sponsored by: Dell EMC Isilon
Notes
Notes:
svn path=/head/; revision=340127
Diffstat (limited to 'contrib/expat/xmlwf')
-rw-r--r-- | contrib/expat/xmlwf/Makefile.am | 61 | ||||
-rw-r--r-- | contrib/expat/xmlwf/Makefile.in | 753 | ||||
-rw-r--r-- | contrib/expat/xmlwf/codepage.c | 38 | ||||
-rw-r--r-- | contrib/expat/xmlwf/codepage.h | 32 | ||||
-rw-r--r-- | contrib/expat/xmlwf/ct.c | 32 | ||||
-rw-r--r-- | contrib/expat/xmlwf/filemap.h | 44 | ||||
-rw-r--r-- | contrib/expat/xmlwf/readfilemap.c | 110 | ||||
-rw-r--r-- | contrib/expat/xmlwf/unixfilemap.c | 57 | ||||
-rw-r--r-- | contrib/expat/xmlwf/win32filemap.c | 49 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlfile.c | 95 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlfile.h | 32 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlmime.c | 32 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlmime.h | 32 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmltchar.h | 104 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlurl.h | 32 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlwf.c | 375 | ||||
-rw-r--r-- | contrib/expat/xmlwf/xmlwin32url.cxx | 32 |
17 files changed, 1735 insertions, 175 deletions
diff --git a/contrib/expat/xmlwf/Makefile.am b/contrib/expat/xmlwf/Makefile.am new file mode 100644 index 000000000000..ff460902caa0 --- /dev/null +++ b/contrib/expat/xmlwf/Makefile.am @@ -0,0 +1,61 @@ +# +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| 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 = -I$(srcdir)/../lib + +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 \ + xmlurl.h \ + xmlwin32url.cxx diff --git a/contrib/expat/xmlwf/Makefile.in b/contrib/expat/xmlwf/Makefile.in new file mode 100644 index 000000000000..152bbe97eec3 --- /dev/null +++ b/contrib/expat/xmlwf/Makefile.in @@ -0,0 +1,753 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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 +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)/conftools/ac_c_bigendian_cross.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__depfiles_maybe = depfiles +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_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +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@ +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@ +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 = -I$(srcdir)/../lib $(am__append_1) +@MINGW_TRUE@@UNICODE_TRUE@xmlwf_LDFLAGS = -municode +EXTRA_DIST = \ + codepage.h \ + ct.c \ + filemap.h \ + readfilemap.c \ + unixfilemap.c \ + win32filemap.c \ + xmlfile.h \ + xmlmime.c \ + xmlmime.h \ + xmltchar.h \ + xmlurl.h \ + xmlwin32url.cxx + +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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + 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@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@ + +.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: $(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 -rf ./$(DEPDIR) + -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 -rf ./$(DEPDIR) + -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 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/contrib/expat/xmlwf/codepage.c b/contrib/expat/xmlwf/codepage.c index 91bd15e96f8b..1a0487ff91d2 100644 --- a/contrib/expat/xmlwf/codepage.c +++ b/contrib/expat/xmlwf/codepage.c @@ -1,11 +1,39 @@ -/* 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__))) +#if defined(_WIN32) #define STRICT 1 #define WIN32_LEAN_AND_MEAN 1 @@ -52,7 +80,7 @@ codepageConvert(int cp, const char *p) return -1; } -#else /* not WIN32 */ +#else /* not _WIN32 */ int codepageMap(int UNUSED_P(cp), int *UNUSED_P(map)) @@ -66,4 +94,4 @@ codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p)) return -1; } -#endif /* not WIN32 */ +#endif /* not _WIN32 */ diff --git a/contrib/expat/xmlwf/codepage.h b/contrib/expat/xmlwf/codepage.h index 6a4df68883e4..1b75d58365f4 100644 --- a/contrib/expat/xmlwf/codepage.h +++ b/contrib/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/contrib/expat/xmlwf/ct.c b/contrib/expat/xmlwf/ct.c index 95903a34500a..dd42f5ec98d8 100644 --- a/contrib/expat/xmlwf/ct.c +++ b/contrib/expat/xmlwf/ct.c @@ -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. +*/ + #define CHARSET_MAX 41 static const char * diff --git a/contrib/expat/xmlwf/filemap.h b/contrib/expat/xmlwf/filemap.h index 814edec2528c..5487a4ebe50b 100644 --- a/contrib/expat/xmlwf/filemap.h +++ b/contrib/expat/xmlwf/filemap.h @@ -1,9 +1,49 @@ -/* 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, diff --git a/contrib/expat/xmlwf/readfilemap.c b/contrib/expat/xmlwf/readfilemap.c index d816b263aae1..4c4780bde0e3 100644 --- a/contrib/expat/xmlwf/readfilemap.c +++ b/contrib/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> @@ -9,64 +37,76 @@ #include <stdio.h> /* Functions close(2) and read(2) */ -#ifdef __WATCOMC__ -#ifndef __LINUX__ -#include <io.h> -#else -#include <unistd.h> +#if !defined(_WIN32) && !defined(_WIN64) +# include <unistd.h> #endif -#else -# if !defined(WIN32) && !defined(_WIN32) && !defined(_WIN64) -# include <unistd.h> -# endif + +/* 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), +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); + 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) { @@ -77,19 +117,19 @@ filemap(const char *name, } p = malloc(nbytes); if (!p) { - fprintf(stderr, "%s: out of memory\n", name); + 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/contrib/expat/xmlwf/unixfilemap.c b/contrib/expat/xmlwf/unixfilemap.c index e13299da05fc..4ab757c2ab9c 100644 --- a/contrib/expat/xmlwf/unixfilemap.c +++ b/contrib/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> @@ -15,11 +43,18 @@ #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), +filemap(const tchar *name, + void (*processor)(const void *, size_t, const tchar *, void *arg), void *arg) { int fd; @@ -27,21 +62,25 @@ filemap(const char *name, 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)) { 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 */ @@ -54,7 +93,7 @@ filemap(const char *name, 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/contrib/expat/xmlwf/win32filemap.c b/contrib/expat/xmlwf/win32filemap.c index 41dc35b614db..a040a097db4c 100644 --- a/contrib/expat/xmlwf/win32filemap.c +++ b/contrib/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> @@ -42,11 +70,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) { diff --git a/contrib/expat/xmlwf/xmlfile.c b/contrib/expat/xmlwf/xmlfile.c index 2f769aa894cf..4075f5710cad 100644 --- a/contrib/expat/xmlwf/xmlfile.c +++ b/contrib/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,17 +36,11 @@ #include <string.h> #include <fcntl.h> -#ifdef WIN32 +#ifdef _WIN32 #include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" #elif defined(HAVE_EXPAT_CONFIG_H) #include <expat_config.h> -#endif /* ndef WIN32 */ +#endif /* ndef _WIN32 */ #include "expat.h" #include "internal.h" /* for UNUSED_P only */ @@ -26,14 +48,10 @@ #include "xmltchar.h" #include "filemap.h" -#if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__))) +#if defined(_MSC_VER) #include <io.h> #endif -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include <proto/expat.h> -#endif - #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -58,13 +76,20 @@ typedef struct { int *retPtr; } PROCESS_ARGS; +static int +processStream(const XML_Char *filename, XML_Parser parser); + static void 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"), + 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), @@ -88,7 +113,7 @@ processFile(const void *data, size_t size, *retPtr = 1; } -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) static int isAsciiLetter(XML_Char c) @@ -96,7 +121,7 @@ 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, @@ -106,7 +131,7 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId, *toFree = 0; if (!base || *systemId == T('/') -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) || *systemId == T('\\') || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) #endif @@ -120,7 +145,7 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId, 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 @@ -139,13 +164,23 @@ externalEntityRefFilemap(XML_Parser parser, XML_Char *s; const XML_Char *filename; XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); + int filemapRes; PROCESS_ARGS args; 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; @@ -171,18 +206,18 @@ processStream(const XML_Char *filename, XML_Parser parser) 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; @@ -233,11 +268,21 @@ XML_ProcessFile(XML_Parser parser, ? 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; + 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); diff --git a/contrib/expat/xmlwf/xmlfile.h b/contrib/expat/xmlwf/xmlfile.h index d093ecc06f9c..c47ea2cf5947 100644 --- a/contrib/expat/xmlwf/xmlfile.h +++ b/contrib/expat/xmlwf/xmlfile.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. */ #define XML_MAP_FILE 01 diff --git a/contrib/expat/xmlwf/xmlmime.c b/contrib/expat/xmlwf/xmlmime.c index 56a0e7f40e49..c530979060f4 100644 --- a/contrib/expat/xmlwf/xmlmime.c +++ b/contrib/expat/xmlwf/xmlmime.c @@ -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. +*/ + #include <string.h> #include "xmlmime.h" diff --git a/contrib/expat/xmlwf/xmlmime.h b/contrib/expat/xmlwf/xmlmime.h index bf0356df0d91..0471286234a1 100644 --- a/contrib/expat/xmlwf/xmlmime.h +++ b/contrib/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/contrib/expat/xmlwf/xmltchar.h b/contrib/expat/xmlwf/xmltchar.h index 1088575512de..cdfaea79552f 100644 --- a/contrib/expat/xmlwf/xmltchar.h +++ b/contrib/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/contrib/expat/xmlwf/xmlurl.h b/contrib/expat/xmlwf/xmlurl.h index d329913ac853..f2cff093e2ea 100644 --- a/contrib/expat/xmlwf/xmlurl.h +++ b/contrib/expat/xmlwf/xmlurl.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/contrib/expat/xmlwf/xmlwf.c b/contrib/expat/xmlwf/xmlwf.c index 66d6c9ef4b71..82d028ea56fd 100644 --- a/contrib/expat/xmlwf/xmlwf.c +++ b/contrib/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> @@ -14,13 +43,28 @@ #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') @@ -28,7 +72,7 @@ static void XMLCALL characterData(void *userData, const XML_Char *s, int len) { - FILE *fp = (FILE *)userData; + FILE *fp = ((XmlwfUserData *)userData)->fp; for (; len > 0; --len, ++s) { switch (*s) { case T('&'): @@ -66,6 +110,7 @@ attributeValue(FILE *fp, const XML_Char *s) { puttc(T('='), fp); puttc(T('"'), fp); + assert(s); for (;;) { switch (*s) { case 0: @@ -123,7 +168,7 @@ 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); @@ -145,7 +190,7 @@ 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; + FILE *fp = ((XmlwfUserData *)userData)->fp; puttc(T('<'), fp); puttc(T('/'), fp); fputts(name, fp); @@ -170,7 +215,7 @@ 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); @@ -216,7 +261,7 @@ 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; + FILE *fp = ((XmlwfUserData *)userData)->fp; const XML_Char *sep; puttc(T('<'), fp); puttc(T('/'), fp); @@ -236,7 +281,7 @@ static void XMLCALL processingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { - FILE *fp = (FILE *)userData; + FILE *fp = ((XmlwfUserData *)userData)->fp; puttc(T('<'), fp); puttc(T('?'), fp); fputts(target, fp); @@ -246,6 +291,200 @@ 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 *UNUSED_P(sysid), + const XML_Char *UNUSED_P(publid), + int UNUSED_P(has_internal_subset)) +{ + XmlwfUserData *data = (XmlwfUserData *)userData; + 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 *UNUSED_P(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"; + + 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 @@ -298,7 +537,7 @@ nopProcessingInstruction(void *UNUSED_P(userData), const XML_Char *UNUSED_P(targ static void XMLCALL markup(void *userData, const XML_Char *s, int len) { - FILE *fp = (FILE *)XML_GetUserData((XML_Parser) userData); + FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp; for (; len > 0; --len, ++s) puttc(*s, fp); } @@ -307,11 +546,14 @@ static void 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\""), + 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), @@ -321,13 +563,15 @@ metaLocation(XML_Parser parser) static void metaStartDocument(void *userData) { - fputts(T("<document>\n"), (FILE *)XML_GetUserData((XML_Parser) 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)); + fputts(T("</document>\n"), + ((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp); } static void XMLCALL @@ -335,7 +579,8 @@ metaStartElement(void *userData, const XML_Char *name, const XML_Char **atts) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; const XML_Char **specifiedAttsEnd = atts + XML_GetSpecifiedAttributeCount(parser); const XML_Char **idAttPtr; @@ -344,14 +589,14 @@ metaStartElement(void *userData, const XML_Char *name, 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) @@ -369,7 +614,8 @@ static void XMLCALL metaEndElement(void *userData, const XML_Char *name) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; ftprintf(fp, T("<endtag name=\"%s\""), name); metaLocation(parser); fputts(T("/>\n"), fp); @@ -380,9 +626,10 @@ metaProcessingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + 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); @@ -392,9 +639,10 @@ static void XMLCALL metaComment(void *userData, const XML_Char *data) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + 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); @@ -404,7 +652,8 @@ static void XMLCALL metaStartCdataSection(void *userData) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; fputts(T("<startcdata"), fp); metaLocation(parser); fputts(T("/>\n"), fp); @@ -414,7 +663,8 @@ static void XMLCALL metaEndCdataSection(void *userData) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; fputts(T("<endcdata"), fp); metaLocation(parser); fputts(T("/>\n"), fp); @@ -424,9 +674,10 @@ static void XMLCALL metaCharacterData(void *userData, const XML_Char *s, int len) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + 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); @@ -440,7 +691,8 @@ metaStartDoctypeDecl(void *userData, int UNUSED_P(has_internal_subset)) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName); metaLocation(parser); fputts(T("/>\n"), fp); @@ -450,7 +702,8 @@ static void XMLCALL metaEndDoctypeDecl(void *userData) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; fputts(T("<enddoctype"), fp); metaLocation(parser); fputts(T("/>\n"), fp); @@ -464,13 +717,14 @@ metaNotationDecl(void *userData, const XML_Char *publicId) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; 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); @@ -490,13 +744,14 @@ metaEntityDecl(void *userData, const XML_Char *notationName) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; 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) { @@ -504,7 +759,7 @@ metaEntityDecl(void *userData, 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); @@ -515,7 +770,7 @@ metaEntityDecl(void *userData, 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); @@ -528,13 +783,14 @@ metaStartNamespaceDecl(void *userData, const XML_Char *uri) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + 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 @@ -545,7 +801,8 @@ static void XMLCALL metaEndNamespaceDecl(void *userData, const XML_Char *prefix) { XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); + XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); + FILE *fp = data->fp; if (!prefix) fputts(T("<endns/>\n"), fp); else @@ -608,7 +865,7 @@ showVersion(XML_Char *prog) const XML_Feature *features = XML_GetFeatureList(); while ((ch = *s) != 0) { if (ch == '/' -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) || ch == '\\' #endif ) @@ -635,10 +892,15 @@ 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); + T("usage: %s [-s] [-n] [-p] [-x] [-e encoding] [-w] [-d output-dir] [-c] [-m] [-r] [-t] [-N] [file ...]\n"), 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) { @@ -650,9 +912,11 @@ tmain(int argc, XML_Char **argv) int outputType = 0; int useNamespaces = 0; int requireStandalone = 0; + 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); @@ -707,6 +971,10 @@ 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) @@ -752,7 +1020,6 @@ tmain(int argc, XML_Char **argv) i--; } for (; i < argc; i++) { - FILE *fp = 0; XML_Char *outName = 0; int result; XML_Parser parser; @@ -762,7 +1029,7 @@ tmain(int argc, XML_Char **argv) parser = XML_ParserCreate(encoding); if (! parser) { - tperror("Could not instantiate parser"); + tperror(T("Could not instantiate parser")); exit(1); } @@ -785,7 +1052,7 @@ tmain(int argc, XML_Char **argv) 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("\\"); lastDelim = tcsrchr(file, winDelim[0]); @@ -801,16 +1068,16 @@ tmain(int argc, XML_Char **argv) 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); } - 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); @@ -844,6 +1111,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; } @@ -854,7 +1125,7 @@ tmain(int argc, XML_Char **argv) if (outputDir) { if (outputType == 'm') metaEndDocument(parser); - fclose(fp); + fclose(userData.fp); if (!result) { tremove(outName); exit(2); diff --git a/contrib/expat/xmlwf/xmlwin32url.cxx b/contrib/expat/xmlwf/xmlwin32url.cxx index bbfcce22c964..ef2a137452e7 100644 --- a/contrib/expat/xmlwf/xmlwin32url.cxx +++ b/contrib/expat/xmlwf/xmlwin32url.cxx @@ -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. +*/ + #include "expat.h" #ifdef XML_UNICODE #define UNICODE |