summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatsuu Takuto <matsuu@gentoo.org>2007-03-24 23:51:11 +0000
committerMatsuu Takuto <matsuu@gentoo.org>2007-03-24 23:51:11 +0000
commit3d846dc7c9891e13f00debfda3c6de5d10b76024 (patch)
treea5545bdff5a2ec63677e18bd5ad035e7377da00c
downloadsecondlife-3d846dc7c9891e13f00debfda3c6de5d10b76024.tar.gz
secondlife-3d846dc7c9891e13f00debfda3c6de5d10b76024.tar.bz2
secondlife-3d846dc7c9891e13f00debfda3c6de5d10b76024.zip
Initial import.
svn path=/secondlife/; revision=1
-rw-r--r--dev-libs/ELFIO/ELFIO-1.0.3.ebuild30
-rw-r--r--dev-libs/ELFIO/Manifest8
-rw-r--r--dev-libs/ELFIO/files/digest-ELFIO-1.0.33
-rw-r--r--dev-libs/xmlrpc-epi/Manifest28
-rw-r--r--dev-libs/xmlrpc-epi/files/digest-xmlrpc-epi-0.513
-rw-r--r--dev-libs/xmlrpc-epi/files/remove_expat_xmlrpc-epi-0.51.diff14499
-rw-r--r--dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-64bit-fixes.patch93
-rw-r--r--dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-expat.patch83
-rw-r--r--dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-gcc4.patch11
-rw-r--r--dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-secondlife.patch12
-rw-r--r--dev-libs/xmlrpc-epi/xmlrpc-epi-0.51.ebuild31
-rw-r--r--games-simulation/secondlife-bin/Manifest16
-rw-r--r--games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.3.23
-rw-r--r--games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.4.595583
-rw-r--r--games-simulation/secondlife-bin/secondlife-bin-1.13.3.2.ebuild89
-rw-r--r--games-simulation/secondlife-bin/secondlife-bin-1.13.4.59558.ebuild91
-rw-r--r--games-simulation/secondlife/Manifest25
-rw-r--r--games-simulation/secondlife/files/digest-secondlife-1.13.3.595586
-rw-r--r--games-simulation/secondlife/files/opensecondlife-svn41.patch28
-rw-r--r--games-simulation/secondlife/files/secondlife-1.13.3.2-llimagej2coj_debug.patch121
-rw-r--r--games-simulation/secondlife/files/secondlife-1.13.3.59315-no_fmod.patch21
-rw-r--r--games-simulation/secondlife/files/secondlife-1.13.3.59558-gentoo.patch211
-rw-r--r--games-simulation/secondlife/secondlife-1.13.3.59558.ebuild131
-rw-r--r--media-libs/openjpeg/Manifest20
-rw-r--r--media-libs/openjpeg/files/OPJ_limit_tags_for_decode_UPDATED.patch3765
-rw-r--r--media-libs/openjpeg/files/digest-openjpeg-1.1.13
-rw-r--r--media-libs/openjpeg/files/openjpeg-1.1.1-gentoo.patch20
-rw-r--r--media-libs/openjpeg/openjpeg-1.1.1.ebuild38
28 files changed, 19392 insertions, 0 deletions
diff --git a/dev-libs/ELFIO/ELFIO-1.0.3.ebuild b/dev-libs/ELFIO/ELFIO-1.0.3.ebuild
new file mode 100644
index 0000000..0edbfeb
--- /dev/null
+++ b/dev-libs/ELFIO/ELFIO-1.0.3.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="ELF (Executable and Linkable Format) reader and producer implemented as a C++ library."
+HOMEPAGE="http://elfio.sourceforge.net/"
+SRC_URI="mirror://sourceforge/elfio/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~mips ~sparc ~x86"
+IUSE=""
+
+src_compile() {
+ append-flags -fPIC
+ econf || die "econf failed"
+ emake || die "emake failed"
+
+ # for secondlife
+ cd ELFIO && $(tc-getCC) -shared *.o -o libelfio.so || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "install failed"
+ dolib.so ELFIO/libelfio.so || die
+
+ dodoc AUTHORS NEWS README
+}
diff --git a/dev-libs/ELFIO/Manifest b/dev-libs/ELFIO/Manifest
new file mode 100644
index 0000000..d932f83
--- /dev/null
+++ b/dev-libs/ELFIO/Manifest
@@ -0,0 +1,8 @@
+DIST ELFIO-1.0.3.tar.gz 308560 RMD160 f89212b30df5ede1339aca0f66f4e40b36d083ca SHA1 1339541932653a29ef937210e7ae283d33462ec5 SHA256 e8cdd3895c4f6e5ed2422a2151e7940f9085a1c10d1f0508ed03b1c4860bcada
+EBUILD ELFIO-1.0.3.ebuild 734 RMD160 2acdd641a1d05764cb3a6ce3b4ad1fabc30660db SHA1 470c853548c1e1346a4374e1fbb8a471f5ee74fe SHA256 39d141d7ca1e72440ccf85df3e0cc3fca87ac782eb131f7503a7a8af02a9dcd7
+MD5 6ff7b6fd275efb641cbcd84027aebbf7 ELFIO-1.0.3.ebuild 734
+RMD160 2acdd641a1d05764cb3a6ce3b4ad1fabc30660db ELFIO-1.0.3.ebuild 734
+SHA256 39d141d7ca1e72440ccf85df3e0cc3fca87ac782eb131f7503a7a8af02a9dcd7 ELFIO-1.0.3.ebuild 734
+MD5 596e1cfa4b31cd034210677307e67210 files/digest-ELFIO-1.0.3 235
+RMD160 fd808ad68224b17092591f9aaf4a0f70d33ec942 files/digest-ELFIO-1.0.3 235
+SHA256 cec4da390170d5a59c1c2c3cf4751ea6f10499f2006b92e0809f507767d601f2 files/digest-ELFIO-1.0.3 235
diff --git a/dev-libs/ELFIO/files/digest-ELFIO-1.0.3 b/dev-libs/ELFIO/files/digest-ELFIO-1.0.3
new file mode 100644
index 0000000..1f72a89
--- /dev/null
+++ b/dev-libs/ELFIO/files/digest-ELFIO-1.0.3
@@ -0,0 +1,3 @@
+MD5 fd6fca12c7b43f6c01d30b23d22aaefe ELFIO-1.0.3.tar.gz 308560
+RMD160 f89212b30df5ede1339aca0f66f4e40b36d083ca ELFIO-1.0.3.tar.gz 308560
+SHA256 e8cdd3895c4f6e5ed2422a2151e7940f9085a1c10d1f0508ed03b1c4860bcada ELFIO-1.0.3.tar.gz 308560
diff --git a/dev-libs/xmlrpc-epi/Manifest b/dev-libs/xmlrpc-epi/Manifest
new file mode 100644
index 0000000..1554484
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/Manifest
@@ -0,0 +1,28 @@
+AUX remove_expat_xmlrpc-epi-0.51.diff 423619 RMD160 bb48769b57660d1c5694b978007f29fd615c755e SHA1 8c944948b6da78890da82288acce45ec8b98ef7e SHA256 70472b98a3b9fc4f7e4388cd70f3425b0d329948d516051cde62f02085a0fac7
+MD5 b06ce8a53a8617d509cc992b61cafdef files/remove_expat_xmlrpc-epi-0.51.diff 423619
+RMD160 bb48769b57660d1c5694b978007f29fd615c755e files/remove_expat_xmlrpc-epi-0.51.diff 423619
+SHA256 70472b98a3b9fc4f7e4388cd70f3425b0d329948d516051cde62f02085a0fac7 files/remove_expat_xmlrpc-epi-0.51.diff 423619
+AUX xmlrpc-epi-0.51-64bit-fixes.patch 3457 RMD160 6da25f27c64c9838766113c3914d0a141bc9401d SHA1 63a86e1e1e3cb6fa6cc7ee45dfa9ba836de1af0d SHA256 17b9f345cf0d5c4d8d601a1586e8d559daaa4c409e36699bbf7e63022c4e7783
+MD5 50e267b3dcf40e9860eb1b05fa770bc7 files/xmlrpc-epi-0.51-64bit-fixes.patch 3457
+RMD160 6da25f27c64c9838766113c3914d0a141bc9401d files/xmlrpc-epi-0.51-64bit-fixes.patch 3457
+SHA256 17b9f345cf0d5c4d8d601a1586e8d559daaa4c409e36699bbf7e63022c4e7783 files/xmlrpc-epi-0.51-64bit-fixes.patch 3457
+AUX xmlrpc-epi-0.51-expat.patch 2935 RMD160 6fccc4d8cfb372811e58e3df31667d41753e5df0 SHA1 e0be6e9f0dffe044f09024fd0e562e6c7027554c SHA256 36b1d156c34d25f446c4b14b779795c7544538e63f762de8bc8d2eb5e2abe168
+MD5 8b9efab174a958269f7bc754943ab232 files/xmlrpc-epi-0.51-expat.patch 2935
+RMD160 6fccc4d8cfb372811e58e3df31667d41753e5df0 files/xmlrpc-epi-0.51-expat.patch 2935
+SHA256 36b1d156c34d25f446c4b14b779795c7544538e63f762de8bc8d2eb5e2abe168 files/xmlrpc-epi-0.51-expat.patch 2935
+AUX xmlrpc-epi-0.51-gcc4.patch 413 RMD160 abf7cf13e58ad056b50368f7f0cf6b9f72ee9ea4 SHA1 46f4950075fcb5e3f0e6a762a89edf35d2c13570 SHA256 b6c6c90382863a3915aad277b9bcec1521eed17f478334324e19648f31520e4b
+MD5 2c30e81d3bc50b4879ff263bf119f715 files/xmlrpc-epi-0.51-gcc4.patch 413
+RMD160 abf7cf13e58ad056b50368f7f0cf6b9f72ee9ea4 files/xmlrpc-epi-0.51-gcc4.patch 413
+SHA256 b6c6c90382863a3915aad277b9bcec1521eed17f478334324e19648f31520e4b files/xmlrpc-epi-0.51-gcc4.patch 413
+AUX xmlrpc-epi-0.51-secondlife.patch 364 RMD160 6c6ccab1174bbc4f9547c210b2584e6e6b484852 SHA1 b1a5d407dcde8a8a4ac08486e72bdc3ffd06e8f7 SHA256 7d7b77622b3656d0463d9a54bf4fc3244c22013ef664f160ec1729714f4533fa
+MD5 748958d5afa4de930e9614e510b801b0 files/xmlrpc-epi-0.51-secondlife.patch 364
+RMD160 6c6ccab1174bbc4f9547c210b2584e6e6b484852 files/xmlrpc-epi-0.51-secondlife.patch 364
+SHA256 7d7b77622b3656d0463d9a54bf4fc3244c22013ef664f160ec1729714f4533fa files/xmlrpc-epi-0.51-secondlife.patch 364
+DIST xmlrpc-epi-0.51.tar.gz 458208 RMD160 c505ee80460cbf521cdee8895a02273d5a773e8e SHA1 dc986663a1d996844dacd8787bee427a03a0c01b SHA256 ec9e54e72e70b38d515d6fc69b4d591ed6018b65d9409965dfacdcd1f59d13b3
+EBUILD xmlrpc-epi-0.51.ebuild 642 RMD160 c2f0ac2f258a9805fd03f12ab7e3e0dcd7546ce2 SHA1 b712edf37ac354ac6d6190cc7648e7f81b3c6558 SHA256 46d765b22e1868cb6568444ec0d2232f56f2d309c8187d1a1df24771dc1e9adb
+MD5 843b21ed19bc8689c45bdc49c2689b10 xmlrpc-epi-0.51.ebuild 642
+RMD160 c2f0ac2f258a9805fd03f12ab7e3e0dcd7546ce2 xmlrpc-epi-0.51.ebuild 642
+SHA256 46d765b22e1868cb6568444ec0d2232f56f2d309c8187d1a1df24771dc1e9adb xmlrpc-epi-0.51.ebuild 642
+MD5 7e895aeb0774b7ac737625938d136675 files/digest-xmlrpc-epi-0.51 247
+RMD160 6b2d900894895aecd0a778ffdcc031b16e848711 files/digest-xmlrpc-epi-0.51 247
+SHA256 ebee13b1a57eb81ca648b0b7f40674adb2867ee90b6f3e75b37e97928fe2279e files/digest-xmlrpc-epi-0.51 247
diff --git a/dev-libs/xmlrpc-epi/files/digest-xmlrpc-epi-0.51 b/dev-libs/xmlrpc-epi/files/digest-xmlrpc-epi-0.51
new file mode 100644
index 0000000..a84756d
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/files/digest-xmlrpc-epi-0.51
@@ -0,0 +1,3 @@
+MD5 51c5f062365f82ff1c26c2763e7f0654 xmlrpc-epi-0.51.tar.gz 458208
+RMD160 c505ee80460cbf521cdee8895a02273d5a773e8e xmlrpc-epi-0.51.tar.gz 458208
+SHA256 ec9e54e72e70b38d515d6fc69b4d591ed6018b65d9409965dfacdcd1f59d13b3 xmlrpc-epi-0.51.tar.gz 458208
diff --git a/dev-libs/xmlrpc-epi/files/remove_expat_xmlrpc-epi-0.51.diff b/dev-libs/xmlrpc-epi/files/remove_expat_xmlrpc-epi-0.51.diff
new file mode 100644
index 0000000..a7d2075
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/files/remove_expat_xmlrpc-epi-0.51.diff
@@ -0,0 +1,14499 @@
+diff -u -r -N original/xmlrpc-epi-0.51/Makefile.in dump_expat/xmlrpc-epi-0.51/Makefile.in
+--- original/xmlrpc-epi-0.51/Makefile.in 2002-06-23 18:48:29.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/Makefile.in 2007-02-01 23:12:50.000000000 -0600
+@@ -77,7 +77,7 @@
+ STRIP = @STRIP@
+ VERSION = @VERSION@
+
+-SUBDIRS = expat src sample
++SUBDIRS = src sample
+
+ CHANGE_LOG_GEN_BIN = scripts/cvs2cl.pl
+ CHANGE_LOG_GEN_FLAGS = -t -r -b --accum -I ChangeLog --gmt --prune
+diff -u -r -N original/xmlrpc-epi-0.51/configure dump_expat/xmlrpc-epi-0.51/configure
+--- original/xmlrpc-epi-0.51/configure 2002-06-23 18:48:29.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/configure 2007-02-01 22:43:31.000000000 -0600
+@@ -8541,7 +8541,7 @@
+ fi
+ done
+
+-ac_config_files="$ac_config_files src/Makefile Makefile sample/Makefile expat/Makefile expat/xmltok/Makefile expat/xmlparse/Makefile"
++ac_config_files="$ac_config_files src/Makefile Makefile sample/Makefile"
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
+ # tests run on this system so they can be shared between configure
+@@ -8876,9 +8876,6 @@
+ "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "sample/Makefile" ) CONFIG_FILES="$CONFIG_FILES sample/Makefile" ;;
+- "expat/Makefile" ) CONFIG_FILES="$CONFIG_FILES expat/Makefile" ;;
+- "expat/xmltok/Makefile" ) CONFIG_FILES="$CONFIG_FILES expat/xmltok/Makefile" ;;
+- "expat/xmlparse/Makefile" ) CONFIG_FILES="$CONFIG_FILES expat/xmlparse/Makefile" ;;
+ *) { { echo "$as_me:8882: error: invalid argument: $ac_config_target" >&5
+ echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+diff -u -r -N original/xmlrpc-epi-0.51/expat/.cvsignore dump_expat/xmlrpc-epi-0.51/expat/.cvsignore
+--- original/xmlrpc-epi-0.51/expat/.cvsignore 2001-03-19 21:28:32.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/.cvsignore 1969-12-31 18:00:00.000000000 -0600
+@@ -1 +0,0 @@
+-Makefile
+diff -u -r -N original/xmlrpc-epi-0.51/expat/Makefile.am dump_expat/xmlrpc-epi-0.51/expat/Makefile.am
+--- original/xmlrpc-epi-0.51/expat/Makefile.am 2001-03-19 21:28:32.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/Makefile.am 1969-12-31 18:00:00.000000000 -0600
+@@ -1,2 +0,0 @@
+-SUBDIRS = xmltok xmlparse
+-
+diff -u -r -N original/xmlrpc-epi-0.51/expat/Makefile.in dump_expat/xmlrpc-epi-0.51/expat/Makefile.in
+--- original/xmlrpc-epi-0.51/expat/Makefile.in 2002-06-23 18:48:29.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/expat/Makefile.in 1969-12-31 18:00:00.000000000 -0600
+@@ -1,291 +0,0 @@
+-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+-
+-# Copyright (C) 1994, 1995-8, 1999, 2001 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.
+-
+-
+-SHELL = @SHELL@
+-
+-srcdir = @srcdir@
+-top_srcdir = @top_srcdir@
+-VPATH = @srcdir@
+-prefix = @prefix@
+-exec_prefix = @exec_prefix@
+-
+-bindir = @bindir@
+-sbindir = @sbindir@
+-libexecdir = @libexecdir@
+-datadir = @datadir@
+-sysconfdir = @sysconfdir@
+-sharedstatedir = @sharedstatedir@
+-localstatedir = @localstatedir@
+-libdir = @libdir@
+-infodir = @infodir@
+-mandir = @mandir@
+-includedir = @includedir@
+-oldincludedir = /usr/include
+-
+-DESTDIR =
+-
+-pkgdatadir = $(datadir)/@PACKAGE@
+-pkglibdir = $(libdir)/@PACKAGE@
+-pkgincludedir = $(includedir)/@PACKAGE@
+-
+-top_builddir = ..
+-
+-ACLOCAL = @ACLOCAL@
+-AUTOCONF = @AUTOCONF@
+-AUTOMAKE = @AUTOMAKE@
+-AUTOHEADER = @AUTOHEADER@
+-
+-INSTALL = @INSTALL@
+-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+-INSTALL_DATA = @INSTALL_DATA@
+-INSTALL_SCRIPT = @INSTALL_SCRIPT@
+-transform = @program_transform_name@
+-
+-NORMAL_INSTALL = :
+-PRE_INSTALL = :
+-POST_INSTALL = :
+-NORMAL_UNINSTALL = :
+-PRE_UNINSTALL = :
+-POST_UNINSTALL = :
+-host_alias = @host_alias@
+-host_triplet = @host@
+-AS = @AS@
+-AWK = @AWK@
+-CC = @CC@
+-CPP = @CPP@
+-CXX = @CXX@
+-DLLTOOL = @DLLTOOL@
+-ECHO = @ECHO@
+-EXEEXT = @EXEEXT@
+-LIBTOOL = @LIBTOOL@
+-LN_S = @LN_S@
+-MAKEINFO = @MAKEINFO@
+-OBJDUMP = @OBJDUMP@
+-OBJEXT = @OBJEXT@
+-PACKAGE = @PACKAGE@
+-RANLIB = @RANLIB@
+-STRIP = @STRIP@
+-VERSION = @VERSION@
+-
+-SUBDIRS = xmltok xmlparse
+-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+-CONFIG_CLEAN_FILES =
+-DIST_COMMON = Makefile.am Makefile.in
+-
+-
+-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+-
+-TAR = gtar
+-GZIP_ENV = --best
+-all: all-redirect
+-.SUFFIXES:
+-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+- cd $(top_srcdir) && $(AUTOMAKE) --gnu expat/Makefile
+-
+-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+- cd $(top_builddir) \
+- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+-
+-
+-# This directory's subdirectories are mostly independent; you can cd
+-# into them and run `make' without going through this Makefile.
+-# To change the values of `make' variables: instead of editing Makefiles,
+-# (1) if the variable is set in `config.status', edit `config.status'
+-# (which will cause the Makefiles to be regenerated when you run `make');
+-# (2) otherwise, pass the desired values on the `make' command line.
+-
+-@SET_MAKE@
+-
+-all-recursive install-data-recursive install-exec-recursive \
+-installdirs-recursive install-recursive uninstall-recursive \
+-check-recursive installcheck-recursive info-recursive dvi-recursive:
+- @set fnord $(MAKEFLAGS); amf=$$2; \
+- dot_seen=no; \
+- target=`echo $@ | sed s/-recursive//`; \
+- list='$(SUBDIRS)'; for subdir in $$list; do \
+- echo "Making $$target in $$subdir"; \
+- if test "$$subdir" = "."; then \
+- dot_seen=yes; \
+- local_target="$$target-am"; \
+- else \
+- local_target="$$target"; \
+- fi; \
+- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+- done; \
+- if test "$$dot_seen" = "no"; then \
+- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+- fi; test -z "$$fail"
+-
+-mostlyclean-recursive clean-recursive distclean-recursive \
+-maintainer-clean-recursive:
+- @set fnord $(MAKEFLAGS); amf=$$2; \
+- dot_seen=no; \
+- rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+- rev="$$subdir $$rev"; \
+- test "$$subdir" != "." || dot_seen=yes; \
+- done; \
+- test "$$dot_seen" = "no" && rev=". $$rev"; \
+- target=`echo $@ | sed s/-recursive//`; \
+- for subdir in $$rev; do \
+- echo "Making $$target in $$subdir"; \
+- if test "$$subdir" = "."; then \
+- local_target="$$target-am"; \
+- else \
+- local_target="$$target"; \
+- fi; \
+- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+- done && test -z "$$fail"
+-tags-recursive:
+- list='$(SUBDIRS)'; for subdir in $$list; do \
+- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+- done
+-
+-tags: TAGS
+-
+-ID: $(HEADERS) $(SOURCES) $(LISP)
+- list='$(SOURCES) $(HEADERS)'; \
+- unique=`for i in $$list; do echo $$i; done | \
+- awk ' { files[$$0] = 1; } \
+- END { for (i in files) print i; }'`; \
+- here=`pwd` && cd $(srcdir) \
+- && mkid -f$$here/ID $$unique $(LISP)
+-
+-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+- tags=; \
+- here=`pwd`; \
+- list='$(SUBDIRS)'; for subdir in $$list; do \
+- if test "$$subdir" = .; then :; else \
+- test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+- fi; \
+- done; \
+- list='$(SOURCES) $(HEADERS)'; \
+- unique=`for i in $$list; do echo $$i; done | \
+- awk ' { files[$$0] = 1; } \
+- END { for (i in files) print i; }'`; \
+- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+-
+-mostlyclean-tags:
+-
+-clean-tags:
+-
+-distclean-tags:
+- -rm -f TAGS ID
+-
+-maintainer-clean-tags:
+-
+-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+-
+-subdir = expat
+-
+-distdir: $(DISTFILES)
+- here=`cd $(top_builddir) && pwd`; \
+- top_distdir=`cd $(top_distdir) && pwd`; \
+- distdir=`cd $(distdir) && pwd`; \
+- cd $(top_srcdir) \
+- && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu expat/Makefile
+- @for file in $(DISTFILES); do \
+- d=$(srcdir); \
+- if test -d $$d/$$file; then \
+- cp -pr $$d/$$file $(distdir)/$$file; \
+- else \
+- test -f $(distdir)/$$file \
+- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+- || cp -p $$d/$$file $(distdir)/$$file || :; \
+- fi; \
+- done
+- for subdir in $(SUBDIRS); do \
+- if test "$$subdir" = .; then :; else \
+- test -d $(distdir)/$$subdir \
+- || mkdir $(distdir)/$$subdir \
+- || exit 1; \
+- chmod 777 $(distdir)/$$subdir; \
+- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
+- || exit 1; \
+- fi; \
+- done
+-info-am:
+-info: info-recursive
+-dvi-am:
+-dvi: dvi-recursive
+-check-am: all-am
+-check: check-recursive
+-installcheck-am:
+-installcheck: installcheck-recursive
+-install-exec-am:
+-install-exec: install-exec-recursive
+-
+-install-data-am:
+-install-data: install-data-recursive
+-
+-install-am: all-am
+- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+-install: install-recursive
+-uninstall-am:
+-uninstall: uninstall-recursive
+-all-am: Makefile
+-all-redirect: all-recursive
+-install-strip:
+- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+-installdirs: installdirs-recursive
+-installdirs-am:
+-
+-
+-mostlyclean-generic:
+-
+-clean-generic:
+-
+-distclean-generic:
+- -rm -f Makefile $(CONFIG_CLEAN_FILES)
+- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+-
+-maintainer-clean-generic:
+-mostlyclean-am: mostlyclean-tags mostlyclean-generic
+-
+-mostlyclean: mostlyclean-recursive
+-
+-clean-am: clean-tags clean-generic mostlyclean-am
+-
+-clean: clean-recursive
+-
+-distclean-am: distclean-tags distclean-generic clean-am
+- -rm -f libtool
+-
+-distclean: distclean-recursive
+-
+-maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
+- distclean-am
+- @echo "This command is intended for maintainers to use;"
+- @echo "it deletes files that may require special tools to rebuild."
+-
+-maintainer-clean: maintainer-clean-recursive
+-
+-.PHONY: install-data-recursive uninstall-data-recursive \
+-install-exec-recursive uninstall-exec-recursive installdirs-recursive \
+-uninstalldirs-recursive all-recursive check-recursive \
+-installcheck-recursive info-recursive dvi-recursive \
+-mostlyclean-recursive distclean-recursive clean-recursive \
+-maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+-install-exec install-data-am install-data install-am install \
+-uninstall-am uninstall all-redirect all-am all installdirs-am \
+-installdirs mostlyclean-generic distclean-generic clean-generic \
+-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+-
+-
+-# 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:
+Binary files original/xmlrpc-epi-0.51/expat/bin/xmlparse.dll and dump_expat/xmlrpc-epi-0.51/expat/bin/xmlparse.dll differ
+Binary files original/xmlrpc-epi-0.51/expat/bin/xmltok.dll and dump_expat/xmlrpc-epi-0.51/expat/bin/xmltok.dll differ
+diff -u -r -N original/xmlrpc-epi-0.51/expat/expat.dsw dump_expat/xmlrpc-epi-0.51/expat/expat.dsw
+--- original/xmlrpc-epi-0.51/expat/expat.dsw 2001-03-19 21:28:32.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/expat.dsw 1969-12-31 18:00:00.000000000 -0600
+@@ -1,71 +0,0 @@
+-Microsoft Developer Studio Workspace File, Format Version 6.00
+-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+-
+-###############################################################################
+-
+-Project: "gennmtab"=".\gennmtab\gennmtab.dsp" - Package Owner=<4>
+-
+-Package=<5>
+-{{{
+-}}}
+-
+-Package=<4>
+-{{{
+-}}}
+-
+-###############################################################################
+-
+-Project: "xmlparse"=".\xmlparse\xmlparse.dsp" - Package Owner=<4>
+-
+-Package=<5>
+-{{{
+-}}}
+-
+-Package=<4>
+-{{{
+- Begin Project Dependency
+- Project_Dep_Name xmltok
+- End Project Dependency
+-}}}
+-
+-###############################################################################
+-
+-Project: "xmltok"=".\xmltok\xmltok.dsp" - Package Owner=<4>
+-
+-Package=<5>
+-{{{
+-}}}
+-
+-Package=<4>
+-{{{
+-}}}
+-
+-###############################################################################
+-
+-Project: "xmlwf"=".\xmlwf\xmlwf.dsp" - Package Owner=<4>
+-
+-Package=<5>
+-{{{
+-}}}
+-
+-Package=<4>
+-{{{
+- Begin Project Dependency
+- Project_Dep_Name xmlparse
+- End Project Dependency
+-}}}
+-
+-###############################################################################
+-
+-Global:
+-
+-Package=<5>
+-{{{
+-}}}
+-
+-Package=<3>
+-{{{
+-}}}
+-
+-###############################################################################
+-
+diff -u -r -N original/xmlrpc-epi-0.51/expat/expat.html dump_expat/xmlrpc-epi-0.51/expat/expat.html
+--- original/xmlrpc-epi-0.51/expat/expat.html 2001-03-19 21:28:32.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/expat.html 1969-12-31 18:00:00.000000000 -0600
+@@ -1,73 +0,0 @@
+-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+-"http://www.w3.org/TR/REC-html40/loose.dtd">
+-
+-<HTML>
+-
+-<TITLE>expat</TITLE>
+-
+-<BODY>
+-
+-<H1>expat - XML Parser Toolkit</H1>
+-
+-<H3>Version 1.1</H3>
+-
+-<P>Copyright (c) 1998, 1999 James Clark. Expat is subject to the <A
+-HREF="http://www.mozilla.org/NPL/NPL-1_1Final.html">Mozilla Public
+-License Version 1.1</A>. Alternatively you may use expat under the <A
+-href="http://www.gnu.org/copyleft/gpl.html">GNU General Public
+-License</A> instead. Please contact me if you wish to negotiate an
+-alternative license.</P>
+-
+-<P>Expat is an <A
+-HREF="http://www.w3.org/TR/1998/REC-xml-19980210">XML 1.0</A> parser
+-written in C. It aims to be fully conforming. It is currently not a
+-validating XML processor. The current production version of expat can
+-be downloaded from <A href = "ftp://ftp.jclark.com/pub/xml/expat.zip"
+->ftp://ftp.jclark.com/pub/xml/expat.zip</A>.</P>
+-
+-<P>The directory <SAMP>xmltok</SAMP> contains a low-level library for
+-tokenizing XML. The interface is documented in
+-<SAMP>xmltok/xmltok.h</SAMP>.</P>
+-
+-<P>The directory <SAMP>xmlparse</SAMP> contains an XML parser library
+-which is built on top of the <SAMP>xmltok</SAMP> library. The
+-interface is documented in <SAMP>xmlparse/xmlparse.h</SAMP>. The
+-directory <SAMP>sample</SAMP> contains a simple example program using
+-this interface; <SAMP>sample/build.bat</SAMP> is a batch file to build
+-the example using Visual C++.</P>
+-
+-<P>The directory <SAMP>xmlwf</SAMP> contains the <SAMP>xmlwf</SAMP>
+-application, which uses the <SAMP>xmlparse</SAMP> library. The
+-arguments to <SAMP>xmlwf</SAMP> are one or more files which are each
+-to be checked for well-formedness. An option <SAMP>-d
+-<VAR>dir</VAR></SAMP> can be specified; for each well-formed input
+-file the corresponding <A
+-href="http://www.jclark.com/xml/canonxml.html">canonical XML</A> will
+-be written to <SAMP>dir/<VAR>f</VAR></SAMP>, where
+-<SAMP><VAR>f</VAR></SAMP> is the filename (without any path) of the
+-input file. A <CODE>-x</CODE> option will cause references to
+-external general entities to be processed. A <CODE>-s</CODE> option
+-will make documents that are not standalone cause an error (a document
+-is considered standalone if either it is intrinsically standalone
+-because it has no external subset and no references to parameter
+-entities in the internal subset or it is declared as standalone in the
+-XML declaration).</P>
+-
+-<P>The <SAMP>bin</SAMP> directory contains Win32 executables. The
+-<SAMP>lib</SAMP> directory contains Win32 import libraries.</P>
+-
+-<P>Answers to some frequently asked questions about expat can be found
+-in the <A HREF="http://www.jclark.com/xml/expatfaq.html">expat
+-FAQ</A>.</P>
+-
+-<P></P>
+-
+-<ADDRESS>
+-
+-<A HREF="mailto:jjc@jclark.com">James Clark</A>
+-
+-</ADDRESS>
+-
+-</BODY>
+-
+-</HTML>
+diff -u -r -N original/xmlrpc-epi-0.51/expat/expat.mak dump_expat/xmlrpc-epi-0.51/expat/expat.mak
+--- original/xmlrpc-epi-0.51/expat/expat.mak 2001-03-19 21:28:32.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/expat.mak 1969-12-31 18:00:00.000000000 -0600
+@@ -1,1071 +0,0 @@
+-# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
+-# ** DO NOT EDIT **
+-
+-# TARGTYPE "Win32 (x86) Console Application" 0x0103
+-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+-
+-!IF "$(CFG)" == ""
+-CFG=xmltok - Win32 Debug
+-!MESSAGE No configuration specified. Defaulting to xmltok - Win32 Debug.
+-!ENDIF
+-
+-!IF "$(CFG)" != "xmlwf - Win32 Release" && "$(CFG)" != "xmlwf - Win32 Debug" &&\
+- "$(CFG)" != "gennmtab - Win32 Release" && "$(CFG)" != "gennmtab - Win32 Debug"\
+- && "$(CFG)" != "xmlparse - Win32 Release" && "$(CFG)" !=\
+- "xmlparse - Win32 Debug" && "$(CFG)" != "xmltok - Win32 Release" && "$(CFG)" !=\
+- "xmltok - Win32 Debug"
+-!MESSAGE Invalid configuration "$(CFG)" specified.
+-!MESSAGE You can specify a configuration when running NMAKE on this makefile
+-!MESSAGE by defining the macro CFG on the command line. For example:
+-!MESSAGE
+-!MESSAGE NMAKE /f "expat.mak" CFG="xmltok - Win32 Debug"
+-!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 "gennmtab - Win32 Release" (based on\
+- "Win32 (x86) Console Application")
+-!MESSAGE "gennmtab - Win32 Debug" (based on "Win32 (x86) Console Application")
+-!MESSAGE "xmlparse - Win32 Release" (based on\
+- "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE "xmlparse - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE "xmltok - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE "xmltok - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE
+-!ERROR An invalid configuration is specified.
+-!ENDIF
+-
+-!IF "$(OS)" == "Windows_NT"
+-NULL=
+-!ELSE
+-NULL=nul
+-!ENDIF
+-################################################################################
+-# Begin Project
+-# PROP Target_Last_Scanned "xmltok - Win32 Debug"
+-
+-!IF "$(CFG)" == "xmlwf - Win32 Release"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 0
+-# PROP BASE Output_Dir "xmlwf\Release"
+-# PROP BASE Intermediate_Dir "xmlwf\Release"
+-# PROP BASE Target_Dir "xmlwf"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 0
+-# PROP Output_Dir "xmlwf\Release"
+-# PROP Intermediate_Dir "xmlwf\Release"
+-# PROP Target_Dir "xmlwf"
+-OUTDIR=.\xmlwf\Release
+-INTDIR=.\xmlwf\Release
+-
+-ALL : "xmlparse - Win32 Release" ".\bin\xmlwf.exe"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\codepage.obj"
+- -@erase "$(INTDIR)\win32filemap.obj"
+- -@erase "$(INTDIR)\xmlwf.obj"
+- -@erase ".\bin\xmlwf.exe"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+-# ADD CPP /nologo /W3 /GX /O2 /I "." /I "xmlparse" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
+-CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "." /I "xmlparse" /D "NDEBUG" /D "WIN32" /D\
+- "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D\
+- XMLPARSEAPI=__declspec(dllimport) /Fp"$(INTDIR)/xmlwf.pch" /YX /Fo"$(INTDIR)/"\
+- /c
+-CPP_OBJS=.\xmlwf\Release/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlwf.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+-# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"bin/xmlwf.exe"
+-LINK32_FLAGS=setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib\
+- comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
+- odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\
+- /pdb:"$(OUTDIR)/xmlwf.pdb" /machine:I386 /out:"bin/xmlwf.exe"
+-LINK32_OBJS= \
+- "$(INTDIR)\codepage.obj" \
+- "$(INTDIR)\win32filemap.obj" \
+- "$(INTDIR)\xmlwf.obj" \
+- ".\xmlparse\Release\xmlparse.lib"
+-
+-".\bin\xmlwf.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 1
+-# PROP BASE Output_Dir "xmlwf\Debug"
+-# PROP BASE Intermediate_Dir "xmlwf\Debug"
+-# PROP BASE Target_Dir "xmlwf"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 1
+-# PROP Output_Dir "xmlwf\Debug"
+-# PROP Intermediate_Dir "xmlwf\Debug"
+-# PROP Target_Dir "xmlwf"
+-OUTDIR=.\xmlwf\Debug
+-INTDIR=.\xmlwf\Debug
+-
+-ALL : "xmlparse - Win32 Debug" ".\dbgbin\xmlwf.exe"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\codepage.obj"
+- -@erase "$(INTDIR)\vc40.idb"
+- -@erase "$(INTDIR)\vc40.pdb"
+- -@erase "$(INTDIR)\win32filemap.obj"
+- -@erase "$(INTDIR)\xmlwf.obj"
+- -@erase "$(OUTDIR)\xmlwf.pdb"
+- -@erase ".\dbgbin\xmlwf.exe"
+- -@erase ".\dbgbin\xmlwf.ilk"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "xmlparse" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
+-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "xmlparse" /D "_DEBUG" /D\
+- "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D\
+- XMLPARSEAPI=__declspec(dllimport) /Fp"$(INTDIR)/xmlwf.pch" /YX /Fo"$(INTDIR)/"\
+- /Fd"$(INTDIR)/" /c
+-CPP_OBJS=.\xmlwf\Debug/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlwf.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+-# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
+-LINK32_FLAGS=setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib\
+- comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
+- odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes\
+- /pdb:"$(OUTDIR)/xmlwf.pdb" /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
+-LINK32_OBJS= \
+- "$(INTDIR)\codepage.obj" \
+- "$(INTDIR)\win32filemap.obj" \
+- "$(INTDIR)\xmlwf.obj" \
+- ".\xmlparse\Debug\xmlparse.lib"
+-
+-".\dbgbin\xmlwf.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ELSEIF "$(CFG)" == "gennmtab - Win32 Release"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 0
+-# PROP BASE Output_Dir "gennmtab\Release"
+-# PROP BASE Intermediate_Dir "gennmtab\Release"
+-# PROP BASE Target_Dir "gennmtab"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 0
+-# PROP Output_Dir "gennmtab\Release"
+-# PROP Intermediate_Dir "gennmtab\Release"
+-# PROP Target_Dir "gennmtab"
+-OUTDIR=.\gennmtab\Release
+-INTDIR=.\gennmtab\Release
+-
+-ALL : "$(OUTDIR)\gennmtab.exe"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\gennmtab.obj"
+- -@erase "$(OUTDIR)\gennmtab.exe"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+-CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
+- /Fp"$(INTDIR)/gennmtab.pch" /YX /Fo"$(INTDIR)/" /c
+-CPP_OBJS=.\gennmtab\Release/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/gennmtab.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+- odbccp32.lib /nologo /subsystem:console /incremental:no\
+- /pdb:"$(OUTDIR)/gennmtab.pdb" /machine:I386 /out:"$(OUTDIR)/gennmtab.exe"
+-LINK32_OBJS= \
+- "$(INTDIR)\gennmtab.obj"
+-
+-"$(OUTDIR)\gennmtab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ELSEIF "$(CFG)" == "gennmtab - Win32 Debug"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 1
+-# PROP BASE Output_Dir "gennmtab\Debug"
+-# PROP BASE Intermediate_Dir "gennmtab\Debug"
+-# PROP BASE Target_Dir "gennmtab"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 1
+-# PROP Output_Dir "gennmtab\Debug"
+-# PROP Intermediate_Dir "gennmtab\Debug"
+-# PROP Target_Dir "gennmtab"
+-OUTDIR=.\gennmtab\Debug
+-INTDIR=.\gennmtab\Debug
+-
+-ALL : "$(OUTDIR)\gennmtab.exe"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\gennmtab.obj"
+- -@erase "$(INTDIR)\vc40.idb"
+- -@erase "$(INTDIR)\vc40.pdb"
+- -@erase "$(OUTDIR)\gennmtab.exe"
+- -@erase "$(OUTDIR)\gennmtab.ilk"
+- -@erase "$(OUTDIR)\gennmtab.pdb"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+-# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+-CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"\
+- /Fp"$(INTDIR)/gennmtab.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
+-CPP_OBJS=.\gennmtab\Debug/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/gennmtab.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+- odbccp32.lib /nologo /subsystem:console /incremental:yes\
+- /pdb:"$(OUTDIR)/gennmtab.pdb" /debug /machine:I386\
+- /out:"$(OUTDIR)/gennmtab.exe"
+-LINK32_OBJS= \
+- "$(INTDIR)\gennmtab.obj"
+-
+-"$(OUTDIR)\gennmtab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 0
+-# PROP BASE Output_Dir "xmlparse\Release"
+-# PROP BASE Intermediate_Dir "xmlparse\Release"
+-# PROP BASE Target_Dir "xmlparse"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 0
+-# PROP Output_Dir "xmlparse\Release"
+-# PROP Intermediate_Dir "xmlparse\Release"
+-# PROP Target_Dir "xmlparse"
+-OUTDIR=.\xmlparse\Release
+-INTDIR=.\xmlparse\Release
+-
+-ALL : "xmltok - Win32 Release" ".\bin\xmlparse.dll"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\hashtable.obj"
+- -@erase "$(INTDIR)\xmlparse.obj"
+- -@erase "$(OUTDIR)\xmlparse.exp"
+- -@erase "$(OUTDIR)\xmlparse.lib"
+- -@erase ".\bin\xmlparse.dll"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /W3 /GX /O2 /I "xmltok" /I "xmlwf" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
+-CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "xmltok" /I "xmlwf" /D "NDEBUG" /D "WIN32"\
+- /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D\
+- XMLPARSEAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmlparse.pch" /YX\
+- /Fo"$(INTDIR)/" /c
+-CPP_OBJS=.\xmlparse\Release/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-MTL=mktyplib.exe
+-# ADD BASE MTL /nologo /D "NDEBUG" /win32
+-# ADD MTL /nologo /D "NDEBUG" /win32
+-MTL_PROJ=/nologo /D "NDEBUG" /win32
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlparse.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:0x20000000 /subsystem:windows /dll /machine:I386 /out:"bin/xmlparse.dll"
+-# SUBTRACT LINK32 /profile
+-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+- odbccp32.lib /nologo /base:0x20000000 /subsystem:windows /dll /incremental:no\
+- /pdb:"$(OUTDIR)/xmlparse.pdb" /machine:I386 /out:"bin/xmlparse.dll"\
+- /implib:"$(OUTDIR)/xmlparse.lib"
+-LINK32_OBJS= \
+- "$(INTDIR)\hashtable.obj" \
+- "$(INTDIR)\xmlparse.obj" \
+- ".\xmltok\Release\xmltok.lib"
+-
+-".\bin\xmlparse.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 1
+-# PROP BASE Output_Dir "xmlparse\Debug"
+-# PROP BASE Intermediate_Dir "xmlparse\Debug"
+-# PROP BASE Target_Dir "xmlparse"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 1
+-# PROP Output_Dir "xmlparse\Debug"
+-# PROP Intermediate_Dir "xmlparse\Debug"
+-# PROP Target_Dir "xmlparse"
+-OUTDIR=.\xmlparse\Debug
+-INTDIR=.\xmlparse\Debug
+-
+-ALL : "xmltok - Win32 Debug" ".\dbgbin\xmlparse.dll"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\hashtable.obj"
+- -@erase "$(INTDIR)\vc40.idb"
+- -@erase "$(INTDIR)\vc40.pdb"
+- -@erase "$(INTDIR)\xmlparse.obj"
+- -@erase "$(OUTDIR)\xmlparse.exp"
+- -@erase "$(OUTDIR)\xmlparse.lib"
+- -@erase "$(OUTDIR)\xmlparse.pdb"
+- -@erase ".\dbgbin\xmlparse.dll"
+- -@erase ".\dbgbin\xmlparse.ilk"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "xmltok" /I "xmlwf" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
+-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "xmltok" /I "xmlwf" /D "_DEBUG" /D\
+- "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D\
+- XMLPARSEAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmlparse.pch" /YX\
+- /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
+-CPP_OBJS=.\xmlparse\Debug/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-MTL=mktyplib.exe
+-# ADD BASE MTL /nologo /D "_DEBUG" /win32
+-# ADD MTL /nologo /D "_DEBUG" /win32
+-MTL_PROJ=/nologo /D "_DEBUG" /win32
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlparse.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:0x20000000 /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmlparse.dll"
+-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+- odbccp32.lib /nologo /base:0x20000000 /subsystem:windows /dll /incremental:yes\
+- /pdb:"$(OUTDIR)/xmlparse.pdb" /debug /machine:I386 /out:"dbgbin/xmlparse.dll"\
+- /implib:"$(OUTDIR)/xmlparse.lib"
+-LINK32_OBJS= \
+- "$(INTDIR)\hashtable.obj" \
+- "$(INTDIR)\xmlparse.obj" \
+- ".\xmltok\Debug\xmltok.lib"
+-
+-".\dbgbin\xmlparse.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ELSEIF "$(CFG)" == "xmltok - Win32 Release"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 0
+-# PROP BASE Output_Dir "xmltok\Release"
+-# PROP BASE Intermediate_Dir "xmltok\Release"
+-# PROP BASE Target_Dir "xmltok"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 0
+-# PROP Output_Dir "xmltok\Release"
+-# PROP Intermediate_Dir "xmltok\Release"
+-# PROP Target_Dir "xmltok"
+-OUTDIR=.\xmltok\Release
+-INTDIR=.\xmltok\Release
+-
+-ALL : ".\bin\xmltok.dll"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\dllmain.obj"
+- -@erase "$(INTDIR)\xmlrole.obj"
+- -@erase "$(INTDIR)\xmltok.obj"
+- -@erase "$(OUTDIR)\xmltok.exp"
+- -@erase "$(OUTDIR)\xmltok.lib"
+- -@erase ".\bin\xmltok.dll"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
+-CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
+- XMLTOKAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmltok.pch" /YX /Fo"$(INTDIR)/"\
+- /c
+-CPP_OBJS=.\xmltok\Release/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-MTL=mktyplib.exe
+-# ADD BASE MTL /nologo /D "NDEBUG" /win32
+-# ADD MTL /nologo /D "NDEBUG" /win32
+-MTL_PROJ=/nologo /D "NDEBUG" /win32
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmltok.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"bin/xmltok.dll"
+-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+- odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /incremental:no\
+- /pdb:"$(OUTDIR)/xmltok.pdb" /machine:I386 /out:"bin/xmltok.dll"\
+- /implib:"$(OUTDIR)/xmltok.lib"
+-LINK32_OBJS= \
+- "$(INTDIR)\dllmain.obj" \
+- "$(INTDIR)\xmlrole.obj" \
+- "$(INTDIR)\xmltok.obj"
+-
+-".\bin\xmltok.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 1
+-# PROP BASE Output_Dir "xmltok\Debug"
+-# PROP BASE Intermediate_Dir "xmltok\Debug"
+-# PROP BASE Target_Dir "xmltok"
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 1
+-# PROP Output_Dir "xmltok\Debug"
+-# PROP Intermediate_Dir "xmltok\Debug"
+-# PROP Target_Dir "xmltok"
+-OUTDIR=.\xmltok\Debug
+-INTDIR=.\xmltok\Debug
+-
+-ALL : ".\dbgbin\xmltok.dll"
+-
+-CLEAN :
+- -@erase "$(INTDIR)\dllmain.obj"
+- -@erase "$(INTDIR)\vc40.idb"
+- -@erase "$(INTDIR)\vc40.pdb"
+- -@erase "$(INTDIR)\xmlrole.obj"
+- -@erase "$(INTDIR)\xmltok.obj"
+- -@erase "$(OUTDIR)\xmltok.exp"
+- -@erase "$(OUTDIR)\xmltok.lib"
+- -@erase "$(OUTDIR)\xmltok.pdb"
+- -@erase ".\dbgbin\xmltok.dll"
+- -@erase ".\dbgbin\xmltok.ilk"
+-
+-"$(OUTDIR)" :
+- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+-
+-CPP=cl.exe
+-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
+-CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\
+- /D XMLTOKAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmltok.pch" /YX\
+- /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
+-CPP_OBJS=.\xmltok\Debug/
+-CPP_SBRS=.\.
+-
+-.c{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_OBJS)}.obj:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.c{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cpp{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-.cxx{$(CPP_SBRS)}.sbr:
+- $(CPP) $(CPP_PROJ) $<
+-
+-MTL=mktyplib.exe
+-# ADD BASE MTL /nologo /D "_DEBUG" /win32
+-# ADD MTL /nologo /D "_DEBUG" /win32
+-MTL_PROJ=/nologo /D "_DEBUG" /win32
+-RSC=rc.exe
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmltok.bsc"
+-BSC32_SBRS= \
+-
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmltok.dll"
+-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+- odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\
+- /pdb:"$(OUTDIR)/xmltok.pdb" /debug /machine:I386 /out:"dbgbin/xmltok.dll"\
+- /implib:"$(OUTDIR)/xmltok.lib"
+-LINK32_OBJS= \
+- "$(INTDIR)\dllmain.obj" \
+- "$(INTDIR)\xmlrole.obj" \
+- "$(INTDIR)\xmltok.obj"
+-
+-".\dbgbin\xmltok.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+- $(LINK32) @<<
+- $(LINK32_FLAGS) $(LINK32_OBJS)
+-<<
+-
+-!ENDIF
+-
+-################################################################################
+-# Begin Target
+-
+-# Name "xmlwf - Win32 Release"
+-# Name "xmlwf - Win32 Debug"
+-
+-!IF "$(CFG)" == "xmlwf - Win32 Release"
+-
+-!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug"
+-
+-!ENDIF
+-
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmlwf\xmlwf.c
+-DEP_CPP_XMLWF=\
+- ".\xmlparse\xmlparse.h"\
+- ".\xmlwf\codepage.h"\
+- ".\xmlwf\filemap.h"\
+-
+-
+-"$(INTDIR)\xmlwf.obj" : $(SOURCE) $(DEP_CPP_XMLWF) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-# End Source File
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmlwf\win32filemap.c
+-DEP_CPP_WIN32=\
+- ".\xmlwf\filemap.h"\
+-
+-
+-"$(INTDIR)\win32filemap.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-# End Source File
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmlwf\unixfilemap.c
+-DEP_CPP_UNIXF=\
+- ".\xmlwf\filemap.h"\
+- {$(INCLUDE)}"\sys\stat.h"\
+- {$(INCLUDE)}"\sys\TYPES.H"\
+-
+-# PROP Exclude_From_Build 1
+-# End Source File
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmlwf\readfilemap.c
+-DEP_CPP_READF=\
+- {$(INCLUDE)}"\sys\stat.h"\
+- {$(INCLUDE)}"\sys\TYPES.H"\
+-
+-# PROP Exclude_From_Build 1
+-# End Source File
+-################################################################################
+-# Begin Project Dependency
+-
+-# Project_Dep_Name "xmlparse"
+-
+-!IF "$(CFG)" == "xmlwf - Win32 Release"
+-
+-"xmlparse - Win32 Release" :
+- $(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmlparse - Win32 Release"
+-
+-!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug"
+-
+-"xmlparse - Win32 Debug" :
+- $(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmlparse - Win32 Debug"
+-
+-!ENDIF
+-
+-# End Project Dependency
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmlwf\codepage.c
+-DEP_CPP_CODEP=\
+- ".\xmlwf\codepage.h"\
+-
+-
+-"$(INTDIR)\codepage.obj" : $(SOURCE) $(DEP_CPP_CODEP) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-# End Source File
+-# End Target
+-################################################################################
+-# Begin Target
+-
+-# Name "gennmtab - Win32 Release"
+-# Name "gennmtab - Win32 Debug"
+-
+-!IF "$(CFG)" == "gennmtab - Win32 Release"
+-
+-!ELSEIF "$(CFG)" == "gennmtab - Win32 Debug"
+-
+-!ENDIF
+-
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\gennmtab\gennmtab.c
+-
+-"$(INTDIR)\gennmtab.obj" : $(SOURCE) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-# End Source File
+-# End Target
+-################################################################################
+-# Begin Target
+-
+-# Name "xmlparse - Win32 Release"
+-# Name "xmlparse - Win32 Debug"
+-
+-!IF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-!ENDIF
+-
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmlparse\xmlparse.c
+-
+-!IF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-DEP_CPP_XMLPA=\
+- ".\xmlparse\hashtable.h"\
+- ".\xmlparse\xmlparse.h"\
+- ".\xmltok\xmldef.h"\
+- ".\xmltok\xmlrole.h"\
+- ".\xmltok\xmltok.h"\
+-
+-NODEP_CPP_XMLPA=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\xmlparse.obj" : $(SOURCE) $(DEP_CPP_XMLPA) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-DEP_CPP_XMLPA=\
+- ".\xmlparse\hashtable.h"\
+- ".\xmlparse\xmlparse.h"\
+- ".\xmltok\xmldef.h"\
+- ".\xmltok\xmlrole.h"\
+- ".\xmltok\xmltok.h"\
+-
+-NODEP_CPP_XMLPA=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\xmlparse.obj" : $(SOURCE) $(DEP_CPP_XMLPA) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ENDIF
+-
+-# End Source File
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmlparse\hashtable.c
+-
+-!IF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-DEP_CPP_HASHT=\
+- ".\xmlparse\hashtable.h"\
+- ".\xmltok\xmldef.h"\
+-
+-NODEP_CPP_HASHT=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\hashtable.obj" : $(SOURCE) $(DEP_CPP_HASHT) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-DEP_CPP_HASHT=\
+- ".\xmlparse\hashtable.h"\
+- ".\xmltok\xmldef.h"\
+-
+-NODEP_CPP_HASHT=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\hashtable.obj" : $(SOURCE) $(DEP_CPP_HASHT) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ENDIF
+-
+-# End Source File
+-################################################################################
+-# Begin Project Dependency
+-
+-# Project_Dep_Name "xmltok"
+-
+-!IF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-"xmltok - Win32 Release" :
+- $(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmltok - Win32 Release"
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-"xmltok - Win32 Debug" :
+- $(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmltok - Win32 Debug"
+-
+-!ENDIF
+-
+-# End Project Dependency
+-# End Target
+-################################################################################
+-# Begin Target
+-
+-# Name "xmltok - Win32 Release"
+-# Name "xmltok - Win32 Debug"
+-
+-!IF "$(CFG)" == "xmltok - Win32 Release"
+-
+-!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
+-
+-!ENDIF
+-
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmltok\xmlrole.c
+-
+-!IF "$(CFG)" == "xmltok - Win32 Release"
+-
+-DEP_CPP_XMLRO=\
+- ".\xmltok\xmldef.h"\
+- ".\xmltok\xmlrole.h"\
+- ".\xmltok\xmltok.h"\
+-
+-NODEP_CPP_XMLRO=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\xmlrole.obj" : $(SOURCE) $(DEP_CPP_XMLRO) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
+-
+-DEP_CPP_XMLRO=\
+- ".\xmltok\xmldef.h"\
+- ".\xmltok\xmlrole.h"\
+- ".\xmltok\xmltok.h"\
+-
+-NODEP_CPP_XMLRO=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\xmlrole.obj" : $(SOURCE) $(DEP_CPP_XMLRO) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ENDIF
+-
+-# End Source File
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmltok\xmltok.c
+-
+-!IF "$(CFG)" == "xmltok - Win32 Release"
+-
+-DEP_CPP_XMLTO=\
+- ".\xmltok\asciitab.h"\
+- ".\xmltok\iasciitab.h"\
+- ".\xmltok\latin1tab.h"\
+- ".\xmltok\nametab.h"\
+- ".\xmltok\utf8tab.h"\
+- ".\xmltok\xmldef.h"\
+- ".\xmltok\xmltok.h"\
+- ".\xmltok\xmltok_impl.c"\
+- ".\xmltok\xmltok_impl.h"\
+-
+-NODEP_CPP_XMLTO=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\xmltok.obj" : $(SOURCE) $(DEP_CPP_XMLTO) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
+-
+-DEP_CPP_XMLTO=\
+- ".\xmltok\asciitab.h"\
+- ".\xmltok\iasciitab.h"\
+- ".\xmltok\latin1tab.h"\
+- ".\xmltok\nametab.h"\
+- ".\xmltok\utf8tab.h"\
+- ".\xmltok\xmldef.h"\
+- ".\xmltok\xmltok.h"\
+- ".\xmltok\xmltok_impl.c"\
+- ".\xmltok\xmltok_impl.h"\
+-
+-NODEP_CPP_XMLTO=\
+- ".\xmltok\nspr.h"\
+-
+-
+-"$(INTDIR)\xmltok.obj" : $(SOURCE) $(DEP_CPP_XMLTO) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ENDIF
+-
+-# End Source File
+-################################################################################
+-# Begin Source File
+-
+-SOURCE=.\xmltok\dllmain.c
+-
+-!IF "$(CFG)" == "xmltok - Win32 Release"
+-
+-
+-"$(INTDIR)\dllmain.obj" : $(SOURCE) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
+-
+-
+-"$(INTDIR)\dllmain.obj" : $(SOURCE) "$(INTDIR)"
+- $(CPP) $(CPP_PROJ) $(SOURCE)
+-
+-
+-!ENDIF
+-
+-# End Source File
+-# End Target
+-# End Project
+-################################################################################
+Binary files original/xmlrpc-epi-0.51/expat/gennmtab/gennmtab and dump_expat/xmlrpc-epi-0.51/expat/gennmtab/gennmtab differ
+diff -u -r -N original/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.c dump_expat/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.c
+--- original/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.c 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,452 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include <string.h>
+-#include <stdio.h>
+-#include <stddef.h>
+-
+-struct range {
+- int start;
+- int end;
+-};
+-
+-struct range nmstrt[] = {
+- { '_' },
+- { ':' },
+- /* BaseChar */
+- { 0x0041, 0x005a },
+- { 0x0061, 0x007a },
+- { 0x00c0, 0x00d6 },
+- { 0x00d8, 0x00f6 },
+- { 0x00f8, 0x00ff },
+- { 0x0100, 0x0131 },
+- { 0x0134, 0x013e },
+- { 0x0141, 0x0148 },
+- { 0x014a, 0x017e },
+- { 0x0180, 0x01c3 },
+- { 0x01cd, 0x01f0 },
+- { 0x01f4, 0x01f5 },
+- { 0x01fa, 0x0217 },
+- { 0x0250, 0x02a8 },
+- { 0x02bb, 0x02c1 },
+- { 0x0386 },
+- { 0x0388, 0x038a },
+- { 0x038c },
+- { 0x038e, 0x03a1 },
+- { 0x03a3, 0x03ce },
+- { 0x03d0, 0x03d6 },
+- { 0x03da },
+- { 0x03dc },
+- { 0x03de },
+- { 0x03e0 },
+- { 0x03e2, 0x03f3 },
+- { 0x0401, 0x040c },
+- { 0x040e, 0x044f },
+- { 0x0451, 0x045c },
+- { 0x045e, 0x0481 },
+- { 0x0490, 0x04c4 },
+- { 0x04c7, 0x04c8 },
+- { 0x04cb, 0x04cc },
+- { 0x04d0, 0x04eb },
+- { 0x04ee, 0x04f5 },
+- { 0x04f8, 0x04f9 },
+- { 0x0531, 0x0556 },
+- { 0x0559 },
+- { 0x0561, 0x0586 },
+- { 0x05d0, 0x05ea },
+- { 0x05f0, 0x05f2 },
+- { 0x0621, 0x063a },
+- { 0x0641, 0x064a },
+- { 0x0671, 0x06b7 },
+- { 0x06ba, 0x06be },
+- { 0x06c0, 0x06ce },
+- { 0x06d0, 0x06d3 },
+- { 0x06d5 },
+- { 0x06e5, 0x06e6 },
+- { 0x0905, 0x0939 },
+- { 0x093d },
+- { 0x0958, 0x0961 },
+- { 0x0985, 0x098c },
+- { 0x098f, 0x0990 },
+- { 0x0993, 0x09a8 },
+- { 0x09aa, 0x09b0 },
+- { 0x09b2 },
+- { 0x09b6, 0x09b9 },
+- { 0x09dc, 0x09dd },
+- { 0x09df, 0x09e1 },
+- { 0x09f0, 0x09f1 },
+- { 0x0a05, 0x0a0a },
+- { 0x0a0f, 0x0a10 },
+- { 0x0a13, 0x0a28 },
+- { 0x0a2a, 0x0a30 },
+- { 0x0a32, 0x0a33 },
+- { 0x0a35, 0x0a36 },
+- { 0x0a38, 0x0a39 },
+- { 0x0a59, 0x0a5c },
+- { 0x0a5e },
+- { 0x0a72, 0x0a74 },
+- { 0x0a85, 0x0a8b },
+- { 0x0a8d },
+- { 0x0a8f, 0x0a91 },
+- { 0x0a93, 0x0aa8 },
+- { 0x0aaa, 0x0ab0 },
+- { 0x0ab2, 0x0ab3 },
+- { 0x0ab5, 0x0ab9 },
+- { 0x0abd },
+- { 0x0ae0 },
+- { 0x0b05, 0x0b0c },
+- { 0x0b0f, 0x0b10 },
+- { 0x0b13, 0x0b28 },
+- { 0x0b2a, 0x0b30 },
+- { 0x0b32, 0x0b33 },
+- { 0x0b36, 0x0b39 },
+- { 0x0b3d },
+- { 0x0b5c, 0x0b5d },
+- { 0x0b5f, 0x0b61 },
+- { 0x0b85, 0x0b8a },
+- { 0x0b8e, 0x0b90 },
+- { 0x0b92, 0x0b95 },
+- { 0x0b99, 0x0b9a },
+- { 0x0b9c },
+- { 0x0b9e, 0x0b9f },
+- { 0x0ba3, 0x0ba4 },
+- { 0x0ba8, 0x0baa },
+- { 0x0bae, 0x0bb5 },
+- { 0x0bb7, 0x0bb9 },
+- { 0x0c05, 0x0c0c },
+- { 0x0c0e, 0x0c10 },
+- { 0x0c12, 0x0c28 },
+- { 0x0c2a, 0x0c33 },
+- { 0x0c35, 0x0c39 },
+- { 0x0c60, 0x0c61 },
+- { 0x0c85, 0x0c8c },
+- { 0x0c8e, 0x0c90 },
+- { 0x0c92, 0x0ca8 },
+- { 0x0caa, 0x0cb3 },
+- { 0x0cb5, 0x0cb9 },
+- { 0x0cde },
+- { 0x0ce0, 0x0ce1 },
+- { 0x0d05, 0x0d0c },
+- { 0x0d0e, 0x0d10 },
+- { 0x0d12, 0x0d28 },
+- { 0x0d2a, 0x0d39 },
+- { 0x0d60, 0x0d61 },
+- { 0x0e01, 0x0e2e },
+- { 0x0e30 },
+- { 0x0e32, 0x0e33 },
+- { 0x0e40, 0x0e45 },
+- { 0x0e81, 0x0e82 },
+- { 0x0e84 },
+- { 0x0e87, 0x0e88 },
+- { 0x0e8a },
+- { 0x0e8d },
+- { 0x0e94, 0x0e97 },
+- { 0x0e99, 0x0e9f },
+- { 0x0ea1, 0x0ea3 },
+- { 0x0ea5 },
+- { 0x0ea7 },
+- { 0x0eaa, 0x0eab },
+- { 0x0ead, 0x0eae },
+- { 0x0eb0 },
+- { 0x0eb2, 0x0eb3 },
+- { 0x0ebd },
+- { 0x0ec0, 0x0ec4 },
+- { 0x0f40, 0x0f47 },
+- { 0x0f49, 0x0f69 },
+- { 0x10a0, 0x10c5 },
+- { 0x10d0, 0x10f6 },
+- { 0x1100 },
+- { 0x1102, 0x1103 },
+- { 0x1105, 0x1107 },
+- { 0x1109 },
+- { 0x110b, 0x110c },
+- { 0x110e, 0x1112 },
+- { 0x113c },
+- { 0x113e },
+- { 0x1140 },
+- { 0x114c },
+- { 0x114e },
+- { 0x1150 },
+- { 0x1154, 0x1155 },
+- { 0x1159 },
+- { 0x115f, 0x1161 },
+- { 0x1163 },
+- { 0x1165 },
+- { 0x1167 },
+- { 0x1169 },
+- { 0x116d, 0x116e },
+- { 0x1172, 0x1173 },
+- { 0x1175 },
+- { 0x119e },
+- { 0x11a8 },
+- { 0x11ab },
+- { 0x11ae, 0x11af },
+- { 0x11b7, 0x11b8 },
+- { 0x11ba },
+- { 0x11bc, 0x11c2 },
+- { 0x11eb },
+- { 0x11f0 },
+- { 0x11f9 },
+- { 0x1e00, 0x1e9b },
+- { 0x1ea0, 0x1ef9 },
+- { 0x1f00, 0x1f15 },
+- { 0x1f18, 0x1f1d },
+- { 0x1f20, 0x1f45 },
+- { 0x1f48, 0x1f4d },
+- { 0x1f50, 0x1f57 },
+- { 0x1f59 },
+- { 0x1f5b },
+- { 0x1f5d },
+- { 0x1f5f, 0x1f7d },
+- { 0x1f80, 0x1fb4 },
+- { 0x1fb6, 0x1fbc },
+- { 0x1fbe },
+- { 0x1fc2, 0x1fc4 },
+- { 0x1fc6, 0x1fcc },
+- { 0x1fd0, 0x1fd3 },
+- { 0x1fd6, 0x1fdb },
+- { 0x1fe0, 0x1fec },
+- { 0x1ff2, 0x1ff4 },
+- { 0x1ff6, 0x1ffc },
+- { 0x2126 },
+- { 0x212a, 0x212b },
+- { 0x212e },
+- { 0x2180, 0x2182 },
+- { 0x3041, 0x3094 },
+- { 0x30a1, 0x30fa },
+- { 0x3105, 0x312c },
+- { 0xac00, 0xd7a3 },
+- /* Ideographic */
+- { 0x4e00, 0x9fa5 },
+- { 0x3007 },
+- { 0x3021, 0x3029 },
+-};
+-
+-/* name chars that are not name start chars */
+-struct range name[] = {
+- { '.' },
+- { '-' },
+- /* CombiningChar */
+- { 0x0300, 0x0345 },
+- { 0x0360, 0x0361 },
+- { 0x0483, 0x0486 },
+- { 0x0591, 0x05a1 },
+- { 0x05a3, 0x05b9 },
+- { 0x05bb, 0x05bd },
+- { 0x05bf },
+- { 0x05c1, 0x05c2 },
+- { 0x05c4 },
+- { 0x064b, 0x0652 },
+- { 0x0670 },
+- { 0x06d6, 0x06dc },
+- { 0x06dd, 0x06df },
+- { 0x06e0, 0x06e4 },
+- { 0x06e7, 0x06e8 },
+- { 0x06ea, 0x06ed },
+- { 0x0901, 0x0903 },
+- { 0x093c },
+- { 0x093e, 0x094c },
+- { 0x094d },
+- { 0x0951, 0x0954 },
+- { 0x0962, 0x0963 },
+- { 0x0981, 0x0983 },
+- { 0x09bc },
+- { 0x09be },
+- { 0x09bf },
+- { 0x09c0, 0x09c4 },
+- { 0x09c7, 0x09c8 },
+- { 0x09cb, 0x09cd },
+- { 0x09d7 },
+- { 0x09e2, 0x09e3 },
+- { 0x0a02 },
+- { 0x0a3c },
+- { 0x0a3e },
+- { 0x0a3f },
+- { 0x0a40, 0x0a42 },
+- { 0x0a47, 0x0a48 },
+- { 0x0a4b, 0x0a4d },
+- { 0x0a70, 0x0a71 },
+- { 0x0a81, 0x0a83 },
+- { 0x0abc },
+- { 0x0abe, 0x0ac5 },
+- { 0x0ac7, 0x0ac9 },
+- { 0x0acb, 0x0acd },
+- { 0x0b01, 0x0b03 },
+- { 0x0b3c },
+- { 0x0b3e, 0x0b43 },
+- { 0x0b47, 0x0b48 },
+- { 0x0b4b, 0x0b4d },
+- { 0x0b56, 0x0b57 },
+- { 0x0b82, 0x0b83 },
+- { 0x0bbe, 0x0bc2 },
+- { 0x0bc6, 0x0bc8 },
+- { 0x0bca, 0x0bcd },
+- { 0x0bd7 },
+- { 0x0c01, 0x0c03 },
+- { 0x0c3e, 0x0c44 },
+- { 0x0c46, 0x0c48 },
+- { 0x0c4a, 0x0c4d },
+- { 0x0c55, 0x0c56 },
+- { 0x0c82, 0x0c83 },
+- { 0x0cbe, 0x0cc4 },
+- { 0x0cc6, 0x0cc8 },
+- { 0x0cca, 0x0ccd },
+- { 0x0cd5, 0x0cd6 },
+- { 0x0d02, 0x0d03 },
+- { 0x0d3e, 0x0d43 },
+- { 0x0d46, 0x0d48 },
+- { 0x0d4a, 0x0d4d },
+- { 0x0d57 },
+- { 0x0e31 },
+- { 0x0e34, 0x0e3a },
+- { 0x0e47, 0x0e4e },
+- { 0x0eb1 },
+- { 0x0eb4, 0x0eb9 },
+- { 0x0ebb, 0x0ebc },
+- { 0x0ec8, 0x0ecd },
+- { 0x0f18, 0x0f19 },
+- { 0x0f35 },
+- { 0x0f37 },
+- { 0x0f39 },
+- { 0x0f3e },
+- { 0x0f3f },
+- { 0x0f71, 0x0f84 },
+- { 0x0f86, 0x0f8b },
+- { 0x0f90, 0x0f95 },
+- { 0x0f97 },
+- { 0x0f99, 0x0fad },
+- { 0x0fb1, 0x0fb7 },
+- { 0x0fb9 },
+- { 0x20d0, 0x20dc },
+- { 0x20e1 },
+- { 0x302a, 0x302f },
+- { 0x3099 },
+- { 0x309a },
+- /* Digit */
+- { 0x0030, 0x0039 },
+- { 0x0660, 0x0669 },
+- { 0x06f0, 0x06f9 },
+- { 0x0966, 0x096f },
+- { 0x09e6, 0x09ef },
+- { 0x0a66, 0x0a6f },
+- { 0x0ae6, 0x0aef },
+- { 0x0b66, 0x0b6f },
+- { 0x0be7, 0x0bef },
+- { 0x0c66, 0x0c6f },
+- { 0x0ce6, 0x0cef },
+- { 0x0d66, 0x0d6f },
+- { 0x0e50, 0x0e59 },
+- { 0x0ed0, 0x0ed9 },
+- { 0x0f20, 0x0f29 },
+- /* Extender */
+- { 0xb7 },
+- { 0x02d0 },
+- { 0x02d1 },
+- { 0x0387 },
+- { 0x0640 },
+- { 0x0e46 },
+- { 0x0ec6 },
+- { 0x3005 },
+- { 0x3031, 0x3035 },
+- { 0x309d, 0x309e },
+- { 0x30fc, 0x30fe },
+-};
+-
+-void setTab(char *tab, struct range *ranges, size_t nRanges)
+-{
+- size_t i;
+- int j;
+- for (i = 0; i < nRanges; i++) {
+- if (ranges[i].end) {
+- for (j = ranges[i].start; j <= ranges[i].end; j++)
+- tab[j] = 1;
+- }
+- else
+- tab[ranges[i].start] = 1;
+- }
+-}
+-
+-void printTabs(char *tab)
+-{
+- int nBitmaps = 2;
+- int i, j, k;
+- unsigned char pageIndex[512];
+-
+- printf(
+-"static const unsigned namingBitmap[] = {\n\
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,\n\
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,\n\
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n\
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n");
+- for (i = 0; i < 512; i++) {
+- int kind = tab[i*256];
+- for (j = 1; j < 256; j++)
+- if (tab[i*256 +j] != kind) {
+- kind = -1;
+- break;
+- }
+- if (i >= 256 && memcmp(tab + (i - 256)*256, tab + i*256, 256) == 0)
+- pageIndex[i] = pageIndex[i - 256];
+- else if (kind == -1) {
+- pageIndex[i] = nBitmaps++;
+- for (j = 0; j < 8; j++) {
+- unsigned val = 0;
+- for (k = 0; k < 32; k++) {
+- if (tab[i*256 + j*32 +k])
+- val |= (1 << k);
+- }
+- printf("0x%08X,", val);
+- putchar((((j + 1) & 3) == 0) ? '\n' : ' ');
+- }
+- }
+- else
+- pageIndex[i] = kind;
+- }
+- printf("};\n");
+- printf("static const unsigned char nmstrtPages[] = {\n");
+- for (i = 0; i < 512; i++) {
+- if (i == 256)
+- printf("};\nstatic const unsigned char namePages[] = {\n");
+- printf("0x%02X,", pageIndex[i]);
+- putchar((((i + 1) & 7) == 0) ? '\n' : ' ');
+- }
+- printf("};\n");
+-}
+-
+-int main()
+-{
+- char tab[2*65536];
+- memset(tab, 0, 65536);
+- setTab(tab, nmstrt, sizeof(nmstrt)/sizeof(nmstrt[0]));
+- memcpy(tab + 65536, tab, 65536);
+- setTab(tab + 65536, name, sizeof(name)/sizeof(name[0]));
+- printTabs(tab);
+- return 0;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.dsp dump_expat/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.dsp
+--- original/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.dsp 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/gennmtab/gennmtab.dsp 1969-12-31 18:00:00.000000000 -0600
+@@ -1,101 +0,0 @@
+-# Microsoft Developer Studio Project File - Name="gennmtab" - Package Owner=<4>
+-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+-# ** DO NOT EDIT **
+-
+-# TARGTYPE "Win32 (x86) Console Application" 0x0103
+-
+-CFG=gennmtab - 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 "gennmtab.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 "gennmtab.mak" CFG="gennmtab - Win32 Release"
+-!MESSAGE
+-!MESSAGE Possible choices for configuration are:
+-!MESSAGE
+-!MESSAGE "gennmtab - Win32 Release" (based on "Win32 (x86) Console Application")
+-!MESSAGE "gennmtab - 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)" == "gennmtab - 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 ".\Release"
+-# PROP Intermediate_Dir ".\Release"
+-# PROP Target_Dir "."
+-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+-
+-!ELSEIF "$(CFG)" == "gennmtab - 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 ".\Debug"
+-# PROP Intermediate_Dir ".\Debug"
+-# 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 /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+-
+-!ENDIF
+-
+-# Begin Target
+-
+-# Name "gennmtab - Win32 Release"
+-# Name "gennmtab - 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=.\gennmtab.c
+-# End Source File
+-# End Group
+-# Begin Group "Header Files"
+-
+-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+-# 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
+Binary files original/xmlrpc-epi-0.51/expat/lib/xmlparse.lib and dump_expat/xmlrpc-epi-0.51/expat/lib/xmlparse.lib differ
+Binary files original/xmlrpc-epi-0.51/expat/lib/xmltok.lib and dump_expat/xmlrpc-epi-0.51/expat/lib/xmltok.lib differ
+diff -u -r -N original/xmlrpc-epi-0.51/expat/sample/.cvsignore dump_expat/xmlrpc-epi-0.51/expat/sample/.cvsignore
+--- original/xmlrpc-epi-0.51/expat/sample/.cvsignore 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/sample/.cvsignore 1969-12-31 18:00:00.000000000 -0600
+@@ -1 +0,0 @@
+-.libs
+diff -u -r -N original/xmlrpc-epi-0.51/expat/sample/build.bat dump_expat/xmlrpc-epi-0.51/expat/sample/build.bat
+--- original/xmlrpc-epi-0.51/expat/sample/build.bat 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/sample/build.bat 1969-12-31 18:00:00.000000000 -0600
+@@ -1,4 +0,0 @@
+-@echo off
+-set LIB=..\xmlparse\Release;..\lib;%LIB%
+-cl /nologo /DXMLTOKAPI=__declspec(dllimport) /DXMLPARSEAPI=__declspec(dllimport) /I..\xmlparse /Fe..\bin\elements elements.c xmlparse.lib
+-@echo Run it using: ..\bin\elements ^<..\expat.html
+diff -u -r -N original/xmlrpc-epi-0.51/expat/sample/elements.c dump_expat/xmlrpc-epi-0.51/expat/sample/elements.c
+--- original/xmlrpc-epi-0.51/expat/sample/elements.c 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/sample/elements.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,46 +0,0 @@
+-/* This is simple demonstration of how to use expat. This program
+-reads an XML document from standard input and writes a line with the
+-name of each element to standard output indenting child elements by
+-one tab stop more than their parent element. */
+-
+-#include <stdio.h>
+-#include "xmlparse.h"
+-
+-void startElement(void *userData, const char *name, const char **atts)
+-{
+- int i;
+- int *depthPtr = userData;
+- for (i = 0; i < *depthPtr; i++)
+- putchar('\t');
+- puts(name);
+- *depthPtr += 1;
+-}
+-
+-void endElement(void *userData, const char *name)
+-{
+- int *depthPtr = userData;
+- *depthPtr -= 1;
+-}
+-
+-int main()
+-{
+- char buf[BUFSIZ];
+- XML_Parser parser = XML_ParserCreate(NULL);
+- int done;
+- int depth = 0;
+- XML_SetUserData(parser, &depth);
+- XML_SetElementHandler(parser, startElement, endElement);
+- do {
+- size_t len = fread(buf, 1, sizeof(buf), stdin);
+- done = len < sizeof(buf);
+- if (!XML_Parse(parser, buf, len, done)) {
+- fprintf(stderr,
+- "%s at line %d\n",
+- XML_ErrorString(XML_GetErrorCode(parser)),
+- XML_GetCurrentLineNumber(parser));
+- return 1;
+- }
+- } while (!done);
+- XML_ParserFree(parser);
+- return 0;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/.cvsignore dump_expat/xmlrpc-epi-0.51/expat/xmlparse/.cvsignore
+--- original/xmlrpc-epi-0.51/expat/xmlparse/.cvsignore 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/.cvsignore 1969-12-31 18:00:00.000000000 -0600
+@@ -1,6 +0,0 @@
+-Makefile
+-.deps
+-xmlparse.lo
+-hashtable.lo
+-.libs
+-libexpat_parse.la
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/Makefile.am dump_expat/xmlrpc-epi-0.51/expat/xmlparse/Makefile.am
+--- original/xmlrpc-epi-0.51/expat/xmlparse/Makefile.am 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/Makefile.am 1969-12-31 18:00:00.000000000 -0600
+@@ -1,7 +0,0 @@
+-noinst_LTLIBRARIES = libexpat_parse.la
+-libexpat_parse_la_SOURCES = xmlparse.c hashtable.c
+-
+-INCLUDES = -I../xmltok
+-
+-include_HEADERS= \
+- xmlparse.h
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/Makefile.in dump_expat/xmlrpc-epi-0.51/expat/xmlparse/Makefile.in
+--- original/xmlrpc-epi-0.51/expat/xmlparse/Makefile.in 2002-06-23 18:48:29.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/Makefile.in 1969-12-31 18:00:00.000000000 -0600
+@@ -1,354 +0,0 @@
+-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+-
+-# Copyright (C) 1994, 1995-8, 1999, 2001 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.
+-
+-
+-SHELL = @SHELL@
+-
+-srcdir = @srcdir@
+-top_srcdir = @top_srcdir@
+-VPATH = @srcdir@
+-prefix = @prefix@
+-exec_prefix = @exec_prefix@
+-
+-bindir = @bindir@
+-sbindir = @sbindir@
+-libexecdir = @libexecdir@
+-datadir = @datadir@
+-sysconfdir = @sysconfdir@
+-sharedstatedir = @sharedstatedir@
+-localstatedir = @localstatedir@
+-libdir = @libdir@
+-infodir = @infodir@
+-mandir = @mandir@
+-includedir = @includedir@
+-oldincludedir = /usr/include
+-
+-DESTDIR =
+-
+-pkgdatadir = $(datadir)/@PACKAGE@
+-pkglibdir = $(libdir)/@PACKAGE@
+-pkgincludedir = $(includedir)/@PACKAGE@
+-
+-top_builddir = ../..
+-
+-ACLOCAL = @ACLOCAL@
+-AUTOCONF = @AUTOCONF@
+-AUTOMAKE = @AUTOMAKE@
+-AUTOHEADER = @AUTOHEADER@
+-
+-INSTALL = @INSTALL@
+-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+-INSTALL_DATA = @INSTALL_DATA@
+-INSTALL_SCRIPT = @INSTALL_SCRIPT@
+-transform = @program_transform_name@
+-
+-NORMAL_INSTALL = :
+-PRE_INSTALL = :
+-POST_INSTALL = :
+-NORMAL_UNINSTALL = :
+-PRE_UNINSTALL = :
+-POST_UNINSTALL = :
+-host_alias = @host_alias@
+-host_triplet = @host@
+-AS = @AS@
+-AWK = @AWK@
+-CC = @CC@
+-CPP = @CPP@
+-CXX = @CXX@
+-DLLTOOL = @DLLTOOL@
+-ECHO = @ECHO@
+-EXEEXT = @EXEEXT@
+-LIBTOOL = @LIBTOOL@
+-LN_S = @LN_S@
+-MAKEINFO = @MAKEINFO@
+-OBJDUMP = @OBJDUMP@
+-OBJEXT = @OBJEXT@
+-PACKAGE = @PACKAGE@
+-RANLIB = @RANLIB@
+-STRIP = @STRIP@
+-VERSION = @VERSION@
+-
+-noinst_LTLIBRARIES = libexpat_parse.la
+-libexpat_parse_la_SOURCES = xmlparse.c hashtable.c
+-
+-INCLUDES = -I../xmltok
+-
+-include_HEADERS = xmlparse.h
+-
+-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+-CONFIG_CLEAN_FILES =
+-LTLIBRARIES = $(noinst_LTLIBRARIES)
+-
+-
+-DEFS = @DEFS@ -I. -I$(srcdir)
+-CPPFLAGS = @CPPFLAGS@
+-LDFLAGS = @LDFLAGS@
+-LIBS = @LIBS@
+-libexpat_parse_la_LDFLAGS =
+-libexpat_parse_la_LIBADD =
+-libexpat_parse_la_OBJECTS = xmlparse.lo hashtable.lo
+-CFLAGS = @CFLAGS@
+-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+-CCLD = $(CC)
+-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+-HEADERS = $(include_HEADERS)
+-
+-DIST_COMMON = Makefile.am Makefile.in
+-
+-
+-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+-
+-TAR = gtar
+-GZIP_ENV = --best
+-DEP_FILES = .deps/hashtable.P .deps/xmlparse.P
+-SOURCES = $(libexpat_parse_la_SOURCES)
+-OBJECTS = $(libexpat_parse_la_OBJECTS)
+-
+-all: all-redirect
+-.SUFFIXES:
+-.SUFFIXES: .S .c .lo .o .obj .s
+-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+- cd $(top_srcdir) && $(AUTOMAKE) --gnu expat/xmlparse/Makefile
+-
+-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+- cd $(top_builddir) \
+- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+-
+-
+-mostlyclean-noinstLTLIBRARIES:
+-
+-clean-noinstLTLIBRARIES:
+- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+-
+-distclean-noinstLTLIBRARIES:
+-
+-maintainer-clean-noinstLTLIBRARIES:
+-
+-# FIXME: We should only use cygpath when building on Windows,
+-# and only if it is available.
+-.c.obj:
+- $(COMPILE) -c `cygpath -w $<`
+-
+-.s.o:
+- $(COMPILE) -c $<
+-
+-.S.o:
+- $(COMPILE) -c $<
+-
+-mostlyclean-compile:
+- -rm -f *.o core *.core
+- -rm -f *.$(OBJEXT)
+-
+-clean-compile:
+-
+-distclean-compile:
+- -rm -f *.tab.c
+-
+-maintainer-clean-compile:
+-
+-.s.lo:
+- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+-
+-.S.lo:
+- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+-
+-mostlyclean-libtool:
+- -rm -f *.lo
+-
+-clean-libtool:
+- -rm -rf .libs _libs
+-
+-distclean-libtool:
+-
+-maintainer-clean-libtool:
+-
+-libexpat_parse.la: $(libexpat_parse_la_OBJECTS) $(libexpat_parse_la_DEPENDENCIES)
+- $(LINK) $(libexpat_parse_la_LDFLAGS) $(libexpat_parse_la_OBJECTS) $(libexpat_parse_la_LIBADD) $(LIBS)
+-
+-install-includeHEADERS: $(include_HEADERS)
+- @$(NORMAL_INSTALL)
+- $(mkinstalldirs) $(DESTDIR)$(includedir)
+- @list='$(include_HEADERS)'; for p in $$list; do \
+- if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+- echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
+- $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
+- done
+-
+-uninstall-includeHEADERS:
+- @$(NORMAL_UNINSTALL)
+- list='$(include_HEADERS)'; for p in $$list; do \
+- rm -f $(DESTDIR)$(includedir)/$$p; \
+- done
+-
+-tags: TAGS
+-
+-ID: $(HEADERS) $(SOURCES) $(LISP)
+- list='$(SOURCES) $(HEADERS)'; \
+- unique=`for i in $$list; do echo $$i; done | \
+- awk ' { files[$$0] = 1; } \
+- END { for (i in files) print i; }'`; \
+- here=`pwd` && cd $(srcdir) \
+- && mkid -f$$here/ID $$unique $(LISP)
+-
+-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+- tags=; \
+- here=`pwd`; \
+- list='$(SOURCES) $(HEADERS)'; \
+- unique=`for i in $$list; do echo $$i; done | \
+- awk ' { files[$$0] = 1; } \
+- END { for (i in files) print i; }'`; \
+- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+-
+-mostlyclean-tags:
+-
+-clean-tags:
+-
+-distclean-tags:
+- -rm -f TAGS ID
+-
+-maintainer-clean-tags:
+-
+-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+-
+-subdir = expat/xmlparse
+-
+-distdir: $(DISTFILES)
+- here=`cd $(top_builddir) && pwd`; \
+- top_distdir=`cd $(top_distdir) && pwd`; \
+- distdir=`cd $(distdir) && pwd`; \
+- cd $(top_srcdir) \
+- && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu expat/xmlparse/Makefile
+- @for file in $(DISTFILES); do \
+- d=$(srcdir); \
+- if test -d $$d/$$file; then \
+- cp -pr $$d/$$file $(distdir)/$$file; \
+- else \
+- test -f $(distdir)/$$file \
+- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+- || cp -p $$d/$$file $(distdir)/$$file || :; \
+- fi; \
+- done
+-
+-DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+-
+--include $(DEP_FILES)
+-
+-mostlyclean-depend:
+-
+-clean-depend:
+-
+-distclean-depend:
+- -rm -rf .deps
+-
+-maintainer-clean-depend:
+-
+-%.o: %.c
+- @echo '$(COMPILE) -c $<'; \
+- $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+- @-cp .deps/$(*F).pp .deps/$(*F).P; \
+- tr ' ' '\012' < .deps/$(*F).pp \
+- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+- >> .deps/$(*F).P; \
+- rm .deps/$(*F).pp
+-
+-%.lo: %.c
+- @echo '$(LTCOMPILE) -c $<'; \
+- $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+- @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
+- < .deps/$(*F).pp > .deps/$(*F).P; \
+- tr ' ' '\012' < .deps/$(*F).pp \
+- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+- >> .deps/$(*F).P; \
+- rm -f .deps/$(*F).pp
+-info-am:
+-info: info-am
+-dvi-am:
+-dvi: dvi-am
+-check-am: all-am
+-check: check-am
+-installcheck-am:
+-installcheck: installcheck-am
+-install-exec-am:
+-install-exec: install-exec-am
+-
+-install-data-am: install-includeHEADERS
+-install-data: install-data-am
+-
+-install-am: all-am
+- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+-install: install-am
+-uninstall-am: uninstall-includeHEADERS
+-uninstall: uninstall-am
+-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+-all-redirect: all-am
+-install-strip:
+- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+-installdirs:
+- $(mkinstalldirs) $(DESTDIR)$(includedir)
+-
+-
+-mostlyclean-generic:
+-
+-clean-generic:
+-
+-distclean-generic:
+- -rm -f Makefile $(CONFIG_CLEAN_FILES)
+- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+-
+-maintainer-clean-generic:
+-mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
+- mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
+- mostlyclean-generic
+-
+-mostlyclean: mostlyclean-am
+-
+-clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \
+- clean-tags clean-depend clean-generic mostlyclean-am
+-
+-clean: clean-am
+-
+-distclean-am: distclean-noinstLTLIBRARIES distclean-compile \
+- distclean-libtool distclean-tags distclean-depend \
+- distclean-generic clean-am
+- -rm -f libtool
+-
+-distclean: distclean-am
+-
+-maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \
+- maintainer-clean-compile maintainer-clean-libtool \
+- maintainer-clean-tags maintainer-clean-depend \
+- maintainer-clean-generic distclean-am
+- @echo "This command is intended for maintainers to use;"
+- @echo "it deletes files that may require special tools to rebuild."
+-
+-maintainer-clean: maintainer-clean-am
+-
+-.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
+-clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
+-mostlyclean-compile distclean-compile clean-compile \
+-maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+-clean-libtool maintainer-clean-libtool uninstall-includeHEADERS \
+-install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \
+-maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
+-clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
+-check-am installcheck-am installcheck install-exec-am install-exec \
+-install-data-am install-data install-am install uninstall-am uninstall \
+-all-redirect all-am all installdirs mostlyclean-generic \
+-distclean-generic clean-generic maintainer-clean-generic clean \
+-mostlyclean distclean maintainer-clean
+-
+-
+-# 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 -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/hashtable.c dump_expat/xmlrpc-epi-0.51/expat/xmlparse/hashtable.c
+--- original/xmlrpc-epi-0.51/expat/xmlparse/hashtable.c 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/hashtable.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,152 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-csompliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include "xmldef.h"
+-
+-#ifdef XML_UNICODE_WCHAR_T
+-#ifndef XML_UNICODE
+-#define XML_UNICODE
+-#endif
+-#endif
+-
+-#include "hashtable.h"
+-
+-#define INIT_SIZE 64
+-
+-static
+-int keyeq(KEY s1, KEY s2)
+-{
+- for (; *s1 == *s2; s1++, s2++)
+- if (*s1 == 0)
+- return 1;
+- return 0;
+-}
+-
+-static
+-unsigned long hash(KEY s)
+-{
+- unsigned long h = 0;
+- while (*s)
+- h = (h << 5) + h + (unsigned char)*s++;
+- return h;
+-}
+-
+-NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize)
+-{
+- size_t i;
+- if (table->size == 0) {
+- if (!createSize)
+- return 0;
+- table->v = calloc(INIT_SIZE, sizeof(NAMED *));
+- if (!table->v)
+- return 0;
+- table->size = INIT_SIZE;
+- table->usedLim = INIT_SIZE / 2;
+- i = hash(name) & (table->size - 1);
+- }
+- else {
+- unsigned long h = hash(name);
+- for (i = h & (table->size - 1);
+- table->v[i];
+- i == 0 ? i = table->size - 1 : --i) {
+- if (keyeq(name, table->v[i]->name))
+- return table->v[i];
+- }
+- if (!createSize)
+- return 0;
+- if (table->used == table->usedLim) {
+- /* check for overflow */
+- size_t newSize = table->size * 2;
+- NAMED **newV = calloc(newSize, sizeof(NAMED *));
+- if (!newV)
+- return 0;
+- for (i = 0; i < table->size; i++)
+- if (table->v[i]) {
+- size_t j;
+- for (j = hash(table->v[i]->name) & (newSize - 1);
+- newV[j];
+- j == 0 ? j = newSize - 1 : --j)
+- ;
+- newV[j] = table->v[i];
+- }
+- free(table->v);
+- table->v = newV;
+- table->size = newSize;
+- table->usedLim = newSize/2;
+- for (i = h & (table->size - 1);
+- table->v[i];
+- i == 0 ? i = table->size - 1 : --i)
+- ;
+- }
+- }
+- table->v[i] = calloc(1, createSize);
+- if (!table->v[i])
+- return 0;
+- table->v[i]->name = name;
+- (table->used)++;
+- return table->v[i];
+-}
+-
+-void hashTableDestroy(HASH_TABLE *table)
+-{
+- size_t i;
+- for (i = 0; i < table->size; i++) {
+- NAMED *p = table->v[i];
+- if (p)
+- free(p);
+- }
+- if (table->v)
+- free(table->v);
+-}
+-
+-void hashTableInit(HASH_TABLE *p)
+-{
+- p->size = 0;
+- p->usedLim = 0;
+- p->used = 0;
+- p->v = 0;
+-}
+-
+-void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table)
+-{
+- iter->p = table->v;
+- iter->end = iter->p + table->size;
+-}
+-
+-NAMED *hashTableIterNext(HASH_TABLE_ITER *iter)
+-{
+- while (iter->p != iter->end) {
+- NAMED *tem = *(iter->p)++;
+- if (tem)
+- return tem;
+- }
+- return 0;
+-}
+-
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/hashtable.h dump_expat/xmlrpc-epi-0.51/expat/xmlparse/hashtable.h
+--- original/xmlrpc-epi-0.51/expat/xmlparse/hashtable.h 2001-03-19 21:28:33.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/hashtable.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,69 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-
+-#include <stddef.h>
+-
+-#ifdef XML_UNICODE
+-
+-#ifdef XML_UNICODE_WCHAR_T
+-typedef const wchar_t *KEY;
+-#else /* not XML_UNICODE_WCHAR_T */
+-typedef const unsigned short *KEY;
+-#endif /* not XML_UNICODE_WCHAR_T */
+-
+-#else /* not XML_UNICODE */
+-
+-typedef const char *KEY;
+-
+-#endif /* not XML_UNICODE */
+-
+-typedef struct {
+- KEY name;
+-} NAMED;
+-
+-typedef struct {
+- NAMED **v;
+- size_t size;
+- size_t used;
+- size_t usedLim;
+-} HASH_TABLE;
+-
+-NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize);
+-void hashTableInit(HASH_TABLE *);
+-void hashTableDestroy(HASH_TABLE *);
+-
+-typedef struct {
+- NAMED **p;
+- NAMED **end;
+-} HASH_TABLE_ITER;
+-
+-void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
+-NAMED *hashTableIterNext(HASH_TABLE_ITER *);
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.c dump_expat/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.c
+--- original/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,3254 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include "xmldef.h"
+-#include "xmlparse.h"
+-
+-#ifdef XML_UNICODE
+-#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
+-#define XmlConvert XmlUtf16Convert
+-#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
+-#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
+-#define XmlEncode XmlUtf16Encode
+-#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1))
+-typedef unsigned short ICHAR;
+-#else
+-#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
+-#define XmlConvert XmlUtf8Convert
+-#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
+-#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
+-#define XmlEncode XmlUtf8Encode
+-#define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
+-typedef char ICHAR;
+-#endif
+-
+-
+-#ifndef XML_NS
+-
+-#define XmlInitEncodingNS XmlInitEncoding
+-#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
+-#undef XmlGetInternalEncodingNS
+-#define XmlGetInternalEncodingNS XmlGetInternalEncoding
+-#define XmlParseXmlDeclNS XmlParseXmlDecl
+-
+-#endif
+-
+-
+-#ifdef XML_UNICODE_WCHAR_T
+-#define XML_T(x) L ## x
+-#else
+-#define XML_T(x) x
+-#endif
+-
+-/* Round up n to be a multiple of sz, where sz is a power of 2. */
+-#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
+-
+-#include "xmltok.h"
+-#include "xmlrole.h"
+-#include "hashtable.h"
+-
+-#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */
+-#define INIT_DATA_BUF_SIZE 1024
+-#define INIT_ATTS_SIZE 16
+-#define INIT_BLOCK_SIZE 1024
+-#define INIT_BUFFER_SIZE 1024
+-
+-#define EXPAND_SPARE 24
+-
+-typedef struct binding {
+- struct prefix *prefix;
+- struct binding *nextTagBinding;
+- struct binding *prevPrefixBinding;
+- const struct attribute_id *attId;
+- XML_Char *uri;
+- int uriLen;
+- int uriAlloc;
+-} BINDING;
+-
+-typedef struct prefix {
+- const XML_Char *name;
+- BINDING *binding;
+-} PREFIX;
+-
+-typedef struct {
+- const XML_Char *str;
+- const XML_Char *localPart;
+- int uriLen;
+-} TAG_NAME;
+-
+-typedef struct tag {
+- struct tag *parent;
+- const char *rawName;
+- int rawNameLength;
+- TAG_NAME name;
+- char *buf;
+- char *bufEnd;
+- BINDING *bindings;
+-} TAG;
+-
+-typedef struct {
+- const XML_Char *name;
+- const XML_Char *textPtr;
+- int textLen;
+- const XML_Char *systemId;
+- const XML_Char *base;
+- const XML_Char *publicId;
+- const XML_Char *notation;
+- char open;
+-} ENTITY;
+-
+-typedef struct block {
+- struct block *next;
+- int size;
+- XML_Char s[1];
+-} BLOCK;
+-
+-typedef struct {
+- BLOCK *blocks;
+- BLOCK *freeBlocks;
+- const XML_Char *end;
+- XML_Char *ptr;
+- XML_Char *start;
+-} STRING_POOL;
+-
+-/* The XML_Char before the name is used to determine whether
+-an attribute has been specified. */
+-typedef struct attribute_id {
+- XML_Char *name;
+- PREFIX *prefix;
+- char maybeTokenized;
+- char xmlns;
+-} ATTRIBUTE_ID;
+-
+-typedef struct {
+- const ATTRIBUTE_ID *id;
+- char isCdata;
+- const XML_Char *value;
+-} DEFAULT_ATTRIBUTE;
+-
+-typedef struct {
+- const XML_Char *name;
+- PREFIX *prefix;
+- int nDefaultAtts;
+- int allocDefaultAtts;
+- DEFAULT_ATTRIBUTE *defaultAtts;
+-} ELEMENT_TYPE;
+-
+-typedef struct {
+- HASH_TABLE generalEntities;
+- HASH_TABLE elementTypes;
+- HASH_TABLE attributeIds;
+- HASH_TABLE prefixes;
+- STRING_POOL pool;
+- int complete;
+- int standalone;
+- const XML_Char *base;
+- PREFIX defaultPrefix;
+-} DTD;
+-
+-typedef struct open_internal_entity {
+- const char *internalEventPtr;
+- const char *internalEventEndPtr;
+- struct open_internal_entity *next;
+- ENTITY *entity;
+-} OPEN_INTERNAL_ENTITY;
+-
+-typedef enum XML_Error Processor(XML_Parser parser,
+- const char *start,
+- const char *end,
+- const char **endPtr);
+-
+-static Processor prologProcessor;
+-static Processor prologInitProcessor;
+-static Processor contentProcessor;
+-static Processor cdataSectionProcessor;
+-static Processor epilogProcessor;
+-static Processor errorProcessor;
+-static Processor externalEntityInitProcessor;
+-static Processor externalEntityInitProcessor2;
+-static Processor externalEntityInitProcessor3;
+-static Processor externalEntityContentProcessor;
+-
+-static enum XML_Error
+-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName);
+-static enum XML_Error
+-processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *, const char *);
+-static enum XML_Error
+-initializeEncoding(XML_Parser parser);
+-static enum XML_Error
+-doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
+- const char *start, const char *end, const char **endPtr);
+-static enum XML_Error
+-doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr);
+-static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s,
+- TAG_NAME *tagNamePtr, BINDING **bindingsPtr);
+-static
+-int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr);
+-static int
+-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, int isCdata, const XML_Char *dfltValue);
+-static enum XML_Error
+-storeAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *,
+- STRING_POOL *);
+-static enum XML_Error
+-appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *,
+- STRING_POOL *);
+-static ATTRIBUTE_ID *
+-getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
+-static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);
+-static enum XML_Error
+-storeEntityValue(XML_Parser parser, const char *start, const char *end);
+-static int
+-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
+-static int
+-reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
+-static void
+-reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
+-
+-static const XML_Char *getContext(XML_Parser parser);
+-static int setContext(XML_Parser parser, const XML_Char *context);
+-static void normalizePublicId(XML_Char *s);
+-static int dtdInit(DTD *);
+-static void dtdDestroy(DTD *);
+-static int dtdCopy(DTD *newDtd, const DTD *oldDtd);
+-static void poolInit(STRING_POOL *);
+-static void poolClear(STRING_POOL *);
+-static void poolDestroy(STRING_POOL *);
+-static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
+- const char *ptr, const char *end);
+-static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
+- const char *ptr, const char *end);
+-static int poolGrow(STRING_POOL *pool);
+-static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s);
+-static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n);
+-
+-#define poolStart(pool) ((pool)->start)
+-#define poolEnd(pool) ((pool)->ptr)
+-#define poolLength(pool) ((pool)->ptr - (pool)->start)
+-#define poolChop(pool) ((void)--(pool->ptr))
+-#define poolLastChar(pool) (((pool)->ptr)[-1])
+-#define poolDiscard(pool) ((pool)->ptr = (pool)->start)
+-#define poolFinish(pool) ((pool)->start = (pool)->ptr)
+-#define poolAppendChar(pool, c) \
+- (((pool)->ptr == (pool)->end && !poolGrow(pool)) \
+- ? 0 \
+- : ((*((pool)->ptr)++ = c), 1))
+-
+-typedef struct {
+- /* The first member must be userData so that the XML_GetUserData macro works. */
+- void *m_userData;
+- void *m_handlerArg;
+- char *m_buffer;
+- /* first character to be parsed */
+- const char *m_bufferPtr;
+- /* past last character to be parsed */
+- char *m_bufferEnd;
+- /* allocated end of buffer */
+- const char *m_bufferLim;
+- long m_parseEndByteIndex;
+- const char *m_parseEndPtr;
+- XML_Char *m_dataBuf;
+- XML_Char *m_dataBufEnd;
+- XML_StartElementHandler m_startElementHandler;
+- XML_EndElementHandler m_endElementHandler;
+- XML_CharacterDataHandler m_characterDataHandler;
+- XML_ProcessingInstructionHandler m_processingInstructionHandler;
+- XML_CommentHandler m_commentHandler;
+- XML_StartCdataSectionHandler m_startCdataSectionHandler;
+- XML_EndCdataSectionHandler m_endCdataSectionHandler;
+- XML_DefaultHandler m_defaultHandler;
+- XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler;
+- XML_NotationDeclHandler m_notationDeclHandler;
+- XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler;
+- XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler;
+- XML_NotStandaloneHandler m_notStandaloneHandler;
+- XML_ExternalEntityRefHandler m_externalEntityRefHandler;
+- void *m_externalEntityRefHandlerArg;
+- XML_UnknownEncodingHandler m_unknownEncodingHandler;
+- const ENCODING *m_encoding;
+- INIT_ENCODING m_initEncoding;
+- const XML_Char *m_protocolEncodingName;
+- int m_ns;
+- void *m_unknownEncodingMem;
+- void *m_unknownEncodingData;
+- void *m_unknownEncodingHandlerData;
+- void (*m_unknownEncodingRelease)(void *);
+- PROLOG_STATE m_prologState;
+- Processor *m_processor;
+- enum XML_Error m_errorCode;
+- const char *m_eventPtr;
+- const char *m_eventEndPtr;
+- const char *m_positionPtr;
+- OPEN_INTERNAL_ENTITY *m_openInternalEntities;
+- int m_defaultExpandInternalEntities;
+- int m_tagLevel;
+- ENTITY *m_declEntity;
+- const XML_Char *m_declNotationName;
+- const XML_Char *m_declNotationPublicId;
+- ELEMENT_TYPE *m_declElementType;
+- ATTRIBUTE_ID *m_declAttributeId;
+- char m_declAttributeIsCdata;
+- DTD m_dtd;
+- TAG *m_tagStack;
+- TAG *m_freeTagList;
+- BINDING *m_inheritedBindings;
+- BINDING *m_freeBindingList;
+- int m_attsSize;
+- int m_nSpecifiedAtts;
+- ATTRIBUTE *m_atts;
+- POSITION m_position;
+- STRING_POOL m_tempPool;
+- STRING_POOL m_temp2Pool;
+- char *m_groupConnector;
+- unsigned m_groupSize;
+- int m_hadExternalDoctype;
+- XML_Char m_namespaceSeparator;
+-} Parser;
+-
+-#define userData (((Parser *)parser)->m_userData)
+-#define handlerArg (((Parser *)parser)->m_handlerArg)
+-#define startElementHandler (((Parser *)parser)->m_startElementHandler)
+-#define endElementHandler (((Parser *)parser)->m_endElementHandler)
+-#define characterDataHandler (((Parser *)parser)->m_characterDataHandler)
+-#define processingInstructionHandler (((Parser *)parser)->m_processingInstructionHandler)
+-#define commentHandler (((Parser *)parser)->m_commentHandler)
+-#define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler)
+-#define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler)
+-#define defaultHandler (((Parser *)parser)->m_defaultHandler)
+-#define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler)
+-#define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler)
+-#define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler)
+-#define endNamespaceDeclHandler (((Parser *)parser)->m_endNamespaceDeclHandler)
+-#define notStandaloneHandler (((Parser *)parser)->m_notStandaloneHandler)
+-#define externalEntityRefHandler (((Parser *)parser)->m_externalEntityRefHandler)
+-#define externalEntityRefHandlerArg (((Parser *)parser)->m_externalEntityRefHandlerArg)
+-#define unknownEncodingHandler (((Parser *)parser)->m_unknownEncodingHandler)
+-#define encoding (((Parser *)parser)->m_encoding)
+-#define initEncoding (((Parser *)parser)->m_initEncoding)
+-#define unknownEncodingMem (((Parser *)parser)->m_unknownEncodingMem)
+-#define unknownEncodingData (((Parser *)parser)->m_unknownEncodingData)
+-#define unknownEncodingHandlerData \
+- (((Parser *)parser)->m_unknownEncodingHandlerData)
+-#define unknownEncodingRelease (((Parser *)parser)->m_unknownEncodingRelease)
+-#define protocolEncodingName (((Parser *)parser)->m_protocolEncodingName)
+-#define ns (((Parser *)parser)->m_ns)
+-#define prologState (((Parser *)parser)->m_prologState)
+-#define processor (((Parser *)parser)->m_processor)
+-#define errorCode (((Parser *)parser)->m_errorCode)
+-#define eventPtr (((Parser *)parser)->m_eventPtr)
+-#define eventEndPtr (((Parser *)parser)->m_eventEndPtr)
+-#define positionPtr (((Parser *)parser)->m_positionPtr)
+-#define position (((Parser *)parser)->m_position)
+-#define openInternalEntities (((Parser *)parser)->m_openInternalEntities)
+-#define defaultExpandInternalEntities (((Parser *)parser)->m_defaultExpandInternalEntities)
+-#define tagLevel (((Parser *)parser)->m_tagLevel)
+-#define buffer (((Parser *)parser)->m_buffer)
+-#define bufferPtr (((Parser *)parser)->m_bufferPtr)
+-#define bufferEnd (((Parser *)parser)->m_bufferEnd)
+-#define parseEndByteIndex (((Parser *)parser)->m_parseEndByteIndex)
+-#define parseEndPtr (((Parser *)parser)->m_parseEndPtr)
+-#define bufferLim (((Parser *)parser)->m_bufferLim)
+-#define dataBuf (((Parser *)parser)->m_dataBuf)
+-#define dataBufEnd (((Parser *)parser)->m_dataBufEnd)
+-#define dtd (((Parser *)parser)->m_dtd)
+-#define declEntity (((Parser *)parser)->m_declEntity)
+-#define declNotationName (((Parser *)parser)->m_declNotationName)
+-#define declNotationPublicId (((Parser *)parser)->m_declNotationPublicId)
+-#define declElementType (((Parser *)parser)->m_declElementType)
+-#define declAttributeId (((Parser *)parser)->m_declAttributeId)
+-#define declAttributeIsCdata (((Parser *)parser)->m_declAttributeIsCdata)
+-#define freeTagList (((Parser *)parser)->m_freeTagList)
+-#define freeBindingList (((Parser *)parser)->m_freeBindingList)
+-#define inheritedBindings (((Parser *)parser)->m_inheritedBindings)
+-#define tagStack (((Parser *)parser)->m_tagStack)
+-#define atts (((Parser *)parser)->m_atts)
+-#define attsSize (((Parser *)parser)->m_attsSize)
+-#define nSpecifiedAtts (((Parser *)parser)->m_nSpecifiedAtts)
+-#define tempPool (((Parser *)parser)->m_tempPool)
+-#define temp2Pool (((Parser *)parser)->m_temp2Pool)
+-#define groupConnector (((Parser *)parser)->m_groupConnector)
+-#define groupSize (((Parser *)parser)->m_groupSize)
+-#define hadExternalDoctype (((Parser *)parser)->m_hadExternalDoctype)
+-#define namespaceSeparator (((Parser *)parser)->m_namespaceSeparator)
+-
+-#ifdef _MSC_VER
+-#ifdef _DEBUG
+-Parser *asParser(XML_Parser parser)
+-{
+- return parser;
+-}
+-#endif
+-#endif
+-
+-XML_Parser XML_ParserCreate(const XML_Char *encodingName)
+-{
+- XML_Parser parser = malloc(sizeof(Parser));
+- if (!parser)
+- return parser;
+- processor = prologInitProcessor;
+- XmlPrologStateInit(&prologState);
+- userData = 0;
+- handlerArg = 0;
+- startElementHandler = 0;
+- endElementHandler = 0;
+- characterDataHandler = 0;
+- processingInstructionHandler = 0;
+- commentHandler = 0;
+- startCdataSectionHandler = 0;
+- endCdataSectionHandler = 0;
+- defaultHandler = 0;
+- unparsedEntityDeclHandler = 0;
+- notationDeclHandler = 0;
+- startNamespaceDeclHandler = 0;
+- endNamespaceDeclHandler = 0;
+- notStandaloneHandler = 0;
+- externalEntityRefHandler = 0;
+- externalEntityRefHandlerArg = parser;
+- unknownEncodingHandler = 0;
+- buffer = 0;
+- bufferPtr = 0;
+- bufferEnd = 0;
+- parseEndByteIndex = 0;
+- parseEndPtr = 0;
+- bufferLim = 0;
+- declElementType = 0;
+- declAttributeId = 0;
+- declEntity = 0;
+- declNotationName = 0;
+- declNotationPublicId = 0;
+- memset(&position, 0, sizeof(POSITION));
+- errorCode = XML_ERROR_NONE;
+- eventPtr = 0;
+- eventEndPtr = 0;
+- positionPtr = 0;
+- openInternalEntities = 0;
+- tagLevel = 0;
+- tagStack = 0;
+- freeTagList = 0;
+- freeBindingList = 0;
+- inheritedBindings = 0;
+- attsSize = INIT_ATTS_SIZE;
+- atts = malloc(attsSize * sizeof(ATTRIBUTE));
+- nSpecifiedAtts = 0;
+- dataBuf = malloc(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
+- groupSize = 0;
+- groupConnector = 0;
+- hadExternalDoctype = 0;
+- unknownEncodingMem = 0;
+- unknownEncodingRelease = 0;
+- unknownEncodingData = 0;
+- unknownEncodingHandlerData = 0;
+- namespaceSeparator = '!';
+- ns = 0;
+- poolInit(&tempPool);
+- poolInit(&temp2Pool);
+- protocolEncodingName = encodingName ? poolCopyString(&tempPool, encodingName) : 0;
+- if (!dtdInit(&dtd) || !atts || !dataBuf
+- || (encodingName && !protocolEncodingName)) {
+- XML_ParserFree(parser);
+- return 0;
+- }
+- dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE;
+- XmlInitEncoding(&initEncoding, &encoding, 0);
+- return parser;
+-}
+-
+-XML_Parser XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
+-{
+- static
+- const XML_Char implicitContext[] = {
+- XML_T('x'), XML_T('m'), XML_T('l'), XML_T('='),
+- XML_T('h'), XML_T('t'), XML_T('t'), XML_T('p'), XML_T(':'),
+- XML_T('/'), XML_T('/'), XML_T('w'), XML_T('w'), XML_T('w'),
+- XML_T('.'), XML_T('w'), XML_T('3'),
+- XML_T('.'), XML_T('o'), XML_T('r'), XML_T('g'),
+- XML_T('/'), XML_T('X'), XML_T('M'), XML_T('L'),
+- XML_T('/'), XML_T('1'), XML_T('9'), XML_T('9'), XML_T('8'),
+- XML_T('/'), XML_T('n'), XML_T('a'), XML_T('m'), XML_T('e'),
+- XML_T('s'), XML_T('p'), XML_T('a'), XML_T('c'), XML_T('e'),
+- XML_T('\0')
+- };
+-
+- XML_Parser parser = XML_ParserCreate(encodingName);
+- if (parser) {
+- XmlInitEncodingNS(&initEncoding, &encoding, 0);
+- ns = 1;
+- namespaceSeparator = nsSep;
+- }
+- if (!setContext(parser, implicitContext)) {
+- XML_ParserFree(parser);
+- return 0;
+- }
+- return parser;
+-}
+-
+-int XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
+-{
+- if (!encodingName)
+- protocolEncodingName = 0;
+- else {
+- protocolEncodingName = poolCopyString(&tempPool, encodingName);
+- if (!protocolEncodingName)
+- return 0;
+- }
+- return 1;
+-}
+-
+-XML_Parser XML_ExternalEntityParserCreate(XML_Parser oldParser,
+- const XML_Char *context,
+- const XML_Char *encodingName)
+-{
+- XML_Parser parser = oldParser;
+- DTD *oldDtd = &dtd;
+- XML_StartElementHandler oldStartElementHandler = startElementHandler;
+- XML_EndElementHandler oldEndElementHandler = endElementHandler;
+- XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;
+- XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler;
+- XML_CommentHandler oldCommentHandler = commentHandler;
+- XML_StartCdataSectionHandler oldStartCdataSectionHandler = startCdataSectionHandler;
+- XML_EndCdataSectionHandler oldEndCdataSectionHandler = endCdataSectionHandler;
+- XML_DefaultHandler oldDefaultHandler = defaultHandler;
+- XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler = startNamespaceDeclHandler;
+- XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler = endNamespaceDeclHandler;
+- XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;
+- XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler;
+- XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler;
+- void *oldUserData = userData;
+- void *oldHandlerArg = handlerArg;
+- int oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
+- void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
+-
+- parser = (ns
+- ? XML_ParserCreateNS(encodingName, namespaceSeparator)
+- : XML_ParserCreate(encodingName));
+- if (!parser)
+- return 0;
+- startElementHandler = oldStartElementHandler;
+- endElementHandler = oldEndElementHandler;
+- characterDataHandler = oldCharacterDataHandler;
+- processingInstructionHandler = oldProcessingInstructionHandler;
+- commentHandler = oldCommentHandler;
+- startCdataSectionHandler = oldStartCdataSectionHandler;
+- endCdataSectionHandler = oldEndCdataSectionHandler;
+- defaultHandler = oldDefaultHandler;
+- startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
+- endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
+- notStandaloneHandler = oldNotStandaloneHandler;
+- externalEntityRefHandler = oldExternalEntityRefHandler;
+- unknownEncodingHandler = oldUnknownEncodingHandler;
+- userData = oldUserData;
+- if (oldUserData == oldHandlerArg)
+- handlerArg = userData;
+- else
+- handlerArg = parser;
+- if (oldExternalEntityRefHandlerArg != oldParser)
+- externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
+- defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
+- if (!dtdCopy(&dtd, oldDtd) || !setContext(parser, context)) {
+- XML_ParserFree(parser);
+- return 0;
+- }
+- processor = externalEntityInitProcessor;
+- return parser;
+-}
+-
+-static
+-void destroyBindings(BINDING *bindings)
+-{
+- for (;;) {
+- BINDING *b = bindings;
+- if (!b)
+- break;
+- bindings = b->nextTagBinding;
+- free(b->uri);
+- free(b);
+- }
+-}
+-
+-void XML_ParserFree(XML_Parser parser)
+-{
+- for (;;) {
+- TAG *p;
+- if (tagStack == 0) {
+- if (freeTagList == 0)
+- break;
+- tagStack = freeTagList;
+- freeTagList = 0;
+- }
+- p = tagStack;
+- tagStack = tagStack->parent;
+- free(p->buf);
+- destroyBindings(p->bindings);
+- free(p);
+- }
+- destroyBindings(freeBindingList);
+- destroyBindings(inheritedBindings);
+- poolDestroy(&tempPool);
+- poolDestroy(&temp2Pool);
+- dtdDestroy(&dtd);
+- free((void *)atts);
+- if (groupConnector)
+- free(groupConnector);
+- if (buffer)
+- free(buffer);
+- if (dataBuf)
+- free(dataBuf);
+- if (unknownEncodingMem)
+- free(unknownEncodingMem);
+- if (unknownEncodingRelease)
+- unknownEncodingRelease(unknownEncodingData);
+- free(parser);
+-}
+-
+-void XML_UseParserAsHandlerArg(XML_Parser parser)
+-{
+- handlerArg = parser;
+-}
+-
+-void XML_SetUserData(XML_Parser parser, void *p)
+-{
+- if (handlerArg == userData)
+- handlerArg = userData = p;
+- else
+- userData = p;
+-}
+-
+-int XML_SetBase(XML_Parser parser, const XML_Char *p)
+-{
+- if (p) {
+- p = poolCopyString(&dtd.pool, p);
+- if (!p)
+- return 0;
+- dtd.base = p;
+- }
+- else
+- dtd.base = 0;
+- return 1;
+-}
+-
+-const XML_Char *XML_GetBase(XML_Parser parser)
+-{
+- return dtd.base;
+-}
+-
+-int XML_GetSpecifiedAttributeCount(XML_Parser parser)
+-{
+- return nSpecifiedAtts;
+-}
+-
+-void XML_SetElementHandler(XML_Parser parser,
+- XML_StartElementHandler start,
+- XML_EndElementHandler end)
+-{
+- startElementHandler = start;
+- endElementHandler = end;
+-}
+-
+-void XML_SetCharacterDataHandler(XML_Parser parser,
+- XML_CharacterDataHandler handler)
+-{
+- characterDataHandler = handler;
+-}
+-
+-void XML_SetProcessingInstructionHandler(XML_Parser parser,
+- XML_ProcessingInstructionHandler handler)
+-{
+- processingInstructionHandler = handler;
+-}
+-
+-void XML_SetCommentHandler(XML_Parser parser,
+- XML_CommentHandler handler)
+-{
+- commentHandler = handler;
+-}
+-
+-void XML_SetCdataSectionHandler(XML_Parser parser,
+- XML_StartCdataSectionHandler start,
+- XML_EndCdataSectionHandler end)
+-{
+- startCdataSectionHandler = start;
+- endCdataSectionHandler = end;
+-}
+-
+-void XML_SetDefaultHandler(XML_Parser parser,
+- XML_DefaultHandler handler)
+-{
+- defaultHandler = handler;
+- defaultExpandInternalEntities = 0;
+-}
+-
+-void XML_SetDefaultHandlerExpand(XML_Parser parser,
+- XML_DefaultHandler handler)
+-{
+- defaultHandler = handler;
+- defaultExpandInternalEntities = 1;
+-}
+-
+-void XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
+- XML_UnparsedEntityDeclHandler handler)
+-{
+- unparsedEntityDeclHandler = handler;
+-}
+-
+-void XML_SetNotationDeclHandler(XML_Parser parser,
+- XML_NotationDeclHandler handler)
+-{
+- notationDeclHandler = handler;
+-}
+-
+-void XML_SetNamespaceDeclHandler(XML_Parser parser,
+- XML_StartNamespaceDeclHandler start,
+- XML_EndNamespaceDeclHandler end)
+-{
+- startNamespaceDeclHandler = start;
+- endNamespaceDeclHandler = end;
+-}
+-
+-void XML_SetNotStandaloneHandler(XML_Parser parser,
+- XML_NotStandaloneHandler handler)
+-{
+- notStandaloneHandler = handler;
+-}
+-
+-void XML_SetExternalEntityRefHandler(XML_Parser parser,
+- XML_ExternalEntityRefHandler handler)
+-{
+- externalEntityRefHandler = handler;
+-}
+-
+-void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
+-{
+- if (arg)
+- externalEntityRefHandlerArg = arg;
+- else
+- externalEntityRefHandlerArg = parser;
+-}
+-
+-void XML_SetUnknownEncodingHandler(XML_Parser parser,
+- XML_UnknownEncodingHandler handler,
+- void *data)
+-{
+- unknownEncodingHandler = handler;
+- unknownEncodingHandlerData = data;
+-}
+-
+-int XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
+-{
+- if (len == 0) {
+- if (!isFinal)
+- return 1;
+- positionPtr = bufferPtr;
+- errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0);
+- if (errorCode == XML_ERROR_NONE)
+- return 1;
+- eventEndPtr = eventPtr;
+- return 0;
+- }
+- else if (bufferPtr == bufferEnd) {
+- const char *end;
+- int nLeftOver;
+- parseEndByteIndex += len;
+- positionPtr = s;
+- if (isFinal) {
+- errorCode = processor(parser, s, parseEndPtr = s + len, 0);
+- if (errorCode == XML_ERROR_NONE)
+- return 1;
+- eventEndPtr = eventPtr;
+- return 0;
+- }
+- errorCode = processor(parser, s, parseEndPtr = s + len, &end);
+- if (errorCode != XML_ERROR_NONE) {
+- eventEndPtr = eventPtr;
+- return 0;
+- }
+- XmlUpdatePosition(encoding, positionPtr, end, &position);
+- nLeftOver = s + len - end;
+- if (nLeftOver) {
+- if (buffer == 0 || nLeftOver > bufferLim - buffer) {
+- /* FIXME avoid integer overflow */
+- buffer = buffer == 0 ? malloc(len * 2) : realloc(buffer, len * 2);
+- if (!buffer) {
+- errorCode = XML_ERROR_NO_MEMORY;
+- eventPtr = eventEndPtr = 0;
+- return 0;
+- }
+- bufferLim = buffer + len * 2;
+- }
+- memcpy(buffer, end, nLeftOver);
+- bufferPtr = buffer;
+- bufferEnd = buffer + nLeftOver;
+- }
+- return 1;
+- }
+- else {
+- memcpy(XML_GetBuffer(parser, len), s, len);
+- return XML_ParseBuffer(parser, len, isFinal);
+- }
+-}
+-
+-int XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
+-{
+- const char *start = bufferPtr;
+- positionPtr = start;
+- bufferEnd += len;
+- parseEndByteIndex += len;
+- errorCode = processor(parser, start, parseEndPtr = bufferEnd,
+- isFinal ? (const char **)0 : &bufferPtr);
+- if (errorCode == XML_ERROR_NONE) {
+- if (!isFinal)
+- XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
+- return 1;
+- }
+- else {
+- eventEndPtr = eventPtr;
+- return 0;
+- }
+-}
+-
+-void *XML_GetBuffer(XML_Parser parser, int len)
+-{
+- if (len > bufferLim - bufferEnd) {
+- /* FIXME avoid integer overflow */
+- int neededSize = len + (bufferEnd - bufferPtr);
+- if (neededSize <= bufferLim - buffer) {
+- memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
+- bufferEnd = buffer + (bufferEnd - bufferPtr);
+- bufferPtr = buffer;
+- }
+- else {
+- char *newBuf;
+- int bufferSize = bufferLim - bufferPtr;
+- if (bufferSize == 0)
+- bufferSize = INIT_BUFFER_SIZE;
+- do {
+- bufferSize *= 2;
+- } while (bufferSize < neededSize);
+- newBuf = malloc(bufferSize);
+- if (newBuf == 0) {
+- errorCode = XML_ERROR_NO_MEMORY;
+- return 0;
+- }
+- bufferLim = newBuf + bufferSize;
+- if (bufferPtr) {
+- memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
+- free(buffer);
+- }
+- bufferEnd = newBuf + (bufferEnd - bufferPtr);
+- bufferPtr = buffer = newBuf;
+- }
+- }
+- return bufferEnd;
+-}
+-
+-enum XML_Error XML_GetErrorCode(XML_Parser parser)
+-{
+- return errorCode;
+-}
+-
+-long XML_GetCurrentByteIndex(XML_Parser parser)
+-{
+- if (eventPtr)
+- return parseEndByteIndex - (parseEndPtr - eventPtr);
+- return -1;
+-}
+-
+-int XML_GetCurrentByteCount(XML_Parser parser)
+-{
+- if (eventEndPtr && eventPtr)
+- return eventEndPtr - eventPtr;
+- return 0;
+-}
+-
+-int XML_GetCurrentLineNumber(XML_Parser parser)
+-{
+- if (eventPtr) {
+- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
+- positionPtr = eventPtr;
+- }
+- return position.lineNumber + 1;
+-}
+-
+-int XML_GetCurrentColumnNumber(XML_Parser parser)
+-{
+- if (eventPtr) {
+- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
+- positionPtr = eventPtr;
+- }
+- return position.columnNumber;
+-}
+-
+-void XML_DefaultCurrent(XML_Parser parser)
+-{
+- if (defaultHandler) {
+- if (openInternalEntities)
+- reportDefault(parser,
+- ns ? XmlGetInternalEncodingNS() : XmlGetInternalEncoding(),
+- openInternalEntities->internalEventPtr,
+- openInternalEntities->internalEventEndPtr);
+- else
+- reportDefault(parser, encoding, eventPtr, eventEndPtr);
+- }
+-}
+-
+-const XML_LChar *XML_ErrorString(int code)
+-{
+- static const XML_LChar *message[] = {
+- 0,
+- XML_T("out of memory"),
+- XML_T("syntax error"),
+- XML_T("no element found"),
+- XML_T("not well-formed"),
+- XML_T("unclosed token"),
+- XML_T("unclosed token"),
+- XML_T("mismatched tag"),
+- XML_T("duplicate attribute"),
+- XML_T("junk after document element"),
+- XML_T("illegal parameter entity reference"),
+- XML_T("undefined entity"),
+- XML_T("recursive entity reference"),
+- XML_T("asynchronous entity"),
+- XML_T("reference to invalid character number"),
+- XML_T("reference to binary entity"),
+- XML_T("reference to external entity in attribute"),
+- XML_T("xml processing instruction not at start of external entity"),
+- XML_T("unknown encoding"),
+- XML_T("encoding specified in XML declaration is incorrect"),
+- XML_T("unclosed CDATA section"),
+- XML_T("error in processing external entity reference"),
+- XML_T("document is not standalone")
+- };
+- if (code > 0 && code < sizeof(message)/sizeof(message[0]))
+- return message[code];
+- return 0;
+-}
+-
+-static
+-enum XML_Error contentProcessor(XML_Parser parser,
+- const char *start,
+- const char *end,
+- const char **endPtr)
+-{
+- return doContent(parser, 0, encoding, start, end, endPtr);
+-}
+-
+-static
+-enum XML_Error externalEntityInitProcessor(XML_Parser parser,
+- const char *start,
+- const char *end,
+- const char **endPtr)
+-{
+- enum XML_Error result = initializeEncoding(parser);
+- if (result != XML_ERROR_NONE)
+- return result;
+- processor = externalEntityInitProcessor2;
+- return externalEntityInitProcessor2(parser, start, end, endPtr);
+-}
+-
+-static
+-enum XML_Error externalEntityInitProcessor2(XML_Parser parser,
+- const char *start,
+- const char *end,
+- const char **endPtr)
+-{
+- const char *next;
+- int tok = XmlContentTok(encoding, start, end, &next);
+- switch (tok) {
+- case XML_TOK_BOM:
+- start = next;
+- break;
+- case XML_TOK_PARTIAL:
+- if (endPtr) {
+- *endPtr = start;
+- return XML_ERROR_NONE;
+- }
+- eventPtr = start;
+- return XML_ERROR_UNCLOSED_TOKEN;
+- case XML_TOK_PARTIAL_CHAR:
+- if (endPtr) {
+- *endPtr = start;
+- return XML_ERROR_NONE;
+- }
+- eventPtr = start;
+- return XML_ERROR_PARTIAL_CHAR;
+- }
+- processor = externalEntityInitProcessor3;
+- return externalEntityInitProcessor3(parser, start, end, endPtr);
+-}
+-
+-static
+-enum XML_Error externalEntityInitProcessor3(XML_Parser parser,
+- const char *start,
+- const char *end,
+- const char **endPtr)
+-{
+- const char *next;
+- int tok = XmlContentTok(encoding, start, end, &next);
+- switch (tok) {
+- case XML_TOK_XML_DECL:
+- {
+- enum XML_Error result = processXmlDecl(parser, 1, start, next);
+- if (result != XML_ERROR_NONE)
+- return result;
+- start = next;
+- }
+- break;
+- case XML_TOK_PARTIAL:
+- if (endPtr) {
+- *endPtr = start;
+- return XML_ERROR_NONE;
+- }
+- eventPtr = start;
+- return XML_ERROR_UNCLOSED_TOKEN;
+- case XML_TOK_PARTIAL_CHAR:
+- if (endPtr) {
+- *endPtr = start;
+- return XML_ERROR_NONE;
+- }
+- eventPtr = start;
+- return XML_ERROR_PARTIAL_CHAR;
+- }
+- processor = externalEntityContentProcessor;
+- tagLevel = 1;
+- return doContent(parser, 1, encoding, start, end, endPtr);
+-}
+-
+-static
+-enum XML_Error externalEntityContentProcessor(XML_Parser parser,
+- const char *start,
+- const char *end,
+- const char **endPtr)
+-{
+- return doContent(parser, 1, encoding, start, end, endPtr);
+-}
+-
+-static enum XML_Error
+-doContent(XML_Parser parser,
+- int startTagLevel,
+- const ENCODING *enc,
+- const char *s,
+- const char *end,
+- const char **nextPtr)
+-{
+- const ENCODING *internalEnc = ns ? XmlGetInternalEncodingNS() : XmlGetInternalEncoding();
+- const char **eventPP;
+- const char **eventEndPP;
+- if (enc == encoding) {
+- eventPP = &eventPtr;
+- eventEndPP = &eventEndPtr;
+- }
+- else {
+- eventPP = &(openInternalEntities->internalEventPtr);
+- eventEndPP = &(openInternalEntities->internalEventEndPtr);
+- }
+- *eventPP = s;
+- for (;;) {
+- const char *next = s; /* XmlContentTok doesn't always set the last arg */
+- int tok = XmlContentTok(enc, s, end, &next);
+- *eventEndPP = next;
+- switch (tok) {
+- case XML_TOK_TRAILING_CR:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- *eventEndPP = end;
+- if (characterDataHandler) {
+- XML_Char c = 0xA;
+- characterDataHandler(handlerArg, &c, 1);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, end);
+- if (startTagLevel == 0)
+- return XML_ERROR_NO_ELEMENTS;
+- if (tagLevel != startTagLevel)
+- return XML_ERROR_ASYNC_ENTITY;
+- return XML_ERROR_NONE;
+- case XML_TOK_NONE:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- if (startTagLevel > 0) {
+- if (tagLevel != startTagLevel)
+- return XML_ERROR_ASYNC_ENTITY;
+- return XML_ERROR_NONE;
+- }
+- return XML_ERROR_NO_ELEMENTS;
+- case XML_TOK_INVALID:
+- *eventPP = next;
+- return XML_ERROR_INVALID_TOKEN;
+- case XML_TOK_PARTIAL:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- return XML_ERROR_UNCLOSED_TOKEN;
+- case XML_TOK_PARTIAL_CHAR:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- return XML_ERROR_PARTIAL_CHAR;
+- case XML_TOK_ENTITY_REF:
+- {
+- const XML_Char *name;
+- ENTITY *entity;
+- XML_Char ch = XmlPredefinedEntityName(enc,
+- s + enc->minBytesPerChar,
+- next - enc->minBytesPerChar);
+- if (ch) {
+- if (characterDataHandler)
+- characterDataHandler(handlerArg, &ch, 1);
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- break;
+- }
+- name = poolStoreString(&dtd.pool, enc,
+- s + enc->minBytesPerChar,
+- next - enc->minBytesPerChar);
+- if (!name)
+- return XML_ERROR_NO_MEMORY;
+- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
+- poolDiscard(&dtd.pool);
+- if (!entity) {
+- if (dtd.complete || dtd.standalone)
+- return XML_ERROR_UNDEFINED_ENTITY;
+- if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- break;
+- }
+- if (entity->open)
+- return XML_ERROR_RECURSIVE_ENTITY_REF;
+- if (entity->notation)
+- return XML_ERROR_BINARY_ENTITY_REF;
+- if (entity) {
+- if (entity->textPtr) {
+- enum XML_Error result;
+- OPEN_INTERNAL_ENTITY openEntity;
+- if (defaultHandler && !defaultExpandInternalEntities) {
+- reportDefault(parser, enc, s, next);
+- break;
+- }
+- entity->open = 1;
+- openEntity.next = openInternalEntities;
+- openInternalEntities = &openEntity;
+- openEntity.entity = entity;
+- openEntity.internalEventPtr = 0;
+- openEntity.internalEventEndPtr = 0;
+- result = doContent(parser,
+- tagLevel,
+- internalEnc,
+- (char *)entity->textPtr,
+- (char *)(entity->textPtr + entity->textLen),
+- 0);
+- entity->open = 0;
+- openInternalEntities = openEntity.next;
+- if (result)
+- return result;
+- }
+- else if (externalEntityRefHandler) {
+- const XML_Char *context;
+- entity->open = 1;
+- context = getContext(parser);
+- entity->open = 0;
+- if (!context)
+- return XML_ERROR_NO_MEMORY;
+- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
+- context,
+- dtd.base,
+- entity->systemId,
+- entity->publicId))
+- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
+- poolDiscard(&tempPool);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- }
+- break;
+- }
+- case XML_TOK_START_TAG_WITH_ATTS:
+- if (!startElementHandler) {
+- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
+- if (result)
+- return result;
+- }
+- /* fall through */
+- case XML_TOK_START_TAG_NO_ATTS:
+- {
+- TAG *tag;
+- if (freeTagList) {
+- tag = freeTagList;
+- freeTagList = freeTagList->parent;
+- }
+- else {
+- tag = malloc(sizeof(TAG));
+- if (!tag)
+- return XML_ERROR_NO_MEMORY;
+- tag->buf = malloc(INIT_TAG_BUF_SIZE);
+- if (!tag->buf)
+- return XML_ERROR_NO_MEMORY;
+- tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE;
+- }
+- tag->bindings = 0;
+- tag->parent = tagStack;
+- tagStack = tag;
+- tag->name.localPart = 0;
+- tag->rawName = s + enc->minBytesPerChar;
+- tag->rawNameLength = XmlNameLength(enc, tag->rawName);
+- if (nextPtr) {
+- /* Need to guarantee that:
+- tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */
+- if (tag->rawNameLength + (int)(sizeof(XML_Char) - 1) + (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) {
+- int bufSize = tag->rawNameLength * 4;
+- bufSize = ROUND_UP(bufSize, sizeof(XML_Char));
+- tag->buf = realloc(tag->buf, bufSize);
+- if (!tag->buf)
+- return XML_ERROR_NO_MEMORY;
+- tag->bufEnd = tag->buf + bufSize;
+- }
+- memcpy(tag->buf, tag->rawName, tag->rawNameLength);
+- tag->rawName = tag->buf;
+- }
+- ++tagLevel;
+- if (startElementHandler) {
+- enum XML_Error result;
+- XML_Char *toPtr;
+- for (;;) {
+- const char *rawNameEnd = tag->rawName + tag->rawNameLength;
+- const char *fromPtr = tag->rawName;
+- int bufSize;
+- if (nextPtr)
+- toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)));
+- else
+- toPtr = (XML_Char *)tag->buf;
+- tag->name.str = toPtr;
+- XmlConvert(enc,
+- &fromPtr, rawNameEnd,
+- (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
+- if (fromPtr == rawNameEnd)
+- break;
+- bufSize = (tag->bufEnd - tag->buf) << 1;
+- tag->buf = realloc(tag->buf, bufSize);
+- if (!tag->buf)
+- return XML_ERROR_NO_MEMORY;
+- tag->bufEnd = tag->buf + bufSize;
+- if (nextPtr)
+- tag->rawName = tag->buf;
+- }
+- *toPtr = XML_T('\0');
+- result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));
+- if (result)
+- return result;
+- startElementHandler(handlerArg, tag->name.str, (const XML_Char **)atts);
+- poolClear(&tempPool);
+- }
+- else {
+- tag->name.str = 0;
+- if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- }
+- break;
+- }
+- case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
+- if (!startElementHandler) {
+- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
+- if (result)
+- return result;
+- }
+- /* fall through */
+- case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
+- if (startElementHandler || endElementHandler) {
+- const char *rawName = s + enc->minBytesPerChar;
+- enum XML_Error result;
+- BINDING *bindings = 0;
+- TAG_NAME name;
+- name.str = poolStoreString(&tempPool, enc, rawName,
+- rawName + XmlNameLength(enc, rawName));
+- if (!name.str)
+- return XML_ERROR_NO_MEMORY;
+- poolFinish(&tempPool);
+- result = storeAtts(parser, enc, s, &name, &bindings);
+- if (result)
+- return result;
+- poolFinish(&tempPool);
+- if (startElementHandler)
+- startElementHandler(handlerArg, name.str, (const XML_Char **)atts);
+- if (endElementHandler) {
+- if (startElementHandler)
+- *eventPP = *eventEndPP;
+- endElementHandler(handlerArg, name.str);
+- }
+- poolClear(&tempPool);
+- while (bindings) {
+- BINDING *b = bindings;
+- if (endNamespaceDeclHandler)
+- endNamespaceDeclHandler(handlerArg, b->prefix->name);
+- bindings = bindings->nextTagBinding;
+- b->nextTagBinding = freeBindingList;
+- freeBindingList = b;
+- b->prefix->binding = b->prevPrefixBinding;
+- }
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- if (tagLevel == 0)
+- return epilogProcessor(parser, next, end, nextPtr);
+- break;
+- case XML_TOK_END_TAG:
+- if (tagLevel == startTagLevel)
+- return XML_ERROR_ASYNC_ENTITY;
+- else {
+- int len;
+- const char *rawName;
+- TAG *tag = tagStack;
+- tagStack = tag->parent;
+- tag->parent = freeTagList;
+- freeTagList = tag;
+- rawName = s + enc->minBytesPerChar*2;
+- len = XmlNameLength(enc, rawName);
+- if (len != tag->rawNameLength
+- || memcmp(tag->rawName, rawName, len) != 0) {
+- *eventPP = rawName;
+- return XML_ERROR_TAG_MISMATCH;
+- }
+- --tagLevel;
+- if (endElementHandler && tag->name.str) {
+- if (tag->name.localPart) {
+- XML_Char *to = (XML_Char *)tag->name.str + tag->name.uriLen;
+- const XML_Char *from = tag->name.localPart;
+- while ((*to++ = *from++) != 0)
+- ;
+- }
+- endElementHandler(handlerArg, tag->name.str);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- while (tag->bindings) {
+- BINDING *b = tag->bindings;
+- if (endNamespaceDeclHandler)
+- endNamespaceDeclHandler(handlerArg, b->prefix->name);
+- tag->bindings = tag->bindings->nextTagBinding;
+- b->nextTagBinding = freeBindingList;
+- freeBindingList = b;
+- b->prefix->binding = b->prevPrefixBinding;
+- }
+- if (tagLevel == 0)
+- return epilogProcessor(parser, next, end, nextPtr);
+- }
+- break;
+- case XML_TOK_CHAR_REF:
+- {
+- int n = XmlCharRefNumber(enc, s);
+- if (n < 0)
+- return XML_ERROR_BAD_CHAR_REF;
+- if (characterDataHandler) {
+- XML_Char buf[XML_ENCODE_MAX];
+- characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf));
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- }
+- break;
+- case XML_TOK_XML_DECL:
+- return XML_ERROR_MISPLACED_XML_PI;
+- case XML_TOK_DATA_NEWLINE:
+- if (characterDataHandler) {
+- XML_Char c = 0xA;
+- characterDataHandler(handlerArg, &c, 1);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- break;
+- case XML_TOK_CDATA_SECT_OPEN:
+- {
+- enum XML_Error result;
+- if (startCdataSectionHandler)
+- startCdataSectionHandler(handlerArg);
+-#if 0
+- /* Suppose you doing a transformation on a document that involves
+- changing only the character data. You set up a defaultHandler
+- and a characterDataHandler. The defaultHandler simply copies
+- characters through. The characterDataHandler does the transformation
+- and writes the characters out escaping them as necessary. This case
+- will fail to work if we leave out the following two lines (because &
+- and < inside CDATA sections will be incorrectly escaped).
+-
+- However, now we have a start/endCdataSectionHandler, so it seems
+- easier to let the user deal with this. */
+-
+- else if (characterDataHandler)
+- characterDataHandler(handlerArg, dataBuf, 0);
+-#endif
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- result = doCdataSection(parser, enc, &next, end, nextPtr);
+- if (!next) {
+- processor = cdataSectionProcessor;
+- return result;
+- }
+- }
+- break;
+- case XML_TOK_TRAILING_RSQB:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- if (characterDataHandler) {
+- if (MUST_CONVERT(enc, s)) {
+- ICHAR *dataPtr = (ICHAR *)dataBuf;
+- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
+- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
+- }
+- else
+- characterDataHandler(handlerArg,
+- (XML_Char *)s,
+- (XML_Char *)end - (XML_Char *)s);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, end);
+- if (startTagLevel == 0) {
+- *eventPP = end;
+- return XML_ERROR_NO_ELEMENTS;
+- }
+- if (tagLevel != startTagLevel) {
+- *eventPP = end;
+- return XML_ERROR_ASYNC_ENTITY;
+- }
+- return XML_ERROR_NONE;
+- case XML_TOK_DATA_CHARS:
+- if (characterDataHandler) {
+- if (MUST_CONVERT(enc, s)) {
+- for (;;) {
+- ICHAR *dataPtr = (ICHAR *)dataBuf;
+- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+- *eventEndPP = s;
+- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
+- if (s == next)
+- break;
+- *eventPP = s;
+- }
+- }
+- else
+- characterDataHandler(handlerArg,
+- (XML_Char *)s,
+- (XML_Char *)next - (XML_Char *)s);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- break;
+- case XML_TOK_PI:
+- if (!reportProcessingInstruction(parser, enc, s, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- case XML_TOK_COMMENT:
+- if (!reportComment(parser, enc, s, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- default:
+- if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- break;
+- }
+- *eventPP = s = next;
+- }
+- /* not reached */
+-}
+-
+-/* If tagNamePtr is non-null, build a real list of attributes,
+-otherwise just check the attributes for well-formedness. */
+-
+-static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc,
+- const char *s, TAG_NAME *tagNamePtr,
+- BINDING **bindingsPtr)
+-{
+- ELEMENT_TYPE *elementType = 0;
+- int nDefaultAtts = 0;
+- const XML_Char **appAtts;
+- int attIndex = 0;
+- int i;
+- int n;
+- int nPrefixes = 0;
+- BINDING *binding;
+- const XML_Char *localPart;
+-
+- if (tagNamePtr) {
+- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, 0);
+- if (!elementType) {
+- tagNamePtr->str = poolCopyString(&dtd.pool, tagNamePtr->str);
+- if (!tagNamePtr->str)
+- return XML_ERROR_NO_MEMORY;
+- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, sizeof(ELEMENT_TYPE));
+- if (!elementType)
+- return XML_ERROR_NO_MEMORY;
+- if (ns && !setElementTypePrefix(parser, elementType))
+- return XML_ERROR_NO_MEMORY;
+- }
+- nDefaultAtts = elementType->nDefaultAtts;
+- }
+- n = XmlGetAttributes(enc, s, attsSize, atts);
+- if (n + nDefaultAtts > attsSize) {
+- int oldAttsSize = attsSize;
+- attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;
+- atts = realloc((void *)atts, attsSize * sizeof(ATTRIBUTE));
+- if (!atts)
+- return XML_ERROR_NO_MEMORY;
+- if (n > oldAttsSize)
+- XmlGetAttributes(enc, s, n, atts);
+- }
+- appAtts = (const XML_Char **)atts;
+- for (i = 0; i < n; i++) {
+- ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name,
+- atts[i].name
+- + XmlNameLength(enc, atts[i].name));
+- if (!attId)
+- return XML_ERROR_NO_MEMORY;
+- if ((attId->name)[-1]) {
+- if (enc == encoding)
+- eventPtr = atts[i].name;
+- return XML_ERROR_DUPLICATE_ATTRIBUTE;
+- }
+- (attId->name)[-1] = 1;
+- appAtts[attIndex++] = attId->name;
+- if (!atts[i].normalized) {
+- enum XML_Error result;
+- int isCdata = 1;
+-
+- if (attId->maybeTokenized) {
+- int j;
+- for (j = 0; j < nDefaultAtts; j++) {
+- if (attId == elementType->defaultAtts[j].id) {
+- isCdata = elementType->defaultAtts[j].isCdata;
+- break;
+- }
+- }
+- }
+-
+- result = storeAttributeValue(parser, enc, isCdata,
+- atts[i].valuePtr, atts[i].valueEnd,
+- &tempPool);
+- if (result)
+- return result;
+- if (tagNamePtr) {
+- appAtts[attIndex] = poolStart(&tempPool);
+- poolFinish(&tempPool);
+- }
+- else
+- poolDiscard(&tempPool);
+- }
+- else if (tagNamePtr) {
+- appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd);
+- if (appAtts[attIndex] == 0)
+- return XML_ERROR_NO_MEMORY;
+- poolFinish(&tempPool);
+- }
+- if (attId->prefix && tagNamePtr) {
+- if (attId->xmlns) {
+- if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex], bindingsPtr))
+- return XML_ERROR_NO_MEMORY;
+- --attIndex;
+- }
+- else {
+- attIndex++;
+- nPrefixes++;
+- (attId->name)[-1] = 2;
+- }
+- }
+- else
+- attIndex++;
+- }
+- nSpecifiedAtts = attIndex;
+- if (tagNamePtr) {
+- int j;
+- for (j = 0; j < nDefaultAtts; j++) {
+- const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j;
+- if (!(da->id->name)[-1] && da->value) {
+- if (da->id->prefix) {
+- if (da->id->xmlns) {
+- if (!addBinding(parser, da->id->prefix, da->id, da->value, bindingsPtr))
+- return XML_ERROR_NO_MEMORY;
+- }
+- else {
+- (da->id->name)[-1] = 2;
+- nPrefixes++;
+- appAtts[attIndex++] = da->id->name;
+- appAtts[attIndex++] = da->value;
+- }
+- }
+- else {
+- (da->id->name)[-1] = 1;
+- appAtts[attIndex++] = da->id->name;
+- appAtts[attIndex++] = da->value;
+- }
+- }
+- }
+- appAtts[attIndex] = 0;
+- }
+- i = 0;
+- if (nPrefixes) {
+- for (; i < attIndex; i += 2) {
+- if (appAtts[i][-1] == 2) {
+- ATTRIBUTE_ID *id;
+- ((XML_Char *)(appAtts[i]))[-1] = 0;
+- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0);
+- if (id->prefix->binding) {
+- int j;
+- const BINDING *b = id->prefix->binding;
+- const XML_Char *s = appAtts[i];
+- for (j = 0; j < b->uriLen; j++) {
+- if (!poolAppendChar(&tempPool, b->uri[j]))
+- return XML_ERROR_NO_MEMORY;
+- }
+- while (*s++ != ':')
+- ;
+- do {
+- if (!poolAppendChar(&tempPool, *s))
+- return XML_ERROR_NO_MEMORY;
+- } while (*s++);
+- appAtts[i] = poolStart(&tempPool);
+- poolFinish(&tempPool);
+- }
+- if (!--nPrefixes)
+- break;
+- }
+- else
+- ((XML_Char *)(appAtts[i]))[-1] = 0;
+- }
+- }
+- for (; i < attIndex; i += 2)
+- ((XML_Char *)(appAtts[i]))[-1] = 0;
+- if (!tagNamePtr)
+- return XML_ERROR_NONE;
+- for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding)
+- binding->attId->name[-1] = 0;
+- if (elementType->prefix) {
+- binding = elementType->prefix->binding;
+- if (!binding)
+- return XML_ERROR_NONE;
+- localPart = tagNamePtr->str;
+- while (*localPart++ != XML_T(':'))
+- ;
+- }
+- else if (dtd.defaultPrefix.binding) {
+- binding = dtd.defaultPrefix.binding;
+- localPart = tagNamePtr->str;
+- }
+- else
+- return XML_ERROR_NONE;
+- tagNamePtr->localPart = localPart;
+- tagNamePtr->uriLen = binding->uriLen;
+- i = binding->uriLen;
+- do {
+- if (i == binding->uriAlloc) {
+- binding->uri = realloc(binding->uri, binding->uriAlloc *= 2);
+- if (!binding->uri)
+- return XML_ERROR_NO_MEMORY;
+- }
+- binding->uri[i++] = *localPart;
+- } while (*localPart++);
+- tagNamePtr->str = binding->uri;
+- return XML_ERROR_NONE;
+-}
+-
+-static
+-int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr)
+-{
+- BINDING *b;
+- int len;
+- for (len = 0; uri[len]; len++)
+- ;
+- if (namespaceSeparator)
+- len++;
+- if (freeBindingList) {
+- b = freeBindingList;
+- if (len > b->uriAlloc) {
+- b->uri = realloc(b->uri, len + EXPAND_SPARE);
+- if (!b->uri)
+- return 0;
+- b->uriAlloc = len + EXPAND_SPARE;
+- }
+- freeBindingList = b->nextTagBinding;
+- }
+- else {
+- b = malloc(sizeof(BINDING));
+- if (!b)
+- return 0;
+- b->uri = malloc(sizeof(XML_Char) * len + EXPAND_SPARE);
+- if (!b->uri) {
+- free(b);
+- return 0;
+- }
+- b->uriAlloc = len;
+- }
+- b->uriLen = len;
+- memcpy(b->uri, uri, len * sizeof(XML_Char));
+- if (namespaceSeparator)
+- b->uri[len - 1] = namespaceSeparator;
+- b->prefix = prefix;
+- b->attId = attId;
+- b->prevPrefixBinding = prefix->binding;
+- if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix)
+- prefix->binding = 0;
+- else
+- prefix->binding = b;
+- b->nextTagBinding = *bindingsPtr;
+- *bindingsPtr = b;
+- if (startNamespaceDeclHandler)
+- startNamespaceDeclHandler(handlerArg, prefix->name,
+- prefix->binding ? uri : 0);
+- return 1;
+-}
+-
+-/* The idea here is to avoid using stack for each CDATA section when
+-the whole file is parsed with one call. */
+-
+-static
+-enum XML_Error cdataSectionProcessor(XML_Parser parser,
+- const char *start,
+- const char *end,
+- const char **endPtr)
+-{
+- enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr);
+- if (start) {
+- processor = contentProcessor;
+- return contentProcessor(parser, start, end, endPtr);
+- }
+- return result;
+-}
+-
+-/* startPtr gets set to non-null is the section is closed, and to null if
+-the section is not yet closed. */
+-
+-static
+-enum XML_Error doCdataSection(XML_Parser parser,
+- const ENCODING *enc,
+- const char **startPtr,
+- const char *end,
+- const char **nextPtr)
+-{
+- const char *s = *startPtr;
+- const char **eventPP;
+- const char **eventEndPP;
+- if (enc == encoding) {
+- eventPP = &eventPtr;
+- *eventPP = s;
+- eventEndPP = &eventEndPtr;
+- }
+- else {
+- eventPP = &(openInternalEntities->internalEventPtr);
+- eventEndPP = &(openInternalEntities->internalEventEndPtr);
+- }
+- *eventPP = s;
+- *startPtr = 0;
+- for (;;) {
+- const char *next;
+- int tok = XmlCdataSectionTok(enc, s, end, &next);
+- *eventEndPP = next;
+- switch (tok) {
+- case XML_TOK_CDATA_SECT_CLOSE:
+- if (endCdataSectionHandler)
+- endCdataSectionHandler(handlerArg);
+-#if 0
+- /* see comment under XML_TOK_CDATA_SECT_OPEN */
+- else if (characterDataHandler)
+- characterDataHandler(handlerArg, dataBuf, 0);
+-#endif
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- *startPtr = next;
+- return XML_ERROR_NONE;
+- case XML_TOK_DATA_NEWLINE:
+- if (characterDataHandler) {
+- XML_Char c = 0xA;
+- characterDataHandler(handlerArg, &c, 1);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- break;
+- case XML_TOK_DATA_CHARS:
+- if (characterDataHandler) {
+- if (MUST_CONVERT(enc, s)) {
+- for (;;) {
+- ICHAR *dataPtr = (ICHAR *)dataBuf;
+- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+- *eventEndPP = next;
+- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
+- if (s == next)
+- break;
+- *eventPP = s;
+- }
+- }
+- else
+- characterDataHandler(handlerArg,
+- (XML_Char *)s,
+- (XML_Char *)next - (XML_Char *)s);
+- }
+- else if (defaultHandler)
+- reportDefault(parser, enc, s, next);
+- break;
+- case XML_TOK_INVALID:
+- *eventPP = next;
+- return XML_ERROR_INVALID_TOKEN;
+- case XML_TOK_PARTIAL_CHAR:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- return XML_ERROR_PARTIAL_CHAR;
+- case XML_TOK_PARTIAL:
+- case XML_TOK_NONE:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- return XML_ERROR_UNCLOSED_CDATA_SECTION;
+- default:
+- abort();
+- }
+- *eventPP = s = next;
+- }
+- /* not reached */
+-}
+-
+-static enum XML_Error
+-initializeEncoding(XML_Parser parser)
+-{
+- const char *s;
+-#ifdef XML_UNICODE
+- char encodingBuf[128];
+- if (!protocolEncodingName)
+- s = 0;
+- else {
+- int i;
+- for (i = 0; protocolEncodingName[i]; i++) {
+- if (i == sizeof(encodingBuf) - 1
+- || protocolEncodingName[i] >= 0x80
+- || protocolEncodingName[i] < 0) {
+- encodingBuf[0] = '\0';
+- break;
+- }
+- encodingBuf[i] = (char)protocolEncodingName[i];
+- }
+- encodingBuf[i] = '\0';
+- s = encodingBuf;
+- }
+-#else
+- s = protocolEncodingName;
+-#endif
+- if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s))
+- return XML_ERROR_NONE;
+- return handleUnknownEncoding(parser, protocolEncodingName);
+-}
+-
+-static enum XML_Error
+-processXmlDecl(XML_Parser parser, int isGeneralTextEntity,
+- const char *s, const char *next)
+-{
+- const char *encodingName = 0;
+- const ENCODING *newEncoding = 0;
+- const char *version;
+- int standalone = -1;
+- if (!(ns
+- ? XmlParseXmlDeclNS
+- : XmlParseXmlDecl)(isGeneralTextEntity,
+- encoding,
+- s,
+- next,
+- &eventPtr,
+- &version,
+- &encodingName,
+- &newEncoding,
+- &standalone))
+- return XML_ERROR_SYNTAX;
+- if (!isGeneralTextEntity && standalone == 1)
+- dtd.standalone = 1;
+- if (defaultHandler)
+- reportDefault(parser, encoding, s, next);
+- if (!protocolEncodingName) {
+- if (newEncoding) {
+- if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) {
+- eventPtr = encodingName;
+- return XML_ERROR_INCORRECT_ENCODING;
+- }
+- encoding = newEncoding;
+- }
+- else if (encodingName) {
+- enum XML_Error result;
+- const XML_Char *s = poolStoreString(&tempPool,
+- encoding,
+- encodingName,
+- encodingName
+- + XmlNameLength(encoding, encodingName));
+- if (!s)
+- return XML_ERROR_NO_MEMORY;
+- result = handleUnknownEncoding(parser, s);
+- poolDiscard(&tempPool);
+- if (result == XML_ERROR_UNKNOWN_ENCODING)
+- eventPtr = encodingName;
+- return result;
+- }
+- }
+- return XML_ERROR_NONE;
+-}
+-
+-static enum XML_Error
+-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)
+-{
+- if (unknownEncodingHandler) {
+- XML_Encoding info;
+- int i;
+- for (i = 0; i < 256; i++)
+- info.map[i] = -1;
+- info.convert = 0;
+- info.data = 0;
+- info.release = 0;
+- if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, &info)) {
+- ENCODING *enc;
+- unknownEncodingMem = malloc(XmlSizeOfUnknownEncoding());
+- if (!unknownEncodingMem) {
+- if (info.release)
+- info.release(info.data);
+- return XML_ERROR_NO_MEMORY;
+- }
+- enc = (ns
+- ? XmlInitUnknownEncodingNS
+- : XmlInitUnknownEncoding)(unknownEncodingMem,
+- info.map,
+- info.convert,
+- info.data);
+- if (enc) {
+- unknownEncodingData = info.data;
+- unknownEncodingRelease = info.release;
+- encoding = enc;
+- return XML_ERROR_NONE;
+- }
+- }
+- if (info.release)
+- info.release(info.data);
+- }
+- return XML_ERROR_UNKNOWN_ENCODING;
+-}
+-
+-static enum XML_Error
+-prologInitProcessor(XML_Parser parser,
+- const char *s,
+- const char *end,
+- const char **nextPtr)
+-{
+- enum XML_Error result = initializeEncoding(parser);
+- if (result != XML_ERROR_NONE)
+- return result;
+- processor = prologProcessor;
+- return prologProcessor(parser, s, end, nextPtr);
+-}
+-
+-static enum XML_Error
+-prologProcessor(XML_Parser parser,
+- const char *s,
+- const char *end,
+- const char **nextPtr)
+-{
+- for (;;) {
+- const char *next;
+- int tok = XmlPrologTok(encoding, s, end, &next);
+- if (tok <= 0) {
+- if (nextPtr != 0 && tok != XML_TOK_INVALID) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- switch (tok) {
+- case XML_TOK_INVALID:
+- eventPtr = next;
+- return XML_ERROR_INVALID_TOKEN;
+- case XML_TOK_NONE:
+- return XML_ERROR_NO_ELEMENTS;
+- case XML_TOK_PARTIAL:
+- return XML_ERROR_UNCLOSED_TOKEN;
+- case XML_TOK_PARTIAL_CHAR:
+- return XML_ERROR_PARTIAL_CHAR;
+- case XML_TOK_TRAILING_CR:
+- eventPtr = s + encoding->minBytesPerChar;
+- return XML_ERROR_NO_ELEMENTS;
+- default:
+- abort();
+- }
+- }
+- switch (XmlTokenRole(&prologState, tok, s, next, encoding)) {
+- case XML_ROLE_XML_DECL:
+- {
+- enum XML_Error result = processXmlDecl(parser, 0, s, next);
+- if (result != XML_ERROR_NONE)
+- return result;
+- }
+- break;
+- case XML_ROLE_DOCTYPE_SYSTEM_ID:
+- if (!dtd.standalone
+- && notStandaloneHandler
+- && !notStandaloneHandler(handlerArg))
+- return XML_ERROR_NOT_STANDALONE;
+- hadExternalDoctype = 1;
+- break;
+- case XML_ROLE_DOCTYPE_PUBLIC_ID:
+- case XML_ROLE_ENTITY_PUBLIC_ID:
+- if (!XmlIsPublicId(encoding, s, next, &eventPtr))
+- return XML_ERROR_SYNTAX;
+- if (declEntity) {
+- XML_Char *tem = poolStoreString(&dtd.pool,
+- encoding,
+- s + encoding->minBytesPerChar,
+- next - encoding->minBytesPerChar);
+- if (!tem)
+- return XML_ERROR_NO_MEMORY;
+- normalizePublicId(tem);
+- declEntity->publicId = tem;
+- poolFinish(&dtd.pool);
+- }
+- break;
+- case XML_ROLE_INSTANCE_START:
+- processor = contentProcessor;
+- if (hadExternalDoctype)
+- dtd.complete = 0;
+- return contentProcessor(parser, s, end, nextPtr);
+- case XML_ROLE_ATTLIST_ELEMENT_NAME:
+- {
+- const XML_Char *name = poolStoreString(&dtd.pool, encoding, s, next);
+- if (!name)
+- return XML_ERROR_NO_MEMORY;
+- declElementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE));
+- if (!declElementType)
+- return XML_ERROR_NO_MEMORY;
+- if (declElementType->name != name)
+- poolDiscard(&dtd.pool);
+- else {
+- poolFinish(&dtd.pool);
+- if (!setElementTypePrefix(parser, declElementType))
+- return XML_ERROR_NO_MEMORY;
+- }
+- break;
+- }
+- case XML_ROLE_ATTRIBUTE_NAME:
+- declAttributeId = getAttributeId(parser, encoding, s, next);
+- if (!declAttributeId)
+- return XML_ERROR_NO_MEMORY;
+- declAttributeIsCdata = 0;
+- break;
+- case XML_ROLE_ATTRIBUTE_TYPE_CDATA:
+- declAttributeIsCdata = 1;
+- break;
+- case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:
+- case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:
+- if (dtd.complete
+- && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, 0))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:
+- case XML_ROLE_FIXED_ATTRIBUTE_VALUE:
+- {
+- const XML_Char *attVal;
+- enum XML_Error result
+- = storeAttributeValue(parser, encoding, declAttributeIsCdata,
+- s + encoding->minBytesPerChar,
+- next - encoding->minBytesPerChar,
+- &dtd.pool);
+- if (result)
+- return result;
+- attVal = poolStart(&dtd.pool);
+- poolFinish(&dtd.pool);
+- if (dtd.complete
+- && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, attVal))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- }
+- case XML_ROLE_ENTITY_VALUE:
+- {
+- enum XML_Error result = storeEntityValue(parser, s, next);
+- if (result != XML_ERROR_NONE)
+- return result;
+- }
+- break;
+- case XML_ROLE_ENTITY_SYSTEM_ID:
+- if (declEntity) {
+- declEntity->systemId = poolStoreString(&dtd.pool, encoding,
+- s + encoding->minBytesPerChar,
+- next - encoding->minBytesPerChar);
+- if (!declEntity->systemId)
+- return XML_ERROR_NO_MEMORY;
+- declEntity->base = dtd.base;
+- poolFinish(&dtd.pool);
+- }
+- break;
+- case XML_ROLE_ENTITY_NOTATION_NAME:
+- if (declEntity) {
+- declEntity->notation = poolStoreString(&dtd.pool, encoding, s, next);
+- if (!declEntity->notation)
+- return XML_ERROR_NO_MEMORY;
+- poolFinish(&dtd.pool);
+- if (unparsedEntityDeclHandler) {
+- eventPtr = eventEndPtr = s;
+- unparsedEntityDeclHandler(handlerArg,
+- declEntity->name,
+- declEntity->base,
+- declEntity->systemId,
+- declEntity->publicId,
+- declEntity->notation);
+- }
+-
+- }
+- break;
+- case XML_ROLE_GENERAL_ENTITY_NAME:
+- {
+- const XML_Char *name;
+- if (XmlPredefinedEntityName(encoding, s, next)) {
+- declEntity = 0;
+- break;
+- }
+- name = poolStoreString(&dtd.pool, encoding, s, next);
+- if (!name)
+- return XML_ERROR_NO_MEMORY;
+- if (dtd.complete) {
+- declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, sizeof(ENTITY));
+- if (!declEntity)
+- return XML_ERROR_NO_MEMORY;
+- if (declEntity->name != name) {
+- poolDiscard(&dtd.pool);
+- declEntity = 0;
+- }
+- else
+- poolFinish(&dtd.pool);
+- }
+- else {
+- poolDiscard(&dtd.pool);
+- declEntity = 0;
+- }
+- }
+- break;
+- case XML_ROLE_PARAM_ENTITY_NAME:
+- declEntity = 0;
+- break;
+- case XML_ROLE_NOTATION_NAME:
+- declNotationPublicId = 0;
+- declNotationName = 0;
+- if (notationDeclHandler) {
+- declNotationName = poolStoreString(&tempPool, encoding, s, next);
+- if (!declNotationName)
+- return XML_ERROR_NO_MEMORY;
+- poolFinish(&tempPool);
+- }
+- break;
+- case XML_ROLE_NOTATION_PUBLIC_ID:
+- if (!XmlIsPublicId(encoding, s, next, &eventPtr))
+- return XML_ERROR_SYNTAX;
+- if (declNotationName) {
+- XML_Char *tem = poolStoreString(&tempPool,
+- encoding,
+- s + encoding->minBytesPerChar,
+- next - encoding->minBytesPerChar);
+- if (!tem)
+- return XML_ERROR_NO_MEMORY;
+- normalizePublicId(tem);
+- declNotationPublicId = tem;
+- poolFinish(&tempPool);
+- }
+- break;
+- case XML_ROLE_NOTATION_SYSTEM_ID:
+- if (declNotationName && notationDeclHandler) {
+- const XML_Char *systemId
+- = poolStoreString(&tempPool, encoding,
+- s + encoding->minBytesPerChar,
+- next - encoding->minBytesPerChar);
+- if (!systemId)
+- return XML_ERROR_NO_MEMORY;
+- eventPtr = eventEndPtr = s;
+- notationDeclHandler(handlerArg,
+- declNotationName,
+- dtd.base,
+- systemId,
+- declNotationPublicId);
+- }
+- poolClear(&tempPool);
+- break;
+- case XML_ROLE_NOTATION_NO_SYSTEM_ID:
+- if (declNotationPublicId && notationDeclHandler) {
+- eventPtr = eventEndPtr = s;
+- notationDeclHandler(handlerArg,
+- declNotationName,
+- dtd.base,
+- 0,
+- declNotationPublicId);
+- }
+- poolClear(&tempPool);
+- break;
+- case XML_ROLE_ERROR:
+- eventPtr = s;
+- switch (tok) {
+- case XML_TOK_PARAM_ENTITY_REF:
+- return XML_ERROR_PARAM_ENTITY_REF;
+- case XML_TOK_XML_DECL:
+- return XML_ERROR_MISPLACED_XML_PI;
+- default:
+- return XML_ERROR_SYNTAX;
+- }
+- case XML_ROLE_GROUP_OPEN:
+- if (prologState.level >= groupSize) {
+- if (groupSize)
+- groupConnector = realloc(groupConnector, groupSize *= 2);
+- else
+- groupConnector = malloc(groupSize = 32);
+- if (!groupConnector)
+- return XML_ERROR_NO_MEMORY;
+- }
+- groupConnector[prologState.level] = 0;
+- break;
+- case XML_ROLE_GROUP_SEQUENCE:
+- if (groupConnector[prologState.level] == '|') {
+- eventPtr = s;
+- return XML_ERROR_SYNTAX;
+- }
+- groupConnector[prologState.level] = ',';
+- break;
+- case XML_ROLE_GROUP_CHOICE:
+- if (groupConnector[prologState.level] == ',') {
+- eventPtr = s;
+- return XML_ERROR_SYNTAX;
+- }
+- groupConnector[prologState.level] = '|';
+- break;
+- case XML_ROLE_PARAM_ENTITY_REF:
+- if (!dtd.standalone
+- && notStandaloneHandler
+- && !notStandaloneHandler(handlerArg))
+- return XML_ERROR_NOT_STANDALONE;
+- dtd.complete = 0;
+- break;
+- case XML_ROLE_NONE:
+- switch (tok) {
+- case XML_TOK_PI:
+- eventPtr = s;
+- eventEndPtr = next;
+- if (!reportProcessingInstruction(parser, encoding, s, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- case XML_TOK_COMMENT:
+- eventPtr = s;
+- eventEndPtr = next;
+- if (!reportComment(parser, encoding, s, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- }
+- break;
+- }
+- if (defaultHandler) {
+- switch (tok) {
+- case XML_TOK_PI:
+- case XML_TOK_COMMENT:
+- case XML_TOK_BOM:
+- case XML_TOK_XML_DECL:
+- break;
+- default:
+- eventPtr = s;
+- eventEndPtr = next;
+- reportDefault(parser, encoding, s, next);
+- }
+- }
+- s = next;
+- }
+- /* not reached */
+-}
+-
+-static
+-enum XML_Error epilogProcessor(XML_Parser parser,
+- const char *s,
+- const char *end,
+- const char **nextPtr)
+-{
+- processor = epilogProcessor;
+- eventPtr = s;
+- for (;;) {
+- const char *next;
+- int tok = XmlPrologTok(encoding, s, end, &next);
+- eventEndPtr = next;
+- switch (tok) {
+- case XML_TOK_TRAILING_CR:
+- if (defaultHandler) {
+- eventEndPtr = end;
+- reportDefault(parser, encoding, s, end);
+- }
+- /* fall through */
+- case XML_TOK_NONE:
+- if (nextPtr)
+- *nextPtr = end;
+- return XML_ERROR_NONE;
+- case XML_TOK_PROLOG_S:
+- if (defaultHandler)
+- reportDefault(parser, encoding, s, next);
+- break;
+- case XML_TOK_PI:
+- if (!reportProcessingInstruction(parser, encoding, s, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- case XML_TOK_COMMENT:
+- if (!reportComment(parser, encoding, s, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- case XML_TOK_INVALID:
+- eventPtr = next;
+- return XML_ERROR_INVALID_TOKEN;
+- case XML_TOK_PARTIAL:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- return XML_ERROR_UNCLOSED_TOKEN;
+- case XML_TOK_PARTIAL_CHAR:
+- if (nextPtr) {
+- *nextPtr = s;
+- return XML_ERROR_NONE;
+- }
+- return XML_ERROR_PARTIAL_CHAR;
+- default:
+- return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
+- }
+- eventPtr = s = next;
+- }
+-}
+-
+-static
+-enum XML_Error errorProcessor(XML_Parser parser,
+- const char *s,
+- const char *end,
+- const char **nextPtr)
+-{
+- return errorCode;
+-}
+-
+-static enum XML_Error
+-storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
+- const char *ptr, const char *end,
+- STRING_POOL *pool)
+-{
+- enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, end, pool);
+- if (result)
+- return result;
+- if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
+- poolChop(pool);
+- if (!poolAppendChar(pool, XML_T('\0')))
+- return XML_ERROR_NO_MEMORY;
+- return XML_ERROR_NONE;
+-}
+-
+-static enum XML_Error
+-appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
+- const char *ptr, const char *end,
+- STRING_POOL *pool)
+-{
+- const ENCODING *internalEnc = ns ? XmlGetInternalEncodingNS() : XmlGetInternalEncoding();
+- for (;;) {
+- const char *next;
+- int tok = XmlAttributeValueTok(enc, ptr, end, &next);
+- switch (tok) {
+- case XML_TOK_NONE:
+- return XML_ERROR_NONE;
+- case XML_TOK_INVALID:
+- if (enc == encoding)
+- eventPtr = next;
+- return XML_ERROR_INVALID_TOKEN;
+- case XML_TOK_PARTIAL:
+- if (enc == encoding)
+- eventPtr = ptr;
+- return XML_ERROR_INVALID_TOKEN;
+- case XML_TOK_CHAR_REF:
+- {
+- XML_Char buf[XML_ENCODE_MAX];
+- int i;
+- int n = XmlCharRefNumber(enc, ptr);
+- if (n < 0) {
+- if (enc == encoding)
+- eventPtr = ptr;
+- return XML_ERROR_BAD_CHAR_REF;
+- }
+- if (!isCdata
+- && n == 0x20 /* space */
+- && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
+- break;
+- n = XmlEncode(n, (ICHAR *)buf);
+- if (!n) {
+- if (enc == encoding)
+- eventPtr = ptr;
+- return XML_ERROR_BAD_CHAR_REF;
+- }
+- for (i = 0; i < n; i++) {
+- if (!poolAppendChar(pool, buf[i]))
+- return XML_ERROR_NO_MEMORY;
+- }
+- }
+- break;
+- case XML_TOK_DATA_CHARS:
+- if (!poolAppend(pool, enc, ptr, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- break;
+- case XML_TOK_TRAILING_CR:
+- next = ptr + enc->minBytesPerChar;
+- /* fall through */
+- case XML_TOK_ATTRIBUTE_VALUE_S:
+- case XML_TOK_DATA_NEWLINE:
+- if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
+- break;
+- if (!poolAppendChar(pool, 0x20))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- case XML_TOK_ENTITY_REF:
+- {
+- const XML_Char *name;
+- ENTITY *entity;
+- XML_Char ch = XmlPredefinedEntityName(enc,
+- ptr + enc->minBytesPerChar,
+- next - enc->minBytesPerChar);
+- if (ch) {
+- if (!poolAppendChar(pool, ch))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- }
+- name = poolStoreString(&temp2Pool, enc,
+- ptr + enc->minBytesPerChar,
+- next - enc->minBytesPerChar);
+- if (!name)
+- return XML_ERROR_NO_MEMORY;
+- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
+- poolDiscard(&temp2Pool);
+- if (!entity) {
+- if (dtd.complete) {
+- if (enc == encoding)
+- eventPtr = ptr;
+- return XML_ERROR_UNDEFINED_ENTITY;
+- }
+- }
+- else if (entity->open) {
+- if (enc == encoding)
+- eventPtr = ptr;
+- return XML_ERROR_RECURSIVE_ENTITY_REF;
+- }
+- else if (entity->notation) {
+- if (enc == encoding)
+- eventPtr = ptr;
+- return XML_ERROR_BINARY_ENTITY_REF;
+- }
+- else if (!entity->textPtr) {
+- if (enc == encoding)
+- eventPtr = ptr;
+- return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
+- }
+- else {
+- enum XML_Error result;
+- const XML_Char *textEnd = entity->textPtr + entity->textLen;
+- entity->open = 1;
+- result = appendAttributeValue(parser, internalEnc, isCdata, (char *)entity->textPtr, (char *)textEnd, pool);
+- entity->open = 0;
+- if (result)
+- return result;
+- }
+- }
+- break;
+- default:
+- abort();
+- }
+- ptr = next;
+- }
+- /* not reached */
+-}
+-
+-static
+-enum XML_Error storeEntityValue(XML_Parser parser,
+- const char *entityTextPtr,
+- const char *entityTextEnd)
+-{
+- const ENCODING *internalEnc = ns ? XmlGetInternalEncodingNS() : XmlGetInternalEncoding();
+- STRING_POOL *pool = &(dtd.pool);
+- entityTextPtr += encoding->minBytesPerChar;
+- entityTextEnd -= encoding->minBytesPerChar;
+- for (;;) {
+- const char *next;
+- int tok = XmlEntityValueTok(encoding, entityTextPtr, entityTextEnd, &next);
+- switch (tok) {
+- case XML_TOK_PARAM_ENTITY_REF:
+- eventPtr = entityTextPtr;
+- return XML_ERROR_SYNTAX;
+- case XML_TOK_NONE:
+- if (declEntity) {
+- declEntity->textPtr = pool->start;
+- declEntity->textLen = pool->ptr - pool->start;
+- poolFinish(pool);
+- }
+- else
+- poolDiscard(pool);
+- return XML_ERROR_NONE;
+- case XML_TOK_ENTITY_REF:
+- case XML_TOK_DATA_CHARS:
+- if (!poolAppend(pool, encoding, entityTextPtr, next))
+- return XML_ERROR_NO_MEMORY;
+- break;
+- case XML_TOK_TRAILING_CR:
+- next = entityTextPtr + encoding->minBytesPerChar;
+- /* fall through */
+- case XML_TOK_DATA_NEWLINE:
+- if (pool->end == pool->ptr && !poolGrow(pool))
+- return XML_ERROR_NO_MEMORY;
+- *(pool->ptr)++ = 0xA;
+- break;
+- case XML_TOK_CHAR_REF:
+- {
+- XML_Char buf[XML_ENCODE_MAX];
+- int i;
+- int n = XmlCharRefNumber(encoding, entityTextPtr);
+- if (n < 0) {
+- eventPtr = entityTextPtr;
+- return XML_ERROR_BAD_CHAR_REF;
+- }
+- n = XmlEncode(n, (ICHAR *)buf);
+- if (!n) {
+- eventPtr = entityTextPtr;
+- return XML_ERROR_BAD_CHAR_REF;
+- }
+- for (i = 0; i < n; i++) {
+- if (pool->end == pool->ptr && !poolGrow(pool))
+- return XML_ERROR_NO_MEMORY;
+- *(pool->ptr)++ = buf[i];
+- }
+- }
+- break;
+- case XML_TOK_PARTIAL:
+- eventPtr = entityTextPtr;
+- return XML_ERROR_INVALID_TOKEN;
+- case XML_TOK_INVALID:
+- eventPtr = next;
+- return XML_ERROR_INVALID_TOKEN;
+- default:
+- abort();
+- }
+- entityTextPtr = next;
+- }
+- /* not reached */
+-}
+-
+-static void
+-normalizeLines(XML_Char *s)
+-{
+- XML_Char *p;
+- for (;; s++) {
+- if (*s == XML_T('\0'))
+- return;
+- if (*s == 0xD)
+- break;
+- }
+- p = s;
+- do {
+- if (*s == 0xD) {
+- *p++ = 0xA;
+- if (*++s == 0xA)
+- s++;
+- }
+- else
+- *p++ = *s++;
+- } while (*s);
+- *p = XML_T('\0');
+-}
+-
+-static int
+-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
+-{
+- const XML_Char *target;
+- XML_Char *data;
+- const char *tem;
+- if (!processingInstructionHandler) {
+- if (defaultHandler)
+- reportDefault(parser, enc, start, end);
+- return 1;
+- }
+- start += enc->minBytesPerChar * 2;
+- tem = start + XmlNameLength(enc, start);
+- target = poolStoreString(&tempPool, enc, start, tem);
+- if (!target)
+- return 0;
+- poolFinish(&tempPool);
+- data = poolStoreString(&tempPool, enc,
+- XmlSkipS(enc, tem),
+- end - enc->minBytesPerChar*2);
+- if (!data)
+- return 0;
+- normalizeLines(data);
+- processingInstructionHandler(handlerArg, target, data);
+- poolClear(&tempPool);
+- return 1;
+-}
+-
+-static int
+-reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
+-{
+- XML_Char *data;
+- if (!commentHandler) {
+- if (defaultHandler)
+- reportDefault(parser, enc, start, end);
+- return 1;
+- }
+- data = poolStoreString(&tempPool,
+- enc,
+- start + enc->minBytesPerChar * 4,
+- end - enc->minBytesPerChar * 3);
+- if (!data)
+- return 0;
+- normalizeLines(data);
+- commentHandler(handlerArg, data);
+- poolClear(&tempPool);
+- return 1;
+-}
+-
+-static void
+-reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end)
+-{
+- if (MUST_CONVERT(enc, s)) {
+- const char **eventPP;
+- const char **eventEndPP;
+- if (enc == encoding) {
+- eventPP = &eventPtr;
+- eventEndPP = &eventEndPtr;
+- }
+- else {
+- eventPP = &(openInternalEntities->internalEventPtr);
+- eventEndPP = &(openInternalEntities->internalEventEndPtr);
+- }
+- do {
+- ICHAR *dataPtr = (ICHAR *)dataBuf;
+- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
+- *eventEndPP = s;
+- defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
+- *eventPP = s;
+- } while (s != end);
+- }
+- else
+- defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s);
+-}
+-
+-
+-static int
+-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata, const XML_Char *value)
+-{
+- DEFAULT_ATTRIBUTE *att;
+- if (type->nDefaultAtts == type->allocDefaultAtts) {
+- if (type->allocDefaultAtts == 0) {
+- type->allocDefaultAtts = 8;
+- type->defaultAtts = malloc(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
+- }
+- else {
+- type->allocDefaultAtts *= 2;
+- type->defaultAtts = realloc(type->defaultAtts,
+- type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
+- }
+- if (!type->defaultAtts)
+- return 0;
+- }
+- att = type->defaultAtts + type->nDefaultAtts;
+- att->id = attId;
+- att->value = value;
+- att->isCdata = isCdata;
+- if (!isCdata)
+- attId->maybeTokenized = 1;
+- type->nDefaultAtts += 1;
+- return 1;
+-}
+-
+-static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
+-{
+- const XML_Char *name;
+- for (name = elementType->name; *name; name++) {
+- if (*name == XML_T(':')) {
+- PREFIX *prefix;
+- const XML_Char *s;
+- for (s = elementType->name; s != name; s++) {
+- if (!poolAppendChar(&dtd.pool, *s))
+- return 0;
+- }
+- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
+- return 0;
+- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
+- if (!prefix)
+- return 0;
+- if (prefix->name == poolStart(&dtd.pool))
+- poolFinish(&dtd.pool);
+- else
+- poolDiscard(&dtd.pool);
+- elementType->prefix = prefix;
+-
+- }
+- }
+- return 1;
+-}
+-
+-static ATTRIBUTE_ID *
+-getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
+-{
+- ATTRIBUTE_ID *id;
+- const XML_Char *name;
+- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
+- return 0;
+- name = poolStoreString(&dtd.pool, enc, start, end);
+- if (!name)
+- return 0;
+- ++name;
+- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID));
+- if (!id)
+- return 0;
+- if (id->name != name)
+- poolDiscard(&dtd.pool);
+- else {
+- poolFinish(&dtd.pool);
+- if (!ns)
+- ;
+- else if (name[0] == 'x'
+- && name[1] == 'm'
+- && name[2] == 'l'
+- && name[3] == 'n'
+- && name[4] == 's'
+- && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) {
+- if (name[5] == '\0')
+- id->prefix = &dtd.defaultPrefix;
+- else
+- id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX));
+- id->xmlns = 1;
+- }
+- else {
+- int i;
+- for (i = 0; name[i]; i++) {
+- if (name[i] == XML_T(':')) {
+- int j;
+- for (j = 0; j < i; j++) {
+- if (!poolAppendChar(&dtd.pool, name[j]))
+- return 0;
+- }
+- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
+- return 0;
+- id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
+- if (id->prefix->name == poolStart(&dtd.pool))
+- poolFinish(&dtd.pool);
+- else
+- poolDiscard(&dtd.pool);
+- break;
+- }
+- }
+- }
+- }
+- return id;
+-}
+-
+-#define CONTEXT_SEP XML_T('\f')
+-
+-static
+-const XML_Char *getContext(XML_Parser parser)
+-{
+- HASH_TABLE_ITER iter;
+- int needSep = 0;
+-
+- if (dtd.defaultPrefix.binding) {
+- int i;
+- int len;
+- if (!poolAppendChar(&tempPool, XML_T('=')))
+- return 0;
+- len = dtd.defaultPrefix.binding->uriLen;
+- if (namespaceSeparator != XML_T('\0'))
+- len--;
+- for (i = 0; i < len; i++)
+- if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i]))
+- return 0;
+- needSep = 1;
+- }
+-
+- hashTableIterInit(&iter, &(dtd.prefixes));
+- for (;;) {
+- int i;
+- int len;
+- const XML_Char *s;
+- PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter);
+- if (!prefix)
+- break;
+- if (!prefix->binding)
+- continue;
+- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
+- return 0;
+- for (s = prefix->name; *s; s++)
+- if (!poolAppendChar(&tempPool, *s))
+- return 0;
+- if (!poolAppendChar(&tempPool, XML_T('=')))
+- return 0;
+- len = prefix->binding->uriLen;
+- if (namespaceSeparator != XML_T('\0'))
+- len--;
+- for (i = 0; i < len; i++)
+- if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))
+- return 0;
+- needSep = 1;
+- }
+-
+-
+- hashTableIterInit(&iter, &(dtd.generalEntities));
+- for (;;) {
+- const XML_Char *s;
+- ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
+- if (!e)
+- break;
+- if (!e->open)
+- continue;
+- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
+- return 0;
+- for (s = e->name; *s; s++)
+- if (!poolAppendChar(&tempPool, *s))
+- return 0;
+- needSep = 1;
+- }
+-
+- if (!poolAppendChar(&tempPool, XML_T('\0')))
+- return 0;
+- return tempPool.start;
+-}
+-
+-static
+-int setContext(XML_Parser parser, const XML_Char *context)
+-{
+- const XML_Char *s = context;
+-
+- while (*context != XML_T('\0')) {
+- if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
+- ENTITY *e;
+- if (!poolAppendChar(&tempPool, XML_T('\0')))
+- return 0;
+- e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0);
+- if (e)
+- e->open = 1;
+- if (*s != XML_T('\0'))
+- s++;
+- context = s;
+- poolDiscard(&tempPool);
+- }
+- else if (*s == '=') {
+- PREFIX *prefix;
+- if (poolLength(&tempPool) == 0)
+- prefix = &dtd.defaultPrefix;
+- else {
+- if (!poolAppendChar(&tempPool, XML_T('\0')))
+- return 0;
+- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool), sizeof(PREFIX));
+- if (!prefix)
+- return 0;
+- if (prefix->name == poolStart(&tempPool))
+- poolFinish(&tempPool);
+- else
+- poolDiscard(&tempPool);
+- }
+- for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0'); context++)
+- if (!poolAppendChar(&tempPool, *context))
+- return 0;
+- if (!poolAppendChar(&tempPool, XML_T('\0')))
+- return 0;
+- if (!addBinding(parser, prefix, 0, poolStart(&tempPool), &inheritedBindings))
+- return 0;
+- poolDiscard(&tempPool);
+- if (*context != XML_T('\0'))
+- ++context;
+- s = context;
+- }
+- else {
+- if (!poolAppendChar(&tempPool, *s))
+- return 0;
+- s++;
+- }
+- }
+- return 1;
+-}
+-
+-
+-static
+-void normalizePublicId(XML_Char *publicId)
+-{
+- XML_Char *p = publicId;
+- XML_Char *s;
+- for (s = publicId; *s; s++) {
+- switch (*s) {
+- case 0x20:
+- case 0xD:
+- case 0xA:
+- if (p != publicId && p[-1] != 0x20)
+- *p++ = 0x20;
+- break;
+- default:
+- *p++ = *s;
+- }
+- }
+- if (p != publicId && p[-1] == 0x20)
+- --p;
+- *p = XML_T('\0');
+-}
+-
+-static int dtdInit(DTD *p)
+-{
+- poolInit(&(p->pool));
+- hashTableInit(&(p->generalEntities));
+- hashTableInit(&(p->elementTypes));
+- hashTableInit(&(p->attributeIds));
+- hashTableInit(&(p->prefixes));
+- p->complete = 1;
+- p->standalone = 0;
+- p->base = 0;
+- p->defaultPrefix.name = 0;
+- p->defaultPrefix.binding = 0;
+- return 1;
+-}
+-
+-static void dtdDestroy(DTD *p)
+-{
+- HASH_TABLE_ITER iter;
+- hashTableIterInit(&iter, &(p->elementTypes));
+- for (;;) {
+- ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
+- if (!e)
+- break;
+- if (e->allocDefaultAtts != 0)
+- free(e->defaultAtts);
+- }
+- hashTableDestroy(&(p->generalEntities));
+- hashTableDestroy(&(p->elementTypes));
+- hashTableDestroy(&(p->attributeIds));
+- hashTableDestroy(&(p->prefixes));
+- poolDestroy(&(p->pool));
+-}
+-
+-/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise.
+-The new DTD has already been initialized. */
+-
+-static int dtdCopy(DTD *newDtd, const DTD *oldDtd)
+-{
+- HASH_TABLE_ITER iter;
+-
+- if (oldDtd->base) {
+- const XML_Char *tem = poolCopyString(&(newDtd->pool), oldDtd->base);
+- if (!tem)
+- return 0;
+- newDtd->base = tem;
+- }
+-
+- /* Copy the prefix table. */
+-
+- hashTableIterInit(&iter, &(oldDtd->prefixes));
+- for (;;) {
+- const XML_Char *name;
+- const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
+- if (!oldP)
+- break;
+- name = poolCopyString(&(newDtd->pool), oldP->name);
+- if (!name)
+- return 0;
+- if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX)))
+- return 0;
+- }
+-
+- hashTableIterInit(&iter, &(oldDtd->attributeIds));
+-
+- /* Copy the attribute id table. */
+-
+- for (;;) {
+- ATTRIBUTE_ID *newA;
+- const XML_Char *name;
+- const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);
+-
+- if (!oldA)
+- break;
+- /* Remember to allocate the scratch byte before the name. */
+- if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
+- return 0;
+- name = poolCopyString(&(newDtd->pool), oldA->name);
+- if (!name)
+- return 0;
+- ++name;
+- newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID));
+- if (!newA)
+- return 0;
+- newA->maybeTokenized = oldA->maybeTokenized;
+- if (oldA->prefix) {
+- newA->xmlns = oldA->xmlns;
+- if (oldA->prefix == &oldDtd->defaultPrefix)
+- newA->prefix = &newDtd->defaultPrefix;
+- else
+- newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldA->prefix->name, 0);
+- }
+- }
+-
+- /* Copy the element type table. */
+-
+- hashTableIterInit(&iter, &(oldDtd->elementTypes));
+-
+- for (;;) {
+- int i;
+- ELEMENT_TYPE *newE;
+- const XML_Char *name;
+- const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
+- if (!oldE)
+- break;
+- name = poolCopyString(&(newDtd->pool), oldE->name);
+- if (!name)
+- return 0;
+- newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE));
+- if (!newE)
+- return 0;
+- if (oldE->nDefaultAtts) {
+- newE->defaultAtts = (DEFAULT_ATTRIBUTE *)malloc(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
+- if (!newE->defaultAtts)
+- return 0;
+- }
+- newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
+- if (oldE->prefix)
+- newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldE->prefix->name, 0);
+- for (i = 0; i < newE->nDefaultAtts; i++) {
+- newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
+- newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
+- if (oldE->defaultAtts[i].value) {
+- newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
+- if (!newE->defaultAtts[i].value)
+- return 0;
+- }
+- else
+- newE->defaultAtts[i].value = 0;
+- }
+- }
+-
+- /* Copy the entity table. */
+-
+- hashTableIterInit(&iter, &(oldDtd->generalEntities));
+-
+- for (;;) {
+- ENTITY *newE;
+- const XML_Char *name;
+- const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
+- if (!oldE)
+- break;
+- name = poolCopyString(&(newDtd->pool), oldE->name);
+- if (!name)
+- return 0;
+- newE = (ENTITY *)lookup(&(newDtd->generalEntities), name, sizeof(ENTITY));
+- if (!newE)
+- return 0;
+- if (oldE->systemId) {
+- const XML_Char *tem = poolCopyString(&(newDtd->pool), oldE->systemId);
+- if (!tem)
+- return 0;
+- newE->systemId = tem;
+- if (oldE->base) {
+- if (oldE->base == oldDtd->base)
+- newE->base = newDtd->base;
+- tem = poolCopyString(&(newDtd->pool), oldE->base);
+- if (!tem)
+- return 0;
+- newE->base = tem;
+- }
+- }
+- else {
+- const XML_Char *tem = poolCopyStringN(&(newDtd->pool), oldE->textPtr, oldE->textLen);
+- if (!tem)
+- return 0;
+- newE->textPtr = tem;
+- newE->textLen = oldE->textLen;
+- }
+- if (oldE->notation) {
+- const XML_Char *tem = poolCopyString(&(newDtd->pool), oldE->notation);
+- if (!tem)
+- return 0;
+- newE->notation = tem;
+- }
+- }
+-
+- newDtd->complete = oldDtd->complete;
+- newDtd->standalone = oldDtd->standalone;
+- return 1;
+-}
+-
+-static
+-void poolInit(STRING_POOL *pool)
+-{
+- pool->blocks = 0;
+- pool->freeBlocks = 0;
+- pool->start = 0;
+- pool->ptr = 0;
+- pool->end = 0;
+-}
+-
+-static
+-void poolClear(STRING_POOL *pool)
+-{
+- if (!pool->freeBlocks)
+- pool->freeBlocks = pool->blocks;
+- else {
+- BLOCK *p = pool->blocks;
+- while (p) {
+- BLOCK *tem = p->next;
+- p->next = pool->freeBlocks;
+- pool->freeBlocks = p;
+- p = tem;
+- }
+- }
+- pool->blocks = 0;
+- pool->start = 0;
+- pool->ptr = 0;
+- pool->end = 0;
+-}
+-
+-static
+-void poolDestroy(STRING_POOL *pool)
+-{
+- BLOCK *p = pool->blocks;
+- while (p) {
+- BLOCK *tem = p->next;
+- free(p);
+- p = tem;
+- }
+- pool->blocks = 0;
+- p = pool->freeBlocks;
+- while (p) {
+- BLOCK *tem = p->next;
+- free(p);
+- p = tem;
+- }
+- pool->freeBlocks = 0;
+- pool->ptr = 0;
+- pool->start = 0;
+- pool->end = 0;
+-}
+-
+-static
+-XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
+- const char *ptr, const char *end)
+-{
+- if (!pool->ptr && !poolGrow(pool))
+- return 0;
+- for (;;) {
+- XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
+- if (ptr == end)
+- break;
+- if (!poolGrow(pool))
+- return 0;
+- }
+- return pool->start;
+-}
+-
+-static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s)
+-{
+- do {
+- if (!poolAppendChar(pool, *s))
+- return 0;
+- } while (*s++);
+- s = pool->start;
+- poolFinish(pool);
+- return s;
+-}
+-
+-static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n)
+-{
+- if (!pool->ptr && !poolGrow(pool))
+- return 0;
+- for (; n > 0; --n, s++) {
+- if (!poolAppendChar(pool, *s))
+- return 0;
+-
+- }
+- s = pool->start;
+- poolFinish(pool);
+- return s;
+-}
+-
+-static
+-XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
+- const char *ptr, const char *end)
+-{
+- if (!poolAppend(pool, enc, ptr, end))
+- return 0;
+- if (pool->ptr == pool->end && !poolGrow(pool))
+- return 0;
+- *(pool->ptr)++ = 0;
+- return pool->start;
+-}
+-
+-static
+-int poolGrow(STRING_POOL *pool)
+-{
+- if (pool->freeBlocks) {
+- if (pool->start == 0) {
+- pool->blocks = pool->freeBlocks;
+- pool->freeBlocks = pool->freeBlocks->next;
+- pool->blocks->next = 0;
+- pool->start = pool->blocks->s;
+- pool->end = pool->start + pool->blocks->size;
+- pool->ptr = pool->start;
+- return 1;
+- }
+- if (pool->end - pool->start < pool->freeBlocks->size) {
+- BLOCK *tem = pool->freeBlocks->next;
+- pool->freeBlocks->next = pool->blocks;
+- pool->blocks = pool->freeBlocks;
+- pool->freeBlocks = tem;
+- memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char));
+- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
+- pool->start = pool->blocks->s;
+- pool->end = pool->start + pool->blocks->size;
+- return 1;
+- }
+- }
+- if (pool->blocks && pool->start == pool->blocks->s) {
+- int blockSize = (pool->end - pool->start)*2;
+- pool->blocks = realloc(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
+- if (!pool->blocks)
+- return 0;
+- pool->blocks->size = blockSize;
+- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
+- pool->start = pool->blocks->s;
+- pool->end = pool->start + blockSize;
+- }
+- else {
+- BLOCK *tem;
+- int blockSize = pool->end - pool->start;
+- if (blockSize < INIT_BLOCK_SIZE)
+- blockSize = INIT_BLOCK_SIZE;
+- else
+- blockSize *= 2;
+- tem = malloc(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
+- if (!tem)
+- return 0;
+- tem->size = blockSize;
+- tem->next = pool->blocks;
+- pool->blocks = tem;
+- memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char));
+- pool->ptr = tem->s + (pool->ptr - pool->start);
+- pool->start = tem->s;
+- pool->end = tem->s + blockSize;
+- }
+- return 1;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.dsp dump_expat/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.dsp
+--- original/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.dsp 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.dsp 1969-12-31 18:00:00.000000000 -0600
+@@ -1,202 +0,0 @@
+-# Microsoft Developer Studio Project File - Name="xmlparse" - Package Owner=<4>
+-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+-# ** DO NOT EDIT **
+-
+-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+-
+-CFG=xmlparse - 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 "xmlparse.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 "xmlparse.mak" CFG="xmlparse - Win32 Release"
+-!MESSAGE
+-!MESSAGE Possible choices for configuration are:
+-!MESSAGE
+-!MESSAGE "xmlparse - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE "xmlparse - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE "xmlparse - Win32 MinSize" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE
+-
+-# Begin Project
+-# PROP AllowPerConfigDependencies 0
+-# PROP Scc_ProjName ""
+-# PROP Scc_LocalPath ""
+-CPP=cl.exe
+-MTL=midl.exe
+-RSC=rc.exe
+-
+-!IF "$(CFG)" == "xmlparse - 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 ".\Release"
+-# PROP Intermediate_Dir ".\Release"
+-# PROP Ignore_Export_Lib 0
+-# PROP Target_Dir "."
+-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /W3 /GX /O2 /I "..\xmltok" /I "..\xmlwf" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /YX /FD /c
+-# ADD BASE MTL /nologo /D "NDEBUG" /win32
+-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmlparse.dll" /link50compat
+-# SUBTRACT LINK32 /pdb:none
+-
+-!ELSEIF "$(CFG)" == "xmlparse - 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 ".\Debug"
+-# PROP Intermediate_Dir ".\Debug"
+-# PROP Ignore_Export_Lib 0
+-# PROP Target_Dir "."
+-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\xmltok" /I "..\xmlwf" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /FD /c
+-# ADD BASE MTL /nologo /D "_DEBUG" /win32
+-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /debug /machine:I386 /out:"..\dbgbin\xmlparse.dll"
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 MinSize"
+-
+-# PROP BASE Use_MFC 0
+-# PROP BASE Use_Debug_Libraries 0
+-# PROP BASE Output_Dir "MinSize"
+-# PROP BASE Intermediate_Dir "MinSize"
+-# PROP BASE Ignore_Export_Lib 0
+-# PROP BASE Target_Dir ""
+-# PROP Use_MFC 0
+-# PROP Use_Debug_Libraries 0
+-# PROP Output_Dir "MinSize"
+-# PROP Intermediate_Dir "MinSize"
+-# PROP Ignore_Export_Lib 0
+-# PROP Target_Dir ""
+-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\xmltok" /I "..\xmlwf" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /YX /FD /c
+-# ADD CPP /nologo /W3 /GX /O1 /I "..\xmltok" /I "..\xmlwf" /D "XML_MIN_SIZE" /D "XML_WINLIB" /D XMLPARSEAPI=__declspec(dllexport) /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmlparse.dll"
+-# SUBTRACT BASE LINK32 /profile
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmlparse.dll"
+-# SUBTRACT LINK32 /profile /nodefaultlib
+-
+-!ENDIF
+-
+-# Begin Target
+-
+-# Name "xmlparse - Win32 Release"
+-# Name "xmlparse - Win32 Debug"
+-# Name "xmlparse - Win32 MinSize"
+-# Begin Group "Source Files"
+-
+-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+-# Begin Source File
+-
+-SOURCE=..\xmltok\dllmain.c
+-
+-!IF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-# PROP Exclude_From_Build 1
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-# PROP Exclude_From_Build 1
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 MinSize"
+-
+-!ENDIF
+-
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\hashtable.c
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmlparse.c
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=..\xmltok\xmlrole.c
+-
+-!IF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-# PROP Exclude_From_Build 1
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-# PROP Exclude_From_Build 1
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 MinSize"
+-
+-!ENDIF
+-
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=..\xmltok\xmltok.c
+-
+-!IF "$(CFG)" == "xmlparse - Win32 Release"
+-
+-# PROP Exclude_From_Build 1
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
+-
+-# PROP Exclude_From_Build 1
+-
+-!ELSEIF "$(CFG)" == "xmlparse - Win32 MinSize"
+-
+-!ENDIF
+-
+-# End Source File
+-# End Group
+-# Begin Group "Header Files"
+-
+-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+-# Begin Source File
+-
+-SOURCE=.\hashtable.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmlparse.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 -u -r -N original/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.h dump_expat/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.h
+--- original/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlparse/xmlparse.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,482 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#ifndef XmlParse_INCLUDED
+-#define XmlParse_INCLUDED 1
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-#ifndef XMLPARSEAPI
+-#define XMLPARSEAPI /* as nothing */
+-#endif
+-
+-typedef void *XML_Parser;
+-
+-#ifdef XML_UNICODE_WCHAR_T
+-
+-/* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
+-uses Unicode. */
+-/* Information is UTF-16 encoded as wchar_ts */
+-
+-#ifndef XML_UNICODE
+-#define XML_UNICODE
+-#endif
+-
+-#include <stddef.h>
+-typedef wchar_t XML_Char;
+-typedef wchar_t XML_LChar;
+-
+-#else /* not XML_UNICODE_WCHAR_T */
+-
+-#ifdef XML_UNICODE
+-
+-/* Information is UTF-16 encoded as unsigned shorts */
+-typedef unsigned short XML_Char;
+-typedef char XML_LChar;
+-
+-#else /* not XML_UNICODE */
+-
+-/* Information is UTF-8 encoded. */
+-typedef char XML_Char;
+-typedef char XML_LChar;
+-
+-#endif /* not XML_UNICODE */
+-
+-#endif /* not XML_UNICODE_WCHAR_T */
+-
+-
+-/* Constructs a new parser; encoding is the encoding specified by the external
+-protocol or null if there is none specified. */
+-
+-XML_Parser XMLPARSEAPI
+-XML_ParserCreate(const XML_Char *encoding);
+-
+-/* Constructs a new parser and namespace processor. Element type names
+-and attribute names that belong to a namespace will be expanded;
+-unprefixed attribute names are never expanded; unprefixed element type
+-names are expanded only if there is a default namespace. The expanded
+-name is the concatenation of the namespace URI, the namespace separator character,
+-and the local part of the name. If the namespace separator is '\0' then
+-the namespace URI and the local part will be concatenated without any
+-separator. When a namespace is not declared, the name and prefix will be
+-passed through without expansion. */
+-
+-XML_Parser XMLPARSEAPI
+-XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
+-
+-
+-/* atts is array of name/value pairs, terminated by 0;
+- names and values are 0 terminated. */
+-
+-typedef void (*XML_StartElementHandler)(void *userData,
+- const XML_Char *name,
+- const XML_Char **atts);
+-
+-typedef void (*XML_EndElementHandler)(void *userData,
+- const XML_Char *name);
+-
+-/* s is not 0 terminated. */
+-typedef void (*XML_CharacterDataHandler)(void *userData,
+- const XML_Char *s,
+- int len);
+-
+-/* target and data are 0 terminated */
+-typedef void (*XML_ProcessingInstructionHandler)(void *userData,
+- const XML_Char *target,
+- const XML_Char *data);
+-
+-/* data is 0 terminated */
+-typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
+-
+-typedef void (*XML_StartCdataSectionHandler)(void *userData);
+-typedef void (*XML_EndCdataSectionHandler)(void *userData);
+-
+-/* This is called for any characters in the XML document for
+-which there is no applicable handler. This includes both
+-characters that are part of markup which is of a kind that is
+-not reported (comments, markup declarations), or characters
+-that are part of a construct which could be reported but
+-for which no handler has been supplied. The characters are passed
+-exactly as they were in the XML document except that
+-they will be encoded in UTF-8. Line boundaries are not normalized.
+-Note that a byte order mark character is not passed to the default handler.
+-There are no guarantees about how characters are divided between calls
+-to the default handler: for example, a comment might be split between
+-multiple calls. */
+-
+-typedef void (*XML_DefaultHandler)(void *userData,
+- const XML_Char *s,
+- int len);
+-
+-/* This is called for a declaration of an unparsed (NDATA)
+-entity. The base argument is whatever was set by XML_SetBase.
+-The entityName, systemId and notationName arguments will never be null.
+-The other arguments may be. */
+-
+-typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
+- const XML_Char *entityName,
+- const XML_Char *base,
+- const XML_Char *systemId,
+- const XML_Char *publicId,
+- const XML_Char *notationName);
+-
+-/* This is called for a declaration of notation.
+-The base argument is whatever was set by XML_SetBase.
+-The notationName will never be null. The other arguments can be. */
+-
+-typedef void (*XML_NotationDeclHandler)(void *userData,
+- const XML_Char *notationName,
+- const XML_Char *base,
+- const XML_Char *systemId,
+- const XML_Char *publicId);
+-
+-/* When namespace processing is enabled, these are called once for
+-each namespace declaration. The call to the start and end element
+-handlers occur between the calls to the start and end namespace
+-declaration handlers. For an xmlns attribute, prefix will be null.
+-For an xmlns="" attribute, uri will be null. */
+-
+-typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
+- const XML_Char *prefix,
+- const XML_Char *uri);
+-
+-typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
+- const XML_Char *prefix);
+-
+-/* This is called if the document is not standalone (it has an
+-external subset or a reference to a parameter entity, but does not
+-have standalone="yes"). If this handler returns 0, then processing
+-will not continue, and the parser will return a
+-XML_ERROR_NOT_STANDALONE error. */
+-
+-typedef int (*XML_NotStandaloneHandler)(void *userData);
+-
+-/* This is called for a reference to an external parsed general entity.
+-The referenced entity is not automatically parsed.
+-The application can parse it immediately or later using
+-XML_ExternalEntityParserCreate.
+-The parser argument is the parser parsing the entity containing the reference;
+-it can be passed as the parser argument to XML_ExternalEntityParserCreate.
+-The systemId argument is the system identifier as specified in the entity declaration;
+-it will not be null.
+-The base argument is the system identifier that should be used as the base for
+-resolving systemId if systemId was relative; this is set by XML_SetBase;
+-it may be null.
+-The publicId argument is the public identifier as specified in the entity declaration,
+-or null if none was specified; the whitespace in the public identifier
+-will have been normalized as required by the XML spec.
+-The context argument specifies the parsing context in the format
+-expected by the context argument to
+-XML_ExternalEntityParserCreate; context is valid only until the handler
+-returns, so if the referenced entity is to be parsed later, it must be copied.
+-The handler should return 0 if processing should not continue because of
+-a fatal error in the handling of the external entity.
+-In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING
+-error.
+-Note that unlike other handlers the first argument is the parser, not userData. */
+-
+-typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
+- const XML_Char *context,
+- const XML_Char *base,
+- const XML_Char *systemId,
+- const XML_Char *publicId);
+-
+-/* This structure is filled in by the XML_UnknownEncodingHandler
+-to provide information to the parser about encodings that are unknown
+-to the parser.
+-The map[b] member gives information about byte sequences
+-whose first byte is b.
+-If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c.
+-If map[b] is -1, then the byte sequence is malformed.
+-If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
+-sequence that encodes a single Unicode scalar value.
+-The data member will be passed as the first argument to the convert function.
+-The convert function is used to convert multibyte sequences;
+-s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
+-The convert function must return the Unicode scalar value
+-represented by this byte sequence or -1 if the byte sequence is malformed.
+-The convert function may be null if the encoding is a single-byte encoding,
+-that is if map[b] >= -1 for all bytes b.
+-When the parser is finished with the encoding, then if release is not null,
+-it will call release passing it the data member;
+-once release has been called, the convert function will not be called again.
+-
+-Expat places certain restrictions on the encodings that are supported
+-using this mechanism.
+-
+-1. Every ASCII character that can appear in a well-formed XML document,
+-other than the characters
+-
+- $@\^`{}~
+-
+-must be represented by a single byte, and that byte must be the
+-same byte that represents that character in ASCII.
+-
+-2. No character may require more than 4 bytes to encode.
+-
+-3. All characters encoded must have Unicode scalar values <= 0xFFFF,
+-(ie characters that would be encoded by surrogates in UTF-16
+-are not allowed). Note that this restriction doesn't apply to
+-the built-in support for UTF-8 and UTF-16.
+-
+-4. No Unicode character may be encoded by more than one distinct sequence
+-of bytes. */
+-
+-typedef struct {
+- int map[256];
+- void *data;
+- int (*convert)(void *data, const char *s);
+- void (*release)(void *data);
+-} XML_Encoding;
+-
+-/* This is called for an encoding that is unknown to the parser.
+-The encodingHandlerData argument is that which was passed as the
+-second argument to XML_SetUnknownEncodingHandler.
+-The name argument gives the name of the encoding as specified in
+-the encoding declaration.
+-If the callback can provide information about the encoding,
+-it must fill in the XML_Encoding structure, and return 1.
+-Otherwise it must return 0.
+-If info does not describe a suitable encoding,
+-then the parser will return an XML_UNKNOWN_ENCODING error. */
+-
+-typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
+- const XML_Char *name,
+- XML_Encoding *info);
+-
+-void XMLPARSEAPI
+-XML_SetElementHandler(XML_Parser parser,
+- XML_StartElementHandler start,
+- XML_EndElementHandler end);
+-
+-void XMLPARSEAPI
+-XML_SetCharacterDataHandler(XML_Parser parser,
+- XML_CharacterDataHandler handler);
+-
+-void XMLPARSEAPI
+-XML_SetProcessingInstructionHandler(XML_Parser parser,
+- XML_ProcessingInstructionHandler handler);
+-void XMLPARSEAPI
+-XML_SetCommentHandler(XML_Parser parser,
+- XML_CommentHandler handler);
+-
+-void XMLPARSEAPI
+-XML_SetCdataSectionHandler(XML_Parser parser,
+- XML_StartCdataSectionHandler start,
+- XML_EndCdataSectionHandler end);
+-
+-/* This sets the default handler and also inhibits expansion of internal entities.
+-The entity reference will be passed to the default handler. */
+-
+-void XMLPARSEAPI
+-XML_SetDefaultHandler(XML_Parser parser,
+- XML_DefaultHandler handler);
+-
+-/* This sets the default handler but does not inhibit expansion of internal entities.
+-The entity reference will not be passed to the default handler. */
+-
+-void XMLPARSEAPI
+-XML_SetDefaultHandlerExpand(XML_Parser parser,
+- XML_DefaultHandler handler);
+-
+-void XMLPARSEAPI
+-XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
+- XML_UnparsedEntityDeclHandler handler);
+-
+-void XMLPARSEAPI
+-XML_SetNotationDeclHandler(XML_Parser parser,
+- XML_NotationDeclHandler handler);
+-
+-void XMLPARSEAPI
+-XML_SetNamespaceDeclHandler(XML_Parser parser,
+- XML_StartNamespaceDeclHandler start,
+- XML_EndNamespaceDeclHandler end);
+-
+-void XMLPARSEAPI
+-XML_SetNotStandaloneHandler(XML_Parser parser,
+- XML_NotStandaloneHandler handler);
+-
+-void XMLPARSEAPI
+-XML_SetExternalEntityRefHandler(XML_Parser parser,
+- XML_ExternalEntityRefHandler handler);
+-
+-/* If a non-null value for arg is specified here, then it will be passed
+-as the first argument to the external entity ref handler instead
+-of the parser object. */
+-void XMLPARSEAPI
+-XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
+-
+-void XMLPARSEAPI
+-XML_SetUnknownEncodingHandler(XML_Parser parser,
+- XML_UnknownEncodingHandler handler,
+- void *encodingHandlerData);
+-
+-/* This can be called within a handler for a start element, end element,
+-processing instruction or character data. It causes the corresponding
+-markup to be passed to the default handler. */
+-void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser);
+-
+-/* This value is passed as the userData argument to callbacks. */
+-void XMLPARSEAPI
+-XML_SetUserData(XML_Parser parser, void *userData);
+-
+-/* Returns the last value set by XML_SetUserData or null. */
+-#define XML_GetUserData(parser) (*(void **)(parser))
+-
+-/* This is equivalent to supplying an encoding argument
+-to XML_CreateParser. It must not be called after XML_Parse
+-or XML_ParseBuffer. */
+-
+-int XMLPARSEAPI
+-XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
+-
+-/* If this function is called, then the parser will be passed
+-as the first argument to callbacks instead of userData.
+-The userData will still be accessible using XML_GetUserData. */
+-
+-void XMLPARSEAPI
+-XML_UseParserAsHandlerArg(XML_Parser parser);
+-
+-/* Sets the base to be used for resolving relative URIs in system identifiers in
+-declarations. Resolving relative identifiers is left to the application:
+-this value will be passed through as the base argument to the
+-XML_ExternalEntityRefHandler, XML_NotationDeclHandler
+-and XML_UnparsedEntityDeclHandler. The base argument will be copied.
+-Returns zero if out of memory, non-zero otherwise. */
+-
+-int XMLPARSEAPI
+-XML_SetBase(XML_Parser parser, const XML_Char *base);
+-
+-const XML_Char XMLPARSEAPI *
+-XML_GetBase(XML_Parser parser);
+-
+-/* Returns the number of the attributes passed in last call to the
+-XML_StartElementHandler that were specified in the start-tag rather
+-than defaulted. */
+-
+-int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
+-
+-/* Parses some input. Returns 0 if a fatal error is detected.
+-The last call to XML_Parse must have isFinal true;
+-len may be zero for this call (or any other). */
+-int XMLPARSEAPI
+-XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
+-
+-void XMLPARSEAPI *
+-XML_GetBuffer(XML_Parser parser, int len);
+-
+-int XMLPARSEAPI
+-XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
+-
+-/* Creates an XML_Parser object that can parse an external general entity;
+-context is a '\0'-terminated string specifying the parse context;
+-encoding is a '\0'-terminated string giving the name of the externally specified encoding,
+-or null if there is no externally specified encoding.
+-The context string consists of a sequence of tokens separated by formfeeds (\f);
+-a token consisting of a name specifies that the general entity of the name
+-is open; a token of the form prefix=uri specifies the namespace for a particular
+-prefix; a token of the form =uri specifies the default namespace.
+-This can be called at any point after the first call to an ExternalEntityRefHandler
+-so longer as the parser has not yet been freed.
+-The new parser is completely independent and may safely be used in a separate thread.
+-The handlers and userData are initialized from the parser argument.
+-Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
+-XML_Parser XMLPARSEAPI
+-XML_ExternalEntityParserCreate(XML_Parser parser,
+- const XML_Char *context,
+- const XML_Char *encoding);
+-
+-enum XML_Error {
+- XML_ERROR_NONE,
+- XML_ERROR_NO_MEMORY,
+- XML_ERROR_SYNTAX,
+- XML_ERROR_NO_ELEMENTS,
+- XML_ERROR_INVALID_TOKEN,
+- XML_ERROR_UNCLOSED_TOKEN,
+- XML_ERROR_PARTIAL_CHAR,
+- XML_ERROR_TAG_MISMATCH,
+- XML_ERROR_DUPLICATE_ATTRIBUTE,
+- XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
+- XML_ERROR_PARAM_ENTITY_REF,
+- XML_ERROR_UNDEFINED_ENTITY,
+- XML_ERROR_RECURSIVE_ENTITY_REF,
+- XML_ERROR_ASYNC_ENTITY,
+- XML_ERROR_BAD_CHAR_REF,
+- XML_ERROR_BINARY_ENTITY_REF,
+- XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
+- XML_ERROR_MISPLACED_XML_PI,
+- XML_ERROR_UNKNOWN_ENCODING,
+- XML_ERROR_INCORRECT_ENCODING,
+- XML_ERROR_UNCLOSED_CDATA_SECTION,
+- XML_ERROR_EXTERNAL_ENTITY_HANDLING,
+- XML_ERROR_NOT_STANDALONE
+-};
+-
+-/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
+-returns information about the error. */
+-
+-enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
+-
+-/* These functions return information about the current parse location.
+-They may be called when XML_Parse or XML_ParseBuffer return 0;
+-in this case the location is the location of the character at which
+-the error was detected.
+-They may also be called from any other callback called to report
+-some parse event; in this the location is the location of the first
+-of the sequence of characters that generated the event. */
+-
+-int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
+-int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
+-long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
+-
+-/* Return the number of bytes in the current event.
+-Returns 0 if the event is in an internal entity. */
+-
+-int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser);
+-
+-/* For backwards compatibility with previous versions. */
+-#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
+-#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
+-#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
+-
+-/* Frees memory used by the parser. */
+-void XMLPARSEAPI
+-XML_ParserFree(XML_Parser parser);
+-
+-/* Returns a string describing the error. */
+-const XML_LChar XMLPARSEAPI *XML_ErrorString(int code);
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* not XmlParse_INCLUDED */
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/.cvsignore dump_expat/xmlrpc-epi-0.51/expat/xmltok/.cvsignore
+--- original/xmlrpc-epi-0.51/expat/xmltok/.cvsignore 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/.cvsignore 1969-12-31 18:00:00.000000000 -0600
+@@ -1,6 +0,0 @@
+-Makefile
+-.deps
+-xmltok.lo
+-xmlrole.lo
+-.libs
+-libexpat_tok.la
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/Makefile.am dump_expat/xmlrpc-epi-0.51/expat/xmltok/Makefile.am
+--- original/xmlrpc-epi-0.51/expat/xmltok/Makefile.am 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/Makefile.am 1969-12-31 18:00:00.000000000 -0600
+@@ -1,3 +0,0 @@
+-noinst_LTLIBRARIES = libexpat_tok.la
+-libexpat_tok_la_SOURCES = xmltok.c xmlrole.c
+-
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/Makefile.in dump_expat/xmlrpc-epi-0.51/expat/xmltok/Makefile.in
+--- original/xmlrpc-epi-0.51/expat/xmltok/Makefile.in 2002-06-23 18:48:29.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/Makefile.in 1969-12-31 18:00:00.000000000 -0600
+@@ -1,331 +0,0 @@
+-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+-
+-# Copyright (C) 1994, 1995-8, 1999, 2001 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.
+-
+-
+-SHELL = @SHELL@
+-
+-srcdir = @srcdir@
+-top_srcdir = @top_srcdir@
+-VPATH = @srcdir@
+-prefix = @prefix@
+-exec_prefix = @exec_prefix@
+-
+-bindir = @bindir@
+-sbindir = @sbindir@
+-libexecdir = @libexecdir@
+-datadir = @datadir@
+-sysconfdir = @sysconfdir@
+-sharedstatedir = @sharedstatedir@
+-localstatedir = @localstatedir@
+-libdir = @libdir@
+-infodir = @infodir@
+-mandir = @mandir@
+-includedir = @includedir@
+-oldincludedir = /usr/include
+-
+-DESTDIR =
+-
+-pkgdatadir = $(datadir)/@PACKAGE@
+-pkglibdir = $(libdir)/@PACKAGE@
+-pkgincludedir = $(includedir)/@PACKAGE@
+-
+-top_builddir = ../..
+-
+-ACLOCAL = @ACLOCAL@
+-AUTOCONF = @AUTOCONF@
+-AUTOMAKE = @AUTOMAKE@
+-AUTOHEADER = @AUTOHEADER@
+-
+-INSTALL = @INSTALL@
+-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+-INSTALL_DATA = @INSTALL_DATA@
+-INSTALL_SCRIPT = @INSTALL_SCRIPT@
+-transform = @program_transform_name@
+-
+-NORMAL_INSTALL = :
+-PRE_INSTALL = :
+-POST_INSTALL = :
+-NORMAL_UNINSTALL = :
+-PRE_UNINSTALL = :
+-POST_UNINSTALL = :
+-host_alias = @host_alias@
+-host_triplet = @host@
+-AS = @AS@
+-AWK = @AWK@
+-CC = @CC@
+-CPP = @CPP@
+-CXX = @CXX@
+-DLLTOOL = @DLLTOOL@
+-ECHO = @ECHO@
+-EXEEXT = @EXEEXT@
+-LIBTOOL = @LIBTOOL@
+-LN_S = @LN_S@
+-MAKEINFO = @MAKEINFO@
+-OBJDUMP = @OBJDUMP@
+-OBJEXT = @OBJEXT@
+-PACKAGE = @PACKAGE@
+-RANLIB = @RANLIB@
+-STRIP = @STRIP@
+-VERSION = @VERSION@
+-
+-noinst_LTLIBRARIES = libexpat_tok.la
+-libexpat_tok_la_SOURCES = xmltok.c xmlrole.c
+-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+-CONFIG_CLEAN_FILES =
+-LTLIBRARIES = $(noinst_LTLIBRARIES)
+-
+-
+-DEFS = @DEFS@ -I. -I$(srcdir)
+-CPPFLAGS = @CPPFLAGS@
+-LDFLAGS = @LDFLAGS@
+-LIBS = @LIBS@
+-libexpat_tok_la_LDFLAGS =
+-libexpat_tok_la_LIBADD =
+-libexpat_tok_la_OBJECTS = xmltok.lo xmlrole.lo
+-CFLAGS = @CFLAGS@
+-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+-CCLD = $(CC)
+-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+-DIST_COMMON = Makefile.am Makefile.in
+-
+-
+-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+-
+-TAR = gtar
+-GZIP_ENV = --best
+-DEP_FILES = .deps/xmlrole.P .deps/xmltok.P
+-SOURCES = $(libexpat_tok_la_SOURCES)
+-OBJECTS = $(libexpat_tok_la_OBJECTS)
+-
+-all: all-redirect
+-.SUFFIXES:
+-.SUFFIXES: .S .c .lo .o .obj .s
+-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+- cd $(top_srcdir) && $(AUTOMAKE) --gnu expat/xmltok/Makefile
+-
+-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+- cd $(top_builddir) \
+- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+-
+-
+-mostlyclean-noinstLTLIBRARIES:
+-
+-clean-noinstLTLIBRARIES:
+- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+-
+-distclean-noinstLTLIBRARIES:
+-
+-maintainer-clean-noinstLTLIBRARIES:
+-
+-# FIXME: We should only use cygpath when building on Windows,
+-# and only if it is available.
+-.c.obj:
+- $(COMPILE) -c `cygpath -w $<`
+-
+-.s.o:
+- $(COMPILE) -c $<
+-
+-.S.o:
+- $(COMPILE) -c $<
+-
+-mostlyclean-compile:
+- -rm -f *.o core *.core
+- -rm -f *.$(OBJEXT)
+-
+-clean-compile:
+-
+-distclean-compile:
+- -rm -f *.tab.c
+-
+-maintainer-clean-compile:
+-
+-.s.lo:
+- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+-
+-.S.lo:
+- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+-
+-mostlyclean-libtool:
+- -rm -f *.lo
+-
+-clean-libtool:
+- -rm -rf .libs _libs
+-
+-distclean-libtool:
+-
+-maintainer-clean-libtool:
+-
+-libexpat_tok.la: $(libexpat_tok_la_OBJECTS) $(libexpat_tok_la_DEPENDENCIES)
+- $(LINK) $(libexpat_tok_la_LDFLAGS) $(libexpat_tok_la_OBJECTS) $(libexpat_tok_la_LIBADD) $(LIBS)
+-
+-tags: TAGS
+-
+-ID: $(HEADERS) $(SOURCES) $(LISP)
+- list='$(SOURCES) $(HEADERS)'; \
+- unique=`for i in $$list; do echo $$i; done | \
+- awk ' { files[$$0] = 1; } \
+- END { for (i in files) print i; }'`; \
+- here=`pwd` && cd $(srcdir) \
+- && mkid -f$$here/ID $$unique $(LISP)
+-
+-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+- tags=; \
+- here=`pwd`; \
+- list='$(SOURCES) $(HEADERS)'; \
+- unique=`for i in $$list; do echo $$i; done | \
+- awk ' { files[$$0] = 1; } \
+- END { for (i in files) print i; }'`; \
+- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+-
+-mostlyclean-tags:
+-
+-clean-tags:
+-
+-distclean-tags:
+- -rm -f TAGS ID
+-
+-maintainer-clean-tags:
+-
+-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+-
+-subdir = expat/xmltok
+-
+-distdir: $(DISTFILES)
+- here=`cd $(top_builddir) && pwd`; \
+- top_distdir=`cd $(top_distdir) && pwd`; \
+- distdir=`cd $(distdir) && pwd`; \
+- cd $(top_srcdir) \
+- && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu expat/xmltok/Makefile
+- @for file in $(DISTFILES); do \
+- d=$(srcdir); \
+- if test -d $$d/$$file; then \
+- cp -pr $$d/$$file $(distdir)/$$file; \
+- else \
+- test -f $(distdir)/$$file \
+- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+- || cp -p $$d/$$file $(distdir)/$$file || :; \
+- fi; \
+- done
+-
+-DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+-
+--include $(DEP_FILES)
+-
+-mostlyclean-depend:
+-
+-clean-depend:
+-
+-distclean-depend:
+- -rm -rf .deps
+-
+-maintainer-clean-depend:
+-
+-%.o: %.c
+- @echo '$(COMPILE) -c $<'; \
+- $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+- @-cp .deps/$(*F).pp .deps/$(*F).P; \
+- tr ' ' '\012' < .deps/$(*F).pp \
+- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+- >> .deps/$(*F).P; \
+- rm .deps/$(*F).pp
+-
+-%.lo: %.c
+- @echo '$(LTCOMPILE) -c $<'; \
+- $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+- @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
+- < .deps/$(*F).pp > .deps/$(*F).P; \
+- tr ' ' '\012' < .deps/$(*F).pp \
+- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+- >> .deps/$(*F).P; \
+- rm -f .deps/$(*F).pp
+-info-am:
+-info: info-am
+-dvi-am:
+-dvi: dvi-am
+-check-am: all-am
+-check: check-am
+-installcheck-am:
+-installcheck: installcheck-am
+-install-exec-am:
+-install-exec: install-exec-am
+-
+-install-data-am:
+-install-data: install-data-am
+-
+-install-am: all-am
+- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+-install: install-am
+-uninstall-am:
+-uninstall: uninstall-am
+-all-am: Makefile $(LTLIBRARIES)
+-all-redirect: all-am
+-install-strip:
+- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+-installdirs:
+-
+-
+-mostlyclean-generic:
+-
+-clean-generic:
+-
+-distclean-generic:
+- -rm -f Makefile $(CONFIG_CLEAN_FILES)
+- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+-
+-maintainer-clean-generic:
+-mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
+- mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
+- mostlyclean-generic
+-
+-mostlyclean: mostlyclean-am
+-
+-clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \
+- clean-tags clean-depend clean-generic mostlyclean-am
+-
+-clean: clean-am
+-
+-distclean-am: distclean-noinstLTLIBRARIES distclean-compile \
+- distclean-libtool distclean-tags distclean-depend \
+- distclean-generic clean-am
+- -rm -f libtool
+-
+-distclean: distclean-am
+-
+-maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \
+- maintainer-clean-compile maintainer-clean-libtool \
+- maintainer-clean-tags maintainer-clean-depend \
+- maintainer-clean-generic distclean-am
+- @echo "This command is intended for maintainers to use;"
+- @echo "it deletes files that may require special tools to rebuild."
+-
+-maintainer-clean: maintainer-clean-am
+-
+-.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
+-clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
+-mostlyclean-compile distclean-compile clean-compile \
+-maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+-clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
+-distclean-tags clean-tags maintainer-clean-tags distdir \
+-mostlyclean-depend distclean-depend clean-depend \
+-maintainer-clean-depend info-am info dvi-am dvi check check-am \
+-installcheck-am installcheck install-exec-am install-exec \
+-install-data-am install-data install-am install uninstall-am uninstall \
+-all-redirect all-am all installdirs mostlyclean-generic \
+-distclean-generic clean-generic maintainer-clean-generic clean \
+-mostlyclean distclean maintainer-clean
+-
+-
+-# 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 -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/asciitab.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/asciitab.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/asciitab.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/asciitab.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,62 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
+-/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
+-/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
+-/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
+-/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
+-/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
+-/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
+-/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
+-/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
+-/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
+-/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
+-/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
+-/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
+-/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
+-/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
+-/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
+-/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
+-/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/dllmain.c dump_expat/xmlrpc-epi-0.51/expat/xmltok/dllmain.c
+--- original/xmlrpc-epi-0.51/expat/xmltok/dllmain.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/dllmain.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,40 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#define STRICT 1
+-#define WIN32_LEAN_AND_MEAN 1
+-
+-#include <windows.h>
+-
+-BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
+-{
+- return TRUE;
+-}
+-
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/iasciitab.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/iasciitab.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/iasciitab.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/iasciitab.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,63 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
+-/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
+-/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
+-/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
+-/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
+-/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
+-/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
+-/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
+-/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
+-/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
+-/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
+-/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
+-/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
+-/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
+-/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
+-/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
+-/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
+-/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
+-/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/latin1tab.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/latin1tab.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/latin1tab.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/latin1tab.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,62 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
+-/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
+-/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
+-/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
+-/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
+-/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
+-/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+-/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/nametab.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/nametab.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/nametab.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/nametab.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,150 +0,0 @@
+-static const unsigned namingBitmap[] = {
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+-0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
+-0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
+-0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
+-0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
+-0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
+-0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
+-0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
+-0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
+-0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
+-0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
+-0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
+-0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
+-0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
+-0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
+-0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
+-0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
+-0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
+-0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
+-0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
+-0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
+-0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
+-0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
+-0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
+-0x40000000, 0xF580C900, 0x00000007, 0x02010800,
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+-0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
+-0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
+-0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
+-0x00000000, 0x00004C40, 0x00000000, 0x00000000,
+-0x00000007, 0x00000000, 0x00000000, 0x00000000,
+-0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
+-0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
+-0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+-0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
+-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+-0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
+-0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
+-0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
+-0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
+-0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
+-0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
+-0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
+-0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
+-0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
+-0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
+-0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
+-0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
+-0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
+-0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
+-0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
+-0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
+-0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
+-0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
+-0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
+-0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
+-0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
+-0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
+-0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
+-0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
+-0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
+-0x00000000, 0x00000000, 0x00000000, 0x00000000,
+-0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
+-0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
+-0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
+-};
+-static const unsigned char nmstrtPages[] = {
+-0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
+-0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+-0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
+-0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-};
+-static const unsigned char namePages[] = {
+-0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
+-0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
+-0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
+-0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+-};
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/utf8tab.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/utf8tab.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/utf8tab.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/utf8tab.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,63 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-
+-/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
+-/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
+-/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
+-/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
+-/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
+-/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
+-/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
+-/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
+-/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmldef.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmldef.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmldef.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmldef.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,63 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include <string.h>
+-
+-#ifdef XML_WINLIB
+-
+-#define WIN32_LEAN_AND_MEAN
+-#define STRICT
+-#include <windows.h>
+-
+-#define malloc(x) HeapAlloc(GetProcessHeap(), 0, (x))
+-#define calloc(x, y) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x)*(y))
+-#define free(x) HeapFree(GetProcessHeap(), 0, (x))
+-#define realloc(x, y) HeapReAlloc(GetProcessHeap(), 0, x, y)
+-#define abort() /* as nothing */
+-
+-#else /* not XML_WINLIB */
+-
+-#include <stdlib.h>
+-
+-#endif /* not XML_WINLIB */
+-
+-/* This file can be used for any definitions needed in
+-particular environments. */
+-
+-#ifdef MOZILLA
+-
+-#include "nspr.h"
+-#define malloc(x) PR_Malloc(x)
+-#define realloc(x, y) PR_Realloc((x), (y))
+-#define calloc(x, y) PR_Calloc((x),(y))
+-#define free(x) PR_Free(x)
+-#define int int32
+-
+-#endif /* MOZILLA */
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmlrole.c dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmlrole.c
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmlrole.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmlrole.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,1113 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include "xmldef.h"
+-#include "xmlrole.h"
+-
+-/* Doesn't check:
+-
+- that ,| are not mixed in a model group
+- content of literals
+-
+-*/
+-
+-#ifndef MIN_BYTES_PER_CHAR
+-#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar)
+-#endif
+-
+-typedef int PROLOG_HANDLER(struct prolog_state *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc);
+-
+-static PROLOG_HANDLER
+- prolog0, prolog1, prolog2,
+- doctype0, doctype1, doctype2, doctype3, doctype4, doctype5,
+- internalSubset,
+- entity0, entity1, entity2, entity3, entity4, entity5, entity6,
+- entity7, entity8, entity9,
+- notation0, notation1, notation2, notation3, notation4,
+- attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6,
+- attlist7, attlist8, attlist9,
+- element0, element1, element2, element3, element4, element5, element6,
+- element7,
+- declClose,
+- error;
+-
+-static
+-int syntaxError(PROLOG_STATE *);
+-
+-static
+-int prolog0(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- state->handler = prolog1;
+- return XML_ROLE_NONE;
+- case XML_TOK_XML_DECL:
+- state->handler = prolog1;
+- return XML_ROLE_XML_DECL;
+- case XML_TOK_PI:
+- state->handler = prolog1;
+- return XML_ROLE_NONE;
+- case XML_TOK_COMMENT:
+- state->handler = prolog1;
+- case XML_TOK_BOM:
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_OPEN:
+- if (!XmlNameMatchesAscii(enc,
+- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
+- "DOCTYPE"))
+- break;
+- state->handler = doctype0;
+- return XML_ROLE_NONE;
+- case XML_TOK_INSTANCE_START:
+- state->handler = error;
+- return XML_ROLE_INSTANCE_START;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int prolog1(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_PI:
+- case XML_TOK_COMMENT:
+- case XML_TOK_BOM:
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_OPEN:
+- if (!XmlNameMatchesAscii(enc,
+- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
+- "DOCTYPE"))
+- break;
+- state->handler = doctype0;
+- return XML_ROLE_NONE;
+- case XML_TOK_INSTANCE_START:
+- state->handler = error;
+- return XML_ROLE_INSTANCE_START;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int prolog2(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_PI:
+- case XML_TOK_COMMENT:
+- return XML_ROLE_NONE;
+- case XML_TOK_INSTANCE_START:
+- state->handler = error;
+- return XML_ROLE_INSTANCE_START;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int doctype0(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = doctype1;
+- return XML_ROLE_DOCTYPE_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int doctype1(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_OPEN_BRACKET:
+- state->handler = internalSubset;
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_CLOSE:
+- state->handler = prolog2;
+- return XML_ROLE_DOCTYPE_CLOSE;
+- case XML_TOK_NAME:
+- if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
+- state->handler = doctype3;
+- return XML_ROLE_NONE;
+- }
+- if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
+- state->handler = doctype2;
+- return XML_ROLE_NONE;
+- }
+- break;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int doctype2(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = doctype3;
+- return XML_ROLE_DOCTYPE_PUBLIC_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int doctype3(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = doctype4;
+- return XML_ROLE_DOCTYPE_SYSTEM_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int doctype4(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_OPEN_BRACKET:
+- state->handler = internalSubset;
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_CLOSE:
+- state->handler = prolog2;
+- return XML_ROLE_DOCTYPE_CLOSE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int doctype5(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_CLOSE:
+- state->handler = prolog2;
+- return XML_ROLE_DOCTYPE_CLOSE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int internalSubset(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_OPEN:
+- if (XmlNameMatchesAscii(enc,
+- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
+- "ENTITY")) {
+- state->handler = entity0;
+- return XML_ROLE_NONE;
+- }
+- if (XmlNameMatchesAscii(enc,
+- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
+- "ATTLIST")) {
+- state->handler = attlist0;
+- return XML_ROLE_NONE;
+- }
+- if (XmlNameMatchesAscii(enc,
+- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
+- "ELEMENT")) {
+- state->handler = element0;
+- return XML_ROLE_NONE;
+- }
+- if (XmlNameMatchesAscii(enc,
+- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
+- "NOTATION")) {
+- state->handler = notation0;
+- return XML_ROLE_NONE;
+- }
+- break;
+- case XML_TOK_PI:
+- case XML_TOK_COMMENT:
+- return XML_ROLE_NONE;
+- case XML_TOK_PARAM_ENTITY_REF:
+- return XML_ROLE_PARAM_ENTITY_REF;
+- case XML_TOK_CLOSE_BRACKET:
+- state->handler = doctype5;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity0(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_PERCENT:
+- state->handler = entity1;
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- state->handler = entity2;
+- return XML_ROLE_GENERAL_ENTITY_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity1(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- state->handler = entity7;
+- return XML_ROLE_PARAM_ENTITY_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity2(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
+- state->handler = entity4;
+- return XML_ROLE_NONE;
+- }
+- if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
+- state->handler = entity3;
+- return XML_ROLE_NONE;
+- }
+- break;
+- case XML_TOK_LITERAL:
+- state->handler = declClose;
+- return XML_ROLE_ENTITY_VALUE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity3(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = entity4;
+- return XML_ROLE_ENTITY_PUBLIC_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-
+-static
+-int entity4(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = entity5;
+- return XML_ROLE_ENTITY_SYSTEM_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity5(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_CLOSE:
+- state->handler = internalSubset;
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- if (XmlNameMatchesAscii(enc, ptr, "NDATA")) {
+- state->handler = entity6;
+- return XML_ROLE_NONE;
+- }
+- break;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity6(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- state->handler = declClose;
+- return XML_ROLE_ENTITY_NOTATION_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity7(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
+- state->handler = entity9;
+- return XML_ROLE_NONE;
+- }
+- if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
+- state->handler = entity8;
+- return XML_ROLE_NONE;
+- }
+- break;
+- case XML_TOK_LITERAL:
+- state->handler = declClose;
+- return XML_ROLE_ENTITY_VALUE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity8(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = entity9;
+- return XML_ROLE_ENTITY_PUBLIC_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int entity9(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = declClose;
+- return XML_ROLE_ENTITY_SYSTEM_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int notation0(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- state->handler = notation1;
+- return XML_ROLE_NOTATION_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int notation1(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
+- state->handler = notation3;
+- return XML_ROLE_NONE;
+- }
+- if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
+- state->handler = notation2;
+- return XML_ROLE_NONE;
+- }
+- break;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int notation2(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = notation4;
+- return XML_ROLE_NOTATION_PUBLIC_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int notation3(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = declClose;
+- return XML_ROLE_NOTATION_SYSTEM_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int notation4(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = declClose;
+- return XML_ROLE_NOTATION_SYSTEM_ID;
+- case XML_TOK_DECL_CLOSE:
+- state->handler = internalSubset;
+- return XML_ROLE_NOTATION_NO_SYSTEM_ID;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist0(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = attlist1;
+- return XML_ROLE_ATTLIST_ELEMENT_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist1(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_CLOSE:
+- state->handler = internalSubset;
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = attlist2;
+- return XML_ROLE_ATTRIBUTE_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist2(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- {
+- static const char *types[] = {
+- "CDATA",
+- "ID",
+- "IDREF",
+- "IDREFS",
+- "ENTITY",
+- "ENTITIES",
+- "NMTOKEN",
+- "NMTOKENS",
+- };
+- int i;
+- for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++)
+- if (XmlNameMatchesAscii(enc, ptr, types[i])) {
+- state->handler = attlist8;
+- return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i;
+- }
+- }
+- if (XmlNameMatchesAscii(enc, ptr, "NOTATION")) {
+- state->handler = attlist5;
+- return XML_ROLE_NONE;
+- }
+- break;
+- case XML_TOK_OPEN_PAREN:
+- state->handler = attlist3;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist3(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NMTOKEN:
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = attlist4;
+- return XML_ROLE_ATTRIBUTE_ENUM_VALUE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist4(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_CLOSE_PAREN:
+- state->handler = attlist8;
+- return XML_ROLE_NONE;
+- case XML_TOK_OR:
+- state->handler = attlist3;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist5(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_OPEN_PAREN:
+- state->handler = attlist6;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-
+-static
+-int attlist6(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- state->handler = attlist7;
+- return XML_ROLE_ATTRIBUTE_NOTATION_VALUE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist7(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_CLOSE_PAREN:
+- state->handler = attlist8;
+- return XML_ROLE_NONE;
+- case XML_TOK_OR:
+- state->handler = attlist6;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-/* default value */
+-static
+-int attlist8(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_POUND_NAME:
+- if (XmlNameMatchesAscii(enc,
+- ptr + MIN_BYTES_PER_CHAR(enc),
+- "IMPLIED")) {
+- state->handler = attlist1;
+- return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE;
+- }
+- if (XmlNameMatchesAscii(enc,
+- ptr + MIN_BYTES_PER_CHAR(enc),
+- "REQUIRED")) {
+- state->handler = attlist1;
+- return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE;
+- }
+- if (XmlNameMatchesAscii(enc,
+- ptr + MIN_BYTES_PER_CHAR(enc),
+- "FIXED")) {
+- state->handler = attlist9;
+- return XML_ROLE_NONE;
+- }
+- break;
+- case XML_TOK_LITERAL:
+- state->handler = attlist1;
+- return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int attlist9(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_LITERAL:
+- state->handler = attlist1;
+- return XML_ROLE_FIXED_ATTRIBUTE_VALUE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element0(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = element1;
+- return XML_ROLE_ELEMENT_NAME;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element1(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- if (XmlNameMatchesAscii(enc, ptr, "EMPTY")) {
+- state->handler = declClose;
+- return XML_ROLE_CONTENT_EMPTY;
+- }
+- if (XmlNameMatchesAscii(enc, ptr, "ANY")) {
+- state->handler = declClose;
+- return XML_ROLE_CONTENT_ANY;
+- }
+- break;
+- case XML_TOK_OPEN_PAREN:
+- state->handler = element2;
+- state->level = 1;
+- return XML_ROLE_GROUP_OPEN;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element2(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_POUND_NAME:
+- if (XmlNameMatchesAscii(enc,
+- ptr + MIN_BYTES_PER_CHAR(enc),
+- "PCDATA")) {
+- state->handler = element3;
+- return XML_ROLE_CONTENT_PCDATA;
+- }
+- break;
+- case XML_TOK_OPEN_PAREN:
+- state->level = 2;
+- state->handler = element6;
+- return XML_ROLE_GROUP_OPEN;
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT;
+- case XML_TOK_NAME_QUESTION:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT_OPT;
+- case XML_TOK_NAME_ASTERISK:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT_REP;
+- case XML_TOK_NAME_PLUS:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT_PLUS;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element3(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_CLOSE_PAREN:
+- case XML_TOK_CLOSE_PAREN_ASTERISK:
+- state->handler = declClose;
+- return XML_ROLE_GROUP_CLOSE_REP;
+- case XML_TOK_OR:
+- state->handler = element4;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element4(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = element5;
+- return XML_ROLE_CONTENT_ELEMENT;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element5(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_CLOSE_PAREN_ASTERISK:
+- state->handler = declClose;
+- return XML_ROLE_GROUP_CLOSE_REP;
+- case XML_TOK_OR:
+- state->handler = element4;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element6(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_OPEN_PAREN:
+- state->level += 1;
+- return XML_ROLE_GROUP_OPEN;
+- case XML_TOK_NAME:
+- case XML_TOK_PREFIXED_NAME:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT;
+- case XML_TOK_NAME_QUESTION:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT_OPT;
+- case XML_TOK_NAME_ASTERISK:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT_REP;
+- case XML_TOK_NAME_PLUS:
+- state->handler = element7;
+- return XML_ROLE_CONTENT_ELEMENT_PLUS;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int element7(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_CLOSE_PAREN:
+- state->level -= 1;
+- if (state->level == 0)
+- state->handler = declClose;
+- return XML_ROLE_GROUP_CLOSE;
+- case XML_TOK_CLOSE_PAREN_ASTERISK:
+- state->level -= 1;
+- if (state->level == 0)
+- state->handler = declClose;
+- return XML_ROLE_GROUP_CLOSE_REP;
+- case XML_TOK_CLOSE_PAREN_QUESTION:
+- state->level -= 1;
+- if (state->level == 0)
+- state->handler = declClose;
+- return XML_ROLE_GROUP_CLOSE_OPT;
+- case XML_TOK_CLOSE_PAREN_PLUS:
+- state->level -= 1;
+- if (state->level == 0)
+- state->handler = declClose;
+- return XML_ROLE_GROUP_CLOSE_PLUS;
+- case XML_TOK_COMMA:
+- state->handler = element6;
+- return XML_ROLE_GROUP_SEQUENCE;
+- case XML_TOK_OR:
+- state->handler = element6;
+- return XML_ROLE_GROUP_CHOICE;
+- }
+- return syntaxError(state);
+-}
+-
+-static
+-int declClose(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_PROLOG_S:
+- return XML_ROLE_NONE;
+- case XML_TOK_DECL_CLOSE:
+- state->handler = internalSubset;
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-
+-#if 0
+-
+-static
+-int ignore(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- switch (tok) {
+- case XML_TOK_DECL_CLOSE:
+- state->handler = internalSubset;
+- return 0;
+- default:
+- return XML_ROLE_NONE;
+- }
+- return syntaxError(state);
+-}
+-#endif
+-
+-static
+-int error(PROLOG_STATE *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc)
+-{
+- return XML_ROLE_NONE;
+-}
+-
+-static
+-int syntaxError(PROLOG_STATE *state)
+-{
+- state->handler = error;
+- return XML_ROLE_ERROR;
+-}
+-
+-void XmlPrologStateInit(PROLOG_STATE *state)
+-{
+- state->handler = prolog0;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmlrole.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmlrole.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmlrole.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmlrole.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,111 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#ifndef XmlRole_INCLUDED
+-#define XmlRole_INCLUDED 1
+-
+-#include "xmltok.h"
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-enum {
+- XML_ROLE_ERROR = -1,
+- XML_ROLE_NONE = 0,
+- XML_ROLE_XML_DECL,
+- XML_ROLE_INSTANCE_START,
+- XML_ROLE_DOCTYPE_NAME,
+- XML_ROLE_DOCTYPE_SYSTEM_ID,
+- XML_ROLE_DOCTYPE_PUBLIC_ID,
+- XML_ROLE_DOCTYPE_CLOSE,
+- XML_ROLE_GENERAL_ENTITY_NAME,
+- XML_ROLE_PARAM_ENTITY_NAME,
+- XML_ROLE_ENTITY_VALUE,
+- XML_ROLE_ENTITY_SYSTEM_ID,
+- XML_ROLE_ENTITY_PUBLIC_ID,
+- XML_ROLE_ENTITY_NOTATION_NAME,
+- XML_ROLE_NOTATION_NAME,
+- XML_ROLE_NOTATION_SYSTEM_ID,
+- XML_ROLE_NOTATION_NO_SYSTEM_ID,
+- XML_ROLE_NOTATION_PUBLIC_ID,
+- XML_ROLE_ATTRIBUTE_NAME,
+- XML_ROLE_ATTRIBUTE_TYPE_CDATA,
+- XML_ROLE_ATTRIBUTE_TYPE_ID,
+- XML_ROLE_ATTRIBUTE_TYPE_IDREF,
+- XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
+- XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
+- XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
+- XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
+- XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
+- XML_ROLE_ATTRIBUTE_ENUM_VALUE,
+- XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
+- XML_ROLE_ATTLIST_ELEMENT_NAME,
+- XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
+- XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
+- XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
+- XML_ROLE_FIXED_ATTRIBUTE_VALUE,
+- XML_ROLE_ELEMENT_NAME,
+- XML_ROLE_CONTENT_ANY,
+- XML_ROLE_CONTENT_EMPTY,
+- XML_ROLE_CONTENT_PCDATA,
+- XML_ROLE_GROUP_OPEN,
+- XML_ROLE_GROUP_CLOSE,
+- XML_ROLE_GROUP_CLOSE_REP,
+- XML_ROLE_GROUP_CLOSE_OPT,
+- XML_ROLE_GROUP_CLOSE_PLUS,
+- XML_ROLE_GROUP_CHOICE,
+- XML_ROLE_GROUP_SEQUENCE,
+- XML_ROLE_CONTENT_ELEMENT,
+- XML_ROLE_CONTENT_ELEMENT_REP,
+- XML_ROLE_CONTENT_ELEMENT_OPT,
+- XML_ROLE_CONTENT_ELEMENT_PLUS,
+- XML_ROLE_PARAM_ENTITY_REF
+-};
+-
+-typedef struct prolog_state {
+- int (*handler)(struct prolog_state *state,
+- int tok,
+- const char *ptr,
+- const char *end,
+- const ENCODING *enc);
+- unsigned level;
+-} PROLOG_STATE;
+-
+-void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *);
+-
+-#define XmlTokenRole(state, tok, ptr, end, enc) \
+- (((state)->handler)(state, tok, ptr, end, enc))
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* not XmlRole_INCLUDED */
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmltok.c dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok.c
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmltok.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,1527 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include "xmldef.h"
+-#include "xmltok.h"
+-#include "nametab.h"
+-
+-#define VTABLE1 \
+- { PREFIX(prologTok), PREFIX(contentTok), PREFIX(cdataSectionTok) }, \
+- { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
+- PREFIX(sameName), \
+- PREFIX(nameMatchesAscii), \
+- PREFIX(nameLength), \
+- PREFIX(skipS), \
+- PREFIX(getAtts), \
+- PREFIX(charRefNumber), \
+- PREFIX(predefinedEntityName), \
+- PREFIX(updatePosition), \
+- PREFIX(isPublicId)
+-
+-#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
+-
+-#define UCS2_GET_NAMING(pages, hi, lo) \
+- (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
+-
+-/* A 2 byte UTF-8 representation splits the characters 11 bits
+-between the bottom 5 and 6 bits of the bytes.
+-We need 8 bits to index into pages, 3 bits to add to that index and
+-5 bits to generate the mask. */
+-#define UTF8_GET_NAMING2(pages, byte) \
+- (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
+- + ((((byte)[0]) & 3) << 1) \
+- + ((((byte)[1]) >> 5) & 1)] \
+- & (1 << (((byte)[1]) & 0x1F)))
+-
+-/* A 3 byte UTF-8 representation splits the characters 16 bits
+-between the bottom 4, 6 and 6 bits of the bytes.
+-We need 8 bits to index into pages, 3 bits to add to that index and
+-5 bits to generate the mask. */
+-#define UTF8_GET_NAMING3(pages, byte) \
+- (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \
+- + ((((byte)[1]) >> 2) & 0xF)] \
+- << 3) \
+- + ((((byte)[1]) & 3) << 1) \
+- + ((((byte)[2]) >> 5) & 1)] \
+- & (1 << (((byte)[2]) & 0x1F)))
+-
+-#define UTF8_GET_NAMING(pages, p, n) \
+- ((n) == 2 \
+- ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \
+- : ((n) == 3 \
+- ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \
+- : 0))
+-
+-#define UTF8_INVALID3(p) \
+- ((*p) == 0xED \
+- ? (((p)[1] & 0x20) != 0) \
+- : ((*p) == 0xEF \
+- ? ((p)[1] == 0xBF && ((p)[2] == 0xBF || (p)[2] == 0xBE)) \
+- : 0))
+-
+-#define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0)
+-
+-static
+-int isNever(const ENCODING *enc, const char *p)
+-{
+- return 0;
+-}
+-
+-static
+-int utf8_isName2(const ENCODING *enc, const char *p)
+-{
+- return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
+-}
+-
+-static
+-int utf8_isName3(const ENCODING *enc, const char *p)
+-{
+- return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
+-}
+-
+-#define utf8_isName4 isNever
+-
+-static
+-int utf8_isNmstrt2(const ENCODING *enc, const char *p)
+-{
+- return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
+-}
+-
+-static
+-int utf8_isNmstrt3(const ENCODING *enc, const char *p)
+-{
+- return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
+-}
+-
+-#define utf8_isNmstrt4 isNever
+-
+-#define utf8_isInvalid2 isNever
+-
+-static
+-int utf8_isInvalid3(const ENCODING *enc, const char *p)
+-{
+- return UTF8_INVALID3((const unsigned char *)p);
+-}
+-
+-static
+-int utf8_isInvalid4(const ENCODING *enc, const char *p)
+-{
+- return UTF8_INVALID4((const unsigned char *)p);
+-}
+-
+-struct normal_encoding {
+- ENCODING enc;
+- unsigned char type[256];
+-#ifdef XML_MIN_SIZE
+- int (*byteType)(const ENCODING *, const char *);
+- int (*isNameMin)(const ENCODING *, const char *);
+- int (*isNmstrtMin)(const ENCODING *, const char *);
+- int (*byteToAscii)(const ENCODING *, const char *);
+- int (*charMatches)(const ENCODING *, const char *, int);
+-#endif /* XML_MIN_SIZE */
+- int (*isName2)(const ENCODING *, const char *);
+- int (*isName3)(const ENCODING *, const char *);
+- int (*isName4)(const ENCODING *, const char *);
+- int (*isNmstrt2)(const ENCODING *, const char *);
+- int (*isNmstrt3)(const ENCODING *, const char *);
+- int (*isNmstrt4)(const ENCODING *, const char *);
+- int (*isInvalid2)(const ENCODING *, const char *);
+- int (*isInvalid3)(const ENCODING *, const char *);
+- int (*isInvalid4)(const ENCODING *, const char *);
+-};
+-
+-#ifdef XML_MIN_SIZE
+-
+-#define STANDARD_VTABLE(E) \
+- E ## byteType, \
+- E ## isNameMin, \
+- E ## isNmstrtMin, \
+- E ## byteToAscii, \
+- E ## charMatches,
+-
+-#else
+-
+-#define STANDARD_VTABLE(E) /* as nothing */
+-
+-#endif
+-
+-#define NORMAL_VTABLE(E) \
+- E ## isName2, \
+- E ## isName3, \
+- E ## isName4, \
+- E ## isNmstrt2, \
+- E ## isNmstrt3, \
+- E ## isNmstrt4, \
+- E ## isInvalid2, \
+- E ## isInvalid3, \
+- E ## isInvalid4
+-
+-static int checkCharRefNumber(int);
+-
+-#include "xmltok_impl.h"
+-
+-#ifdef XML_MIN_SIZE
+-#define sb_isNameMin isNever
+-#define sb_isNmstrtMin isNever
+-#endif
+-
+-#ifdef XML_MIN_SIZE
+-#define MINBPC(enc) ((enc)->minBytesPerChar)
+-#else
+-/* minimum bytes per character */
+-#define MINBPC(enc) 1
+-#endif
+-
+-#define SB_BYTE_TYPE(enc, p) \
+- (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
+-
+-#ifdef XML_MIN_SIZE
+-static
+-int sb_byteType(const ENCODING *enc, const char *p)
+-{
+- return SB_BYTE_TYPE(enc, p);
+-}
+-#define BYTE_TYPE(enc, p) \
+- (((const struct normal_encoding *)(enc))->byteType(enc, p))
+-#else
+-#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p)
+-#endif
+-
+-#ifdef XML_MIN_SIZE
+-#define BYTE_TO_ASCII(enc, p) \
+- (((const struct normal_encoding *)(enc))->byteToAscii(enc, p))
+-static
+-int sb_byteToAscii(const ENCODING *enc, const char *p)
+-{
+- return *p;
+-}
+-#else
+-#define BYTE_TO_ASCII(enc, p) (*p)
+-#endif
+-
+-#define IS_NAME_CHAR(enc, p, n) \
+- (((const struct normal_encoding *)(enc))->isName ## n(enc, p))
+-#define IS_NMSTRT_CHAR(enc, p, n) \
+- (((const struct normal_encoding *)(enc))->isNmstrt ## n(enc, p))
+-#define IS_INVALID_CHAR(enc, p, n) \
+- (((const struct normal_encoding *)(enc))->isInvalid ## n(enc, p))
+-
+-#ifdef XML_MIN_SIZE
+-#define IS_NAME_CHAR_MINBPC(enc, p) \
+- (((const struct normal_encoding *)(enc))->isNameMin(enc, p))
+-#define IS_NMSTRT_CHAR_MINBPC(enc, p) \
+- (((const struct normal_encoding *)(enc))->isNmstrtMin(enc, p))
+-#else
+-#define IS_NAME_CHAR_MINBPC(enc, p) (0)
+-#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0)
+-#endif
+-
+-#ifdef XML_MIN_SIZE
+-#define CHAR_MATCHES(enc, p, c) \
+- (((const struct normal_encoding *)(enc))->charMatches(enc, p, c))
+-static
+-int sb_charMatches(const ENCODING *enc, const char *p, int c)
+-{
+- return *p == c;
+-}
+-#else
+-/* c is an ASCII character */
+-#define CHAR_MATCHES(enc, p, c) (*(p) == c)
+-#endif
+-
+-#define PREFIX(ident) normal_ ## ident
+-#include "xmltok_impl.c"
+-
+-#undef MINBPC
+-#undef BYTE_TYPE
+-#undef BYTE_TO_ASCII
+-#undef CHAR_MATCHES
+-#undef IS_NAME_CHAR
+-#undef IS_NAME_CHAR_MINBPC
+-#undef IS_NMSTRT_CHAR
+-#undef IS_NMSTRT_CHAR_MINBPC
+-#undef IS_INVALID_CHAR
+-
+-enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */
+- UTF8_cval1 = 0x00,
+- UTF8_cval2 = 0xc0,
+- UTF8_cval3 = 0xe0,
+- UTF8_cval4 = 0xf0
+-};
+-
+-static
+-void utf8_toUtf8(const ENCODING *enc,
+- const char **fromP, const char *fromLim,
+- char **toP, const char *toLim)
+-{
+- char *to;
+- const char *from;
+- if (fromLim - *fromP > toLim - *toP) {
+- /* Avoid copying partial characters. */
+- for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--)
+- if (((unsigned char)fromLim[-1] & 0xc0) != 0x80)
+- break;
+- }
+- for (to = *toP, from = *fromP; from != fromLim; from++, to++)
+- *to = *from;
+- *fromP = from;
+- *toP = to;
+-}
+-
+-static
+-void utf8_toUtf16(const ENCODING *enc,
+- const char **fromP, const char *fromLim,
+- unsigned short **toP, const unsigned short *toLim)
+-{
+- unsigned short *to = *toP;
+- const char *from = *fromP;
+- while (from != fromLim && to != toLim) {
+- switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {
+- case BT_LEAD2:
+- *to++ = ((from[0] & 0x1f) << 6) | (from[1] & 0x3f);
+- from += 2;
+- break;
+- case BT_LEAD3:
+- *to++ = ((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f);
+- from += 3;
+- break;
+- case BT_LEAD4:
+- {
+- unsigned long n;
+- if (to + 1 == toLim)
+- break;
+- n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f);
+- n -= 0x10000;
+- to[0] = (unsigned short)((n >> 10) | 0xD800);
+- to[1] = (unsigned short)((n & 0x3FF) | 0xDC00);
+- to += 2;
+- from += 4;
+- }
+- break;
+- default:
+- *to++ = *from++;
+- break;
+- }
+- }
+- *fromP = from;
+- *toP = to;
+-}
+-
+-#ifdef XML_NS
+-static const struct normal_encoding utf8_encoding_ns = {
+- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
+- {
+-#include "asciitab.h"
+-#include "utf8tab.h"
+- },
+- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
+-};
+-#endif
+-
+-static const struct normal_encoding utf8_encoding = {
+- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "asciitab.h"
+-#undef BT_COLON
+-#include "utf8tab.h"
+- },
+- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
+-};
+-
+-#ifdef XML_NS
+-
+-static const struct normal_encoding internal_utf8_encoding_ns = {
+- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
+- {
+-#include "iasciitab.h"
+-#include "utf8tab.h"
+- },
+- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
+-};
+-
+-#endif
+-
+-static const struct normal_encoding internal_utf8_encoding = {
+- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "iasciitab.h"
+-#undef BT_COLON
+-#include "utf8tab.h"
+- },
+- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
+-};
+-
+-static
+-void latin1_toUtf8(const ENCODING *enc,
+- const char **fromP, const char *fromLim,
+- char **toP, const char *toLim)
+-{
+- for (;;) {
+- unsigned char c;
+- if (*fromP == fromLim)
+- break;
+- c = (unsigned char)**fromP;
+- if (c & 0x80) {
+- if (toLim - *toP < 2)
+- break;
+- *(*toP)++ = ((c >> 6) | UTF8_cval2);
+- *(*toP)++ = ((c & 0x3f) | 0x80);
+- (*fromP)++;
+- }
+- else {
+- if (*toP == toLim)
+- break;
+- *(*toP)++ = *(*fromP)++;
+- }
+- }
+-}
+-
+-static
+-void latin1_toUtf16(const ENCODING *enc,
+- const char **fromP, const char *fromLim,
+- unsigned short **toP, const unsigned short *toLim)
+-{
+- while (*fromP != fromLim && *toP != toLim)
+- *(*toP)++ = (unsigned char)*(*fromP)++;
+-}
+-
+-#ifdef XML_NS
+-
+-static const struct normal_encoding latin1_encoding_ns = {
+- { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
+- {
+-#include "asciitab.h"
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(sb_)
+-};
+-
+-#endif
+-
+-static const struct normal_encoding latin1_encoding = {
+- { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "asciitab.h"
+-#undef BT_COLON
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(sb_)
+-};
+-
+-static
+-void ascii_toUtf8(const ENCODING *enc,
+- const char **fromP, const char *fromLim,
+- char **toP, const char *toLim)
+-{
+- while (*fromP != fromLim && *toP != toLim)
+- *(*toP)++ = *(*fromP)++;
+-}
+-
+-#ifdef XML_NS
+-
+-static const struct normal_encoding ascii_encoding_ns = {
+- { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
+- {
+-#include "asciitab.h"
+-/* BT_NONXML == 0 */
+- },
+- STANDARD_VTABLE(sb_)
+-};
+-
+-#endif
+-
+-static const struct normal_encoding ascii_encoding = {
+- { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "asciitab.h"
+-#undef BT_COLON
+-/* BT_NONXML == 0 */
+- },
+- STANDARD_VTABLE(sb_)
+-};
+-
+-static int unicode_byte_type(char hi, char lo)
+-{
+- switch ((unsigned char)hi) {
+- case 0xD8: case 0xD9: case 0xDA: case 0xDB:
+- return BT_LEAD4;
+- case 0xDC: case 0xDD: case 0xDE: case 0xDF:
+- return BT_TRAIL;
+- case 0xFF:
+- switch ((unsigned char)lo) {
+- case 0xFF:
+- case 0xFE:
+- return BT_NONXML;
+- }
+- break;
+- }
+- return BT_NONASCII;
+-}
+-
+-#define DEFINE_UTF16_TO_UTF8(E) \
+-static \
+-void E ## toUtf8(const ENCODING *enc, \
+- const char **fromP, const char *fromLim, \
+- char **toP, const char *toLim) \
+-{ \
+- const char *from; \
+- for (from = *fromP; from != fromLim; from += 2) { \
+- int plane; \
+- unsigned char lo2; \
+- unsigned char lo = GET_LO(from); \
+- unsigned char hi = GET_HI(from); \
+- switch (hi) { \
+- case 0: \
+- if (lo < 0x80) { \
+- if (*toP == toLim) { \
+- *fromP = from; \
+- return; \
+- } \
+- *(*toP)++ = lo; \
+- break; \
+- } \
+- /* fall through */ \
+- case 0x1: case 0x2: case 0x3: \
+- case 0x4: case 0x5: case 0x6: case 0x7: \
+- if (toLim - *toP < 2) { \
+- *fromP = from; \
+- return; \
+- } \
+- *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \
+- *(*toP)++ = ((lo & 0x3f) | 0x80); \
+- break; \
+- default: \
+- if (toLim - *toP < 3) { \
+- *fromP = from; \
+- return; \
+- } \
+- /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \
+- *(*toP)++ = ((hi >> 4) | UTF8_cval3); \
+- *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \
+- *(*toP)++ = ((lo & 0x3f) | 0x80); \
+- break; \
+- case 0xD8: case 0xD9: case 0xDA: case 0xDB: \
+- if (toLim - *toP < 4) { \
+- *fromP = from; \
+- return; \
+- } \
+- plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
+- *(*toP)++ = ((plane >> 2) | UTF8_cval4); \
+- *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \
+- from += 2; \
+- lo2 = GET_LO(from); \
+- *(*toP)++ = (((lo & 0x3) << 4) \
+- | ((GET_HI(from) & 0x3) << 2) \
+- | (lo2 >> 6) \
+- | 0x80); \
+- *(*toP)++ = ((lo2 & 0x3f) | 0x80); \
+- break; \
+- } \
+- } \
+- *fromP = from; \
+-}
+-
+-#define DEFINE_UTF16_TO_UTF16(E) \
+-static \
+-void E ## toUtf16(const ENCODING *enc, \
+- const char **fromP, const char *fromLim, \
+- unsigned short **toP, const unsigned short *toLim) \
+-{ \
+- /* Avoid copying first half only of surrogate */ \
+- if (fromLim - *fromP > ((toLim - *toP) << 1) \
+- && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \
+- fromLim -= 2; \
+- for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \
+- *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
+-}
+-
+-#define SET2(ptr, ch) \
+- (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))
+-#define GET_LO(ptr) ((unsigned char)(ptr)[0])
+-#define GET_HI(ptr) ((unsigned char)(ptr)[1])
+-
+-DEFINE_UTF16_TO_UTF8(little2_)
+-DEFINE_UTF16_TO_UTF16(little2_)
+-
+-#undef SET2
+-#undef GET_LO
+-#undef GET_HI
+-
+-#define SET2(ptr, ch) \
+- (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))
+-#define GET_LO(ptr) ((unsigned char)(ptr)[1])
+-#define GET_HI(ptr) ((unsigned char)(ptr)[0])
+-
+-DEFINE_UTF16_TO_UTF8(big2_)
+-DEFINE_UTF16_TO_UTF16(big2_)
+-
+-#undef SET2
+-#undef GET_LO
+-#undef GET_HI
+-
+-#define LITTLE2_BYTE_TYPE(enc, p) \
+- ((p)[1] == 0 \
+- ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
+- : unicode_byte_type((p)[1], (p)[0]))
+-#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1)
+-#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c)
+-#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \
+- UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
+-#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
+- UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
+-
+-#ifdef XML_MIN_SIZE
+-
+-static
+-int little2_byteType(const ENCODING *enc, const char *p)
+-{
+- return LITTLE2_BYTE_TYPE(enc, p);
+-}
+-
+-static
+-int little2_byteToAscii(const ENCODING *enc, const char *p)
+-{
+- return LITTLE2_BYTE_TO_ASCII(enc, p);
+-}
+-
+-static
+-int little2_charMatches(const ENCODING *enc, const char *p, int c)
+-{
+- return LITTLE2_CHAR_MATCHES(enc, p, c);
+-}
+-
+-static
+-int little2_isNameMin(const ENCODING *enc, const char *p)
+-{
+- return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p);
+-}
+-
+-static
+-int little2_isNmstrtMin(const ENCODING *enc, const char *p)
+-{
+- return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p);
+-}
+-
+-#undef VTABLE
+-#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16
+-
+-#else /* not XML_MIN_SIZE */
+-
+-#undef PREFIX
+-#define PREFIX(ident) little2_ ## ident
+-#define MINBPC(enc) 2
+-/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
+-#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p)
+-#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p)
+-#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c)
+-#define IS_NAME_CHAR(enc, p, n) 0
+-#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)
+-#define IS_NMSTRT_CHAR(enc, p, n) (0)
+-#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)
+-
+-#include "xmltok_impl.c"
+-
+-#undef MINBPC
+-#undef BYTE_TYPE
+-#undef BYTE_TO_ASCII
+-#undef CHAR_MATCHES
+-#undef IS_NAME_CHAR
+-#undef IS_NAME_CHAR_MINBPC
+-#undef IS_NMSTRT_CHAR
+-#undef IS_NMSTRT_CHAR_MINBPC
+-#undef IS_INVALID_CHAR
+-
+-#endif /* not XML_MIN_SIZE */
+-
+-#ifdef XML_NS
+-
+-static const struct normal_encoding little2_encoding_ns = {
+- { VTABLE, 2, 0,
+-#if XML_BYTE_ORDER == 12
+- 1
+-#else
+- 0
+-#endif
+- },
+- {
+-#include "asciitab.h"
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(little2_)
+-};
+-
+-#endif
+-
+-static const struct normal_encoding little2_encoding = {
+- { VTABLE, 2, 0,
+-#if XML_BYTE_ORDER == 12
+- 1
+-#else
+- 0
+-#endif
+- },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "asciitab.h"
+-#undef BT_COLON
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(little2_)
+-};
+-
+-#if XML_BYTE_ORDER != 21
+-
+-#ifdef XML_NS
+-
+-static const struct normal_encoding internal_little2_encoding_ns = {
+- { VTABLE, 2, 0, 1 },
+- {
+-#include "iasciitab.h"
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(little2_)
+-};
+-
+-#endif
+-
+-static const struct normal_encoding internal_little2_encoding = {
+- { VTABLE, 2, 0, 1 },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "iasciitab.h"
+-#undef BT_COLON
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(little2_)
+-};
+-
+-#endif
+-
+-
+-#define BIG2_BYTE_TYPE(enc, p) \
+- ((p)[0] == 0 \
+- ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
+- : unicode_byte_type((p)[0], (p)[1]))
+-#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1)
+-#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c)
+-#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \
+- UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
+-#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
+- UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
+-
+-#ifdef XML_MIN_SIZE
+-
+-static
+-int big2_byteType(const ENCODING *enc, const char *p)
+-{
+- return BIG2_BYTE_TYPE(enc, p);
+-}
+-
+-static
+-int big2_byteToAscii(const ENCODING *enc, const char *p)
+-{
+- return BIG2_BYTE_TO_ASCII(enc, p);
+-}
+-
+-static
+-int big2_charMatches(const ENCODING *enc, const char *p, int c)
+-{
+- return BIG2_CHAR_MATCHES(enc, p, c);
+-}
+-
+-static
+-int big2_isNameMin(const ENCODING *enc, const char *p)
+-{
+- return BIG2_IS_NAME_CHAR_MINBPC(enc, p);
+-}
+-
+-static
+-int big2_isNmstrtMin(const ENCODING *enc, const char *p)
+-{
+- return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p);
+-}
+-
+-#undef VTABLE
+-#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16
+-
+-#else /* not XML_MIN_SIZE */
+-
+-#undef PREFIX
+-#define PREFIX(ident) big2_ ## ident
+-#define MINBPC(enc) 2
+-/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
+-#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p)
+-#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p)
+-#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c)
+-#define IS_NAME_CHAR(enc, p, n) 0
+-#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p)
+-#define IS_NMSTRT_CHAR(enc, p, n) (0)
+-#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)
+-
+-#include "xmltok_impl.c"
+-
+-#undef MINBPC
+-#undef BYTE_TYPE
+-#undef BYTE_TO_ASCII
+-#undef CHAR_MATCHES
+-#undef IS_NAME_CHAR
+-#undef IS_NAME_CHAR_MINBPC
+-#undef IS_NMSTRT_CHAR
+-#undef IS_NMSTRT_CHAR_MINBPC
+-#undef IS_INVALID_CHAR
+-
+-#endif /* not XML_MIN_SIZE */
+-
+-#ifdef XML_NS
+-
+-static const struct normal_encoding big2_encoding_ns = {
+- { VTABLE, 2, 0,
+-#if XML_BYTE_ORDER == 21
+- 1
+-#else
+- 0
+-#endif
+- },
+- {
+-#include "asciitab.h"
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(big2_)
+-};
+-
+-#endif
+-
+-static const struct normal_encoding big2_encoding = {
+- { VTABLE, 2, 0,
+-#if XML_BYTE_ORDER == 21
+- 1
+-#else
+- 0
+-#endif
+- },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "asciitab.h"
+-#undef BT_COLON
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(big2_)
+-};
+-
+-#if XML_BYTE_ORDER != 12
+-
+-#ifdef XML_NS
+-
+-static const struct normal_encoding internal_big2_encoding_ns = {
+- { VTABLE, 2, 0, 1 },
+- {
+-#include "iasciitab.h"
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(big2_)
+-};
+-
+-#endif
+-
+-static const struct normal_encoding internal_big2_encoding = {
+- { VTABLE, 2, 0, 1 },
+- {
+-#define BT_COLON BT_NMSTRT
+-#include "iasciitab.h"
+-#undef BT_COLON
+-#include "latin1tab.h"
+- },
+- STANDARD_VTABLE(big2_)
+-};
+-
+-#endif
+-
+-#undef PREFIX
+-
+-static
+-int streqci(const char *s1, const char *s2)
+-{
+- for (;;) {
+- char c1 = *s1++;
+- char c2 = *s2++;
+- if ('a' <= c1 && c1 <= 'z')
+- c1 += 'A' - 'a';
+- if ('a' <= c2 && c2 <= 'z')
+- c2 += 'A' - 'a';
+- if (c1 != c2)
+- return 0;
+- if (!c1)
+- break;
+- }
+- return 1;
+-}
+-
+-static
+-void initUpdatePosition(const ENCODING *enc, const char *ptr,
+- const char *end, POSITION *pos)
+-{
+- normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
+-}
+-
+-static
+-int toAscii(const ENCODING *enc, const char *ptr, const char *end)
+-{
+- char buf[1];
+- char *p = buf;
+- XmlUtf8Convert(enc, &ptr, end, &p, p + 1);
+- if (p == buf)
+- return -1;
+- else
+- return buf[0];
+-}
+-
+-static
+-int isSpace(int c)
+-{
+- switch (c) {
+- case 0x20:
+- case 0xD:
+- case 0xA:
+- case 0x9:
+- return 1;
+- }
+- return 0;
+-}
+-
+-/* Return 1 if there's just optional white space
+-or there's an S followed by name=val. */
+-static
+-int parsePseudoAttribute(const ENCODING *enc,
+- const char *ptr,
+- const char *end,
+- const char **namePtr,
+- const char **valPtr,
+- const char **nextTokPtr)
+-{
+- int c;
+- char open;
+- if (ptr == end) {
+- *namePtr = 0;
+- return 1;
+- }
+- if (!isSpace(toAscii(enc, ptr, end))) {
+- *nextTokPtr = ptr;
+- return 0;
+- }
+- do {
+- ptr += enc->minBytesPerChar;
+- } while (isSpace(toAscii(enc, ptr, end)));
+- if (ptr == end) {
+- *namePtr = 0;
+- return 1;
+- }
+- *namePtr = ptr;
+- for (;;) {
+- c = toAscii(enc, ptr, end);
+- if (c == -1) {
+- *nextTokPtr = ptr;
+- return 0;
+- }
+- if (c == '=')
+- break;
+- if (isSpace(c)) {
+- do {
+- ptr += enc->minBytesPerChar;
+- } while (isSpace(c = toAscii(enc, ptr, end)));
+- if (c != '=') {
+- *nextTokPtr = ptr;
+- return 0;
+- }
+- break;
+- }
+- ptr += enc->minBytesPerChar;
+- }
+- if (ptr == *namePtr) {
+- *nextTokPtr = ptr;
+- return 0;
+- }
+- ptr += enc->minBytesPerChar;
+- c = toAscii(enc, ptr, end);
+- while (isSpace(c)) {
+- ptr += enc->minBytesPerChar;
+- c = toAscii(enc, ptr, end);
+- }
+- if (c != '"' && c != '\'') {
+- *nextTokPtr = ptr;
+- return 0;
+- }
+- open = c;
+- ptr += enc->minBytesPerChar;
+- *valPtr = ptr;
+- for (;; ptr += enc->minBytesPerChar) {
+- c = toAscii(enc, ptr, end);
+- if (c == open)
+- break;
+- if (!('a' <= c && c <= 'z')
+- && !('A' <= c && c <= 'Z')
+- && !('0' <= c && c <= '9')
+- && c != '.'
+- && c != '-'
+- && c != '_') {
+- *nextTokPtr = ptr;
+- return 0;
+- }
+- }
+- *nextTokPtr = ptr + enc->minBytesPerChar;
+- return 1;
+-}
+-
+-static
+-int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
+- const char *,
+- const char *),
+- int isGeneralTextEntity,
+- const ENCODING *enc,
+- const char *ptr,
+- const char *end,
+- const char **badPtr,
+- const char **versionPtr,
+- const char **encodingName,
+- const ENCODING **encoding,
+- int *standalone)
+-{
+- const char *val = 0;
+- const char *name = 0;
+- ptr += 5 * enc->minBytesPerChar;
+- end -= 2 * enc->minBytesPerChar;
+- if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr) || !name) {
+- *badPtr = ptr;
+- return 0;
+- }
+- if (!XmlNameMatchesAscii(enc, name, "version")) {
+- if (!isGeneralTextEntity) {
+- *badPtr = name;
+- return 0;
+- }
+- }
+- else {
+- if (versionPtr)
+- *versionPtr = val;
+- if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) {
+- *badPtr = ptr;
+- return 0;
+- }
+- if (!name) {
+- if (isGeneralTextEntity) {
+- /* a TextDecl must have an EncodingDecl */
+- *badPtr = ptr;
+- return 0;
+- }
+- return 1;
+- }
+- }
+- if (XmlNameMatchesAscii(enc, name, "encoding")) {
+- int c = toAscii(enc, val, end);
+- if (!('a' <= c && c <= 'z') && !('A' <= c && c <= 'Z')) {
+- *badPtr = val;
+- return 0;
+- }
+- if (encodingName)
+- *encodingName = val;
+- if (encoding)
+- *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar);
+- if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) {
+- *badPtr = ptr;
+- return 0;
+- }
+- if (!name)
+- return 1;
+- }
+- if (!XmlNameMatchesAscii(enc, name, "standalone") || isGeneralTextEntity) {
+- *badPtr = name;
+- return 0;
+- }
+- if (XmlNameMatchesAscii(enc, val, "yes")) {
+- if (standalone)
+- *standalone = 1;
+- }
+- else if (XmlNameMatchesAscii(enc, val, "no")) {
+- if (standalone)
+- *standalone = 0;
+- }
+- else {
+- *badPtr = val;
+- return 0;
+- }
+- while (isSpace(toAscii(enc, ptr, end)))
+- ptr += enc->minBytesPerChar;
+- if (ptr != end) {
+- *badPtr = ptr;
+- return 0;
+- }
+- return 1;
+-}
+-
+-static
+-int checkCharRefNumber(int result)
+-{
+- switch (result >> 8) {
+- case 0xD8: case 0xD9: case 0xDA: case 0xDB:
+- case 0xDC: case 0xDD: case 0xDE: case 0xDF:
+- return -1;
+- case 0:
+- if (latin1_encoding.type[result] == BT_NONXML)
+- return -1;
+- break;
+- case 0xFF:
+- if (result == 0xFFFE || result == 0xFFFF)
+- return -1;
+- break;
+- }
+- return result;
+-}
+-
+-int XmlUtf8Encode(int c, char *buf)
+-{
+- enum {
+- /* minN is minimum legal resulting value for N byte sequence */
+- min2 = 0x80,
+- min3 = 0x800,
+- min4 = 0x10000
+- };
+-
+- if (c < 0)
+- return 0;
+- if (c < min2) {
+- buf[0] = (c | UTF8_cval1);
+- return 1;
+- }
+- if (c < min3) {
+- buf[0] = ((c >> 6) | UTF8_cval2);
+- buf[1] = ((c & 0x3f) | 0x80);
+- return 2;
+- }
+- if (c < min4) {
+- buf[0] = ((c >> 12) | UTF8_cval3);
+- buf[1] = (((c >> 6) & 0x3f) | 0x80);
+- buf[2] = ((c & 0x3f) | 0x80);
+- return 3;
+- }
+- if (c < 0x110000) {
+- buf[0] = ((c >> 18) | UTF8_cval4);
+- buf[1] = (((c >> 12) & 0x3f) | 0x80);
+- buf[2] = (((c >> 6) & 0x3f) | 0x80);
+- buf[3] = ((c & 0x3f) | 0x80);
+- return 4;
+- }
+- return 0;
+-}
+-
+-int XmlUtf16Encode(int charNum, unsigned short *buf)
+-{
+- if (charNum < 0)
+- return 0;
+- if (charNum < 0x10000) {
+- buf[0] = charNum;
+- return 1;
+- }
+- if (charNum < 0x110000) {
+- charNum -= 0x10000;
+- buf[0] = (charNum >> 10) + 0xD800;
+- buf[1] = (charNum & 0x3FF) + 0xDC00;
+- return 2;
+- }
+- return 0;
+-}
+-
+-struct unknown_encoding {
+- struct normal_encoding normal;
+- int (*convert)(void *userData, const char *p);
+- void *userData;
+- unsigned short utf16[256];
+- char utf8[256][4];
+-};
+-
+-int XmlSizeOfUnknownEncoding()
+-{
+- return sizeof(struct unknown_encoding);
+-}
+-
+-static
+-int unknown_isName(const ENCODING *enc, const char *p)
+-{
+- int c = ((const struct unknown_encoding *)enc)
+- ->convert(((const struct unknown_encoding *)enc)->userData, p);
+- if (c & ~0xFFFF)
+- return 0;
+- return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF);
+-}
+-
+-static
+-int unknown_isNmstrt(const ENCODING *enc, const char *p)
+-{
+- int c = ((const struct unknown_encoding *)enc)
+- ->convert(((const struct unknown_encoding *)enc)->userData, p);
+- if (c & ~0xFFFF)
+- return 0;
+- return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF);
+-}
+-
+-static
+-int unknown_isInvalid(const ENCODING *enc, const char *p)
+-{
+- int c = ((const struct unknown_encoding *)enc)
+- ->convert(((const struct unknown_encoding *)enc)->userData, p);
+- return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
+-}
+-
+-static
+-void unknown_toUtf8(const ENCODING *enc,
+- const char **fromP, const char *fromLim,
+- char **toP, const char *toLim)
+-{
+- char buf[XML_UTF8_ENCODE_MAX];
+- for (;;) {
+- const char *utf8;
+- int n;
+- if (*fromP == fromLim)
+- break;
+- utf8 = ((const struct unknown_encoding *)enc)->utf8[(unsigned char)**fromP];
+- n = *utf8++;
+- if (n == 0) {
+- int c = ((const struct unknown_encoding *)enc)
+- ->convert(((const struct unknown_encoding *)enc)->userData, *fromP);
+- n = XmlUtf8Encode(c, buf);
+- if (n > toLim - *toP)
+- break;
+- utf8 = buf;
+- *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP]
+- - (BT_LEAD2 - 2);
+- }
+- else {
+- if (n > toLim - *toP)
+- break;
+- (*fromP)++;
+- }
+- do {
+- *(*toP)++ = *utf8++;
+- } while (--n != 0);
+- }
+-}
+-
+-static
+-void unknown_toUtf16(const ENCODING *enc,
+- const char **fromP, const char *fromLim,
+- unsigned short **toP, const unsigned short *toLim)
+-{
+- while (*fromP != fromLim && *toP != toLim) {
+- unsigned short c
+- = ((const struct unknown_encoding *)enc)->utf16[(unsigned char)**fromP];
+- if (c == 0) {
+- c = (unsigned short)((const struct unknown_encoding *)enc)
+- ->convert(((const struct unknown_encoding *)enc)->userData, *fromP);
+- *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP]
+- - (BT_LEAD2 - 2);
+- }
+- else
+- (*fromP)++;
+- *(*toP)++ = c;
+- }
+-}
+-
+-ENCODING *
+-XmlInitUnknownEncoding(void *mem,
+- int *table,
+- int (*convert)(void *userData, const char *p),
+- void *userData)
+-{
+- int i;
+- struct unknown_encoding *e = mem;
+- for (i = 0; i < sizeof(struct normal_encoding); i++)
+- ((char *)mem)[i] = ((char *)&latin1_encoding)[i];
+- for (i = 0; i < 128; i++)
+- if (latin1_encoding.type[i] != BT_OTHER
+- && latin1_encoding.type[i] != BT_NONXML
+- && table[i] != i)
+- return 0;
+- for (i = 0; i < 256; i++) {
+- int c = table[i];
+- if (c == -1) {
+- e->normal.type[i] = BT_MALFORM;
+- /* This shouldn't really get used. */
+- e->utf16[i] = 0xFFFF;
+- e->utf8[i][0] = 1;
+- e->utf8[i][1] = 0;
+- }
+- else if (c < 0) {
+- if (c < -4)
+- return 0;
+- e->normal.type[i] = BT_LEAD2 - (c + 2);
+- e->utf8[i][0] = 0;
+- e->utf16[i] = 0;
+- }
+- else if (c < 0x80) {
+- if (latin1_encoding.type[c] != BT_OTHER
+- && latin1_encoding.type[c] != BT_NONXML
+- && c != i)
+- return 0;
+- e->normal.type[i] = latin1_encoding.type[c];
+- e->utf8[i][0] = 1;
+- e->utf8[i][1] = (char)c;
+- e->utf16[i] = c == 0 ? 0xFFFF : c;
+- }
+- else if (checkCharRefNumber(c) < 0) {
+- e->normal.type[i] = BT_NONXML;
+- /* This shouldn't really get used. */
+- e->utf16[i] = 0xFFFF;
+- e->utf8[i][0] = 1;
+- e->utf8[i][1] = 0;
+- }
+- else {
+- if (c > 0xFFFF)
+- return 0;
+- if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff))
+- e->normal.type[i] = BT_NMSTRT;
+- else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff))
+- e->normal.type[i] = BT_NAME;
+- else
+- e->normal.type[i] = BT_OTHER;
+- e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1);
+- e->utf16[i] = c;
+- }
+- }
+- e->userData = userData;
+- e->convert = convert;
+- if (convert) {
+- e->normal.isName2 = unknown_isName;
+- e->normal.isName3 = unknown_isName;
+- e->normal.isName4 = unknown_isName;
+- e->normal.isNmstrt2 = unknown_isNmstrt;
+- e->normal.isNmstrt3 = unknown_isNmstrt;
+- e->normal.isNmstrt4 = unknown_isNmstrt;
+- e->normal.isInvalid2 = unknown_isInvalid;
+- e->normal.isInvalid3 = unknown_isInvalid;
+- e->normal.isInvalid4 = unknown_isInvalid;
+- }
+- e->normal.enc.utf8Convert = unknown_toUtf8;
+- e->normal.enc.utf16Convert = unknown_toUtf16;
+- return &(e->normal.enc);
+-}
+-
+-/* If this enumeration is changed, getEncodingIndex and encodings
+-must also be changed. */
+-enum {
+- UNKNOWN_ENC = -1,
+- ISO_8859_1_ENC = 0,
+- US_ASCII_ENC,
+- UTF_8_ENC,
+- UTF_16_ENC,
+- UTF_16BE_ENC,
+- UTF_16LE_ENC,
+- /* must match encodingNames up to here */
+- NO_ENC
+-};
+-
+-static
+-int getEncodingIndex(const char *name)
+-{
+- static const char *encodingNames[] = {
+- "ISO-8859-1",
+- "US-ASCII",
+- "UTF-8",
+- "UTF-16",
+- "UTF-16BE"
+- "UTF-16LE",
+- };
+- int i;
+- if (name == 0)
+- return NO_ENC;
+- for (i = 0; i < sizeof(encodingNames)/sizeof(encodingNames[0]); i++)
+- if (streqci(name, encodingNames[i]))
+- return i;
+- return UNKNOWN_ENC;
+-}
+-
+-/* For binary compatibility, we store the index of the encoding specified
+-at initialization in the isUtf16 member. */
+-
+-#define INIT_ENC_INDEX(enc) ((enc)->initEnc.isUtf16)
+-
+-/* This is what detects the encoding.
+-encodingTable maps from encoding indices to encodings;
+-INIT_ENC_INDEX(enc) is the index of the external (protocol) specified encoding;
+-state is XML_CONTENT_STATE if we're parsing an external text entity,
+-and XML_PROLOG_STATE otherwise.
+-*/
+-
+-
+-static
+-int initScan(const ENCODING **encodingTable,
+- const INIT_ENCODING *enc,
+- int state,
+- const char *ptr,
+- const char *end,
+- const char **nextTokPtr)
+-{
+- const ENCODING **encPtr;
+-
+- if (ptr == end)
+- return XML_TOK_NONE;
+- encPtr = enc->encPtr;
+- if (ptr + 1 == end) {
+- /* only a single byte available for auto-detection */
+- /* a well-formed document entity must have more than one byte */
+- if (state != XML_CONTENT_STATE)
+- return XML_TOK_PARTIAL;
+- /* so we're parsing an external text entity... */
+- /* if UTF-16 was externally specified, then we need at least 2 bytes */
+- switch (INIT_ENC_INDEX(enc)) {
+- case UTF_16_ENC:
+- case UTF_16LE_ENC:
+- case UTF_16BE_ENC:
+- return XML_TOK_PARTIAL;
+- }
+- switch ((unsigned char)*ptr) {
+- case 0xFE:
+- case 0xFF:
+- case 0xEF: /* possibly first byte of UTF-8 BOM */
+- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
+- && state == XML_CONTENT_STATE)
+- break;
+- /* fall through */
+- case 0x00:
+- case 0x3C:
+- return XML_TOK_PARTIAL;
+- }
+- }
+- else {
+- switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) {
+- case 0xFEFF:
+- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
+- && state == XML_CONTENT_STATE)
+- break;
+- *nextTokPtr = ptr + 2;
+- *encPtr = encodingTable[UTF_16BE_ENC];
+- return XML_TOK_BOM;
+- /* 00 3C is handled in the default case */
+- case 0x3C00:
+- if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC
+- || INIT_ENC_INDEX(enc) == UTF_16_ENC)
+- && state == XML_CONTENT_STATE)
+- break;
+- *encPtr = encodingTable[UTF_16LE_ENC];
+- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
+- case 0xFFFE:
+- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
+- && state == XML_CONTENT_STATE)
+- break;
+- *nextTokPtr = ptr + 2;
+- *encPtr = encodingTable[UTF_16LE_ENC];
+- return XML_TOK_BOM;
+- case 0xEFBB:
+- /* Maybe a UTF-8 BOM (EF BB BF) */
+- /* If there's an explicitly specified (external) encoding
+- of ISO-8859-1 or some flavour of UTF-16
+- and this is an external text entity,
+- don't look for the BOM,
+- because it might be a legal data. */
+- if (state == XML_CONTENT_STATE) {
+- int e = INIT_ENC_INDEX(enc);
+- if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC || e == UTF_16LE_ENC || e == UTF_16_ENC)
+- break;
+- }
+- if (ptr + 2 == end)
+- return XML_TOK_PARTIAL;
+- if ((unsigned char)ptr[2] == 0xBF) {
+- *encPtr = encodingTable[UTF_8_ENC];
+- return XML_TOK_BOM;
+- }
+- break;
+- default:
+- if (ptr[0] == '\0') {
+- /* 0 isn't a legal data character. Furthermore a document entity can only
+- start with ASCII characters. So the only way this can fail to be big-endian
+- UTF-16 if it it's an external parsed general entity that's labelled as
+- UTF-16LE. */
+- if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC)
+- break;
+- *encPtr = encodingTable[UTF_16BE_ENC];
+- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
+- }
+- else if (ptr[1] == '\0') {
+- /* We could recover here in the case:
+- - parsing an external entity
+- - second byte is 0
+- - no externally specified encoding
+- - no encoding declaration
+- by assuming UTF-16LE. But we don't, because this would mean when
+- presented just with a single byte, we couldn't reliably determine
+- whether we needed further bytes. */
+- if (state == XML_CONTENT_STATE)
+- break;
+- *encPtr = encodingTable[UTF_16LE_ENC];
+- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
+- }
+- break;
+- }
+- }
+- *encPtr = encodingTable[INIT_ENC_INDEX(enc)];
+- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
+-}
+-
+-
+-#define NS(x) x
+-#define ns(x) x
+-#include "xmltok_ns.c"
+-#undef NS
+-#undef ns
+-
+-#ifdef XML_NS
+-
+-#define NS(x) x ## NS
+-#define ns(x) x ## _ns
+-
+-#include "xmltok_ns.c"
+-
+-#undef NS
+-#undef ns
+-
+-ENCODING *
+-XmlInitUnknownEncodingNS(void *mem,
+- int *table,
+- int (*convert)(void *userData, const char *p),
+- void *userData)
+-{
+- ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
+- if (enc)
+- ((struct normal_encoding *)enc)->type[':'] = BT_COLON;
+- return enc;
+-}
+-
+-#endif /* XML_NS */
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmltok.dsp dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok.dsp
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmltok.dsp 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok.dsp 1969-12-31 18:00:00.000000000 -0600
+@@ -1,163 +0,0 @@
+-# Microsoft Developer Studio Project File - Name="xmltok" - Package Owner=<4>
+-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+-# ** DO NOT EDIT **
+-
+-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+-
+-CFG=xmltok - 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 "xmltok.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 "xmltok.mak" CFG="xmltok - Win32 Release"
+-!MESSAGE
+-!MESSAGE Possible choices for configuration are:
+-!MESSAGE
+-!MESSAGE "xmltok - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE "xmltok - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+-!MESSAGE
+-
+-# Begin Project
+-# PROP AllowPerConfigDependencies 0
+-# PROP Scc_ProjName ""
+-# PROP Scc_LocalPath ""
+-CPP=cl.exe
+-MTL=midl.exe
+-RSC=rc.exe
+-
+-!IF "$(CFG)" == "xmltok - 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 ".\Release"
+-# PROP Intermediate_Dir ".\Release"
+-# PROP Ignore_Export_Lib 0
+-# PROP Target_Dir "."
+-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /MT /W3 /GX /O2 /D XMLTOKAPI=__declspec(dllexport) /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /YX /FD /c
+-# ADD BASE MTL /nologo /D "NDEBUG" /win32
+-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmltok.dll" /link50compat
+-# SUBTRACT LINK32 /pdb:none
+-
+-!ELSEIF "$(CFG)" == "xmltok - 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 ".\Debug"
+-# PROP Intermediate_Dir ".\Debug"
+-# PROP Ignore_Export_Lib 0
+-# PROP Target_Dir "."
+-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /FD /c
+-# ADD BASE MTL /nologo /D "_DEBUG" /win32
+-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\dbgbin\xmltok.dll"
+-
+-!ENDIF
+-
+-# Begin Target
+-
+-# Name "xmltok - Win32 Release"
+-# Name "xmltok - 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=.\dllmain.c
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmlrole.c
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmltok.c
+-# End Source File
+-# End Group
+-# Begin Group "Header Files"
+-
+-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+-# Begin Source File
+-
+-SOURCE=.\asciitab.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\iasciitab.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\latin1tab.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\nametab.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\utf8tab.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmldef.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmlrole.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmltok.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmltok_impl.c
+-# PROP BASE Exclude_From_Build 1
+-# PROP Exclude_From_Build 1
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmltok_impl.h
+-# End Source File
+-# Begin Source File
+-
+-SOURCE=.\xmltok_ns.c
+-# PROP Exclude_From_Build 1
+-# 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 -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmltok.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmltok.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,307 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#ifndef XmlTok_INCLUDED
+-#define XmlTok_INCLUDED 1
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-#ifndef XMLTOKAPI
+-#define XMLTOKAPI /* as nothing */
+-#endif
+-
+-/* The following token may be returned by XmlContentTok */
+-#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of
+- illegal ]]> sequence */
+-/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
+-#define XML_TOK_NONE -4 /* The string to be scanned is empty */
+-#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
+- might be part of CRLF sequence */
+-#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
+-#define XML_TOK_PARTIAL -1 /* only part of a token */
+-#define XML_TOK_INVALID 0
+-
+-/* The following tokens are returned by XmlContentTok; some are also
+- returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */
+-
+-#define XML_TOK_START_TAG_WITH_ATTS 1
+-#define XML_TOK_START_TAG_NO_ATTS 2
+-#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
+-#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
+-#define XML_TOK_END_TAG 5
+-#define XML_TOK_DATA_CHARS 6
+-#define XML_TOK_DATA_NEWLINE 7
+-#define XML_TOK_CDATA_SECT_OPEN 8
+-#define XML_TOK_ENTITY_REF 9
+-#define XML_TOK_CHAR_REF 10 /* numeric character reference */
+-
+-/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
+-#define XML_TOK_PI 11 /* processing instruction */
+-#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
+-#define XML_TOK_COMMENT 13
+-#define XML_TOK_BOM 14 /* Byte order mark */
+-
+-/* The following tokens are returned only by XmlPrologTok */
+-#define XML_TOK_PROLOG_S 15
+-#define XML_TOK_DECL_OPEN 16 /* <!foo */
+-#define XML_TOK_DECL_CLOSE 17 /* > */
+-#define XML_TOK_NAME 18
+-#define XML_TOK_NMTOKEN 19
+-#define XML_TOK_POUND_NAME 20 /* #name */
+-#define XML_TOK_OR 21 /* | */
+-#define XML_TOK_PERCENT 22
+-#define XML_TOK_OPEN_PAREN 23
+-#define XML_TOK_CLOSE_PAREN 24
+-#define XML_TOK_OPEN_BRACKET 25
+-#define XML_TOK_CLOSE_BRACKET 26
+-#define XML_TOK_LITERAL 27
+-#define XML_TOK_PARAM_ENTITY_REF 28
+-#define XML_TOK_INSTANCE_START 29
+-
+-/* The following occur only in element type declarations */
+-#define XML_TOK_NAME_QUESTION 30 /* name? */
+-#define XML_TOK_NAME_ASTERISK 31 /* name* */
+-#define XML_TOK_NAME_PLUS 32 /* name+ */
+-#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
+-#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
+-#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
+-#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
+-#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
+-#define XML_TOK_COMMA 38
+-
+-/* The following token is returned only by XmlAttributeValueTok */
+-#define XML_TOK_ATTRIBUTE_VALUE_S 39
+-
+-/* The following token is returned only by XmlCdataSectionTok */
+-#define XML_TOK_CDATA_SECT_CLOSE 40
+-
+-/* With namespace processing this is returned by XmlPrologTok
+- for a name with a colon. */
+-#define XML_TOK_PREFIXED_NAME 41
+-
+-#define XML_N_STATES 3
+-#define XML_PROLOG_STATE 0
+-#define XML_CONTENT_STATE 1
+-#define XML_CDATA_SECTION_STATE 2
+-
+-#define XML_N_LITERAL_TYPES 2
+-#define XML_ATTRIBUTE_VALUE_LITERAL 0
+-#define XML_ENTITY_VALUE_LITERAL 1
+-
+-/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
+-#define XML_UTF8_ENCODE_MAX 4
+-/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
+-#define XML_UTF16_ENCODE_MAX 2
+-
+-typedef struct position {
+- /* first line and first column are 0 not 1 */
+- unsigned long lineNumber;
+- unsigned long columnNumber;
+-} POSITION;
+-
+-typedef struct {
+- const char *name;
+- const char *valuePtr;
+- const char *valueEnd;
+- char normalized;
+-} ATTRIBUTE;
+-
+-struct encoding;
+-typedef struct encoding ENCODING;
+-
+-struct encoding {
+- int (*scanners[XML_N_STATES])(const ENCODING *,
+- const char *,
+- const char *,
+- const char **);
+- int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
+- const char *,
+- const char *,
+- const char **);
+- int (*sameName)(const ENCODING *,
+- const char *, const char *);
+- int (*nameMatchesAscii)(const ENCODING *,
+- const char *, const char *);
+- int (*nameLength)(const ENCODING *, const char *);
+- const char *(*skipS)(const ENCODING *, const char *);
+- int (*getAtts)(const ENCODING *enc, const char *ptr,
+- int attsMax, ATTRIBUTE *atts);
+- int (*charRefNumber)(const ENCODING *enc, const char *ptr);
+- int (*predefinedEntityName)(const ENCODING *, const char *, const char *);
+- void (*updatePosition)(const ENCODING *,
+- const char *ptr,
+- const char *end,
+- POSITION *);
+- int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **badPtr);
+- void (*utf8Convert)(const ENCODING *enc,
+- const char **fromP,
+- const char *fromLim,
+- char **toP,
+- const char *toLim);
+- void (*utf16Convert)(const ENCODING *enc,
+- const char **fromP,
+- const char *fromLim,
+- unsigned short **toP,
+- const unsigned short *toLim);
+- int minBytesPerChar;
+- char isUtf8;
+- char isUtf16;
+-};
+-
+-/*
+-Scan the string starting at ptr until the end of the next complete token,
+-but do not scan past eptr. Return an integer giving the type of token.
+-
+-Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
+-
+-Return XML_TOK_PARTIAL when the string does not contain a complete token;
+-nextTokPtr will not be set.
+-
+-Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr
+-will be set to point to the character which made the token invalid.
+-
+-Otherwise the string starts with a valid token; nextTokPtr will be set to point
+-to the character following the end of that token.
+-
+-Each data character counts as a single token, but adjacent data characters
+-may be returned together. Similarly for characters in the prolog outside
+-literals, comments and processing instructions.
+-*/
+-
+-
+-#define XmlTok(enc, state, ptr, end, nextTokPtr) \
+- (((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
+-
+-#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
+- XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
+-
+-#define XmlContentTok(enc, ptr, end, nextTokPtr) \
+- XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
+-
+-#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
+- XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
+-
+-/* This is used for performing a 2nd-level tokenization on
+-the content of a literal that has already been returned by XmlTok. */
+-
+-#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
+- (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
+-
+-#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
+- XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
+-
+-#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
+- XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
+-
+-#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
+-
+-#define XmlNameMatchesAscii(enc, ptr1, ptr2) \
+- (((enc)->nameMatchesAscii)(enc, ptr1, ptr2))
+-
+-#define XmlNameLength(enc, ptr) \
+- (((enc)->nameLength)(enc, ptr))
+-
+-#define XmlSkipS(enc, ptr) \
+- (((enc)->skipS)(enc, ptr))
+-
+-#define XmlGetAttributes(enc, ptr, attsMax, atts) \
+- (((enc)->getAtts)(enc, ptr, attsMax, atts))
+-
+-#define XmlCharRefNumber(enc, ptr) \
+- (((enc)->charRefNumber)(enc, ptr))
+-
+-#define XmlPredefinedEntityName(enc, ptr, end) \
+- (((enc)->predefinedEntityName)(enc, ptr, end))
+-
+-#define XmlUpdatePosition(enc, ptr, end, pos) \
+- (((enc)->updatePosition)(enc, ptr, end, pos))
+-
+-#define XmlIsPublicId(enc, ptr, end, badPtr) \
+- (((enc)->isPublicId)(enc, ptr, end, badPtr))
+-
+-#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
+- (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
+-
+-#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
+- (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
+-
+-typedef struct {
+- ENCODING initEnc;
+- const ENCODING **encPtr;
+-} INIT_ENCODING;
+-
+-int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
+- const ENCODING *enc,
+- const char *ptr,
+- const char *end,
+- const char **badPtr,
+- const char **versionPtr,
+- const char **encodingNamePtr,
+- const ENCODING **namedEncodingPtr,
+- int *standalonePtr);
+-
+-int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
+-const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding();
+-const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding();
+-int XMLTOKAPI XmlUtf8Encode(int charNumber, char *buf);
+-int XMLTOKAPI XmlUtf16Encode(int charNumber, unsigned short *buf);
+-
+-int XMLTOKAPI XmlSizeOfUnknownEncoding();
+-ENCODING XMLTOKAPI *
+-XmlInitUnknownEncoding(void *mem,
+- int *table,
+- int (*conv)(void *userData, const char *p),
+- void *userData);
+-
+-int XMLTOKAPI XmlParseXmlDeclNS(int isGeneralTextEntity,
+- const ENCODING *enc,
+- const char *ptr,
+- const char *end,
+- const char **badPtr,
+- const char **versionPtr,
+- const char **encodingNamePtr,
+- const ENCODING **namedEncodingPtr,
+- int *standalonePtr);
+-int XMLTOKAPI XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
+-const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncodingNS();
+-const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncodingNS();
+-ENCODING XMLTOKAPI *
+-XmlInitUnknownEncodingNS(void *mem,
+- int *table,
+- int (*conv)(void *userData, const char *p),
+- void *userData);
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* not XmlTok_INCLUDED */
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.c dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.c
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,1746 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#ifndef IS_INVALID_CHAR
+-#define IS_INVALID_CHAR(enc, ptr, n) (0)
+-#endif
+-
+-#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \
+- case BT_LEAD ## n: \
+- if (end - ptr < n) \
+- return XML_TOK_PARTIAL_CHAR; \
+- if (IS_INVALID_CHAR(enc, ptr, n)) { \
+- *(nextTokPtr) = (ptr); \
+- return XML_TOK_INVALID; \
+- } \
+- ptr += n; \
+- break;
+-
+-#define INVALID_CASES(ptr, nextTokPtr) \
+- INVALID_LEAD_CASE(2, ptr, nextTokPtr) \
+- INVALID_LEAD_CASE(3, ptr, nextTokPtr) \
+- INVALID_LEAD_CASE(4, ptr, nextTokPtr) \
+- case BT_NONXML: \
+- case BT_MALFORM: \
+- case BT_TRAIL: \
+- *(nextTokPtr) = (ptr); \
+- return XML_TOK_INVALID;
+-
+-#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \
+- case BT_LEAD ## n: \
+- if (end - ptr < n) \
+- return XML_TOK_PARTIAL_CHAR; \
+- if (!IS_NAME_CHAR(enc, ptr, n)) { \
+- *nextTokPtr = ptr; \
+- return XML_TOK_INVALID; \
+- } \
+- ptr += n; \
+- break;
+-
+-#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \
+- case BT_NONASCII: \
+- if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \
+- *nextTokPtr = ptr; \
+- return XML_TOK_INVALID; \
+- } \
+- case BT_NMSTRT: \
+- case BT_HEX: \
+- case BT_DIGIT: \
+- case BT_NAME: \
+- case BT_MINUS: \
+- ptr += MINBPC(enc); \
+- break; \
+- CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \
+- CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \
+- CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr)
+-
+-#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \
+- case BT_LEAD ## n: \
+- if (end - ptr < n) \
+- return XML_TOK_PARTIAL_CHAR; \
+- if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \
+- *nextTokPtr = ptr; \
+- return XML_TOK_INVALID; \
+- } \
+- ptr += n; \
+- break;
+-
+-#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \
+- case BT_NONASCII: \
+- if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \
+- *nextTokPtr = ptr; \
+- return XML_TOK_INVALID; \
+- } \
+- case BT_NMSTRT: \
+- case BT_HEX: \
+- ptr += MINBPC(enc); \
+- break; \
+- CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \
+- CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \
+- CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr)
+-
+-#ifndef PREFIX
+-#define PREFIX(ident) ident
+-#endif
+-
+-/* ptr points to character following "<!-" */
+-
+-static
+-int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr != end) {
+- if (!CHAR_MATCHES(enc, ptr, '-')) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- ptr += MINBPC(enc);
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- INVALID_CASES(ptr, nextTokPtr)
+- case BT_MINUS:
+- if ((ptr += MINBPC(enc)) == end)
+- return XML_TOK_PARTIAL;
+- if (CHAR_MATCHES(enc, ptr, '-')) {
+- if ((ptr += MINBPC(enc)) == end)
+- return XML_TOK_PARTIAL;
+- if (!CHAR_MATCHES(enc, ptr, '>')) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_COMMENT;
+- }
+- break;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-/* ptr points to character following "<!" */
+-
+-static
+-int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_MINUS:
+- return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_LSQB:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_COND_SECT_OPEN;
+- case BT_NMSTRT:
+- case BT_HEX:
+- ptr += MINBPC(enc);
+- break;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_PERCNT:
+- if (ptr + MINBPC(enc) == end)
+- return XML_TOK_PARTIAL;
+- /* don't allow <!ENTITY% foo "whatever"> */
+- switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) {
+- case BT_S: case BT_CR: case BT_LF: case BT_PERCNT:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- /* fall through */
+- case BT_S: case BT_CR: case BT_LF:
+- *nextTokPtr = ptr;
+- return XML_TOK_DECL_OPEN;
+- case BT_NMSTRT:
+- case BT_HEX:
+- ptr += MINBPC(enc);
+- break;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-static
+-int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr)
+-{
+- int upper = 0;
+- *tokPtr = XML_TOK_PI;
+- if (end - ptr != MINBPC(enc)*3)
+- return 1;
+- switch (BYTE_TO_ASCII(enc, ptr)) {
+- case 'x':
+- break;
+- case 'X':
+- upper = 1;
+- break;
+- default:
+- return 1;
+- }
+- ptr += MINBPC(enc);
+- switch (BYTE_TO_ASCII(enc, ptr)) {
+- case 'm':
+- break;
+- case 'M':
+- upper = 1;
+- break;
+- default:
+- return 1;
+- }
+- ptr += MINBPC(enc);
+- switch (BYTE_TO_ASCII(enc, ptr)) {
+- case 'l':
+- break;
+- case 'L':
+- upper = 1;
+- break;
+- default:
+- return 1;
+- }
+- if (upper)
+- return 0;
+- *tokPtr = XML_TOK_XML_DECL;
+- return 1;
+-}
+-
+-/* ptr points to character following "<?" */
+-
+-static
+-int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- int tok;
+- const char *target = ptr;
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+- case BT_S: case BT_CR: case BT_LF:
+- if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- ptr += MINBPC(enc);
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- INVALID_CASES(ptr, nextTokPtr)
+- case BT_QUEST:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (CHAR_MATCHES(enc, ptr, '>')) {
+- *nextTokPtr = ptr + MINBPC(enc);
+- return tok;
+- }
+- break;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- return XML_TOK_PARTIAL;
+- case BT_QUEST:
+- if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (CHAR_MATCHES(enc, ptr, '>')) {
+- *nextTokPtr = ptr + MINBPC(enc);
+- return tok;
+- }
+- /* fall through */
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-
+-static
+-int PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- int i;
+- /* CDATA[ */
+- if (end - ptr < 6 * MINBPC(enc))
+- return XML_TOK_PARTIAL;
+- for (i = 0; i < 6; i++, ptr += MINBPC(enc)) {
+- if (!CHAR_MATCHES(enc, ptr, "CDATA["[i])) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_CDATA_SECT_OPEN;
+-}
+-
+-static
+-int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr == end)
+- return XML_TOK_NONE;
+- if (MINBPC(enc) > 1) {
+- size_t n = end - ptr;
+- if (n & (MINBPC(enc) - 1)) {
+- n &= ~(MINBPC(enc) - 1);
+- if (n == 0)
+- return XML_TOK_PARTIAL;
+- end = ptr + n;
+- }
+- }
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_RSQB:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (!CHAR_MATCHES(enc, ptr, ']'))
+- break;
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (!CHAR_MATCHES(enc, ptr, '>')) {
+- ptr -= MINBPC(enc);
+- break;
+- }
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_CDATA_SECT_CLOSE;
+- case BT_CR:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (BYTE_TYPE(enc, ptr) == BT_LF)
+- ptr += MINBPC(enc);
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_NEWLINE;
+- case BT_LF:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_DATA_NEWLINE;
+- INVALID_CASES(ptr, nextTokPtr)
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: \
+- if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
+- *nextTokPtr = ptr; \
+- return XML_TOK_DATA_CHARS; \
+- } \
+- ptr += n; \
+- break;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_NONXML:
+- case BT_MALFORM:
+- case BT_TRAIL:
+- case BT_CR:
+- case BT_LF:
+- case BT_RSQB:
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+-}
+-
+-/* ptr points to character following "</" */
+-
+-static
+-int PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+- case BT_S: case BT_CR: case BT_LF:
+- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_S: case BT_CR: case BT_LF:
+- break;
+- case BT_GT:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_END_TAG;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-#ifdef XML_NS
+- case BT_COLON:
+- /* no need to check qname syntax here, since end-tag must match exactly */
+- ptr += MINBPC(enc);
+- break;
+-#endif
+- case BT_GT:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_END_TAG;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-/* ptr points to character following "&#X" */
+-
+-static
+-int PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_DIGIT:
+- case BT_HEX:
+- break;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_DIGIT:
+- case BT_HEX:
+- break;
+- case BT_SEMI:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_CHAR_REF;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-/* ptr points to character following "&#" */
+-
+-static
+-int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr != end) {
+- if (CHAR_MATCHES(enc, ptr, 'x'))
+- return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_DIGIT:
+- break;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_DIGIT:
+- break;
+- case BT_SEMI:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_CHAR_REF;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-/* ptr points to character following "&" */
+-
+-static
+-int PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- case BT_NUM:
+- return PREFIX(scanCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+- case BT_SEMI:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_ENTITY_REF;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-/* ptr points to character following first character of attribute name */
+-
+-static
+-int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+-#ifdef XML_NS
+- int hadColon = 0;
+-#endif
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+-#ifdef XML_NS
+- case BT_COLON:
+- if (hadColon) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- hadColon = 1;
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- break;
+-#endif
+- case BT_S: case BT_CR: case BT_LF:
+- for (;;) {
+- int t;
+-
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- t = BYTE_TYPE(enc, ptr);
+- if (t == BT_EQUALS)
+- break;
+- switch (t) {
+- case BT_S:
+- case BT_LF:
+- case BT_CR:
+- break;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- /* fall through */
+- case BT_EQUALS:
+- {
+- int open;
+-#ifdef XML_NS
+- hadColon = 0;
+-#endif
+- for (;;) {
+-
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- open = BYTE_TYPE(enc, ptr);
+- if (open == BT_QUOT || open == BT_APOS)
+- break;
+- switch (open) {
+- case BT_S:
+- case BT_LF:
+- case BT_CR:
+- break;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- ptr += MINBPC(enc);
+- /* in attribute value */
+- for (;;) {
+- int t;
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- t = BYTE_TYPE(enc, ptr);
+- if (t == open)
+- break;
+- switch (t) {
+- INVALID_CASES(ptr, nextTokPtr)
+- case BT_AMP:
+- {
+- int tok = PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, &ptr);
+- if (tok <= 0) {
+- if (tok == XML_TOK_INVALID)
+- *nextTokPtr = ptr;
+- return tok;
+- }
+- break;
+- }
+- case BT_LT:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_S:
+- case BT_CR:
+- case BT_LF:
+- break;
+- case BT_SOL:
+- goto sol;
+- case BT_GT:
+- goto gt;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- /* ptr points to closing quote */
+- for (;;) {
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- case BT_S: case BT_CR: case BT_LF:
+- continue;
+- case BT_GT:
+- gt:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_START_TAG_WITH_ATTS;
+- case BT_SOL:
+- sol:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (!CHAR_MATCHES(enc, ptr, '>')) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_EMPTY_ELEMENT_WITH_ATTS;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- break;
+- }
+- break;
+- }
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-/* ptr points to character following "<" */
+-
+-static
+-int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+-#ifdef XML_NS
+- int hadColon;
+-#endif
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- case BT_EXCL:
+- if ((ptr += MINBPC(enc)) == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_MINUS:
+- return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_LSQB:
+- return PREFIX(scanCdataSection)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- case BT_QUEST:
+- return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_SOL:
+- return PREFIX(scanEndTag)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+-#ifdef XML_NS
+- hadColon = 0;
+-#endif
+- /* we have a start-tag */
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+-#ifdef XML_NS
+- case BT_COLON:
+- if (hadColon) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- hadColon = 1;
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- break;
+-#endif
+- case BT_S: case BT_CR: case BT_LF:
+- {
+- ptr += MINBPC(enc);
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- case BT_GT:
+- goto gt;
+- case BT_SOL:
+- goto sol;
+- case BT_S: case BT_CR: case BT_LF:
+- ptr += MINBPC(enc);
+- continue;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- return PREFIX(scanAtts)(enc, ptr, end, nextTokPtr);
+- }
+- return XML_TOK_PARTIAL;
+- }
+- case BT_GT:
+- gt:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_START_TAG_NO_ATTS;
+- case BT_SOL:
+- sol:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (!CHAR_MATCHES(enc, ptr, '>')) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_EMPTY_ELEMENT_NO_ATTS;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-static
+-int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr == end)
+- return XML_TOK_NONE;
+- if (MINBPC(enc) > 1) {
+- size_t n = end - ptr;
+- if (n & (MINBPC(enc) - 1)) {
+- n &= ~(MINBPC(enc) - 1);
+- if (n == 0)
+- return XML_TOK_PARTIAL;
+- end = ptr + n;
+- }
+- }
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_LT:
+- return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_AMP:
+- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_CR:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_TRAILING_CR;
+- if (BYTE_TYPE(enc, ptr) == BT_LF)
+- ptr += MINBPC(enc);
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_NEWLINE;
+- case BT_LF:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_DATA_NEWLINE;
+- case BT_RSQB:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_TRAILING_RSQB;
+- if (!CHAR_MATCHES(enc, ptr, ']'))
+- break;
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_TRAILING_RSQB;
+- if (!CHAR_MATCHES(enc, ptr, '>')) {
+- ptr -= MINBPC(enc);
+- break;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- INVALID_CASES(ptr, nextTokPtr)
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: \
+- if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
+- *nextTokPtr = ptr; \
+- return XML_TOK_DATA_CHARS; \
+- } \
+- ptr += n; \
+- break;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_RSQB:
+- if (ptr + MINBPC(enc) != end) {
+- if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ']')) {
+- ptr += MINBPC(enc);
+- break;
+- }
+- if (ptr + 2*MINBPC(enc) != end) {
+- if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), '>')) {
+- ptr += MINBPC(enc);
+- break;
+- }
+- *nextTokPtr = ptr + 2*MINBPC(enc);
+- return XML_TOK_INVALID;
+- }
+- }
+- /* fall through */
+- case BT_AMP:
+- case BT_LT:
+- case BT_NONXML:
+- case BT_MALFORM:
+- case BT_TRAIL:
+- case BT_CR:
+- case BT_LF:
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+-}
+-
+-/* ptr points to character following "%" */
+-
+-static
+-int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- case BT_S: case BT_LF: case BT_CR: case BT_PERCNT:
+- *nextTokPtr = ptr;
+- return XML_TOK_PERCENT;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+- case BT_SEMI:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_PARAM_ENTITY_REF;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-static
+-int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+- case BT_CR: case BT_LF: case BT_S:
+- case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR:
+- *nextTokPtr = ptr;
+- return XML_TOK_POUND_NAME;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-static
+-int PREFIX(scanLit)(int open, const ENCODING *enc,
+- const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- while (ptr != end) {
+- int t = BYTE_TYPE(enc, ptr);
+- switch (t) {
+- INVALID_CASES(ptr, nextTokPtr)
+- case BT_QUOT:
+- case BT_APOS:
+- ptr += MINBPC(enc);
+- if (t != open)
+- break;
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- *nextTokPtr = ptr;
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_S: case BT_CR: case BT_LF:
+- case BT_GT: case BT_PERCNT: case BT_LSQB:
+- return XML_TOK_LITERAL;
+- default:
+- return XML_TOK_INVALID;
+- }
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-static
+-int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- int tok;
+- if (ptr == end)
+- return XML_TOK_NONE;
+- if (MINBPC(enc) > 1) {
+- size_t n = end - ptr;
+- if (n & (MINBPC(enc) - 1)) {
+- n &= ~(MINBPC(enc) - 1);
+- if (n == 0)
+- return XML_TOK_PARTIAL;
+- end = ptr + n;
+- }
+- }
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_QUOT:
+- return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_APOS:
+- return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_LT:
+- {
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_EXCL:
+- return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_QUEST:
+- return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_NMSTRT:
+- case BT_HEX:
+- case BT_NONASCII:
+- case BT_LEAD2:
+- case BT_LEAD3:
+- case BT_LEAD4:
+- *nextTokPtr = ptr - MINBPC(enc);
+- return XML_TOK_INSTANCE_START;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- case BT_CR:
+- if (ptr + MINBPC(enc) == end)
+- return XML_TOK_TRAILING_CR;
+- /* fall through */
+- case BT_S: case BT_LF:
+- for (;;) {
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- break;
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_S: case BT_LF:
+- break;
+- case BT_CR:
+- /* don't split CR/LF pair */
+- if (ptr + MINBPC(enc) != end)
+- break;
+- /* fall through */
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_PROLOG_S;
+- }
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_PROLOG_S;
+- case BT_PERCNT:
+- return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- case BT_COMMA:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_COMMA;
+- case BT_LSQB:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_OPEN_BRACKET;
+- case BT_RSQB:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- if (CHAR_MATCHES(enc, ptr, ']')) {
+- if (ptr + MINBPC(enc) == end)
+- return XML_TOK_PARTIAL;
+- if (CHAR_MATCHES(enc, ptr + MINBPC(enc), '>')) {
+- *nextTokPtr = ptr + 2*MINBPC(enc);
+- return XML_TOK_COND_SECT_CLOSE;
+- }
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_CLOSE_BRACKET;
+- case BT_LPAR:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_OPEN_PAREN;
+- case BT_RPAR:
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_AST:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_CLOSE_PAREN_ASTERISK;
+- case BT_QUEST:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_CLOSE_PAREN_QUESTION;
+- case BT_PLUS:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_CLOSE_PAREN_PLUS;
+- case BT_CR: case BT_LF: case BT_S:
+- case BT_GT: case BT_COMMA: case BT_VERBAR:
+- case BT_RPAR:
+- *nextTokPtr = ptr;
+- return XML_TOK_CLOSE_PAREN;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- case BT_VERBAR:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_OR;
+- case BT_GT:
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_DECL_CLOSE;
+- case BT_NUM:
+- return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: \
+- if (end - ptr < n) \
+- return XML_TOK_PARTIAL_CHAR; \
+- if (IS_NMSTRT_CHAR(enc, ptr, n)) { \
+- ptr += n; \
+- tok = XML_TOK_NAME; \
+- break; \
+- } \
+- if (IS_NAME_CHAR(enc, ptr, n)) { \
+- ptr += n; \
+- tok = XML_TOK_NMTOKEN; \
+- break; \
+- } \
+- *nextTokPtr = ptr; \
+- return XML_TOK_INVALID;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_NMSTRT:
+- case BT_HEX:
+- tok = XML_TOK_NAME;
+- ptr += MINBPC(enc);
+- break;
+- case BT_DIGIT:
+- case BT_NAME:
+- case BT_MINUS:
+-#ifdef XML_NS
+- case BT_COLON:
+-#endif
+- tok = XML_TOK_NMTOKEN;
+- ptr += MINBPC(enc);
+- break;
+- case BT_NONASCII:
+- if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {
+- ptr += MINBPC(enc);
+- tok = XML_TOK_NAME;
+- break;
+- }
+- if (IS_NAME_CHAR_MINBPC(enc, ptr)) {
+- ptr += MINBPC(enc);
+- tok = XML_TOK_NMTOKEN;
+- break;
+- }
+- /* fall through */
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+- case BT_GT: case BT_RPAR: case BT_COMMA:
+- case BT_VERBAR: case BT_LSQB: case BT_PERCNT:
+- case BT_S: case BT_CR: case BT_LF:
+- *nextTokPtr = ptr;
+- return tok;
+-#ifdef XML_NS
+- case BT_COLON:
+- ptr += MINBPC(enc);
+- switch (tok) {
+- case XML_TOK_NAME:
+- if (ptr == end)
+- return XML_TOK_PARTIAL;
+- tok = XML_TOK_PREFIXED_NAME;
+- switch (BYTE_TYPE(enc, ptr)) {
+- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
+- default:
+- tok = XML_TOK_NMTOKEN;
+- break;
+- }
+- break;
+- case XML_TOK_PREFIXED_NAME:
+- tok = XML_TOK_NMTOKEN;
+- break;
+- }
+- break;
+-#endif
+- case BT_PLUS:
+- if (tok == XML_TOK_NMTOKEN) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_NAME_PLUS;
+- case BT_AST:
+- if (tok == XML_TOK_NMTOKEN) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_NAME_ASTERISK;
+- case BT_QUEST:
+- if (tok == XML_TOK_NMTOKEN) {
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_NAME_QUESTION;
+- default:
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- }
+- }
+- return XML_TOK_PARTIAL;
+-}
+-
+-static
+-int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- const char *start;
+- if (ptr == end)
+- return XML_TOK_NONE;
+- start = ptr;
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: ptr += n; break;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_AMP:
+- if (ptr == start)
+- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- case BT_LT:
+- /* this is for inside entity references */
+- *nextTokPtr = ptr;
+- return XML_TOK_INVALID;
+- case BT_LF:
+- if (ptr == start) {
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_DATA_NEWLINE;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- case BT_CR:
+- if (ptr == start) {
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_TRAILING_CR;
+- if (BYTE_TYPE(enc, ptr) == BT_LF)
+- ptr += MINBPC(enc);
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_NEWLINE;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- case BT_S:
+- if (ptr == start) {
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_ATTRIBUTE_VALUE_S;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+-}
+-
+-static
+-int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- const char *start;
+- if (ptr == end)
+- return XML_TOK_NONE;
+- start = ptr;
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: ptr += n; break;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_AMP:
+- if (ptr == start)
+- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- case BT_PERCNT:
+- if (ptr == start)
+- return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- case BT_LF:
+- if (ptr == start) {
+- *nextTokPtr = ptr + MINBPC(enc);
+- return XML_TOK_DATA_NEWLINE;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- case BT_CR:
+- if (ptr == start) {
+- ptr += MINBPC(enc);
+- if (ptr == end)
+- return XML_TOK_TRAILING_CR;
+- if (BYTE_TYPE(enc, ptr) == BT_LF)
+- ptr += MINBPC(enc);
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_NEWLINE;
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- }
+- *nextTokPtr = ptr;
+- return XML_TOK_DATA_CHARS;
+-}
+-
+-static
+-int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **badPtr)
+-{
+- ptr += MINBPC(enc);
+- end -= MINBPC(enc);
+- for (; ptr != end; ptr += MINBPC(enc)) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_DIGIT:
+- case BT_HEX:
+- case BT_MINUS:
+- case BT_APOS:
+- case BT_LPAR:
+- case BT_RPAR:
+- case BT_PLUS:
+- case BT_COMMA:
+- case BT_SOL:
+- case BT_EQUALS:
+- case BT_QUEST:
+- case BT_CR:
+- case BT_LF:
+- case BT_SEMI:
+- case BT_EXCL:
+- case BT_AST:
+- case BT_PERCNT:
+- case BT_NUM:
+-#ifdef XML_NS
+- case BT_COLON:
+-#endif
+- break;
+- case BT_S:
+- if (CHAR_MATCHES(enc, ptr, '\t')) {
+- *badPtr = ptr;
+- return 0;
+- }
+- break;
+- case BT_NAME:
+- case BT_NMSTRT:
+- if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f))
+- break;
+- default:
+- switch (BYTE_TO_ASCII(enc, ptr)) {
+- case 0x24: /* $ */
+- case 0x40: /* @ */
+- break;
+- default:
+- *badPtr = ptr;
+- return 0;
+- }
+- break;
+- }
+- }
+- return 1;
+-}
+-
+-/* This must only be called for a well-formed start-tag or empty element tag.
+-Returns the number of attributes. Pointers to the first attsMax attributes
+-are stored in atts. */
+-
+-static
+-int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
+- int attsMax, ATTRIBUTE *atts)
+-{
+- enum { other, inName, inValue } state = inName;
+- int nAtts = 0;
+- int open;
+-
+- for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) {
+- switch (BYTE_TYPE(enc, ptr)) {
+-#define START_NAME \
+- if (state == other) { \
+- if (nAtts < attsMax) { \
+- atts[nAtts].name = ptr; \
+- atts[nAtts].normalized = 1; \
+- } \
+- state = inName; \
+- }
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_NONASCII:
+- case BT_NMSTRT:
+- case BT_HEX:
+- START_NAME
+- break;
+-#undef START_NAME
+- case BT_QUOT:
+- if (state != inValue) {
+- if (nAtts < attsMax)
+- atts[nAtts].valuePtr = ptr + MINBPC(enc);
+- state = inValue;
+- open = BT_QUOT;
+- }
+- else if (open == BT_QUOT) {
+- state = other;
+- if (nAtts < attsMax)
+- atts[nAtts].valueEnd = ptr;
+- nAtts++;
+- }
+- break;
+- case BT_APOS:
+- if (state != inValue) {
+- if (nAtts < attsMax)
+- atts[nAtts].valuePtr = ptr + MINBPC(enc);
+- state = inValue;
+- open = BT_APOS;
+- }
+- else if (open == BT_APOS) {
+- state = other;
+- if (nAtts < attsMax)
+- atts[nAtts].valueEnd = ptr;
+- nAtts++;
+- }
+- break;
+- case BT_AMP:
+- if (nAtts < attsMax)
+- atts[nAtts].normalized = 0;
+- break;
+- case BT_S:
+- if (state == inName)
+- state = other;
+- else if (state == inValue
+- && nAtts < attsMax
+- && atts[nAtts].normalized
+- && (ptr == atts[nAtts].valuePtr
+- || BYTE_TO_ASCII(enc, ptr) != ' '
+- || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ' '
+- || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open))
+- atts[nAtts].normalized = 0;
+- break;
+- case BT_CR: case BT_LF:
+- /* This case ensures that the first attribute name is counted
+- Apart from that we could just change state on the quote. */
+- if (state == inName)
+- state = other;
+- else if (state == inValue && nAtts < attsMax)
+- atts[nAtts].normalized = 0;
+- break;
+- case BT_GT:
+- case BT_SOL:
+- if (state != inValue)
+- return nAtts;
+- break;
+- default:
+- break;
+- }
+- }
+- /* not reached */
+-}
+-
+-static
+-int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
+-{
+- int result = 0;
+- /* skip &# */
+- ptr += 2*MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 'x')) {
+- for (ptr += MINBPC(enc); !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC(enc)) {
+- int c = BYTE_TO_ASCII(enc, ptr);
+- switch (c) {
+- case '0': case '1': case '2': case '3': case '4':
+- case '5': case '6': case '7': case '8': case '9':
+- result <<= 4;
+- result |= (c - '0');
+- break;
+- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+- result <<= 4;
+- result += 10 + (c - 'A');
+- break;
+- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+- result <<= 4;
+- result += 10 + (c - 'a');
+- break;
+- }
+- if (result >= 0x110000)
+- return -1;
+- }
+- }
+- else {
+- for (; !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC(enc)) {
+- int c = BYTE_TO_ASCII(enc, ptr);
+- result *= 10;
+- result += (c - '0');
+- if (result >= 0x110000)
+- return -1;
+- }
+- }
+- return checkCharRefNumber(result);
+-}
+-
+-static
+-int PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end)
+-{
+- switch ((end - ptr)/MINBPC(enc)) {
+- case 2:
+- if (CHAR_MATCHES(enc, ptr + MINBPC(enc), 't')) {
+- switch (BYTE_TO_ASCII(enc, ptr)) {
+- case 'l':
+- return '<';
+- case 'g':
+- return '>';
+- }
+- }
+- break;
+- case 3:
+- if (CHAR_MATCHES(enc, ptr, 'a')) {
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 'm')) {
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 'p'))
+- return '&';
+- }
+- }
+- break;
+- case 4:
+- switch (BYTE_TO_ASCII(enc, ptr)) {
+- case 'q':
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 'u')) {
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 'o')) {
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 't'))
+- return '"';
+- }
+- }
+- break;
+- case 'a':
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 'p')) {
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 'o')) {
+- ptr += MINBPC(enc);
+- if (CHAR_MATCHES(enc, ptr, 's'))
+- return '\'';
+- }
+- }
+- break;
+- }
+- }
+- return 0;
+-}
+-
+-static
+-int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
+-{
+- for (;;) {
+- switch (BYTE_TYPE(enc, ptr1)) {
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: \
+- if (*ptr1++ != *ptr2++) \
+- return 0;
+- LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2)
+-#undef LEAD_CASE
+- /* fall through */
+- if (*ptr1++ != *ptr2++)
+- return 0;
+- break;
+- case BT_NONASCII:
+- case BT_NMSTRT:
+-#ifdef XML_NS
+- case BT_COLON:
+-#endif
+- case BT_HEX:
+- case BT_DIGIT:
+- case BT_NAME:
+- case BT_MINUS:
+- if (*ptr2++ != *ptr1++)
+- return 0;
+- if (MINBPC(enc) > 1) {
+- if (*ptr2++ != *ptr1++)
+- return 0;
+- if (MINBPC(enc) > 2) {
+- if (*ptr2++ != *ptr1++)
+- return 0;
+- if (MINBPC(enc) > 3) {
+- if (*ptr2++ != *ptr1++)
+- return 0;
+- }
+- }
+- }
+- break;
+- default:
+- if (MINBPC(enc) == 1 && *ptr1 == *ptr2)
+- return 1;
+- switch (BYTE_TYPE(enc, ptr2)) {
+- case BT_LEAD2:
+- case BT_LEAD3:
+- case BT_LEAD4:
+- case BT_NONASCII:
+- case BT_NMSTRT:
+-#ifdef XML_NS
+- case BT_COLON:
+-#endif
+- case BT_HEX:
+- case BT_DIGIT:
+- case BT_NAME:
+- case BT_MINUS:
+- return 0;
+- default:
+- return 1;
+- }
+- }
+- }
+- /* not reached */
+-}
+-
+-static
+-int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, const char *ptr2)
+-{
+- for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {
+- if (!CHAR_MATCHES(enc, ptr1, *ptr2))
+- return 0;
+- }
+- switch (BYTE_TYPE(enc, ptr1)) {
+- case BT_LEAD2:
+- case BT_LEAD3:
+- case BT_LEAD4:
+- case BT_NONASCII:
+- case BT_NMSTRT:
+-#ifdef XML_NS
+- case BT_COLON:
+-#endif
+- case BT_HEX:
+- case BT_DIGIT:
+- case BT_NAME:
+- case BT_MINUS:
+- return 0;
+- default:
+- return 1;
+- }
+-}
+-
+-static
+-int PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
+-{
+- const char *start = ptr;
+- for (;;) {
+- switch (BYTE_TYPE(enc, ptr)) {
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: ptr += n; break;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_NONASCII:
+- case BT_NMSTRT:
+-#ifdef XML_NS
+- case BT_COLON:
+-#endif
+- case BT_HEX:
+- case BT_DIGIT:
+- case BT_NAME:
+- case BT_MINUS:
+- ptr += MINBPC(enc);
+- break;
+- default:
+- return ptr - start;
+- }
+- }
+-}
+-
+-static
+-const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr)
+-{
+- for (;;) {
+- switch (BYTE_TYPE(enc, ptr)) {
+- case BT_LF:
+- case BT_CR:
+- case BT_S:
+- ptr += MINBPC(enc);
+- break;
+- default:
+- return ptr;
+- }
+- }
+-}
+-
+-static
+-void PREFIX(updatePosition)(const ENCODING *enc,
+- const char *ptr,
+- const char *end,
+- POSITION *pos)
+-{
+- while (ptr != end) {
+- switch (BYTE_TYPE(enc, ptr)) {
+-#define LEAD_CASE(n) \
+- case BT_LEAD ## n: \
+- ptr += n; \
+- break;
+- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
+-#undef LEAD_CASE
+- case BT_LF:
+- pos->columnNumber = (unsigned)-1;
+- pos->lineNumber++;
+- ptr += MINBPC(enc);
+- break;
+- case BT_CR:
+- pos->lineNumber++;
+- ptr += MINBPC(enc);
+- if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
+- ptr += MINBPC(enc);
+- pos->columnNumber = (unsigned)-1;
+- break;
+- default:
+- ptr += MINBPC(enc);
+- break;
+- }
+- pos->columnNumber++;
+- }
+-}
+-
+-#undef DO_LEAD_CASE
+-#undef MULTIBYTE_CASES
+-#undef INVALID_CASES
+-#undef CHECK_NAME_CASE
+-#undef CHECK_NAME_CASES
+-#undef CHECK_NMSTRT_CASE
+-#undef CHECK_NMSTRT_CASES
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.h dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.h
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok_impl.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,71 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-enum {
+- BT_NONXML,
+- BT_MALFORM,
+- BT_LT,
+- BT_AMP,
+- BT_RSQB,
+- BT_LEAD2,
+- BT_LEAD3,
+- BT_LEAD4,
+- BT_TRAIL,
+- BT_CR,
+- BT_LF,
+- BT_GT,
+- BT_QUOT,
+- BT_APOS,
+- BT_EQUALS,
+- BT_QUEST,
+- BT_EXCL,
+- BT_SOL,
+- BT_SEMI,
+- BT_NUM,
+- BT_LSQB,
+- BT_S,
+- BT_NMSTRT,
+- BT_COLON,
+- BT_HEX,
+- BT_DIGIT,
+- BT_NAME,
+- BT_MINUS,
+- BT_OTHER, /* known not to be a name or name start character */
+- BT_NONASCII, /* might be a name or name start character */
+- BT_PERCNT,
+- BT_LPAR,
+- BT_RPAR,
+- BT_AST,
+- BT_PLUS,
+- BT_COMMA,
+- BT_VERBAR
+-};
+-
+-#include <stddef.h>
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmltok/xmltok_ns.c dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok_ns.c
+--- original/xmlrpc-epi-0.51/expat/xmltok/xmltok_ns.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmltok/xmltok_ns.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,96 +0,0 @@
+-const ENCODING *NS(XmlGetUtf8InternalEncoding)()
+-{
+- return &ns(internal_utf8_encoding).enc;
+-}
+-
+-const ENCODING *NS(XmlGetUtf16InternalEncoding)()
+-{
+-#if XML_BYTE_ORDER == 12
+- return &ns(internal_little2_encoding).enc;
+-#elif XML_BYTE_ORDER == 21
+- return &ns(internal_big2_encoding).enc;
+-#else
+- const short n = 1;
+- return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc;
+-#endif
+-}
+-
+-static
+-const ENCODING *NS(encodings)[] = {
+- &ns(latin1_encoding).enc,
+- &ns(ascii_encoding).enc,
+- &ns(utf8_encoding).enc,
+- &ns(big2_encoding).enc,
+- &ns(big2_encoding).enc,
+- &ns(little2_encoding).enc,
+- &ns(utf8_encoding).enc /* NO_ENC */
+-};
+-
+-static
+-int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr);
+-}
+-
+-static
+-int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
+- const char **nextTokPtr)
+-{
+- return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr);
+-}
+-
+-int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
+-{
+- int i = getEncodingIndex(name);
+- if (i == UNKNOWN_ENC)
+- return 0;
+- INIT_ENC_INDEX(p) = (char)i;
+- p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
+- p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
+- p->initEnc.updatePosition = initUpdatePosition;
+- p->encPtr = encPtr;
+- *encPtr = &(p->initEnc);
+- return 1;
+-}
+-
+-static
+-const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
+-{
+-#define ENCODING_MAX 128
+- char buf[ENCODING_MAX];
+- char *p = buf;
+- int i;
+- XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
+- if (ptr != end)
+- return 0;
+- *p = 0;
+- if (streqci(buf, "UTF-16") && enc->minBytesPerChar == 2)
+- return enc;
+- i = getEncodingIndex(buf);
+- if (i == UNKNOWN_ENC)
+- return 0;
+- return NS(encodings)[i];
+-}
+-
+-int NS(XmlParseXmlDecl)(int isGeneralTextEntity,
+- const ENCODING *enc,
+- const char *ptr,
+- const char *end,
+- const char **badPtr,
+- const char **versionPtr,
+- const char **encodingName,
+- const ENCODING **encoding,
+- int *standalone)
+-{
+- return doParseXmlDecl(NS(findEncoding),
+- isGeneralTextEntity,
+- enc,
+- ptr,
+- end,
+- badPtr,
+- versionPtr,
+- encodingName,
+- encoding,
+- standalone);
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/codepage.c dump_expat/xmlrpc-epi-0.51/expat/xmlwf/codepage.c
+--- original/xmlrpc-epi-0.51/expat/xmlwf/codepage.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/codepage.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,90 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include "codepage.h"
+-
+-#ifdef WIN32
+-#define STRICT 1
+-#define WIN32_LEAN_AND_MEAN 1
+-
+-#include <windows.h>
+-
+-int codepageMap(int cp, int *map)
+-{
+- int i;
+- CPINFO info;
+- 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++) {
+- int j, lim;
+- if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0)
+- break;
+- lim = info.LeadByte[i + 1];
+- for (j = info.LeadByte[i]; j < lim; j++)
+- map[j] = -2;
+- }
+- }
+- for (i = 0; i < 256; i++) {
+- if (map[i] == -1) {
+- char c = i;
+- unsigned short n;
+- if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
+- &c, 1, &n, 1) == 1)
+- map[i] = n;
+- }
+- }
+- return 1;
+-}
+-
+-int codepageConvert(int cp, const char *p)
+-{
+- unsigned short c;
+- 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)
+-{
+- return -1;
+-}
+-
+-#endif /* not WIN32 */
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/codepage.h dump_expat/xmlrpc-epi-0.51/expat/xmlwf/codepage.h
+--- original/xmlrpc-epi-0.51/expat/xmlwf/codepage.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/codepage.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,32 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-int codepageMap(int cp, int *map);
+-int codepageConvert(int cp, const char *p);
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/filemap.h dump_expat/xmlrpc-epi-0.51/expat/xmlwf/filemap.h
+--- original/xmlrpc-epi-0.51/expat/xmlwf/filemap.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/filemap.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,42 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-
+-#include <stddef.h>
+-
+-#ifdef XML_UNICODE
+-int filemap(const wchar_t *name,
+- 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 *arg);
+-#endif
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/readfilemap.c dump_expat/xmlrpc-epi-0.51/expat/xmlwf/readfilemap.c
+--- original/xmlrpc-epi-0.51/expat/xmlwf/readfilemap.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/readfilemap.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,99 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include <sys/types.h>
+-#include <sys/stat.h>
+-#include <fcntl.h>
+-#include <stdlib.h>
+-#include <stdio.h>
+-
+-#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)
+-#endif /* not S_ISREG */
+-
+-#ifndef O_BINARY
+-#ifdef _O_BINARY
+-#define O_BINARY _O_BINARY
+-#else
+-#define O_BINARY 0
+-#endif
+-#endif
+-
+-int filemap(const char *name,
+- void (*processor)(const void *, size_t, const char *, void *arg),
+- void *arg)
+-{
+- size_t nbytes;
+- int fd;
+- int n;
+- struct stat sb;
+- void *p;
+-
+- fd = open(name, O_RDONLY|O_BINARY);
+- if (fd < 0) {
+- perror(name);
+- return 0;
+- }
+- if (fstat(fd, &sb) < 0) {
+- perror(name);
+- return 0;
+- }
+- if (!S_ISREG(sb.st_mode)) {
+- fprintf(stderr, "%s: not a regular file\n", name);
+- return 0;
+- }
+- nbytes = sb.st_size;
+- p = malloc(nbytes);
+- if (!p) {
+- fprintf(stderr, "%s: out of memory\n", name);
+- return 0;
+- }
+- n = read(fd, p, nbytes);
+- if (n < 0) {
+- perror(name);
+- close(fd);
+- return 0;
+- }
+- if (n != nbytes) {
+- fprintf(stderr, "%s: read unexpected number of bytes\n", name);
+- close(fd);
+- return 0;
+- }
+- processor(p, nbytes, name, arg);
+- free(p);
+- close(fd);
+- return 1;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/unixfilemap.c dump_expat/xmlrpc-epi-0.51/expat/xmlwf/unixfilemap.c
+--- original/xmlrpc-epi-0.51/expat/xmlwf/unixfilemap.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/unixfilemap.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,82 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include <sys/types.h>
+-#include <sys/mman.h>
+-#include <sys/stat.h>
+-#include <fcntl.h>
+-#include <errno.h>
+-#include <string.h>
+-#include <stdio.h>
+-
+-#ifndef MAP_FILE
+-#define MAP_FILE 0
+-#endif
+-
+-#include "filemap.h"
+-
+-int filemap(const char *name,
+- void (*processor)(const void *, size_t, const char *, void *arg),
+- void *arg)
+-{
+- int fd;
+- size_t nbytes;
+- struct stat sb;
+- void *p;
+-
+- fd = open(name, O_RDONLY);
+- if (fd < 0) {
+- perror(name);
+- return 0;
+- }
+- if (fstat(fd, &sb) < 0) {
+- perror(name);
+- close(fd);
+- return 0;
+- }
+- if (!S_ISREG(sb.st_mode)) {
+- close(fd);
+- fprintf(stderr, "%s: not a regular file\n", name);
+- return 0;
+- }
+-
+- nbytes = sb.st_size;
+- p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ,
+- MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
+- if (p == (void *)-1) {
+- perror(name);
+- close(fd);
+- return 0;
+- }
+- processor(p, nbytes, name, arg);
+- munmap((caddr_t)p, nbytes);
+- close(fd);
+- return 1;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/win32filemap.c dump_expat/xmlrpc-epi-0.51/expat/xmlwf/win32filemap.c
+--- original/xmlrpc-epi-0.51/expat/xmlwf/win32filemap.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/win32filemap.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,120 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#define STRICT 1
+-#define WIN32_LEAN_AND_MEAN 1
+-
+-#ifdef XML_UNICODE_WCHAR_T
+-#ifndef XML_UNICODE
+-#define XML_UNICODE
+-#endif
+-#endif
+-
+-#ifdef XML_UNICODE
+-#define UNICODE
+-#define _UNICODE
+-#endif /* XML_UNICODE */
+-#include <windows.h>
+-#include <stdio.h>
+-#include <tchar.h>
+-#include "filemap.h"
+-
+-static void win32perror(const TCHAR *);
+-
+-int filemap(const TCHAR *name,
+- void (*processor)(const void *, size_t, const TCHAR *, void *arg),
+- void *arg)
+-{
+- HANDLE f;
+- HANDLE m;
+- DWORD size;
+- DWORD sizeHi;
+- void *p;
+-
+- f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+- FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+- if (f == INVALID_HANDLE_VALUE) {
+- win32perror(name);
+- return 0;
+- }
+- size = GetFileSize(f, &sizeHi);
+- if (size == (DWORD)-1) {
+- win32perror(name);
+- return 0;
+- }
+- if (sizeHi) {
+- _ftprintf(stderr, _T("%s: bigger than 2Gb\n"), name);
+- return 0;
+- }
+- /* CreateFileMapping barfs on zero length files */
+- if (size == 0) {
+- static const char c = '\0';
+- processor(&c, 0, name, arg);
+- CloseHandle(f);
+- return 1;
+- }
+- m = CreateFileMapping(f, NULL, PAGE_READONLY, 0, 0, NULL);
+- if (m == NULL) {
+- win32perror(name);
+- CloseHandle(f);
+- return 0;
+- }
+- p = MapViewOfFile(m, FILE_MAP_READ, 0, 0, 0);
+- if (p == NULL) {
+- win32perror(name);
+- CloseHandle(m);
+- CloseHandle(f);
+- return 0;
+- }
+- processor(p, size, name, arg);
+- UnmapViewOfFile(p);
+- CloseHandle(m);
+- CloseHandle(f);
+- return 1;
+-}
+-
+-static
+-void 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,
+- NULL)) {
+- _ftprintf(stderr, _T("%s: %s"), s, buf);
+- fflush(stderr);
+- LocalFree(buf);
+- }
+- else
+- _ftprintf(stderr, _T("%s: unknown Windows error\n"), s);
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.c dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.c
+--- original/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.c 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,238 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <stddef.h>
+-#include <string.h>
+-#include <fcntl.h>
+-#include "xmlparse.h"
+-#include "xmlfile.h"
+-#include "xmltchar.h"
+-#include "filemap.h"
+-
+-#ifdef _MSC_VER
+-#include <io.h>
+-#endif
+-
+-#ifdef _POSIX_SOURCE
+-#include <unistd.h>
+-#endif
+-
+-#ifndef O_BINARY
+-#ifdef _O_BINARY
+-#define O_BINARY _O_BINARY
+-#else
+-#define O_BINARY 0
+-#endif
+-#endif
+-
+-#ifdef _DEBUG
+-#define READ_SIZE 16
+-#else
+-#define READ_SIZE (1024*8)
+-#endif
+-
+-
+-
+-typedef struct {
+- XML_Parser parser;
+- int *retPtr;
+-} PROCESS_ARGS;
+-
+-static
+-void reportError(XML_Parser parser, const XML_Char *filename)
+-{
+- int code = XML_GetErrorCode(parser);
+- const XML_Char *message = XML_ErrorString(code);
+- if (message)
+- ftprintf(stdout, T("%s:%d:%ld: %s\n"),
+- filename,
+- XML_GetErrorLineNumber(parser),
+- XML_GetErrorColumnNumber(parser),
+- message);
+- else
+- ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code);
+-}
+-
+-static
+-void 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, data, size, 1)) {
+- reportError(parser, filename);
+- *retPtr = 0;
+- }
+- else
+- *retPtr = 1;
+-}
+-
+-static
+-int isAsciiLetter(XML_Char c)
+-{
+- return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z'));
+-}
+-
+-static
+-const XML_Char *resolveSystemId(const XML_Char *base, const XML_Char *systemId, XML_Char **toFree)
+-{
+- XML_Char *s;
+- *toFree = 0;
+- if (!base
+- || *systemId == T('/')
+-#ifdef 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)
+- return systemId;
+- tcscpy(*toFree, base);
+- s = *toFree;
+- if (tcsrchr(s, T('/')))
+- s = tcsrchr(s, T('/')) + 1;
+-#ifdef WIN32
+- if (tcsrchr(s, T('\\')))
+- s = tcsrchr(s, T('\\')) + 1;
+-#endif
+- tcscpy(s, systemId);
+- return *toFree;
+-}
+-
+-static
+-int 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);
+- PROCESS_ARGS args;
+- args.retPtr = &result;
+- args.parser = entParser;
+- filename = resolveSystemId(base, systemId, &s);
+- XML_SetBase(entParser, filename);
+- if (!filemap(filename, processFile, &args))
+- result = 0;
+- free(s);
+- XML_ParserFree(entParser);
+- return result;
+-}
+-
+-static
+-int processStream(const XML_Char *filename, XML_Parser parser)
+-{
+- int fd = topen(filename, O_BINARY|O_RDONLY);
+- if (fd < 0) {
+- tperror(filename);
+- return 0;
+- }
+- for (;;) {
+- int nread;
+- char *buf = XML_GetBuffer(parser, READ_SIZE);
+- if (!buf) {
+- close(fd);
+- ftprintf(stderr, T("%s: out of memory\n"), filename);
+- return 0;
+- }
+- nread = read(fd, buf, READ_SIZE);
+- if (nread < 0) {
+- tperror(filename);
+- close(fd);
+- return 0;
+- }
+- if (!XML_ParseBuffer(parser, nread, nread == 0)) {
+- reportError(parser, filename);
+- close(fd);
+- return 0;
+- }
+- if (nread == 0) {
+- close(fd);
+- 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)
+-{
+- XML_Char *s;
+- const XML_Char *filename;
+- int ret;
+- XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
+- filename = resolveSystemId(base, systemId, &s);
+- XML_SetBase(entParser, filename);
+- ret = processStream(filename, entParser);
+- free(s);
+- XML_ParserFree(entParser);
+- return ret;
+-}
+-
+-int XML_ProcessFile(XML_Parser parser,
+- const XML_Char *filename,
+- unsigned flags)
+-{
+- int result;
+-
+- 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);
+- if (flags & XML_MAP_FILE) {
+- PROCESS_ARGS args;
+- args.retPtr = &result;
+- args.parser = parser;
+- if (!filemap(filename, processFile, &args))
+- result = 0;
+- }
+- else
+- result = processStream(filename, parser);
+- return result;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.h dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.h
+--- original/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlfile.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,36 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#define XML_MAP_FILE 01
+-#define XML_EXTERNAL_ENTITIES 02
+-
+-extern int XML_ProcessFile(XML_Parser parser,
+- const XML_Char *filename,
+- unsigned flags);
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/xmltchar.h dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmltchar.h
+--- original/xmlrpc-epi-0.51/expat/xmlwf/xmltchar.h 2001-03-19 21:28:34.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmltchar.h 1969-12-31 18:00:00.000000000 -0600
+@@ -1,36 +0,0 @@
+-#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
+-#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
+-#endif /* not XML_UNICODE */
+Binary files original/xmlrpc-epi-0.51/expat/xmlwf/xmlwf and dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlwf differ
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.c dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.c
+--- original/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.c 2001-03-19 21:28:35.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.c 1969-12-31 18:00:00.000000000 -0600
+@@ -1,657 +0,0 @@
+-/*
+-The contents of this file are subject to the Mozilla Public License
+-Version 1.1 (the "License"); you may not use this file except in
+-compliance with the License. You may obtain a copy of the License at
+-http://www.mozilla.org/MPL/
+-
+-Software distributed under the License is distributed on an "AS IS"
+-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+-License for the specific language governing rights and limitations
+-under the License.
+-
+-The Original Code is expat.
+-
+-The Initial Developer of the Original Code is James Clark.
+-Portions created by James Clark are Copyright (C) 1998, 1999
+-James Clark. All Rights Reserved.
+-
+-Contributor(s):
+-
+-Alternatively, the contents of this file may be used under the terms
+-of the GNU General Public License (the "GPL"), in which case the
+-provisions of the GPL are applicable instead of those above. If you
+-wish to allow use of your version of this file only under the terms of
+-the GPL and not to allow others to use your version of this file under
+-the MPL, indicate your decision by deleting the provisions above and
+-replace them with the notice and other provisions required by the
+-GPL. If you do not delete the provisions above, a recipient may use
+-your version of this file under either the MPL or the GPL.
+-*/
+-
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <stddef.h>
+-#include <string.h>
+-
+-#include "xmlparse.h"
+-#include "codepage.h"
+-#include "xmlfile.h"
+-#include "xmltchar.h"
+-
+-#ifdef _MSC_VER
+-#include <crtdbg.h>
+-#endif
+-
+-#define NSSEP T('#')
+-
+-static void characterData(void *userData, const XML_Char *s, int len)
+-{
+- FILE *fp = userData;
+- for (; len > 0; --len, ++s) {
+- switch (*s) {
+- case T('&'):
+- fputts(T("&amp;"), fp);
+- break;
+- case T('<'):
+- fputts(T("&lt;"), fp);
+- break;
+- case T('>'):
+- fputts(T("&gt;"), fp);
+- break;
+- case T('"'):
+- fputts(T("&quot;"), fp);
+- break;
+- case 9:
+- case 10:
+- case 13:
+- ftprintf(fp, T("&#%d;"), *s);
+- break;
+- default:
+- puttc(*s, fp);
+- break;
+- }
+- }
+-}
+-
+-/* Lexicographically comparing UTF-8 encoded attribute values,
+-is equivalent to lexicographically comparing based on the character number. */
+-
+-static int attcmp(const void *att1, const void *att2)
+-{
+- return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);
+-}
+-
+-static void startElement(void *userData, const XML_Char *name, const XML_Char **atts)
+-{
+- int nAtts;
+- const XML_Char **p;
+- FILE *fp = userData;
+- puttc(T('<'), fp);
+- fputts(name, fp);
+-
+- p = atts;
+- while (*p)
+- ++p;
+- nAtts = (p - atts) >> 1;
+- if (nAtts > 1)
+- qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp);
+- while (*atts) {
+- puttc(T(' '), fp);
+- fputts(*atts++, fp);
+- puttc(T('='), fp);
+- puttc(T('"'), fp);
+- characterData(userData, *atts, tcslen(*atts));
+- puttc(T('"'), fp);
+- atts++;
+- }
+- puttc(T('>'), fp);
+-}
+-
+-static void endElement(void *userData, const XML_Char *name)
+-{
+- FILE *fp = userData;
+- puttc(T('<'), fp);
+- puttc(T('/'), fp);
+- fputts(name, fp);
+- puttc(T('>'), fp);
+-}
+-
+-static void startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
+-{
+- int nAtts;
+- int nsi;
+- const XML_Char **p;
+- FILE *fp = userData;
+- const XML_Char *sep;
+- puttc(T('<'), fp);
+-
+- sep = tcsrchr(name, NSSEP);
+- if (sep) {
+- fputts(T("ns0:"), fp);
+- fputts(sep + 1, fp);
+- fputts(T(" xmlns:ns0=\""), fp);
+- characterData(userData, name, sep - name);
+- puttc(T('"'), fp);
+- nsi = 1;
+- }
+- else {
+- fputts(name, fp);
+- nsi = 0;
+- }
+-
+- p = atts;
+- while (*p)
+- ++p;
+- nAtts = (p - atts) >> 1;
+- if (nAtts > 1)
+- qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp);
+- while (*atts) {
+- name = *atts++;
+- sep = tcsrchr(name, NSSEP);
+- if (sep) {
+- ftprintf(fp, T(" xmlns:ns%d=\""), nsi);
+- characterData(userData, name, sep - name);
+- puttc(T('"'), fp);
+- name = sep + 1;
+- ftprintf(fp, T(" ns%d:"), nsi++);
+- }
+- else
+- puttc(T(' '), fp);
+- fputts(name, fp);
+- puttc(T('='), fp);
+- puttc(T('"'), fp);
+- characterData(userData, *atts, tcslen(*atts));
+- puttc(T('"'), fp);
+- atts++;
+- }
+- puttc(T('>'), fp);
+-}
+-
+-static void endElementNS(void *userData, const XML_Char *name)
+-{
+- FILE *fp = userData;
+- const XML_Char *sep;
+- puttc(T('<'), fp);
+- puttc(T('/'), fp);
+- sep = tcsrchr(name, NSSEP);
+- if (sep) {
+- fputts(T("ns0:"), fp);
+- fputts(sep + 1, fp);
+- }
+- else
+- fputts(name, fp);
+- puttc(T('>'), fp);
+-}
+-
+-static void processingInstruction(void *userData, const XML_Char *target, const XML_Char *data)
+-{
+- FILE *fp = userData;
+- puttc(T('<'), fp);
+- puttc(T('?'), fp);
+- fputts(target, fp);
+- puttc(T(' '), fp);
+- fputts(data, fp);
+- puttc(T('?'), fp);
+- puttc(T('>'), fp);
+-}
+-
+-static void defaultCharacterData(XML_Parser parser, const XML_Char *s, int len)
+-{
+- XML_DefaultCurrent(parser);
+-}
+-
+-static void defaultStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts)
+-{
+- XML_DefaultCurrent(parser);
+-}
+-
+-static void defaultEndElement(XML_Parser parser, const XML_Char *name)
+-{
+- XML_DefaultCurrent(parser);
+-}
+-
+-static void defaultProcessingInstruction(XML_Parser parser, const XML_Char *target, const XML_Char *data)
+-{
+- XML_DefaultCurrent(parser);
+-}
+-
+-static void nopCharacterData(XML_Parser parser, const XML_Char *s, int len)
+-{
+-}
+-
+-static void nopStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts)
+-{
+-}
+-
+-static void nopEndElement(XML_Parser parser, const XML_Char *name)
+-{
+-}
+-
+-static void nopProcessingInstruction(XML_Parser parser, const XML_Char *target, const XML_Char *data)
+-{
+-}
+-
+-static void markup(XML_Parser parser, const XML_Char *s, int len)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- for (; len > 0; --len, ++s)
+- puttc(*s, fp);
+-}
+-
+-static
+-void metaLocation(XML_Parser parser)
+-{
+- const XML_Char *uri = XML_GetBase(parser);
+- if (uri)
+- ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri);
+- ftprintf(XML_GetUserData(parser),
+- T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""),
+- XML_GetCurrentByteIndex(parser),
+- XML_GetCurrentByteCount(parser),
+- XML_GetCurrentLineNumber(parser),
+- XML_GetCurrentColumnNumber(parser));
+-}
+-
+-static
+-void metaStartDocument(XML_Parser parser)
+-{
+- fputts(T("<document>\n"), XML_GetUserData(parser));
+-}
+-
+-static
+-void metaEndDocument(XML_Parser parser)
+-{
+- fputts(T("</document>\n"), XML_GetUserData(parser));
+-}
+-
+-static
+-void metaStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- const XML_Char **specifiedAttsEnd
+- = atts + 2*XML_GetSpecifiedAttributeCount(parser);
+- 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], tcslen(atts[1]));
+- if (atts >= specifiedAttsEnd)
+- fputs(T("\" defaulted=\"yes\"/>\n"), fp);
+- else
+- fputts(T("\"/>\n"), fp);
+- } while (*(atts += 2));
+- fputts(T("</starttag>\n"), fp);
+- }
+- else
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaEndElement(XML_Parser parser, const XML_Char *name)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- ftprintf(fp, T("<endtag name=\"%s\""), name);
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaProcessingInstruction(XML_Parser parser, const XML_Char *target, const XML_Char *data)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- ftprintf(fp, T("<pi target=\"%s\" data=\""), target);
+- characterData(fp, data, tcslen(data));
+- puttc(T('"'), fp);
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaComment(XML_Parser parser, const XML_Char *data)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- fputts(T("<comment data=\""), fp);
+- characterData(fp, data, tcslen(data));
+- puttc(T('"'), fp);
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaStartCdataSection(XML_Parser parser)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- fputts(T("<startcdata"), fp);
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaEndCdataSection(XML_Parser parser)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- fputts(T("<endcdata"), fp);
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaCharacterData(XML_Parser parser, const XML_Char *s, int len)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- fputts(T("<chars str=\""), fp);
+- characterData(fp, s, len);
+- puttc(T('"'), fp);
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaUnparsedEntityDecl(XML_Parser parser,
+- const XML_Char *entityName,
+- const XML_Char *base,
+- const XML_Char *systemId,
+- const XML_Char *publicId,
+- const XML_Char *notationName)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- ftprintf(fp, T("<entity name=\"%s\""), entityName);
+- if (publicId)
+- ftprintf(fp, T(" public=\"%s\""), publicId);
+- fputts(T(" system=\""), fp);
+- characterData(fp, systemId, tcslen(systemId));
+- puttc(T('"'), fp);
+- ftprintf(fp, T(" notation=\"%s\""), notationName);
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaNotationDecl(XML_Parser parser,
+- const XML_Char *notationName,
+- const XML_Char *base,
+- const XML_Char *systemId,
+- const XML_Char *publicId)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- ftprintf(fp, T("<notation name=\"%s\""), notationName);
+- if (publicId)
+- ftprintf(fp, T(" public=\"%s\""), publicId);
+- if (systemId) {
+- fputts(T(" system=\""), fp);
+- characterData(fp, systemId, tcslen(systemId));
+- puttc(T('"'), fp);
+- }
+- metaLocation(parser);
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaStartNamespaceDecl(XML_Parser parser,
+- const XML_Char *prefix,
+- const XML_Char *uri)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- fputts(T("<startns"), fp);
+- if (prefix)
+- ftprintf(fp, T(" prefix=\"%s\""), prefix);
+- if (uri) {
+- fputts(T(" ns=\""), fp);
+- characterData(fp, uri, tcslen(uri));
+- fputts(T("\"/>\n"), fp);
+- }
+- else
+- fputts(T("/>\n"), fp);
+-}
+-
+-static
+-void metaEndNamespaceDecl(XML_Parser parser, const XML_Char *prefix)
+-{
+- FILE *fp = XML_GetUserData(parser);
+- if (!prefix)
+- fputts(T("<endns/>\n"), fp);
+- else
+- ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
+-}
+-
+-static
+-int unknownEncodingConvert(void *data, const char *p)
+-{
+- return codepageConvert(*(int *)data, p);
+-}
+-
+-static
+-int 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;
+-
+- 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)
+- return 0;
+- cp *= 10;
+- cp += s - digits;
+- if (cp >= 0x10000)
+- return 0;
+- }
+- 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)
+- return 0;
+- *(int *)info->data = cp;
+- return 1;
+-}
+-
+-static
+-int notStandalone(void *userData)
+-{
+- return 0;
+-}
+-
+-static
+-void usage(const XML_Char *prog)
+-{
+- ftprintf(stderr, T("usage: %s [-n] [-r] [-s] [-w] [-x] [-d output-dir] [-e encoding] file ...\n"), prog);
+- exit(1);
+-}
+-
+-int tmain(int argc, XML_Char **argv)
+-{
+- int i, j;
+- const XML_Char *outputDir = 0;
+- const XML_Char *encoding = 0;
+- unsigned processFlags = XML_MAP_FILE;
+- int windowsCodePages = 0;
+- int outputType = 0;
+- int useNamespaces = 0;
+- int requireStandalone = 0;
+-
+-#ifdef _MSC_VER
+- _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
+-#endif
+-
+- i = 1;
+- j = 0;
+- while (i < argc) {
+- if (j == 0) {
+- if (argv[i][0] != T('-'))
+- break;
+- if (argv[i][1] == T('-') && argv[i][2] == T('\0')) {
+- i++;
+- break;
+- }
+- j++;
+- }
+- switch (argv[i][j]) {
+- case T('r'):
+- processFlags &= ~XML_MAP_FILE;
+- j++;
+- break;
+- case T('s'):
+- requireStandalone = 1;
+- j++;
+- break;
+- case T('n'):
+- useNamespaces = 1;
+- j++;
+- break;
+- case T('x'):
+- processFlags |= XML_EXTERNAL_ENTITIES;
+- j++;
+- break;
+- case T('w'):
+- windowsCodePages = 1;
+- j++;
+- break;
+- case T('m'):
+- outputType = 'm';
+- j++;
+- break;
+- case T('c'):
+- outputType = 'c';
+- useNamespaces = 0;
+- j++;
+- break;
+- case T('t'):
+- outputType = 't';
+- j++;
+- break;
+- case T('d'):
+- if (argv[i][j + 1] == T('\0')) {
+- if (++i == argc)
+- usage(argv[0]);
+- outputDir = argv[i];
+- }
+- else
+- outputDir = argv[i] + j + 1;
+- i++;
+- j = 0;
+- break;
+- case T('e'):
+- if (argv[i][j + 1] == T('\0')) {
+- if (++i == argc)
+- usage(argv[0]);
+- encoding = argv[i];
+- }
+- else
+- encoding = argv[i] + j + 1;
+- i++;
+- j = 0;
+- break;
+- case T('\0'):
+- if (j > 1) {
+- i++;
+- j = 0;
+- break;
+- }
+- /* fall through */
+- default:
+- usage(argv[0]);
+- }
+- }
+- if (i == argc)
+- usage(argv[0]);
+- for (; i < argc; i++) {
+- FILE *fp = 0;
+- XML_Char *outName = 0;
+- int result;
+- XML_Parser parser;
+- if (useNamespaces)
+- parser = XML_ParserCreateNS(encoding, NSSEP);
+- else
+- parser = XML_ParserCreate(encoding);
+- if (requireStandalone)
+- XML_SetNotStandaloneHandler(parser, notStandalone);
+- if (outputType == 't') {
+- /* This is for doing timings; this gives a more realistic estimate of
+- the parsing time. */
+- outputDir = 0;
+- XML_SetElementHandler(parser, nopStartElement, nopEndElement);
+- XML_SetCharacterDataHandler(parser, nopCharacterData);
+- XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
+- }
+- else if (outputDir) {
+- const XML_Char *file = argv[i];
+- if (tcsrchr(file, T('/')))
+- file = tcsrchr(file, T('/')) + 1;
+-#ifdef WIN32
+- if (tcsrchr(file, T('\\')))
+- file = tcsrchr(file, T('\\')) + 1;
+-#endif
+- outName = malloc((tcslen(outputDir) + tcslen(file) + 2) * sizeof(XML_Char));
+- tcscpy(outName, outputDir);
+- tcscat(outName, T("/"));
+- tcscat(outName, file);
+- fp = tfopen(outName, T("wb"));
+- if (!fp) {
+- tperror(outName);
+- exit(1);
+- }
+- setvbuf(fp, NULL, _IOFBF, 16384);
+-#ifdef XML_UNICODE
+- puttc(0xFEFF, fp);
+-#endif
+- XML_SetUserData(parser, fp);
+- switch (outputType) {
+- case 'm':
+- XML_UseParserAsHandlerArg(parser);
+- XML_SetElementHandler(parser, metaStartElement, metaEndElement);
+- XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction);
+- XML_SetCommentHandler(parser, metaComment);
+- XML_SetCdataSectionHandler(parser, metaStartCdataSection, metaEndCdataSection);
+- XML_SetCharacterDataHandler(parser, metaCharacterData);
+- XML_SetUnparsedEntityDeclHandler(parser, metaUnparsedEntityDecl);
+- XML_SetNotationDeclHandler(parser, metaNotationDecl);
+- XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, metaEndNamespaceDecl);
+- metaStartDocument(parser);
+- break;
+- case 'c':
+- XML_UseParserAsHandlerArg(parser);
+- XML_SetDefaultHandler(parser, markup);
+- XML_SetElementHandler(parser, defaultStartElement, defaultEndElement);
+- XML_SetCharacterDataHandler(parser, defaultCharacterData);
+- XML_SetProcessingInstructionHandler(parser, defaultProcessingInstruction);
+- break;
+- default:
+- if (useNamespaces)
+- XML_SetElementHandler(parser, startElementNS, endElementNS);
+- else
+- XML_SetElementHandler(parser, startElement, endElement);
+- XML_SetCharacterDataHandler(parser, characterData);
+- XML_SetProcessingInstructionHandler(parser, processingInstruction);
+- break;
+- }
+- }
+- if (windowsCodePages)
+- XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0);
+- result = XML_ProcessFile(parser, argv[i], processFlags);
+- if (outputDir) {
+- if (outputType == 'm')
+- metaEndDocument(parser);
+- fclose(fp);
+- if (!result)
+- tremove(outName);
+- free(outName);
+- }
+- XML_ParserFree(parser);
+- }
+- return 0;
+-}
+diff -u -r -N original/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.dsp dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.dsp
+--- original/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.dsp 2001-03-19 21:28:35.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/expat/xmlwf/xmlwf.dsp 1969-12-31 18:00:00.000000000 -0600
+@@ -1,136 +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 ".\Release"
+-# PROP Intermediate_Dir ".\Release"
+-# 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 /W3 /GX /O2 /I "..\xmlparse" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /FD /c
+-# ADD BASE RSC /l 0x809 /d "NDEBUG"
+-# ADD RSC /l 0x809 /d "NDEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+-# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlwf.exe"
+-
+-!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 ".\Debug"
+-# PROP Intermediate_Dir ".\Debug"
+-# 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 /MDd /W3 /Gm /GX /ZI /Od /I ".\xmlparse" /I "..\xmlparse" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /FD /c
+-# ADD BASE RSC /l 0x809 /d "_DEBUG"
+-# ADD RSC /l 0x809 /d "_DEBUG"
+-BSC32=bscmake.exe
+-# ADD BASE BSC32 /nologo
+-# ADD BSC32 /nologo
+-LINK32=link.exe
+-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+-# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\dbgbin\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 -u -r -N original/xmlrpc-epi-0.51/sample/Makefile.in dump_expat/xmlrpc-epi-0.51/sample/Makefile.in
+--- original/xmlrpc-epi-0.51/sample/Makefile.in 2002-06-23 18:48:29.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/sample/Makefile.in 2007-02-01 23:13:11.000000000 -0600
+@@ -77,7 +77,7 @@
+ STRIP = @STRIP@
+ VERSION = @VERSION@
+
+-INCLUDES = -I../src -I../expat/xmltok -I../expat/xmlparse
++INCLUDES = -I../src
+
+ bin_PROGRAMS = sample client server server_compliance_test memtest hello_client hello_server
+
+@@ -112,7 +112,7 @@
+ DEFS = @DEFS@ -I. -I$(srcdir)
+ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+-LIBS = @LIBS@
++LIBS = @LIBS@ -lexpat
+ sample_OBJECTS = sample.$(OBJEXT)
+ sample_DEPENDENCIES = ../src/libxmlrpc.la
+ sample_LDFLAGS =
+diff -u -r -N original/xmlrpc-epi-0.51/src/Makefile.in dump_expat/xmlrpc-epi-0.51/src/Makefile.in
+--- original/xmlrpc-epi-0.51/src/Makefile.in 2002-06-23 18:48:29.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/src/Makefile.in 2007-02-01 23:13:36.000000000 -0600
+@@ -75,11 +75,11 @@
+ STRIP = @STRIP@
+ VERSION = @VERSION@
+
+-INCLUDES = -I../liblm -I../expat/xmltok -I../expat/xmlparse -I/usr/local/ssl/include
++INCLUDES = -I../liblm -I/usr/local/ssl/include
+
+ lib_LTLIBRARIES = libxmlrpc.la
+
+-libxmlrpc_la_LIBADD = ../expat/xmltok/libexpat_tok.la ../expat/xmlparse/libexpat_parse.la
++libxmlrpc_la_LIBADD =
+
+ libxmlrpc_la_SOURCES = base64.c encodings.c queue.c simplestring.c xml_element.c xml_to_dandarpc.c xml_to_xmlrpc.c xml_to_soap.c xmlrpc.c xmlrpc_introspection.c system_methods.c
+
+@@ -130,8 +130,7 @@
+ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+-libxmlrpc_la_DEPENDENCIES = ../expat/xmltok/libexpat_tok.la \
+-../expat/xmlparse/libexpat_parse.la
++libxmlrpc_la_DEPENDENCIES =
+ libxmlrpc_la_OBJECTS = base64.lo encodings.lo queue.lo simplestring.lo \
+ xml_element.lo xml_to_dandarpc.lo xml_to_xmlrpc.lo xml_to_soap.lo \
+ xmlrpc.lo xmlrpc_introspection.lo system_methods.lo
+diff -u -r -N original/xmlrpc-epi-0.51/src/xml_element.c dump_expat/xmlrpc-epi-0.51/src/xml_element.c
+--- original/xmlrpc-epi-0.51/src/xml_element.c 2002-05-23 12:46:51.000000000 -0500
++++ dump_expat/xmlrpc-epi-0.51/src/xml_element.c 2007-02-01 22:47:58.000000000 -0600
+@@ -91,7 +91,7 @@
+
+ #include "xml_element.h"
+ #include "queue.h"
+-#include "xmlparse.h"
++#include "expat.h"
+ #include "encodings.h"
+
+ #define my_free(thing) if(thing) {free(thing); thing = 0;}
+@@ -170,7 +170,8 @@
+
+ Q_Destroy(&root->children);
+ Q_Destroy(&root->attrs);
+- my_free((char*)root->name);
++ //my_free((char*)root->name);
++ my_free(root->name);
+ simplestring_free(&root->text);
+ my_free(root);
+ }
+diff -u -r -N original/xmlrpc-epi-0.51/src/xmlrpc.c dump_expat/xmlrpc-epi-0.51/src/xmlrpc.c
+--- original/xmlrpc-epi-0.51/src/xmlrpc.c 2002-03-09 17:15:44.000000000 -0600
++++ dump_expat/xmlrpc-epi-0.51/src/xmlrpc.c 2007-02-01 22:48:11.000000000 -0600
+@@ -120,7 +120,8 @@
+
+ #include "queue.h"
+ #include "xmlrpc.h"
+-#include "xmlparse.h"
++//#include "xmlparse.h"
++#include "expat.h"
+ #include "base64.h"
+
+ #include "xml_to_xmlrpc.h"
diff --git a/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-64bit-fixes.patch b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-64bit-fixes.patch
new file mode 100644
index 0000000..2134b23
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-64bit-fixes.patch
@@ -0,0 +1,93 @@
+--- xmlrpc-epi-0.51/sample/sample.c.64bit-fixes 2001-09-16 16:33:17.000000000 -0400
++++ xmlrpc-epi-0.51/sample/sample.c 2002-12-08 16:25:15.000000000 -0500
+@@ -38,6 +38,7 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include "xmlrpc.h"
+
+
+@@ -118,7 +119,7 @@ void describe_TestStruct(XMLRPC_SERVER s
+ }
+ else {
+ if(err.xml_elem_error.parser_code) {
+- printf("parse error, line: %i, column: %i, message: %s\n",
++ printf("parse error, line: %ld, column: %ld, message: %s\n",
+ err.xml_elem_error.line, err.xml_elem_error.column, err.xml_elem_error.parser_error);
+ }
+ }
+--- xmlrpc-epi-0.51/src/encodings.c.64bit-fixes 2002-03-12 13:08:18.000000000 -0500
++++ xmlrpc-epi-0.51/src/encodings.c 2002-12-08 16:11:28.000000000 -0500
+@@ -42,9 +42,9 @@ static char* convert(const char* src, in
+ char* outbuf = 0;
+
+ if(src && src_len && from_enc && to_enc) {
+- int outlenleft = src_len;
++ size_t outlenleft = src_len;
+ int outlen = src_len;
+- int inlenleft = src_len;
++ size_t inlenleft = src_len;
+ iconv_t ic = iconv_open(to_enc, from_enc);
+ char* src_ptr = (char*)src;
+ char* out_ptr = 0;
+--- xmlrpc-epi-0.51/src/xml_element.c.64bit-fixes 2002-05-23 13:46:51.000000000 -0400
++++ xmlrpc-epi-0.51/src/xml_element.c 2002-12-08 16:22:19.000000000 -0500
+@@ -461,9 +461,10 @@ static void xml_element_serialize(xml_el
+ }
+
+ /* print buf to file */
+-static file_out_fptr(void *f, const char *text, int size)
++static int file_out_fptr(void *f, const char *text, int size)
+ {
+- fputs(text, (FILE *)f);
++ // Assume we want to return 0 on success, -1 otherwise
++ return fputs(text, (FILE *)f) >= 0 ? 0 : -1;
+ }
+
+ /* print buf to simplestring */
+@@ -473,6 +474,7 @@ static simplestring_out_fptr(void *f, co
+ if(buf) {
+ simplestring_addn(buf, text, size);
+ }
++ return 0;
+ }
+
+ /****f* xml_element/xml_elem_serialize_to_string
+@@ -687,7 +689,7 @@ xml_element* xml_elem_parse_buf(const ch
+ if(byte_idx >= 0) {
+ snprintf(buf,
+ sizeof(buf),
+- "\n\tdata beginning %i before byte index: %s\n",
++ "\n\tdata beginning %ld before byte index: %s\n",
+ byte_idx > 10 ? 10 : byte_idx,
+ in_buf + (byte_idx > 10 ? byte_idx - 10 : byte_idx));
+ }
+@@ -696,7 +698,7 @@ xml_element* xml_elem_parse_buf(const ch
+ "\tdescription: %s\n"
+ "\tline: %i\n"
+ "\tcolumn: %i\n"
+- "\tbyte index: %i\n"
++ "\tbyte index: %ld\n"
+ "\ttotal bytes: %i\n%s ",
+ err_code, error_str, line_num,
+ col_num, byte_idx, byte_total, buf);
+--- xmlrpc-epi-0.51/src/xmlrpc.c.64bit-fixes 2002-03-09 18:15:44.000000000 -0500
++++ xmlrpc-epi-0.51/src/xmlrpc.c 2002-12-08 16:23:50.000000000 -0500
+@@ -116,6 +116,7 @@ static const char rcsid[] =
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdarg.h>
++#include <ctype.h>
+ #include <time.h>
+
+ #include "queue.h"
+@@ -699,7 +700,7 @@ static XMLRPC_VALUE map_expat_errors (XM
+ XMLRPC_ERROR_CODE code;
+ char buf[1024];
+ snprintf (buf, sizeof (buf),
+- "error occurred at line %i, column %i, byte index %i",
++ "error occurred at line %ld, column %ld, byte index %ld",
+ error->line, error->column, error->byte_index);
+
+ /* expat specific errors */
diff --git a/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-expat.patch b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-expat.patch
new file mode 100644
index 0000000..a955373
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-expat.patch
@@ -0,0 +1,83 @@
+diff -Naur xmlrpc-epi-0.51.orig/Makefile.am xmlrpc-epi-0.51/Makefile.am
+--- xmlrpc-epi-0.51.orig/Makefile.am 2001-04-10 10:37:40.000000000 +0900
++++ xmlrpc-epi-0.51/Makefile.am 2007-02-03 00:00:00.000000000 +0900
+@@ -1,4 +1,4 @@
+-SUBDIRS = expat src sample
++SUBDIRS = src sample
+
+ CHANGE_LOG_GEN_BIN = scripts/cvs2cl.pl
+ CHANGE_LOG_GEN_FLAGS = -t -r -b --accum -I ChangeLog --gmt --prune
+diff -Naur xmlrpc-epi-0.51.orig/configure.in xmlrpc-epi-0.51/configure.in
+--- xmlrpc-epi-0.51.orig/configure.in 2002-06-24 08:48:29.000000000 +0900
++++ xmlrpc-epi-0.51/configure.in 2007-02-03 00:29:58.000000000 +0900
+@@ -15,12 +15,11 @@
+ AC_PROG_MAKE_SET
+ AC_PROG_LIBTOOL
+
+-LIBS="-L/usr/local/lib"
++LIBS="-lexpat"
+
+ dnl Checks for header files.
+ AC_HEADER_STDC
+-AC_CHECK_HEADERS(fcntl.h malloc.h unistd.h)
+-
++AC_CHECK_HEADERS(fcntl.h malloc.h unistd.h expat.h)
+
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+@@ -36,7 +35,7 @@
+
+ AC_CHECK_FUNCS(mktime strstr)
+
+-AC_OUTPUT(src/Makefile Makefile sample/Makefile expat/Makefile expat/xmltok/Makefile expat/xmlparse/Makefile)
++AC_OUTPUT(src/Makefile Makefile sample/Makefile)
+
+
+
+diff -Naur xmlrpc-epi-0.51.orig/sample/Makefile.am xmlrpc-epi-0.51/sample/Makefile.am
+--- xmlrpc-epi-0.51.orig/sample/Makefile.am 2001-09-01 06:38:27.000000000 +0900
++++ xmlrpc-epi-0.51/sample/Makefile.am 2007-02-03 00:17:22.000000000 +0900
+@@ -1,4 +1,4 @@
+-INCLUDES=-I../src -I../expat/xmltok -I../expat/xmlparse
++INCLUDES=-I../src
+
+ bin_PROGRAMS = sample client server server_compliance_test memtest hello_client hello_server
+
+diff -Naur xmlrpc-epi-0.51.orig/src/Makefile.am xmlrpc-epi-0.51/src/Makefile.am
+--- xmlrpc-epi-0.51.orig/src/Makefile.am 2001-09-17 05:27:27.000000000 +0900
++++ xmlrpc-epi-0.51/src/Makefile.am 2007-02-03 00:14:27.000000000 +0900
+@@ -1,8 +1,8 @@
+-INCLUDES=-I../liblm -I../expat/xmltok -I../expat/xmlparse -I/usr/local/ssl/include
++INCLUDES=-I../liblm
+
+ lib_LTLIBRARIES = libxmlrpc.la
+
+-libxmlrpc_la_LIBADD = ../expat/xmltok/libexpat_tok.la ../expat/xmlparse/libexpat_parse.la
++libxmlrpc_la_LIBADD =
+
+ libxmlrpc_la_SOURCES = \
+ base64.c \
+diff -Naur xmlrpc-epi-0.51.orig/src/xml_element.c xmlrpc-epi-0.51/src/xml_element.c
+--- xmlrpc-epi-0.51.orig/src/xml_element.c 2002-05-24 02:46:51.000000000 +0900
++++ xmlrpc-epi-0.51/src/xml_element.c 2007-02-03 00:15:10.000000000 +0900
+@@ -91,7 +91,7 @@
+
+ #include "xml_element.h"
+ #include "queue.h"
+-#include "xmlparse.h"
++#include "expat.h"
+ #include "encodings.h"
+
+ #define my_free(thing) if(thing) {free(thing); thing = 0;}
+diff -Naur xmlrpc-epi-0.51.orig/src/xmlrpc.c xmlrpc-epi-0.51/src/xmlrpc.c
+--- xmlrpc-epi-0.51.orig/src/xmlrpc.c 2002-03-10 08:15:44.000000000 +0900
++++ xmlrpc-epi-0.51/src/xmlrpc.c 2007-02-03 00:15:40.000000000 +0900
+@@ -120,7 +120,7 @@
+
+ #include "queue.h"
+ #include "xmlrpc.h"
+-#include "xmlparse.h"
++#include "expat.h"
+ #include "base64.h"
+
+ #include "xml_to_xmlrpc.h"
diff --git a/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-gcc4.patch b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-gcc4.patch
new file mode 100644
index 0000000..c7ba6a1
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-gcc4.patch
@@ -0,0 +1,11 @@
+--- xmlrpc-epi-0.51/src/xml_element.c.gcc4 2005-08-09 19:07:40.000000000 -0400
++++ xmlrpc-epi-0.51/src/xml_element.c 2005-08-09 19:11:05.000000000 -0400
+@@ -170,7 +170,7 @@ void xml_elem_free_non_recurse(xml_eleme
+
+ Q_Destroy(&root->children);
+ Q_Destroy(&root->attrs);
+- my_free((char*)root->name);
++ my_free(root->name);
+ simplestring_free(&root->text);
+ my_free(root);
+ }
diff --git a/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-secondlife.patch b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-secondlife.patch
new file mode 100644
index 0000000..a5d31eb
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/files/xmlrpc-epi-0.51-secondlife.patch
@@ -0,0 +1,12 @@
+--- xmlrpc-epi-0.51-old/src/queue.h 2001-05-18 10:29:09.000000000 -0700
++++ xmlrpc-epi-0.51-new/src/queue.h 2006-05-02 14:25:30.573246791 -0700
+@@ -24,6 +24,9 @@
+ #define True_ 1
+ #endif
+
++/* 2006-05-02 Inserted to enable compilation of rpcserver on linux. Phoenix */
++#define queue xmlrpc_queue
++
+ typedef struct nodeptr datanode;
+
+ typedef struct nodeptr {
diff --git a/dev-libs/xmlrpc-epi/xmlrpc-epi-0.51.ebuild b/dev-libs/xmlrpc-epi/xmlrpc-epi-0.51.ebuild
new file mode 100644
index 0000000..2d67c80
--- /dev/null
+++ b/dev-libs/xmlrpc-epi/xmlrpc-epi-0.51.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit autotools eutils
+
+DESCRIPTION=""
+HOMEPAGE="http://xmlrpc-epi.sourceforge.net/"
+SRC_URI="mirror://sourceforge/xmlrpc-epi/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="sys-devel/gettext
+ !dev-libs/xmlrpc-c"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-64bit-fixes.patch
+ epatch "${FILESDIR}"/${P}-gcc4.patch
+ epatch "${FILESDIR}"/${P}-expat.patch
+ epatch "${FILESDIR}"/${P}-secondlife.patch
+ eautoreconf
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+}
diff --git a/games-simulation/secondlife-bin/Manifest b/games-simulation/secondlife-bin/Manifest
new file mode 100644
index 0000000..4ac9da9
--- /dev/null
+++ b/games-simulation/secondlife-bin/Manifest
@@ -0,0 +1,16 @@
+DIST SecondLife_i686_1_13_3_2.tar.bz2 40863936 RMD160 6b2ec9dcd94b2fafa923b606e46eec74bbab4538 SHA1 09629e3da7af9eb647538ee464379ccd384ff9b1 SHA256 db181dc52b31e91982bfed2e19678dfca21434a795fefd3dba06bdcf9fdc30a8
+DIST SecondLife_i686_1_13_4_59558_FIRSTLOOK.tar.bz2 50021132 RMD160 d9fd87bfcadef25a609a982653f2a8b491b7527f SHA1 875d3ccee60910036c0c30ac98d9b0b14154e68a SHA256 150e372b94356063fae135730dcd68969ebc975f3983eeb626b2bf4258b4cec5
+EBUILD secondlife-bin-1.13.3.2.ebuild 2023 RMD160 17a62e6e7e477b26381603046b4c50f76892224c SHA1 8f8f84eb3a46b95f35b262f8d0669e738d389af1 SHA256 5a4be413c4ff89c599be2e4aff1504c1fd191927b5b2b0651eacbb74b23891fb
+MD5 a6bc44c4fc3c0a4427e1a581ae9eca61 secondlife-bin-1.13.3.2.ebuild 2023
+RMD160 17a62e6e7e477b26381603046b4c50f76892224c secondlife-bin-1.13.3.2.ebuild 2023
+SHA256 5a4be413c4ff89c599be2e4aff1504c1fd191927b5b2b0651eacbb74b23891fb secondlife-bin-1.13.3.2.ebuild 2023
+EBUILD secondlife-bin-1.13.4.59558.ebuild 2144 RMD160 f343fb63c15a2a4ca49a43d5a181549b128bb072 SHA1 92d59c097ba22bc16623654065a0109f0b96cc4a SHA256 f4ddd6e4e89f8514ca9f9b6d62889d80475d68eb37bf20a4cb6f282a74da9d0f
+MD5 b6703cee5426acf4b9ecaaa253638c5b secondlife-bin-1.13.4.59558.ebuild 2144
+RMD160 f343fb63c15a2a4ca49a43d5a181549b128bb072 secondlife-bin-1.13.4.59558.ebuild 2144
+SHA256 f4ddd6e4e89f8514ca9f9b6d62889d80475d68eb37bf20a4cb6f282a74da9d0f secondlife-bin-1.13.4.59558.ebuild 2144
+MD5 119ac56f6e51bb5a576257d3cd08702e files/digest-secondlife-bin-1.13.3.2 283
+RMD160 78158b635c14929f51e6c57e997ce94048b46b5b files/digest-secondlife-bin-1.13.3.2 283
+SHA256 0aa603511191e63204fdf1d31c42cf84d8bc775435e86742734e27a81471ac5e files/digest-secondlife-bin-1.13.3.2 283
+MD5 22fbda7b5d3de28c0865c5dfa29239b5 files/digest-secondlife-bin-1.13.4.59558 325
+RMD160 b09993240ae564218f3d0f4e793d3fbae06708a3 files/digest-secondlife-bin-1.13.4.59558 325
+SHA256 76c67d7929431353f14b9924ce6e548f24f411ff57a96da7ae559aa6e45f2d21 files/digest-secondlife-bin-1.13.4.59558 325
diff --git a/games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.3.2 b/games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.3.2
new file mode 100644
index 0000000..f3da53b
--- /dev/null
+++ b/games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.3.2
@@ -0,0 +1,3 @@
+MD5 9800068b0a06ae5370633fafa57eae10 SecondLife_i686_1_13_3_2.tar.bz2 40863936
+RMD160 6b2ec9dcd94b2fafa923b606e46eec74bbab4538 SecondLife_i686_1_13_3_2.tar.bz2 40863936
+SHA256 db181dc52b31e91982bfed2e19678dfca21434a795fefd3dba06bdcf9fdc30a8 SecondLife_i686_1_13_3_2.tar.bz2 40863936
diff --git a/games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.4.59558 b/games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.4.59558
new file mode 100644
index 0000000..01dd0dd
--- /dev/null
+++ b/games-simulation/secondlife-bin/files/digest-secondlife-bin-1.13.4.59558
@@ -0,0 +1,3 @@
+MD5 22b16b32f9667b66d93221ef98de7392 SecondLife_i686_1_13_4_59558_FIRSTLOOK.tar.bz2 50021132
+RMD160 d9fd87bfcadef25a609a982653f2a8b491b7527f SecondLife_i686_1_13_4_59558_FIRSTLOOK.tar.bz2 50021132
+SHA256 150e372b94356063fae135730dcd68969ebc975f3983eeb626b2bf4258b4cec5 SecondLife_i686_1_13_4_59558_FIRSTLOOK.tar.bz2 50021132
diff --git a/games-simulation/secondlife-bin/secondlife-bin-1.13.3.2.ebuild b/games-simulation/secondlife-bin/secondlife-bin-1.13.3.2.ebuild
new file mode 100644
index 0000000..3bfd28f
--- /dev/null
+++ b/games-simulation/secondlife-bin/secondlife-bin-1.13.3.2.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit games
+
+MY_P="SecondLife_i686_${PV//./_}"
+
+DESCRIPTION="A 3D MMORPG virtual world entirely built and owned by its residents"
+HOMEPAGE="http://secondlife.com/"
+SRC_URI="http://secondlife.com/downloads/viewer/${MY_P}.tar.bz2"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="mirror strip"
+
+dir="${GAMES_PREFIX_OPT}/secondlife"
+QA_EXECSTACK="${dir:1}/bin/do-not-directly-run-secondlife-bin
+ ${dir:1}/lib/libGLU.so.1
+ ${dir:1}/lib/libkdu_v42R.so
+ ${dir:1}/lib/libcrypto.so.0.9.7
+ ${dir:1}/lib/libfmod-3.75.so"
+QA_TEXTRELS="${dir:1}/lib/libfreetype.so.6
+ ${dir:1}/lib/libcrypto.so.0.9.7
+ ${dir:1}/lib/libGLU.so.1
+ ${dir:1}/lib/libkdu_v42R.so
+ ${dir:1}/lib/libfmod-3.75.so
+ ${dir:1}/lib/libelfio.so"
+
+RDEPEND="sys-libs/glibc
+ media-fonts/kochi-substitute
+ x86? (
+ x11-libs/libX11
+ x11-libs/libXau
+ x11-libs/libXdmcp
+ x11-libs/libXext
+ dev-libs/libgcrypt
+ dev-libs/libgpg-error
+ dev-libs/openssl
+ media-libs/freetype
+ media-libs/libogg
+ media-libs/libsdl
+ media-libs/libvorbis
+ net-libs/gnutls
+ net-misc/curl
+ sys-libs/zlib
+ virtual/glu
+ virtual/opengl
+ )
+ amd64? (
+ app-emulation/emul-linux-x86-sdl
+ app-emulation/emul-linux-x86-gtklibs
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${A}
+
+ cd "${S}"
+ rm unicode.ttf
+}
+
+src_install() {
+ exeinto "${dir}"
+ doexe launch_url.sh linux-crash-logger.bin secondlife || die
+ rm -rf launch_url.sh linux-crash-logger.bin secondlife
+
+ exeinto "${dir}"/bin
+ doexe bin/do-not-directly-run-secondlife-bin || die
+ rm -rf bin
+
+ exeinto "${dir}"/lib
+ doexe lib/* || die
+ rm -rf lib
+
+ insinto "${dir}"
+ doins -r * || die "doins * failed"
+
+ dosym /usr/share/fonts/kochi-substitute/kochi-mincho-subst.ttf "${dir}"/unicode.ttf
+
+ games_make_wrapper secondlife-bin ./secondlife "${dir}" "${dir}"/lib
+ newicon secondlife.ico secondlife-bin.ico
+ make_desktop_entry secondlife-bin "Second Life(bin)" secondlife-bin.ico
+
+ prepgamesdirs
+}
diff --git a/games-simulation/secondlife-bin/secondlife-bin-1.13.4.59558.ebuild b/games-simulation/secondlife-bin/secondlife-bin-1.13.4.59558.ebuild
new file mode 100644
index 0000000..0aa317e
--- /dev/null
+++ b/games-simulation/secondlife-bin/secondlife-bin-1.13.4.59558.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit games
+
+MY_P="SecondLife_i686_${PV//./_}_FIRSTLOOK"
+#MY_P="SecondLife_i686_${PV//./_}"
+
+DESCRIPTION="A 3D MMORPG virtual world entirely built and owned by its residents"
+HOMEPAGE="http://secondlife.com/"
+SRC_URI="http://s3.amazonaws.com/firstlook-secondlife-com/${MY_P}.tar.bz2"
+#SRC_URI="http://secondlife.com/downloads/viewer/${MY_P}.tar.bz2"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="mirror strip"
+
+dir="${GAMES_PREFIX_OPT}/secondlife"
+QA_EXECSTACK="${dir:1}/bin/do-not-directly-run-secondlife-bin
+ ${dir:1}/lib/libGLU.so.1
+ ${dir:1}/lib/libkdu_v42R.so
+ ${dir:1}/lib/libcrypto.so.0.9.7
+ ${dir:1}/lib/libfmod-3.75.so"
+QA_TEXTRELS="${dir:1}/lib/libfreetype.so.6
+ ${dir:1}/lib/libcrypto.so.0.9.7
+ ${dir:1}/lib/libGLU.so.1
+ ${dir:1}/lib/libkdu_v42R.so
+ ${dir:1}/lib/libfmod-3.75.so
+ ${dir:1}/lib/libelfio.so"
+
+RDEPEND="sys-libs/glibc
+ media-fonts/kochi-substitute
+ x86? (
+ x11-libs/libX11
+ x11-libs/libXau
+ x11-libs/libXdmcp
+ x11-libs/libXext
+ dev-libs/libgcrypt
+ dev-libs/libgpg-error
+ dev-libs/openssl
+ media-libs/freetype
+ media-libs/libogg
+ media-libs/libsdl
+ media-libs/libvorbis
+ net-libs/gnutls
+ net-misc/curl
+ sys-libs/zlib
+ virtual/glu
+ virtual/opengl
+ )
+ amd64? (
+ app-emulation/emul-linux-x86-sdl
+ app-emulation/emul-linux-x86-gtklibs
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${A}
+
+ cd "${S}"
+ rm unicode.ttf
+}
+
+src_install() {
+ exeinto "${dir}"
+ doexe launch_url.sh linux-crash-logger.bin secondlife || die
+ rm -rf launch_url.sh linux-crash-logger.bin secondlife
+
+ exeinto "${dir}"/bin
+ doexe bin/do-not-directly-run-secondlife-bin || die
+ rm -rf bin
+
+ exeinto "${dir}"/lib
+ doexe lib/* || die
+ rm -rf lib
+
+ insinto "${dir}"
+ doins -r * || die "doins * failed"
+
+ dosym /usr/share/fonts/kochi-substitute/kochi-mincho-subst.ttf "${dir}"/unicode.ttf
+
+ games_make_wrapper secondlife-bin ./secondlife "${dir}" "${dir}"/lib
+ newicon secondlife.ico secondlife-bin.ico
+ make_desktop_entry secondlife-bin "Second Life(bin)" secondlife-bin.ico
+
+ prepgamesdirs
+}
diff --git a/games-simulation/secondlife/Manifest b/games-simulation/secondlife/Manifest
new file mode 100644
index 0000000..1c58797
--- /dev/null
+++ b/games-simulation/secondlife/Manifest
@@ -0,0 +1,25 @@
+AUX opensecondlife-svn41.patch 635 RMD160 4ff31d0a2e52c2ccfa6f5591e0e6e46471609690 SHA1 03998427597e06ede4d702ab4a91a7c8ae6bf824 SHA256 100a42a60f46bc6abd8b2d77ae81ee2d4ea56edcfabb1ab00b589ce0d9314bce
+MD5 23d4c1db16f9351dc2d190120d1962b4 files/opensecondlife-svn41.patch 635
+RMD160 4ff31d0a2e52c2ccfa6f5591e0e6e46471609690 files/opensecondlife-svn41.patch 635
+SHA256 100a42a60f46bc6abd8b2d77ae81ee2d4ea56edcfabb1ab00b589ce0d9314bce files/opensecondlife-svn41.patch 635
+AUX secondlife-1.13.3.2-llimagej2coj_debug.patch 3795 RMD160 4a0bd6cb16e1b35b445b2a61e7d7e372cdcd4450 SHA1 4ac6b96863d64c24f0708dc453cc2b48eb44883e SHA256 d1d16728aa2ebfac50b0563aa57a2f03d8e3dfd12f0fc10c2c2d3e99bcec28ca
+MD5 3b6706a0439c55c02e0d86acd4f495d1 files/secondlife-1.13.3.2-llimagej2coj_debug.patch 3795
+RMD160 4a0bd6cb16e1b35b445b2a61e7d7e372cdcd4450 files/secondlife-1.13.3.2-llimagej2coj_debug.patch 3795
+SHA256 d1d16728aa2ebfac50b0563aa57a2f03d8e3dfd12f0fc10c2c2d3e99bcec28ca files/secondlife-1.13.3.2-llimagej2coj_debug.patch 3795
+AUX secondlife-1.13.3.59315-no_fmod.patch 1146 RMD160 6c9a0f3f2c60fc9dcd7bf89e89c878caa4f730f7 SHA1 ed09cfb98608f530df3286e4d0e2b517821dcd6d SHA256 56a9cf153a2dc18c0527e6c2fed0645f57a542a7ab0990fad333542ebeee2a78
+MD5 29bf4466ac67b38cad15439d87d4f888 files/secondlife-1.13.3.59315-no_fmod.patch 1146
+RMD160 6c9a0f3f2c60fc9dcd7bf89e89c878caa4f730f7 files/secondlife-1.13.3.59315-no_fmod.patch 1146
+SHA256 56a9cf153a2dc18c0527e6c2fed0645f57a542a7ab0990fad333542ebeee2a78 files/secondlife-1.13.3.59315-no_fmod.patch 1146
+AUX secondlife-1.13.3.59558-gentoo.patch 8011 RMD160 aefb846e2d92e93fd9ee845f610ea2e39b44b08a SHA1 977415c6d60118d2a4366fac7ecdf7cd0d1f00f9 SHA256 dde90f2a3ecb9622bd2f366f82af91e0fe026afd593f1289a9be8095845971d1
+MD5 8d337cb0bb353e76a9e819257bc2619d files/secondlife-1.13.3.59558-gentoo.patch 8011
+RMD160 aefb846e2d92e93fd9ee845f610ea2e39b44b08a files/secondlife-1.13.3.59558-gentoo.patch 8011
+SHA256 dde90f2a3ecb9622bd2f366f82af91e0fe026afd593f1289a9be8095845971d1 files/secondlife-1.13.3.59558-gentoo.patch 8011
+DIST slviewer-artwork-FL-1.13.3.59558.zip 20005643 RMD160 bdc64269107054da2176d462f146140ea953e272 SHA1 da987b9201ce44ba72c530e50f0d270fda1c8921 SHA256 0bd2f8c2135184bcab756517c95bc5154e11666014439c56040332d4817b64a0
+DIST slviewer-src-FL-1.13.3.59558.tar.gz 9706079 RMD160 2ab28df4625813f629365c193c447915fb37dd1d SHA1 9ea1223291e304a36004ea3912b101228fd368ac SHA256 fc56a90120915d5b229458cf0d158e3cafac14338aa5e4f9f4c2a44c5b168f87
+EBUILD secondlife-1.13.3.59558.ebuild 3593 RMD160 21822f31a0137f1ee4b1c0eebbb338b53b2c7c4a SHA1 13d968252a0cc18448fb54811e5db6c498a5fd4d SHA256 6618a1691be9ca5e49f7b2c622f61871e9406a3840d54b884119e241a710ee10
+MD5 2513541c828dd4289f023c801a43156d secondlife-1.13.3.59558.ebuild 3593
+RMD160 21822f31a0137f1ee4b1c0eebbb338b53b2c7c4a secondlife-1.13.3.59558.ebuild 3593
+SHA256 6618a1691be9ca5e49f7b2c622f61871e9406a3840d54b884119e241a710ee10 secondlife-1.13.3.59558.ebuild 3593
+MD5 5c5223731df04a37b47f37a14572e7c1 files/digest-secondlife-1.13.3.59558 584
+RMD160 fa83237fb5a462f2ff8a49664b9a78371c322220 files/digest-secondlife-1.13.3.59558 584
+SHA256 2f7dffdd4cecc746870e0ac2a6905b555adc6914aa908f06dc66ba35f74e8878 files/digest-secondlife-1.13.3.59558 584
diff --git a/games-simulation/secondlife/files/digest-secondlife-1.13.3.59558 b/games-simulation/secondlife/files/digest-secondlife-1.13.3.59558
new file mode 100644
index 0000000..b537cb3
--- /dev/null
+++ b/games-simulation/secondlife/files/digest-secondlife-1.13.3.59558
@@ -0,0 +1,6 @@
+MD5 ed38c3e7e11467a3cd140e24453c3884 slviewer-artwork-FL-1.13.3.59558.zip 20005643
+RMD160 bdc64269107054da2176d462f146140ea953e272 slviewer-artwork-FL-1.13.3.59558.zip 20005643
+SHA256 0bd2f8c2135184bcab756517c95bc5154e11666014439c56040332d4817b64a0 slviewer-artwork-FL-1.13.3.59558.zip 20005643
+MD5 0b4ff4cf369f1414d257742ce2d7ab6b slviewer-src-FL-1.13.3.59558.tar.gz 9706079
+RMD160 2ab28df4625813f629365c193c447915fb37dd1d slviewer-src-FL-1.13.3.59558.tar.gz 9706079
+SHA256 fc56a90120915d5b229458cf0d158e3cafac14338aa5e4f9f4c2a44c5b168f87 slviewer-src-FL-1.13.3.59558.tar.gz 9706079
diff --git a/games-simulation/secondlife/files/opensecondlife-svn41.patch b/games-simulation/secondlife/files/opensecondlife-svn41.patch
new file mode 100644
index 0000000..f7f5606
--- /dev/null
+++ b/games-simulation/secondlife/files/opensecondlife-svn41.patch
@@ -0,0 +1,28 @@
+Index: linden/indra/llcommon/llfasttimer.cpp
+===================================================================
+--- linden/indra/llcommon/llfasttimer.cpp (revision 40)
++++ linden/indra/llcommon/llfasttimer.cpp (revision 41)
+@@ -90,21 +90,14 @@
+ #endif // LL_WINDOWS
+
+
+-#if LL_LINUX
++#if LL_LINUX && (defined(__i386__) || defined(__amd64__))
+ U64 get_cpu_clock_count()
+ {
+ U64 x;
+ __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
+ return x;
+ }
+-#endif
+-
+-#if LL_DARWIN
+-//
+-// Mac implementation of CPU clock
+-//
+-// Just use gettimeofday implementation for now
+-
++#else
+ U64 get_cpu_clock_count()
+ {
+ return get_clock_count();
diff --git a/games-simulation/secondlife/files/secondlife-1.13.3.2-llimagej2coj_debug.patch b/games-simulation/secondlife/files/secondlife-1.13.3.2-llimagej2coj_debug.patch
new file mode 100644
index 0000000..e66a198
--- /dev/null
+++ b/games-simulation/secondlife/files/secondlife-1.13.3.2-llimagej2coj_debug.patch
@@ -0,0 +1,121 @@
+--- linden/indra/llimagej2coj/llimagej2coj.cpp.orig 2007-02-04 09:52:40.000000000 +0100
++++ linden/indra/llimagej2coj/llimagej2coj.cpp 2007-02-05 21:09:53.000000000 +0100
+@@ -66,7 +66,8 @@
+ sample debug callback expecting no client object
+ */
+ void info_callback(const char *msg, void *client_data) {
+- fprintf(stdout, "[INFO] %s", msg);
++ FILE *stream = (FILE*)client_data;
++ fprintf(stream, "[INFO] %s", msg);
+ }
+
+
+@@ -86,21 +87,23 @@
+ // FIXME: Get the comment field out of the texture
+ //
+
+- LLTimer decode_timer;
+-
+ opj_dparameters_t parameters; /* decompression parameters */
++#ifdef _DEBUG
+ opj_event_mgr_t event_mgr; /* event manager */
++#endif
+ opj_image_t *image = NULL;
+
+ opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
+ opj_cio_t *cio = NULL;
+
+
++#ifdef _DEBUG
+ /* configure the event callbacks (not required) */
+ memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
+ event_mgr.error_handler = error_callback;
+ event_mgr.warning_handler = warning_callback;
+ event_mgr.info_handler = info_callback;
++#endif
+
+ /* set decoding parameters to default values */
+ opj_set_default_decoder_parameters(&parameters);
+@@ -116,7 +119,11 @@
+ dinfo = opj_create_decompress(CODEC_J2K);
+
+ /* catch events using our callbacks and give a local context */
+- opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
++#ifdef _DEBUG
++ opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
++#else
++ opj_set_event_mgr((opj_common_ptr)dinfo, NULL, stderr);
++#endif
+
+ /* setup the decoder decoding parameters using user parameters */
+ opj_setup_decoder(dinfo, &parameters);
+@@ -181,10 +188,10 @@
+ {
+ const S32 MAX_COMPS = 5;
+ opj_cparameters_t parameters; /* compression parameters */
++#ifdef _DEBUG
+ opj_event_mgr_t event_mgr; /* event manager */
+
+-
+- /*
++ /*
+ configure the event callbacks (not required)
+ setting of each callback is optional
+ */
+@@ -192,6 +199,7 @@
+ event_mgr.error_handler = error_callback;
+ event_mgr.warning_handler = warning_callback;
+ event_mgr.info_handler = info_callback;
++#endif
+
+ /* set encoding parameters to default values */
+ opj_set_default_encoder_parameters(&parameters);
+@@ -264,7 +272,11 @@
+ opj_cinfo_t* cinfo = opj_create_compress(CODEC_J2K);
+
+ /* catch events using our callbacks and give a local context */
+- opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
++#ifdef _DEBUG
++ opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
++#else
++ opj_set_event_mgr((opj_common_ptr)cinfo, NULL, stderr);
++#endif
+
+ /* setup the encoder parameters using the current image and using user parameters */
+ opj_setup_encoder(cinfo, &parameters, image);
+@@ -309,18 +321,22 @@
+ base.updateRawDiscardLevel();
+
+ opj_dparameters_t parameters; /* decompression parameters */
++#ifdef _DEBUG
+ opj_event_mgr_t event_mgr; /* event manager */
++#endif
+ opj_image_t *image = NULL;
+
+ opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
+ opj_cio_t *cio = NULL;
+
+
++#ifdef _DEBUG
+ /* configure the event callbacks (not required) */
+ memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
+ event_mgr.error_handler = error_callback;
+ event_mgr.warning_handler = warning_callback;
+ event_mgr.info_handler = info_callback;
++#endif
+
+ /* set decoding parameters to default values */
+ opj_set_default_decoder_parameters(&parameters);
+@@ -336,7 +352,11 @@
+ dinfo = opj_create_decompress(CODEC_J2K);
+
+ /* catch events using our callbacks and give a local context */
+- opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
++#ifdef _DEBUG
++ opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
++#else
++ opj_set_event_mgr((opj_common_ptr)dinfo, NULL, stderr);
++#endif
+
+ /* setup the decoder decoding parameters using user parameters */
+ opj_setup_decoder(dinfo, &parameters);
diff --git a/games-simulation/secondlife/files/secondlife-1.13.3.59315-no_fmod.patch b/games-simulation/secondlife/files/secondlife-1.13.3.59315-no_fmod.patch
new file mode 100644
index 0000000..fdcb331
--- /dev/null
+++ b/games-simulation/secondlife/files/secondlife-1.13.3.59315-no_fmod.patch
@@ -0,0 +1,21 @@
+diff -Naur linden.orig/indra/SConstruct linden/indra/SConstruct
+--- linden.orig/indra/SConstruct 2007-02-09 15:20:12.000000000 +0900
++++ linden/indra/SConstruct 2007-02-10 17:06:14.000000000 +0900
+@@ -180,7 +180,7 @@
+ # Linux-only flags
+ flags += '-DLL_LINUX=1 '
+ if build_target == 'client':
+- flags += '-DAPPID=secondlife -DLL_SDL=1 -DLL_X11=1 '
++ flags += '-DAPPID=secondlife -DLL_SDL=1 -DLL_FMOD=0 -DLL_X11=1 '
+ flags += '-DLL_GTK=1 '
+ client_external_libs += [ 'gtk-x11-2.0', 'elfio' ]
+ include_dirs += [ '../libraries/' + system_str + '/include/gtk-2.0' ]
+@@ -393,7 +393,7 @@
+ ##################
+ output_bin = 'newview/secondlife-' + arch + '-bin'
+
+- external_libs = client_external_libs + common_external_libs + [ 'freetype', 'jpeg', 'SDL', 'GL', 'GLU', 'ogg', 'vorbisenc', 'vorbisfile', 'vorbis', 'fmod-3.75', 'db-4.2', 'openjpeg' ]
++ external_libs = client_external_libs + common_external_libs + [ 'freetype', 'jpeg', 'SDL', 'GL', 'GLU', 'ogg', 'vorbisenc', 'vorbisfile', 'vorbis', 'db-4.2', 'openjpeg' ]
+ external_libs.remove('cares')
+
+ internal_libs = [ 'lscript', 'llwindow', 'llrender', 'llprimitive',
diff --git a/games-simulation/secondlife/files/secondlife-1.13.3.59558-gentoo.patch b/games-simulation/secondlife/files/secondlife-1.13.3.59558-gentoo.patch
new file mode 100644
index 0000000..352fe1e
--- /dev/null
+++ b/games-simulation/secondlife/files/secondlife-1.13.3.59558-gentoo.patch
@@ -0,0 +1,211 @@
+diff -Naur linden.orig/indra/SConstruct linden/indra/SConstruct
+--- linden.orig/indra/SConstruct 2007-03-22 15:34:54.000000000 +0900
++++ linden/indra/SConstruct 2007-03-22 20:46:41.000000000 +0900
+@@ -192,6 +192,12 @@
+ include_dirs += [ '../libraries/' + system_str + '/include/atk-1.0' ]
+ include_dirs += [ '../libraries/' + system_str + '/include/ELFIO' ]
+ include_dirs += [ '../libraries/' + system_str + '/include/llfreetype2' ]
++ pipe = os.popen('pkg-config gtk+-2.0 --cflags')
++ flags += pipe.read().rstrip('\n') + ' '
++ pipe.close()
++ pipe = os.popen('freetype-config --cflags')
++ flags += pipe.read().rstrip('\n') + ' '
++ pipe.close()
+
+ # llmozlib stuff
+ if enable_mozlib == 'yes':
+@@ -207,7 +213,7 @@
+ ### Build type-specific flags ###
+
+ debug_opts = flags + '-fno-inline -O0 -D_DEBUG -DLL_DEBUG=1 '
+- release_opts = flags + '-O2 -DNDEBUG -DLL_RELEASE=1 '
++ release_opts = flags + '-DNDEBUG -DLL_RELEASE=1 '
+ releasenoopt_opts = flags + '-O0 -DNDEBUG -DLL_RELEASE=1 '
+ releasefordownload_opts = flags + '-O2 -DNDEBUG -DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 '
+
+diff -Naur linden.orig/indra/llcommon/llsdserialize_xml.cpp linden/indra/llcommon/llsdserialize_xml.cpp
+--- linden.orig/indra/llcommon/llsdserialize_xml.cpp 2007-03-22 15:34:56.000000000 +0900
++++ linden/indra/llcommon/llsdserialize_xml.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -35,7 +35,7 @@
+
+ extern "C"
+ {
+-#include "expat/expat.h"
++#include "expat.h"
+ }
+
+ /**
+diff -Naur linden.orig/indra/llcommon/llsys.cpp linden/indra/llcommon/llsys.cpp
+--- linden.orig/indra/llcommon/llsys.cpp 2007-03-22 15:34:56.000000000 +0900
++++ linden/indra/llcommon/llsys.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -30,7 +30,7 @@
+ #include "llsys.h"
+
+ #include <iostream>
+-#include <zlib/zlib.h>
++#include <zlib.h>
+ #include "processor.h"
+
+ #if LL_WINDOWS
+diff -Naur linden.orig/indra/llimage/llimagejpeg.h linden/indra/llimage/llimagejpeg.h
+--- linden.orig/indra/llimage/llimagejpeg.h 2007-03-22 15:34:56.000000000 +0900
++++ linden/indra/llimage/llimagejpeg.h 2007-03-22 19:13:51.000000000 +0900
+@@ -33,9 +33,8 @@
+ #include "llimage.h"
+
+ extern "C" {
+-#include "jpeglib/jinclude.h"
+-#include "jpeglib/jpeglib.h"
+-#include "jpeglib/jerror.h"
++#include "jpeglib.h"
++#include "jerror.h"
+ }
+
+ class LLImageJPEG : public LLImageFormatted
+diff -Naur linden.orig/indra/llimagej2coj/llimagej2coj.cpp linden/indra/llimagej2coj/llimagej2coj.cpp
+--- linden.orig/indra/llimagej2coj/llimagej2coj.cpp 2007-03-22 15:34:56.000000000 +0900
++++ linden/indra/llimagej2coj/llimagej2coj.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -30,7 +30,7 @@
+
+ // this is defined so that we get static linking.
+ #define OPJ_STATIC
+-#include "openjpeg/openjpeg.h"
++#include "openjpeg.h"
+
+ #include "lltimer.h"
+ #include "llmemory.h"
+diff -Naur linden.orig/indra/llmessage/llfiltersd2xmlrpc.cpp linden/indra/llmessage/llfiltersd2xmlrpc.cpp
+--- linden.orig/indra/llmessage/llfiltersd2xmlrpc.cpp 2007-03-22 15:34:58.000000000 +0900
++++ linden/indra/llmessage/llfiltersd2xmlrpc.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -76,7 +76,7 @@
+
+ #include <sstream>
+ #include <iterator>
+-#include <xmlrpc-epi/xmlrpc.h>
++#include <xmlrpc.h>
+ #include "apr-1/apr_base64.h"
+
+ #include "llbuffer.h"
+diff -Naur linden.orig/indra/llmessage/llhttpassetstorage.cpp linden/indra/llmessage/llhttpassetstorage.cpp
+--- linden.orig/indra/llmessage/llhttpassetstorage.cpp 2007-03-22 15:34:58.000000000 +0900
++++ linden/indra/llmessage/llhttpassetstorage.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -36,7 +36,7 @@
+ #include "llvfile.h"
+ #include "llvfs.h"
+
+-#include "zlib/zlib.h"
++#include "zlib.h"
+
+ const U32 MAX_RUNNING_REQUESTS = 4;
+ const F32 MAX_PROCESSING_TIME = 0.005f;
+diff -Naur linden.orig/indra/llrender/llfont.cpp linden/indra/llrender/llfont.cpp
+--- linden.orig/indra/llrender/llfont.cpp 2007-03-22 15:34:58.000000000 +0900
++++ linden/indra/llrender/llfont.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -30,11 +30,11 @@
+ #include "llfont.h"
+
+ // Freetype stuff
+-#if LL_LINUX // I had to do some work to avoid the system-installed FreeType headers... --ryan.
+-#include "llfreetype2/freetype/ft2build.h"
+-#else
++// #if LL_LINUX // I had to do some work to avoid the system-installed FreeType headers... --ryan.
++// #include "llfreetype2/freetype/ft2build.h"
++// #else
+ #include <ft2build.h>
+-#endif
++// #endif
+
+ // For some reason, this won't work if it's not wrapped in the ifdef
+ #ifdef FT_FREETYPE_H
+diff -Naur linden.orig/indra/llxml/llxmlnode.h linden/indra/llxml/llxmlnode.h
+--- linden.orig/indra/llxml/llxmlnode.h 2007-03-22 15:35:00.000000000 +0900
++++ linden/indra/llxml/llxmlnode.h 2007-03-22 19:13:51.000000000 +0900
+@@ -29,7 +29,7 @@
+ #define LL_LLXMLNODE_H
+
+ #define XML_STATIC
+-#include "expat/expat.h"
++#include "expat.h"
+ #include <map>
+
+ #include "indra_constants.h"
+diff -Naur linden.orig/indra/llxml/llxmlparser.h linden/indra/llxml/llxmlparser.h
+--- linden.orig/indra/llxml/llxmlparser.h 2007-03-22 15:35:00.000000000 +0900
++++ linden/indra/llxml/llxmlparser.h 2007-03-22 19:13:51.000000000 +0900
+@@ -29,7 +29,7 @@
+ #define LL_LLXMLPARSER_H
+
+ #define XML_STATIC
+-#include "expat/expat.h"
++#include "expat.h"
+
+ class LLXmlParser
+ {
+diff -Naur linden.orig/indra/newview/llfloaterpostcard.cpp linden/indra/newview/llfloaterpostcard.cpp
+--- linden.orig/indra/newview/llfloaterpostcard.cpp 2007-03-22 15:35:12.000000000 +0900
++++ linden/indra/newview/llfloaterpostcard.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -237,7 +237,7 @@
+ {
+ }
+ // *TODO define custom uploadFailed here so it's not such a generic message
+- void LLSendPostcardResponder::uploadComplete(const LLSD& content)
++ void uploadComplete(const LLSD& content)
+ {
+ // we don't care about what the server returns from this post, just clean up the UI
+ LLUploadDialog::modalUploadFinished();
+diff -Naur linden.orig/indra/newview/lluserauth.cpp linden/indra/newview/lluserauth.cpp
+--- linden.orig/indra/newview/lluserauth.cpp 2007-03-22 15:35:09.000000000 +0900
++++ linden/indra/newview/lluserauth.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -40,7 +40,7 @@
+
+ // NOTE: MUST include these after otherincludes since queue gets redefined!?!!
+ #include <curl/curl.h>
+-#include <xmlrpc-epi/xmlrpc.h>
++#include <xmlrpc.h>
+
+
+
+diff -Naur linden.orig/indra/newview/llviewerobjectlist.cpp linden/indra/newview/llviewerobjectlist.cpp
+--- linden.orig/indra/newview/llviewerobjectlist.cpp 2007-03-22 15:35:11.000000000 +0900
++++ linden/indra/newview/llviewerobjectlist.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -60,7 +60,7 @@
+ #include "u64.h"
+ #include "llviewerimagelist.h"
+ #include "lldatapacker.h"
+-#include <zlib/zlib.h>
++#include <zlib.h>
+ #include "object_flags.h"
+
+ extern BOOL gVelocityInterpolate;
+diff -Naur linden.orig/indra/newview/llwebbrowserctrl.h linden/indra/newview/llwebbrowserctrl.h
+--- linden.orig/indra/newview/llwebbrowserctrl.h 2007-03-22 15:35:05.000000000 +0900
++++ linden/indra/newview/llwebbrowserctrl.h 2007-03-22 19:28:32.000000000 +0900
+@@ -91,6 +91,7 @@
+ #include "lldynamictexture.h"
+ #include "llmozlib.h"
+
++class LLUICtrlFactory;
+ class LLViewBorder;
+ class LLWebBrowserTexture;
+
+@@ -239,7 +240,7 @@
+ class LLWebBrowserTexture : public LLDynamicTexture
+ {
+ public:
+- LLWebBrowserTexture::LLWebBrowserTexture( S32 width, S32 height, LLWebBrowserCtrl* browserCtrl, int browserWindow );
++ LLWebBrowserTexture( S32 width, S32 height, LLWebBrowserCtrl* browserCtrl, int browserWindow );
+ virtual ~LLWebBrowserTexture();
+
+ virtual void preRender( BOOL clear_depth = TRUE ) {};
+diff -Naur linden.orig/indra/newview/llxmlrpctransaction.cpp linden/indra/newview/llxmlrpctransaction.cpp
+--- linden.orig/indra/newview/llxmlrpctransaction.cpp 2007-03-22 15:35:10.000000000 +0900
++++ linden/indra/newview/llxmlrpctransaction.cpp 2007-03-22 19:13:51.000000000 +0900
+@@ -33,7 +33,7 @@
+
+ // Have to include these last to avoid queue redefinition!
+ #include <curl/curl.h>
+-#include <xmlrpc-epi/xmlrpc.h>
++#include <xmlrpc.h>
+
+ #include "viewer.h"
+
diff --git a/games-simulation/secondlife/secondlife-1.13.3.59558.ebuild b/games-simulation/secondlife/secondlife-1.13.3.59558.ebuild
new file mode 100644
index 0000000..b04af45
--- /dev/null
+++ b/games-simulation/secondlife/secondlife-1.13.3.59558.ebuild
@@ -0,0 +1,131 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit games toolchain-funcs
+
+DESCRIPTION="A 3D MMORPG virtual world entirely built and owned by its residents"
+HOMEPAGE="http://secondlife.com/"
+#SRC_URI="http://secondlife.com/developers/opensource/downloads/2007/03/slviewer-src-${PV}.tar.gz
+# http://secondlife.com/developers/opensource/downloads/2007/03/slviewer-artwork-${PV}.zip"
+SRC_URI="http://secondlife.com/developers/opensource/downloads/2007/03/slviewer-src-FL-${PV}.tar.gz
+ http://secondlife.com/developers/opensource/downloads/2007/03/slviewer-artwork-FL-${PV}.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64 ~x86"
+#IUSE="fmod xulrunner"
+IUSE="fmod"
+RESTRICT="mirror"
+
+RDEPEND=">=x11-libs/gtk+-2
+ =dev-libs/apr-1*
+ =dev-libs/apr-util-1*
+ dev-libs/boost
+ >=net-misc/curl-7.15.4
+ dev-libs/openssl
+ media-libs/freetype
+ media-libs/jpeg
+ media-libs/libsdl
+ media-libs/mesa
+ media-libs/libogg
+ media-libs/libvorbis
+ fmod? ( x86? ( =media-libs/fmod-3.75* ) )
+ =sys-libs/db-4.2*
+ dev-libs/expat
+ sys-libs/zlib
+ >=dev-libs/xmlrpc-epi-0.51
+ dev-libs/ELFIO
+ >=media-libs/openjpeg-1.1.1
+ media-fonts/kochi-substitute"
+# xulrunner? ( net-libs/xulrunner )
+
+DEPEND="${RDEPEND}
+ dev-util/scons
+ dev-util/pkgconfig
+ sys-devel/flex
+ sys-devel/bison"
+
+S="${WORKDIR}/linden"
+
+dir="${GAMES_DATADIR}/${PN}"
+
+src_unpack() {
+ unpack ${A}
+
+ cd "${S}"/indra
+
+ if ! use fmod || [ "${ARCH}" != "x86" ] ; then
+ epatch "${FILESDIR}"/${PN}-1.13.3.59315-no_fmod.patch
+ fi
+
+ # VWR-100
+ epatch "${FILESDIR}"/${PN}-1.13.3.2-llimagej2coj_debug.patch
+
+ epatch "${FILESDIR}"/opensecondlife-svn41.patch
+ epatch "${FILESDIR}"/${P}-gentoo.patch
+
+ sed -i -e "s/gcc_bin = .*$/gcc_bin = '$(tc-getCXX)'/" SConstruct || die
+
+ # "${S}"/indra/newview/viewer_manifest.py
+ # touch newview/gridargs.dat
+ sed -i -e 's|\(http://secondlife\.com/app/login/\)|\1firstlook/|' \
+ newview/skins/xui/en-us/panel_login.xml || die
+ echo -n '-settings settings_firstlook.xml' > newview/gridargs.dat
+}
+
+src_compile() {
+ local mozlib
+
+ cd "${S}"/indra
+
+ # if use xulrunner; then
+ # mozlib="yes"
+ #else
+ mozlib="no"
+ #fi
+
+ CLIENT_CPPFLAGS="${CXXFLAGS}" TEMP_BUILD_DIR="/" \
+ scons BUILD=release BTARGET=client DISTCC=no GRID=firstlook MOZLIB=${mozlib} || die
+}
+
+src_install() {
+ cd "${S}"/indra/newview/
+
+ insinto "${dir}"
+ #doins featuretable.txt featuretable_mac.txt gpu_table.txt gridargs.dat || die
+ doins featuretable.txt gpu_table.txt .txt gridargs.dat || die
+ doins -r app_settings character fonts help skins res-sdl || die
+
+ doins lsl_guide.html releasenotes.txt || die
+ newins licenses-linux.txt licenses.txt || die
+ newins linux_tools/client-readme.txt README-linux.txt || die
+ newins res/ll_icon.ico secondlife.ico || die
+
+ insinto "${dir}"/app_settings/
+ doins "${S}"/scripts/messages/message_template.msg || die
+
+ exeinto "${dir}"
+ doexe linux_tools/launch_url.sh || die
+ newexe linux_tools/wrapper.sh secondlife || die
+ newexe ../linux_crash_logger/linux-crash-logger-*-bin* linux-crash-logger.bin || die
+
+ exeinto "${dir}"/bin/
+ newexe secondlife-*-bin do-not-directly-run-secondlife-bin || die
+
+ keepdir "${dir}"/lib
+
+ dosym /usr/share/fonts/kochi-substitute/kochi-mincho-subst.ttf /usr/share/games/secondlife/unicode.ttf
+
+ games_make_wrapper secondlife ./secondlife "${dir}"
+ newicon res/ll_icon.ico secondlife.ico || die
+ make_desktop_entry secondlife "Second Life" secondlife.ico
+
+ dodoc releasenotes.txt
+ newdoc licenses-linux.txt licenses.txt
+ newdoc linux_tools/client-readme.txt README-linux.txt
+
+ dohtml lsl_guide.html
+
+ prepgamesdirs
+}
diff --git a/media-libs/openjpeg/Manifest b/media-libs/openjpeg/Manifest
new file mode 100644
index 0000000..af58122
--- /dev/null
+++ b/media-libs/openjpeg/Manifest
@@ -0,0 +1,20 @@
+AUX OPJ_limit_tags_for_decode_UPDATED.patch 121951 RMD160 876e9c90ee0a18b3f4f9077e9b7f1b7b6491b3a1 SHA1 d3ad1f7da7e318b1575123e7e7032ef22ea8e362 SHA256 a661e2a121e627522736416844dcba854e532beb7d72015217d0ea6b187c6786
+MD5 8233f9be998cb6ca326ec1aa1a5cf136 files/OPJ_limit_tags_for_decode_UPDATED.patch 121951
+RMD160 876e9c90ee0a18b3f4f9077e9b7f1b7b6491b3a1 files/OPJ_limit_tags_for_decode_UPDATED.patch 121951
+SHA256 a661e2a121e627522736416844dcba854e532beb7d72015217d0ea6b187c6786 files/OPJ_limit_tags_for_decode_UPDATED.patch 121951
+AUX openjpeg-1.1.1-gentoo.patch 595 RMD160 eea4058aae591a8a50a78c06788412ddda978195 SHA1 1139bd57dcea2ecadac6597691ccffa835f5e8de SHA256 1e2677bb0635d06fe8f3a37167bf0bd339fa59e20ee7364793e103631c2e989b
+MD5 8248d3ca7ba44598b52dcfe9626554a0 files/openjpeg-1.1.1-gentoo.patch 595
+RMD160 eea4058aae591a8a50a78c06788412ddda978195 files/openjpeg-1.1.1-gentoo.patch 595
+SHA256 1e2677bb0635d06fe8f3a37167bf0bd339fa59e20ee7364793e103631c2e989b files/openjpeg-1.1.1-gentoo.patch 595
+DIST openjpeg_v1_1_1.tar.gz 1406460 RMD160 08b2318441075a8704d6b9b0ac3d9d277c44d85e SHA1 1de6f9ccebe8844c96416daca521a20a84df23f5 SHA256 6076db131bfaa966a691d718044e5b5cdbec028436be3b7a3f146d1a0e3a7ec6
+EBUILD openjpeg-1.1.1.ebuild 876 RMD160 0839119e8c5b1be4817b283a3bee5b37fb629e4f SHA1 a2459ccbac53254b97878051a5745b2fa10b5b34 SHA256 faabd254957b6a7903c566e85e34daa9de861cd6668a5d01b05bab28abf2da40
+MD5 233ec2c814bae7bc17d2c08cce133ac3 openjpeg-1.1.1.ebuild 876
+RMD160 0839119e8c5b1be4817b283a3bee5b37fb629e4f openjpeg-1.1.1.ebuild 876
+SHA256 faabd254957b6a7903c566e85e34daa9de861cd6668a5d01b05bab28abf2da40 openjpeg-1.1.1.ebuild 876
+MISC .swp 4096 RMD160 654e0e4af7c51347966f4e45088874477c3d8a12 SHA1 30c6d8301b2a1b5c9f568ad859bbde7487ffad46 SHA256 fe70d97bd7e13f5c121b33a9e6fd682dbfaec845b07edb261c661ef8de411206
+MD5 327b5dbac44adeca74794fcf547e3122 .swp 4096
+RMD160 654e0e4af7c51347966f4e45088874477c3d8a12 .swp 4096
+SHA256 fe70d97bd7e13f5c121b33a9e6fd682dbfaec845b07edb261c661ef8de411206 .swp 4096
+MD5 fcdc3157bb74483f5e444836db0580b6 files/digest-openjpeg-1.1.1 250
+RMD160 f90411a7b6c5b72cc42ab7e7c217f554dad5d4f6 files/digest-openjpeg-1.1.1 250
+SHA256 d1a1fb2cc3299dae27b36b9ef21418fa213b29ee2709dcd67a2dd597498e4155 files/digest-openjpeg-1.1.1 250
diff --git a/media-libs/openjpeg/files/OPJ_limit_tags_for_decode_UPDATED.patch b/media-libs/openjpeg/files/OPJ_limit_tags_for_decode_UPDATED.patch
new file mode 100644
index 0000000..be5cd8b
--- /dev/null
+++ b/media-libs/openjpeg/files/OPJ_limit_tags_for_decode_UPDATED.patch
@@ -0,0 +1,3765 @@
+diff -Naur OpenJPEG/libopenjpeg/j2k.c OpenJPEG-patched/libopenjpeg/j2k.c
+--- OpenJPEG/libopenjpeg/j2k.c 2007-02-19 10:59:29.000000000 +0100
++++ OpenJPEG-patched/libopenjpeg/j2k.c 2007-03-17 14:18:44.000000000 +0100
+@@ -1342,37 +1342,39 @@
+ int states;
+ /** action linked to the marker */
+ void (*handler) (opj_j2k_t *j2k);
++ /** The enum value used to limit decode to specific tags. */
++ OPJ_LIMIT_TAGS limit_tag;
+ } opj_dec_mstabent_t;
+
+ opj_dec_mstabent_t j2k_dec_mstab[] = {
+- {J2K_MS_SOC, J2K_STATE_MHSOC, j2k_read_soc},
+- {J2K_MS_SOT, J2K_STATE_MH | J2K_STATE_TPHSOT, j2k_read_sot},
+- {J2K_MS_SOD, J2K_STATE_TPH, j2k_read_sod},
+- {J2K_MS_EOC, J2K_STATE_TPHSOT, j2k_read_eoc},
+- {J2K_MS_SIZ, J2K_STATE_MHSIZ, j2k_read_siz},
+- {J2K_MS_COD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_cod},
+- {J2K_MS_COC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_coc},
+- {J2K_MS_RGN, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_rgn},
+- {J2K_MS_QCD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_qcd},
+- {J2K_MS_QCC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_qcc},
+- {J2K_MS_POC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_poc},
+- {J2K_MS_TLM, J2K_STATE_MH, j2k_read_tlm},
+- {J2K_MS_PLM, J2K_STATE_MH, j2k_read_plm},
+- {J2K_MS_PLT, J2K_STATE_TPH, j2k_read_plt},
+- {J2K_MS_PPM, J2K_STATE_MH, j2k_read_ppm},
+- {J2K_MS_PPT, J2K_STATE_TPH, j2k_read_ppt},
+- {J2K_MS_SOP, 0, 0},
+- {J2K_MS_CRG, J2K_STATE_MH, j2k_read_crg},
+- {J2K_MS_COM, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_com},
++ {J2K_MS_SOC, J2K_STATE_MHSOC, j2k_read_soc, OPJ_TAG_SOC},
++ {J2K_MS_SOT, J2K_STATE_MH | J2K_STATE_TPHSOT, j2k_read_sot, OPJ_TAG_SOT},
++ {J2K_MS_SOD, J2K_STATE_TPH, j2k_read_sod, OPJ_TAG_SOD},
++ {J2K_MS_EOC, J2K_STATE_TPHSOT, j2k_read_eoc, OPJ_TAG_EOC},
++ {J2K_MS_SIZ, J2K_STATE_MHSIZ, j2k_read_siz, OPJ_TAG_SIZ},
++ {J2K_MS_COD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_cod, OPJ_TAG_COD},
++ {J2K_MS_COC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_coc, OPJ_TAG_COC},
++ {J2K_MS_RGN, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_rgn, OPJ_TAG_RGN},
++ {J2K_MS_QCD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_qcd, OPJ_TAG_QCD},
++ {J2K_MS_QCC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_qcc, OPJ_TAG_QCC},
++ {J2K_MS_POC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_poc, OPJ_TAG_POC},
++ {J2K_MS_TLM, J2K_STATE_MH, j2k_read_tlm, OPJ_TAG_TLM},
++ {J2K_MS_PLM, J2K_STATE_MH, j2k_read_plm, OPJ_TAG_PLM},
++ {J2K_MS_PLT, J2K_STATE_TPH, j2k_read_plt, OPJ_TAG_PLT},
++ {J2K_MS_PPM, J2K_STATE_MH, j2k_read_ppm, OPJ_TAG_PPM},
++ {J2K_MS_PPT, J2K_STATE_TPH, j2k_read_ppt, OPJ_TAG_PPT},
++ {J2K_MS_SOP, 0, 0, OPJ_TAG_SOP},
++ {J2K_MS_CRG, J2K_STATE_MH, j2k_read_crg, OPJ_TAG_CRG},
++ {J2K_MS_COM, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_com, OPJ_TAG_COM},
+ /* UniPG>> */
+ #ifdef USE_JPWL
+- {J2K_MS_EPC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epc},
+- {J2K_MS_EPB, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epb},
+- {J2K_MS_ESD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_esd},
+- {J2K_MS_RED, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_red},
++ {J2K_MS_EPC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epc, OPJ_TAG_EPC},
++ {J2K_MS_EPB, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epb, OPJ_TAG_EPB},
++ {J2K_MS_ESD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_esd, OPJ_TAG_ESD},
++ {J2K_MS_RED, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_red, OPJ_TAG_RED},
+ #endif /* USE_JPWL */
+ /* <<UniPG */
+- {0, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_unk}
++ {0, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_unk, -1}
+ };
+
+ static void j2k_read_unk(opj_j2k_t *j2k) {
+@@ -1689,6 +1691,12 @@
+ opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
+ return 0;
+ }
++ /* If a partial decode is requested, stop if the current tag
++ * isn't in the list.
++ */
++ if (j2k->cp->limit_tags && !(j2k->cp->limit_tags & e->limit_tag)) {
++ return image;
++ }
+ if (e->handler) {
+ (*e->handler)(j2k);
+ }
+diff -Naur OpenJPEG/libopenjpeg/j2k.c.orig OpenJPEG-patched/libopenjpeg/j2k.c.orig
+--- OpenJPEG/libopenjpeg/j2k.c.orig 1970-01-01 01:00:00.000000000 +0100
++++ OpenJPEG-patched/libopenjpeg/j2k.c.orig 2007-02-19 10:59:29.000000000 +0100
+@@ -0,0 +1,2392 @@
++/*
++ * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
++ * Copyright (c) 2002-2007, Professor Benoit Macq
++ * Copyright (c) 2001-2003, David Janssens
++ * Copyright (c) 2002-2003, Yannick Verschueren
++ * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
++ * Copyright (c) 2005, Herve Drolon, FreeImage Team
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#include "opj_includes.h"
++
++/** @defgroup J2K J2K - JPEG-2000 codestream reader/writer */
++/*@{*/
++
++/** @name Local static functions */
++/*@{*/
++
++/**
++Write the SOC marker (Start Of Codestream)
++@param j2k J2K handle
++*/
++static void j2k_write_soc(opj_j2k_t *j2k);
++/**
++Read the SOC marker (Start of Codestream)
++@param j2k J2K handle
++*/
++static void j2k_read_soc(opj_j2k_t *j2k);
++/**
++Write the SIZ marker (image and tile size)
++@param j2k J2K handle
++*/
++static void j2k_write_siz(opj_j2k_t *j2k);
++/**
++Read the SIZ marker (image and tile size)
++@param j2k J2K handle
++*/
++static void j2k_read_siz(opj_j2k_t *j2k);
++/**
++Write the COM marker (comment)
++@param j2k J2K handle
++*/
++static void j2k_write_com(opj_j2k_t *j2k);
++/**
++Read the COM marker (comment)
++@param j2k J2K handle
++*/
++static void j2k_read_com(opj_j2k_t *j2k);
++/**
++Write the value concerning the specified component in the marker COD and COC
++@param j2k J2K handle
++@param compno Number of the component concerned by the information written
++*/
++static void j2k_write_cox(opj_j2k_t *j2k, int compno);
++/**
++Read the value concerning the specified component in the marker COD and COC
++@param j2k J2K handle
++@param compno Number of the component concerned by the information read
++*/
++static void j2k_read_cox(opj_j2k_t *j2k, int compno);
++/**
++Write the COD marker (coding style default)
++@param j2k J2K handle
++*/
++static void j2k_write_cod(opj_j2k_t *j2k);
++/**
++Read the COD marker (coding style default)
++@param j2k J2K handle
++*/
++static void j2k_read_cod(opj_j2k_t *j2k);
++/**
++Write the COC marker (coding style component)
++@param j2k J2K handle
++@param compno Number of the component concerned by the information written
++*/
++static void j2k_write_coc(opj_j2k_t *j2k, int compno);
++/**
++Read the COC marker (coding style component)
++@param j2k J2K handle
++*/
++static void j2k_read_coc(opj_j2k_t *j2k);
++/**
++Write the value concerning the specified component in the marker QCD and QCC
++@param j2k J2K handle
++@param compno Number of the component concerned by the information written
++*/
++static void j2k_write_qcx(opj_j2k_t *j2k, int compno);
++/**
++Read the value concerning the specified component in the marker QCD and QCC
++@param j2k J2K handle
++@param compno Number of the component concern by the information read
++@param len Length of the information in the QCX part of the marker QCD/QCC
++*/
++static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len);
++/**
++Write the QCD marker (quantization default)
++@param j2k J2K handle
++*/
++static void j2k_write_qcd(opj_j2k_t *j2k);
++/**
++Read the QCD marker (quantization default)
++@param j2k J2K handle
++*/
++static void j2k_read_qcd(opj_j2k_t *j2k);
++/**
++Write the QCC marker (quantization component)
++@param j2k J2K handle
++@param compno Number of the component concerned by the information written
++*/
++static void j2k_write_qcc(opj_j2k_t *j2k, int compno);
++/**
++Read the QCC marker (quantization component)
++@param j2k J2K handle
++*/
++static void j2k_read_qcc(opj_j2k_t *j2k);
++/**
++Write the POC marker (progression order change)
++@param j2k J2K handle
++*/
++static void j2k_write_poc(opj_j2k_t *j2k);
++/**
++Read the POC marker (progression order change)
++@param j2k J2K handle
++*/
++static void j2k_read_poc(opj_j2k_t *j2k);
++/**
++Read the CRG marker (component registration)
++@param j2k J2K handle
++*/
++static void j2k_read_crg(opj_j2k_t *j2k);
++/**
++Read the TLM marker (tile-part lengths)
++@param j2k J2K handle
++*/
++static void j2k_read_tlm(opj_j2k_t *j2k);
++/**
++Read the PLM marker (packet length, main header)
++@param j2k J2K handle
++*/
++static void j2k_read_plm(opj_j2k_t *j2k);
++/**
++Read the PLT marker (packet length, tile-part header)
++@param j2k J2K handle
++*/
++static void j2k_read_plt(opj_j2k_t *j2k);
++/**
++Read the PPM marker (packet packet headers, main header)
++@param j2k J2K handle
++*/
++static void j2k_read_ppm(opj_j2k_t *j2k);
++/**
++Read the PPT marker (packet packet headers, tile-part header)
++@param j2k J2K handle
++*/
++static void j2k_read_ppt(opj_j2k_t *j2k);
++/**
++Write the SOT marker (start of tile-part)
++@param j2k J2K handle
++*/
++static void j2k_write_sot(opj_j2k_t *j2k);
++/**
++Read the SOT marker (start of tile-part)
++@param j2k J2K handle
++*/
++static void j2k_read_sot(opj_j2k_t *j2k);
++/**
++Write the SOD marker (start of data)
++@param j2k J2K handle
++@param tile_coder Pointer to a TCD handle
++*/
++static void j2k_write_sod(opj_j2k_t *j2k, void *tile_coder);
++/**
++Read the SOD marker (start of data)
++@param j2k J2K handle
++*/
++static void j2k_read_sod(opj_j2k_t *j2k);
++/**
++Write the RGN marker (region-of-interest)
++@param j2k J2K handle
++@param compno Number of the component concerned by the information written
++@param tileno Number of the tile concerned by the information written
++*/
++static void j2k_write_rgn(opj_j2k_t *j2k, int compno, int tileno);
++/**
++Read the RGN marker (region-of-interest)
++@param j2k J2K handle
++*/
++static void j2k_read_rgn(opj_j2k_t *j2k);
++/**
++Write the EOC marker (end of codestream)
++@param j2k J2K handle
++*/
++static void j2k_write_eoc(opj_j2k_t *j2k);
++/**
++Read the EOC marker (end of codestream)
++@param j2k J2K handle
++*/
++static void j2k_read_eoc(opj_j2k_t *j2k);
++/**
++Read an unknown marker
++@param j2k J2K handle
++*/
++static void j2k_read_unk(opj_j2k_t *j2k);
++
++/*@}*/
++
++/*@}*/
++
++/* ----------------------------------------------------------------------- */
++
++void j2k_dump_image(FILE *fd, opj_image_t * img) {
++ int compno;
++ fprintf(fd, "image {\n");
++ fprintf(fd, " x0=%d, y0=%d, x1=%d, y1=%d\n", img->x0, img->y0, img->x1, img->y1);
++ fprintf(fd, " numcomps=%d\n", img->numcomps);
++ for (compno = 0; compno < img->numcomps; compno++) {
++ opj_image_comp_t *comp = &img->comps[compno];
++ fprintf(fd, " comp %d {\n", compno);
++ fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
++ fprintf(fd, " prec=%d\n", comp->prec);
++ fprintf(fd, " sgnd=%d\n", comp->sgnd);
++ fprintf(fd, " }\n");
++ }
++ fprintf(fd, "}\n");
++}
++
++void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) {
++ int tileno, compno, layno, bandno, resno, numbands;
++ fprintf(fd, "coding parameters {\n");
++ fprintf(fd, " tx0=%d, ty0=%d\n", cp->tx0, cp->ty0);
++ fprintf(fd, " tdx=%d, tdy=%d\n", cp->tdx, cp->tdy);
++ fprintf(fd, " tw=%d, th=%d\n", cp->tw, cp->th);
++ for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
++ opj_tcp_t *tcp = &cp->tcps[tileno];
++ fprintf(fd, " tile %d {\n", tileno);
++ fprintf(fd, " csty=%x\n", tcp->csty);
++ fprintf(fd, " prg=%d\n", tcp->prg);
++ fprintf(fd, " numlayers=%d\n", tcp->numlayers);
++ fprintf(fd, " mct=%d\n", tcp->mct);
++ fprintf(fd, " rates=");
++ for (layno = 0; layno < tcp->numlayers; layno++) {
++ fprintf(fd, "%.1f ", tcp->rates[layno]);
++ }
++ fprintf(fd, "\n");
++ for (compno = 0; compno < img->numcomps; compno++) {
++ opj_tccp_t *tccp = &tcp->tccps[compno];
++ fprintf(fd, " comp %d {\n", compno);
++ fprintf(fd, " csty=%x\n", tccp->csty);
++ fprintf(fd, " numresolutions=%d\n", tccp->numresolutions);
++ fprintf(fd, " cblkw=%d\n", tccp->cblkw);
++ fprintf(fd, " cblkh=%d\n", tccp->cblkh);
++ fprintf(fd, " cblksty=%x\n", tccp->cblksty);
++ fprintf(fd, " qmfbid=%d\n", tccp->qmfbid);
++ fprintf(fd, " qntsty=%d\n", tccp->qntsty);
++ fprintf(fd, " numgbits=%d\n", tccp->numgbits);
++ fprintf(fd, " roishift=%d\n", tccp->roishift);
++ fprintf(fd, " stepsizes=");
++ numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2;
++ for (bandno = 0; bandno < numbands; bandno++) {
++ fprintf(fd, "(%d,%d) ", tccp->stepsizes[bandno].mant,
++ tccp->stepsizes[bandno].expn);
++ }
++ fprintf(fd, "\n");
++
++ if (tccp->csty & J2K_CCP_CSTY_PRT) {
++ fprintf(fd, " prcw=");
++ for (resno = 0; resno < tccp->numresolutions; resno++) {
++ fprintf(fd, "%d ", tccp->prcw[resno]);
++ }
++ fprintf(fd, "\n");
++ fprintf(fd, " prch=");
++ for (resno = 0; resno < tccp->numresolutions; resno++) {
++ fprintf(fd, "%d ", tccp->prch[resno]);
++ }
++ fprintf(fd, "\n");
++ }
++ fprintf(fd, " }\n");
++ }
++ fprintf(fd, " }\n");
++ }
++ fprintf(fd, "}\n");
++}
++
++/* ----------------------------------------------------------------------- */
++
++static void j2k_write_soc(opj_j2k_t *j2k) {
++ opj_cio_t *cio = j2k->cio;
++ cio_write(cio, J2K_MS_SOC, 2);
++}
++
++static void j2k_read_soc(opj_j2k_t *j2k) {
++ j2k->state = J2K_STATE_MHSIZ;
++}
++
++static void j2k_write_siz(opj_j2k_t *j2k) {
++ int i;
++ int lenp, len;
++
++ opj_cio_t *cio = j2k->cio;
++ opj_image_t *image = j2k->image;
++ opj_cp_t *cp = j2k->cp;
++
++ cio_write(cio, J2K_MS_SIZ, 2); /* SIZ */
++ lenp = cio_tell(cio);
++ cio_skip(cio, 2);
++ cio_write(cio, 0, 2); /* Rsiz (capabilities) */
++ cio_write(cio, image->x1, 4); /* Xsiz */
++ cio_write(cio, image->y1, 4); /* Ysiz */
++ cio_write(cio, image->x0, 4); /* X0siz */
++ cio_write(cio, image->y0, 4); /* Y0siz */
++ cio_write(cio, cp->tdx, 4); /* XTsiz */
++ cio_write(cio, cp->tdy, 4); /* YTsiz */
++ cio_write(cio, cp->tx0, 4); /* XT0siz */
++ cio_write(cio, cp->ty0, 4); /* YT0siz */
++ cio_write(cio, image->numcomps, 2); /* Csiz */
++ for (i = 0; i < image->numcomps; i++) {
++ cio_write(cio, image->comps[i].prec - 1 + (image->comps[i].sgnd << 7), 1); /* Ssiz_i */
++ cio_write(cio, image->comps[i].dx, 1); /* XRsiz_i */
++ cio_write(cio, image->comps[i].dy, 1); /* YRsiz_i */
++ }
++ len = cio_tell(cio) - lenp;
++ cio_seek(cio, lenp);
++ cio_write(cio, len, 2); /* Lsiz */
++ cio_seek(cio, lenp + len);
++}
++
++static void j2k_read_siz(opj_j2k_t *j2k) {
++ int len, i;
++
++ opj_cio_t *cio = j2k->cio;
++ opj_image_t *image = j2k->image;
++ opj_cp_t *cp = j2k->cp;
++
++ len = cio_read(cio, 2); /* Lsiz */
++ cio_read(cio, 2); /* Rsiz (capabilities) */
++ image->x1 = cio_read(cio, 4); /* Xsiz */
++ image->y1 = cio_read(cio, 4); /* Ysiz */
++ image->x0 = cio_read(cio, 4); /* X0siz */
++ image->y0 = cio_read(cio, 4); /* Y0siz */
++ cp->tdx = cio_read(cio, 4); /* XTsiz */
++ cp->tdy = cio_read(cio, 4); /* YTsiz */
++ cp->tx0 = cio_read(cio, 4); /* XT0siz */
++ cp->ty0 = cio_read(cio, 4); /* YT0siz */
++
++ image->numcomps = cio_read(cio, 2); /* Csiz */
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++ /* if JPWL is on, we check whether TX errors have damaged
++ too much the SIZ parameters */
++ if (!(image->x1 * image->y1)) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: bad image size (%d x %d)\n",
++ image->x1, image->y1);
++ if (!JPWL_ASSUME || JPWL_ASSUME)
++ exit(1);
++ }
++ if (image->numcomps != ((len - 38) / 3)) {
++ opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
++ "JPWL: Csiz is %d => space in SIZ only for %d comps.!!!\n",
++ image->numcomps, ((len - 38) / 3));
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust this\n");
++ if (image->numcomps < ((len - 38) / 3)) {
++ len = 38 + 3 * image->numcomps;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting Lsiz to %d => HYPOTHESIS!!!\n",
++ len);
++ } else {
++ image->numcomps = ((len - 38) / 3);
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting Csiz to %d => HYPOTHESIS!!!\n",
++ image->numcomps);
++ }
++ }
++
++ /* update components number in the jpwl_exp_comps filed */
++ cp->exp_comps = image->numcomps;
++ }
++#endif /* USE_JPWL */
++/* <<UniPG */
++ image->comps = (opj_image_comp_t *) opj_malloc(image->numcomps * sizeof(opj_image_comp_t));
++ for (i = 0; i < image->numcomps; i++) {
++ int tmp, w, h;
++ tmp = cio_read(cio, 1); /* Ssiz_i */
++ image->comps[i].prec = (tmp & 0x7f) + 1;
++ image->comps[i].sgnd = tmp >> 7;
++ image->comps[i].dx = cio_read(cio, 1); /* XRsiz_i */
++ image->comps[i].dy = cio_read(cio, 1); /* YRsiz_i */
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++ /* if JPWL is on, we check whether TX errors have damaged
++ too much the SIZ parameters, again */
++ if (!(image->comps[i].dx * image->comps[i].dy)) {
++ opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
++ "JPWL: bad XRsiz_%d/YRsiz_%d (%d x %d)\n",
++ i, i, image->comps[i].dx, image->comps[i].dy);
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust them\n");
++ if (!image->comps[i].dx) {
++ image->comps[i].dx = 1;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting XRsiz_%d to %d => HYPOTHESIS!!!\n",
++ i, image->comps[i].dx);
++ }
++ if (!image->comps[i].dy) {
++ image->comps[i].dy = 1;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting YRsiz_%d to %d => HYPOTHESIS!!!\n",
++ i, image->comps[i].dy);
++ }
++ }
++
++ }
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++
++ /* TODO: unused ? */
++ w = int_ceildiv(image->x1 - image->x0, image->comps[i].dx);
++ h = int_ceildiv(image->y1 - image->y0, image->comps[i].dy);
++
++ image->comps[i].resno_decoded = 0; /* number of resolution decoded */
++ image->comps[i].factor = 0; /* reducing factor per component */
++ }
++
++ cp->tw = int_ceildiv(image->x1 - cp->tx0, cp->tdx);
++ cp->th = int_ceildiv(image->y1 - cp->ty0, cp->tdy);
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++ /* if JPWL is on, we check whether TX errors have damaged
++ too much the SIZ parameters */
++ if ((cp->tw < 1) || (cp->th < 1) || (cp->tw > cp->max_tiles) || (cp->th > cp->max_tiles)) {
++ opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
++ "JPWL: bad number of tiles (%d x %d)\n",
++ cp->tw, cp->th);
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust them\n");
++ if (cp->tw < 1) {
++ cp->tw= 1;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting %d tiles in x => HYPOTHESIS!!!\n",
++ cp->tw);
++ }
++ if (cp->tw > cp->max_tiles) {
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- too large x, increase expectance of %d\n",
++ cp->max_tiles);
++ cp->tw= 1;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting %d tiles in x => HYPOTHESIS!!!\n",
++ cp->tw);
++ }
++ if (cp->th < 1) {
++ cp->th= 1;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting %d tiles in y => HYPOTHESIS!!!\n",
++ cp->th);
++ }
++ if (cp->th > cp->max_tiles) {
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- too large y, increase expectance of %d to continue\n",
++ cp->max_tiles);
++ cp->th= 1;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting %d tiles in y => HYPOTHESIS!!!\n",
++ cp->th);
++ }
++ }
++ }
++#endif /* USE_JPWL */
++/* <<UniPG */
++ cp->tcps = (opj_tcp_t *) opj_malloc(cp->tw * cp->th * sizeof(opj_tcp_t));
++ cp->tileno = (int *) opj_malloc(cp->tw * cp->th * sizeof(int));
++ cp->tileno_size = 0;
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++ if (!cp->tcps) {
++ opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
++ "JPWL: could not alloc tcps field of cp\n");
++ if (!JPWL_ASSUME || JPWL_ASSUME)
++ exit(1);
++ }
++ }
++#endif /* USE_JPWL */
++/* <<UniPG */
++ for (i = 0; i < cp->tw * cp->th; i++) {
++ cp->tcps[i].POC = 0;
++ cp->tcps[i].numpocs = 0;
++ cp->tcps[i].first = 1;
++ }
++
++ /* Initialization for PPM marker */
++ cp->ppm = 0;
++ cp->ppm_data = NULL;
++ cp->ppm_data_first = NULL;
++ cp->ppm_previous = 0;
++ cp->ppm_store = 0;
++
++ j2k->default_tcp->tccps = (opj_tccp_t *) opj_malloc(sizeof(opj_tccp_t) * image->numcomps);
++ for (i = 0; i < cp->tw * cp->th; i++) {
++ cp->tcps[i].tccps = (opj_tccp_t *) opj_malloc(sizeof(opj_tccp_t) * image->numcomps);
++ }
++ j2k->tile_data = (unsigned char **) opj_malloc(cp->tw * cp->th * sizeof(unsigned char *));
++ j2k->tile_len = (int *) opj_malloc(cp->tw * cp->th * sizeof(int));
++ j2k->state = J2K_STATE_MH;
++}
++
++static void j2k_write_com(opj_j2k_t *j2k) {
++ unsigned int i;
++ int lenp, len;
++
++ if(j2k->cp->comment) {
++ opj_cio_t *cio = j2k->cio;
++ char *comment = j2k->cp->comment;
++
++ cio_write(cio, J2K_MS_COM, 2);
++ lenp = cio_tell(cio);
++ cio_skip(cio, 2);
++ cio_write(cio, 0, 2);
++ for (i = 0; i < strlen(comment); i++) {
++ cio_write(cio, comment[i], 1);
++ }
++ len = cio_tell(cio) - lenp;
++ cio_seek(cio, lenp);
++ cio_write(cio, len, 2);
++ cio_seek(cio, lenp + len);
++ }
++}
++
++static void j2k_read_com(opj_j2k_t *j2k) {
++ int len;
++
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2);
++ cio_skip(cio, len - 2);
++}
++
++static void j2k_write_cox(opj_j2k_t *j2k, int compno) {
++ int i;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = &cp->tcps[j2k->curtileno];
++ opj_tccp_t *tccp = &tcp->tccps[compno];
++ opj_cio_t *cio = j2k->cio;
++
++ cio_write(cio, tccp->numresolutions - 1, 1); /* SPcox (D) */
++ cio_write(cio, tccp->cblkw - 2, 1); /* SPcox (E) */
++ cio_write(cio, tccp->cblkh - 2, 1); /* SPcox (F) */
++ cio_write(cio, tccp->cblksty, 1); /* SPcox (G) */
++ cio_write(cio, tccp->qmfbid, 1); /* SPcox (H) */
++
++ if (tccp->csty & J2K_CCP_CSTY_PRT) {
++ for (i = 0; i < tccp->numresolutions; i++) {
++ cio_write(cio, tccp->prcw[i] + (tccp->prch[i] << 4), 1); /* SPcox (I_i) */
++ }
++ }
++}
++
++static void j2k_read_cox(opj_j2k_t *j2k, int compno) {
++ int i;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = j2k->state == J2K_STATE_TPH ? &cp->tcps[j2k->curtileno] : j2k->default_tcp;
++ opj_tccp_t *tccp = &tcp->tccps[compno];
++ opj_cio_t *cio = j2k->cio;
++
++ tccp->numresolutions = cio_read(cio, 1) + 1; /* SPcox (D) */
++
++ /* check the reduce value */
++ cp->reduce = int_min((tccp->numresolutions)-1, cp->reduce);
++ tccp->cblkw = cio_read(cio, 1) + 2; /* SPcox (E) */
++ tccp->cblkh = cio_read(cio, 1) + 2; /* SPcox (F) */
++ tccp->cblksty = cio_read(cio, 1); /* SPcox (G) */
++ tccp->qmfbid = cio_read(cio, 1); /* SPcox (H) */
++ if (tccp->csty & J2K_CP_CSTY_PRT) {
++ for (i = 0; i < tccp->numresolutions; i++) {
++ int tmp = cio_read(cio, 1); /* SPcox (I_i) */
++ tccp->prcw[i] = tmp & 0xf;
++ tccp->prch[i] = tmp >> 4;
++ }
++ }
++}
++
++static void j2k_write_cod(opj_j2k_t *j2k) {
++ opj_cp_t *cp = NULL;
++ opj_tcp_t *tcp = NULL;
++ int lenp, len;
++
++ opj_cio_t *cio = j2k->cio;
++
++ cio_write(cio, J2K_MS_COD, 2); /* COD */
++
++ lenp = cio_tell(cio);
++ cio_skip(cio, 2);
++
++ cp = j2k->cp;
++ tcp = &cp->tcps[j2k->curtileno];
++
++ cio_write(cio, tcp->csty, 1); /* Scod */
++ cio_write(cio, tcp->prg, 1); /* SGcod (A) */
++ cio_write(cio, tcp->numlayers, 2); /* SGcod (B) */
++ cio_write(cio, tcp->mct, 1); /* SGcod (C) */
++
++ j2k_write_cox(j2k, 0);
++ len = cio_tell(cio) - lenp;
++ cio_seek(cio, lenp);
++ cio_write(cio, len, 2); /* Lcod */
++ cio_seek(cio, lenp + len);
++}
++
++static void j2k_read_cod(opj_j2k_t *j2k) {
++ int len, i, pos;
++
++ opj_cio_t *cio = j2k->cio;
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = j2k->state == J2K_STATE_TPH ? &cp->tcps[j2k->curtileno] : j2k->default_tcp;
++ opj_image_t *image = j2k->image;
++
++ len = cio_read(cio, 2); /* Lcod */
++ tcp->csty = cio_read(cio, 1); /* Scod */
++ tcp->prg = (OPJ_PROG_ORDER)cio_read(cio, 1); /* SGcod (A) */
++ tcp->numlayers = cio_read(cio, 2); /* SGcod (B) */
++ tcp->mct = cio_read(cio, 1); /* SGcod (C) */
++
++ pos = cio_tell(cio);
++ for (i = 0; i < image->numcomps; i++) {
++ tcp->tccps[i].csty = tcp->csty & J2K_CP_CSTY_PRT;
++ cio_seek(cio, pos);
++ j2k_read_cox(j2k, i);
++ }
++}
++
++static void j2k_write_coc(opj_j2k_t *j2k, int compno) {
++ int lenp, len;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = &cp->tcps[j2k->curtileno];
++ opj_image_t *image = j2k->image;
++ opj_cio_t *cio = j2k->cio;
++
++ cio_write(cio, J2K_MS_COC, 2); /* COC */
++ lenp = cio_tell(cio);
++ cio_skip(cio, 2);
++ cio_write(cio, compno, image->numcomps <= 256 ? 1 : 2); /* Ccoc */
++ cio_write(cio, tcp->tccps[compno].csty, 1); /* Scoc */
++ j2k_write_cox(j2k, compno);
++ len = cio_tell(cio) - lenp;
++ cio_seek(cio, lenp);
++ cio_write(cio, len, 2); /* Lcoc */
++ cio_seek(cio, lenp + len);
++}
++
++static void j2k_read_coc(opj_j2k_t *j2k) {
++ int len, compno;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = j2k->state == J2K_STATE_TPH ? &cp->tcps[j2k->curtileno] : j2k->default_tcp;
++ opj_image_t *image = j2k->image;
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2); /* Lcoc */
++ compno = cio_read(cio, image->numcomps <= 256 ? 1 : 2); /* Ccoc */
++ tcp->tccps[compno].csty = cio_read(cio, 1); /* Scoc */
++ j2k_read_cox(j2k, compno);
++}
++
++static void j2k_write_qcx(opj_j2k_t *j2k, int compno) {
++ int bandno, numbands;
++ int expn, mant;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = &cp->tcps[j2k->curtileno];
++ opj_tccp_t *tccp = &tcp->tccps[compno];
++ opj_cio_t *cio = j2k->cio;
++
++ cio_write(cio, tccp->qntsty + (tccp->numgbits << 5), 1); /* Sqcx */
++ numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2;
++
++ for (bandno = 0; bandno < numbands; bandno++) {
++ expn = tccp->stepsizes[bandno].expn;
++ mant = tccp->stepsizes[bandno].mant;
++
++ if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
++ cio_write(cio, expn << 3, 1); /* SPqcx_i */
++ } else {
++ cio_write(cio, (expn << 11) + mant, 2); /* SPqcx_i */
++ }
++ }
++}
++
++static void j2k_read_qcx(opj_j2k_t *j2k, int compno, int len) {
++ int tmp;
++ int bandno, numbands;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = j2k->state == J2K_STATE_TPH ? &cp->tcps[j2k->curtileno] : j2k->default_tcp;
++ opj_tccp_t *tccp = &tcp->tccps[compno];
++ opj_cio_t *cio = j2k->cio;
++
++ tmp = cio_read(cio, 1); /* Sqcx */
++ tccp->qntsty = tmp & 0x1f;
++ tccp->numgbits = tmp >> 5;
++ numbands = (tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) ?
++ 1 : ((tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) ? len - 1 : (len - 1) / 2);
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++
++ /* if JPWL is on, we check whether there are too many subbands */
++ if ((numbands < 0) || (numbands >= J2K_MAXBANDS)) {
++ opj_event_msg(j2k->cinfo, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
++ "JPWL: bad number of subbands in Sqcx (%d)\n",
++ numbands);
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust them\n");
++ numbands = 1;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting number of bands to %d => HYPOTHESIS!!!\n",
++ numbands);
++ };
++
++ };
++#endif /* USE_JPWL */
++/* <<UniPG */
++ for (bandno = 0; bandno < numbands; bandno++) {
++ int expn, mant;
++ if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
++ expn = cio_read(cio, 1) >> 3; /* SPqcx_i */
++ mant = 0;
++ } else {
++ tmp = cio_read(cio, 2); /* SPqcx_i */
++ expn = tmp >> 11;
++ mant = tmp & 0x7ff;
++ }
++ tccp->stepsizes[bandno].expn = expn;
++ tccp->stepsizes[bandno].mant = mant;
++ }
++
++ /* Add Antonin : if scalar_derived -> compute other stepsizes */
++ if (tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
++ for (bandno = 1; bandno < J2K_MAXBANDS; bandno++) {
++ tccp->stepsizes[bandno].expn =
++ ((tccp->stepsizes[0].expn) - ((bandno - 1) / 3) > 0) ?
++ (tccp->stepsizes[0].expn) - ((bandno - 1) / 3) : 0;
++ tccp->stepsizes[bandno].mant = tccp->stepsizes[0].mant;
++ }
++ }
++ /* ddA */
++}
++
++static void j2k_write_qcd(opj_j2k_t *j2k) {
++ int lenp, len;
++
++ opj_cio_t *cio = j2k->cio;
++
++ cio_write(cio, J2K_MS_QCD, 2); /* QCD */
++ lenp = cio_tell(cio);
++ cio_skip(cio, 2);
++ j2k_write_qcx(j2k, 0);
++ len = cio_tell(cio) - lenp;
++ cio_seek(cio, lenp);
++ cio_write(cio, len, 2); /* Lqcd */
++ cio_seek(cio, lenp + len);
++}
++
++static void j2k_read_qcd(opj_j2k_t *j2k) {
++ int len, i, pos;
++
++ opj_cio_t *cio = j2k->cio;
++ opj_image_t *image = j2k->image;
++
++ len = cio_read(cio, 2); /* Lqcd */
++ pos = cio_tell(cio);
++ for (i = 0; i < image->numcomps; i++) {
++ cio_seek(cio, pos);
++ j2k_read_qcx(j2k, i, len - 2);
++ }
++}
++
++static void j2k_write_qcc(opj_j2k_t *j2k, int compno) {
++ int lenp, len;
++
++ opj_cio_t *cio = j2k->cio;
++
++ cio_write(cio, J2K_MS_QCC, 2); /* QCC */
++ lenp = cio_tell(cio);
++ cio_skip(cio, 2);
++ cio_write(cio, compno, j2k->image->numcomps <= 256 ? 1 : 2); /* Cqcc */
++ j2k_write_qcx(j2k, compno);
++ len = cio_tell(cio) - lenp;
++ cio_seek(cio, lenp);
++ cio_write(cio, len, 2); /* Lqcc */
++ cio_seek(cio, lenp + len);
++}
++
++static void j2k_read_qcc(opj_j2k_t *j2k) {
++ int len, compno;
++ int numcomp = j2k->image->numcomps;
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2); /* Lqcc */
++ compno = cio_read(cio, numcomp <= 256 ? 1 : 2); /* Cqcc */
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++
++ static int backup_compno = 0;
++
++ /* compno is negative or larger than the number of components!!! */
++ if ((compno < 0) || (compno >= numcomp)) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: bad component number in QCC (%d out of a maximum of %d)\n",
++ compno, numcomp);
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust this\n");
++ compno = backup_compno % numcomp;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting component number to %d\n",
++ compno);
++ }
++
++ /* keep your private count of tiles */
++ backup_compno++;
++ };
++#endif /* USE_JPWL */
++/* <<UniPG */
++ j2k_read_qcx(j2k, compno, len - 2 - (numcomp <= 256 ? 1 : 2));
++}
++
++static void j2k_write_poc(opj_j2k_t *j2k) {
++ int len, numpchgs, i;
++
++ int numcomps = j2k->image->numcomps;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = &cp->tcps[j2k->curtileno];
++ opj_tccp_t *tccp = &tcp->tccps[0];
++ opj_cio_t *cio = j2k->cio;
++
++ numpchgs = tcp->numpocs;
++ cio_write(cio, J2K_MS_POC, 2); /* POC */
++ len = 2 + (5 + 2 * (numcomps <= 256 ? 1 : 2)) * numpchgs;
++ cio_write(cio, len, 2); /* Lpoc */
++ for (i = 0; i < numpchgs; i++) {
++ opj_poc_t *poc = &tcp->pocs[i];
++ cio_write(cio, poc->resno0, 1); /* RSpoc_i */
++ cio_write(cio, poc->compno0, (numcomps <= 256 ? 1 : 2)); /* CSpoc_i */
++ cio_write(cio, poc->layno1, 2); /* LYEpoc_i */
++ poc->layno1 = int_min(poc->layno1, tcp->numlayers);
++ cio_write(cio, poc->resno1, 1); /* REpoc_i */
++ poc->resno1 = int_min(poc->resno1, tccp->numresolutions);
++ cio_write(cio, poc->compno1, (numcomps <= 256 ? 1 : 2)); /* CEpoc_i */
++ poc->compno1 = int_min(poc->compno1, numcomps);
++ cio_write(cio, poc->prg, 1); /* Ppoc_i */
++ }
++}
++
++static void j2k_read_poc(opj_j2k_t *j2k) {
++ int len, numpchgs, i, old_poc;
++
++ int numcomps = j2k->image->numcomps;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = j2k->state == J2K_STATE_TPH ? &cp->tcps[j2k->curtileno] : j2k->default_tcp;
++ opj_tccp_t *tccp = &tcp->tccps[0];
++ opj_cio_t *cio = j2k->cio;
++
++ old_poc = tcp->POC ? tcp->numpocs + 1 : 0;
++ tcp->POC = 1;
++ len = cio_read(cio, 2); /* Lpoc */
++ numpchgs = (len - 2) / (5 + 2 * (numcomps <= 256 ? 1 : 2));
++
++ for (i = old_poc; i < numpchgs + old_poc; i++) {
++ opj_poc_t *poc;
++ poc = &tcp->pocs[i];
++ poc->resno0 = cio_read(cio, 1); /* RSpoc_i */
++ poc->compno0 = cio_read(cio, numcomps <= 256 ? 1 : 2); /* CSpoc_i */
++ poc->layno1 = int_min(cio_read(cio, 2), (unsigned int) tcp->numlayers); /* LYEpoc_i */
++ poc->resno1 = int_min(cio_read(cio, 1), (unsigned int) tccp->numresolutions); /* REpoc_i */
++ poc->compno1 = int_min(
++ cio_read(cio, numcomps <= 256 ? 1 : 2), (unsigned int) numcomps); /* CEpoc_i */
++ poc->prg = (OPJ_PROG_ORDER)cio_read(cio, 1); /* Ppoc_i */
++ }
++
++ tcp->numpocs = numpchgs + old_poc - 1;
++}
++
++static void j2k_read_crg(opj_j2k_t *j2k) {
++ int len, i, Xcrg_i, Ycrg_i;
++
++ opj_cio_t *cio = j2k->cio;
++ int numcomps = j2k->image->numcomps;
++
++ len = cio_read(cio, 2); /* Lcrg */
++ for (i = 0; i < numcomps; i++) {
++ Xcrg_i = cio_read(cio, 2); /* Xcrg_i */
++ Ycrg_i = cio_read(cio, 2); /* Ycrg_i */
++ }
++}
++
++static void j2k_read_tlm(opj_j2k_t *j2k) {
++ int len, Ztlm, Stlm, ST, SP, tile_tlm, i;
++ long int Ttlm_i, Ptlm_i;
++
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2); /* Ltlm */
++ Ztlm = cio_read(cio, 1); /* Ztlm */
++ Stlm = cio_read(cio, 1); /* Stlm */
++ ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02);
++ SP = (Stlm >> 6) & 0x01;
++ tile_tlm = (len - 4) / ((SP + 1) * 2 + ST);
++ for (i = 0; i < tile_tlm; i++) {
++ Ttlm_i = cio_read(cio, ST); /* Ttlm_i */
++ Ptlm_i = cio_read(cio, SP ? 4 : 2); /* Ptlm_i */
++ }
++}
++
++static void j2k_read_plm(opj_j2k_t *j2k) {
++ int len, i, Zplm, Nplm, add, packet_len = 0;
++
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2); /* Lplm */
++ Zplm = cio_read(cio, 1); /* Zplm */
++ len -= 3;
++ while (len > 0) {
++ Nplm = cio_read(cio, 4); /* Nplm */
++ len -= 4;
++ for (i = Nplm; i > 0; i--) {
++ add = cio_read(cio, 1);
++ len--;
++ packet_len = (packet_len << 7) + add; /* Iplm_ij */
++ if ((add & 0x80) == 0) {
++ /* New packet */
++ packet_len = 0;
++ }
++ if (len <= 0)
++ break;
++ }
++ }
++}
++
++static void j2k_read_plt(opj_j2k_t *j2k) {
++ int len, i, Zplt, packet_len = 0, add;
++
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2); /* Lplt */
++ Zplt = cio_read(cio, 1); /* Zplt */
++ for (i = len - 3; i > 0; i--) {
++ add = cio_read(cio, 1);
++ packet_len = (packet_len << 7) + add; /* Iplt_i */
++ if ((add & 0x80) == 0) {
++ /* New packet */
++ packet_len = 0;
++ }
++ }
++}
++
++static void j2k_read_ppm(opj_j2k_t *j2k) {
++ int len, Z_ppm, i, j;
++ int N_ppm;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2);
++ cp->ppm = 1;
++
++ Z_ppm = cio_read(cio, 1); /* Z_ppm */
++ len -= 3;
++ while (len > 0) {
++ if (cp->ppm_previous == 0) {
++ N_ppm = cio_read(cio, 4); /* N_ppm */
++ len -= 4;
++ } else {
++ N_ppm = cp->ppm_previous;
++ }
++ j = cp->ppm_store;
++ if (Z_ppm == 0) { /* First PPM marker */
++ cp->ppm_data = (unsigned char *) opj_malloc(N_ppm * sizeof(unsigned char));
++ cp->ppm_data_first = cp->ppm_data;
++ cp->ppm_len = N_ppm;
++ } else { /* NON-first PPM marker */
++ cp->ppm_data = (unsigned char *) opj_realloc(cp->ppm_data, (N_ppm + cp->ppm_store) * sizeof(unsigned char));
++/* UniPG>> */
++#ifdef USE_JPWL
++ /* this memory allocation check could be done even in non-JPWL cases */
++ if (cp->correct) {
++ if (!cp->ppm_data) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: failed memory allocation during PPM marker parsing (pos. %x)\n",
++ cio_tell(cio));
++ if (!JPWL_ASSUME || JPWL_ASSUME)
++ exit(1);
++ }
++ }
++#endif
++/* <<UniPG */
++ cp->ppm_data_first = cp->ppm_data;
++ cp->ppm_len = N_ppm + cp->ppm_store;
++ }
++ for (i = N_ppm; i > 0; i--) { /* Read packet header */
++ cp->ppm_data[j] = cio_read(cio, 1);
++ j++;
++ len--;
++ if (len == 0)
++ break; /* Case of non-finished packet header in present marker but finished in next one */
++ }
++ cp->ppm_previous = i - 1;
++ cp->ppm_store = j;
++ }
++}
++
++static void j2k_read_ppt(opj_j2k_t *j2k) {
++ int len, Z_ppt, i, j = 0;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = cp->tcps + j2k->curtileno;
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2);
++ Z_ppt = cio_read(cio, 1);
++ tcp->ppt = 1;
++ if (Z_ppt == 0) { /* First PPT marker */
++ tcp->ppt_data = (unsigned char *) opj_malloc((len - 3) * sizeof(unsigned char));
++ tcp->ppt_data_first = tcp->ppt_data;
++ tcp->ppt_store = 0;
++ tcp->ppt_len = len - 3;
++ } else { /* NON-first PPT marker */
++ tcp->ppt_data = (unsigned char *) opj_realloc(tcp->ppt_data, (len - 3 + tcp->ppt_store) * sizeof(unsigned char));
++ tcp->ppt_data_first = tcp->ppt_data;
++ tcp->ppt_len = len - 3 + tcp->ppt_store;
++ }
++ j = tcp->ppt_store;
++ for (i = len - 3; i > 0; i--) {
++ tcp->ppt_data[j] = cio_read(cio, 1);
++ j++;
++ }
++ tcp->ppt_store = j;
++}
++
++static void j2k_write_sot(opj_j2k_t *j2k) {
++ int lenp, len;
++
++ opj_cio_t *cio = j2k->cio;
++
++ j2k->sot_start = cio_tell(cio);
++ cio_write(cio, J2K_MS_SOT, 2); /* SOT */
++ lenp = cio_tell(cio);
++ cio_skip(cio, 2); /* Lsot (further) */
++ cio_write(cio, j2k->curtileno, 2); /* Isot */
++ cio_skip(cio, 4); /* Psot (further in j2k_write_sod) */
++ cio_write(cio, 0, 1); /* TPsot */
++ cio_write(cio, 1, 1); /* TNsot */
++ len = cio_tell(cio) - lenp;
++ cio_seek(cio, lenp);
++ cio_write(cio, len, 2); /* Lsot */
++ cio_seek(cio, lenp + len);
++}
++
++static void j2k_read_sot(opj_j2k_t *j2k) {
++ int len, tileno, totlen, partno, numparts, i;
++ opj_tcp_t *tcp = NULL;
++ char status = 0;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_cio_t *cio = j2k->cio;
++
++ len = cio_read(cio, 2);
++ tileno = cio_read(cio, 2);
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++
++ static int backup_tileno = 0;
++
++ /* tileno is negative or larger than the number of tiles!!! */
++ if ((tileno < 0) || (tileno > (cp->tw * cp->th))) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: bad tile number (%d out of a maximum of %d)\n",
++ tileno, (cp->tw * cp->th));
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust this\n");
++ tileno = backup_tileno;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting tile number to %d\n",
++ tileno);
++ }
++
++ /* keep your private count of tiles */
++ backup_tileno++;
++ };
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++ if (cp->tileno_size == 0) {
++ cp->tileno[cp->tileno_size] = tileno;
++ cp->tileno_size++;
++ } else {
++ i = 0;
++ while (i < cp->tileno_size && status == 0) {
++ status = cp->tileno[i] == tileno ? 1 : 0;
++ i++;
++ }
++ if (status == 0) {
++ cp->tileno[cp->tileno_size] = tileno;
++ cp->tileno_size++;
++ }
++ }
++
++ totlen = cio_read(cio, 4);
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++
++ /* totlen is negative or larger than the bytes left!!! */
++ if ((totlen < 0) || (totlen > (cio_numbytesleft(cio) + 8))) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: bad tile byte size (%d bytes against %d bytes left)\n",
++ totlen, cio_numbytesleft(cio) + 8);
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust this\n");
++ totlen = 0;
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting Psot to %d => "
++ "assuming it is the last tile\n",
++ totlen);
++ }
++
++ };
++#endif /* USE_JPWL */
++/* <<UniPG */
++ if (!totlen)
++ totlen = cio_numbytesleft(cio) + 8;
++
++ partno = cio_read(cio, 1);
++ numparts = cio_read(cio, 1);
++
++ j2k->curtileno = tileno;
++ j2k->eot = cio_getbp(cio) - 12 + totlen;
++ j2k->state = J2K_STATE_TPH;
++ tcp = &cp->tcps[j2k->curtileno];
++
++ if (tcp->first == 1) {
++
++ /* Initialization PPT */
++ opj_tccp_t *tmp = tcp->tccps;
++ memcpy(tcp, j2k->default_tcp, sizeof(opj_tcp_t));
++ tcp->ppt = 0;
++ tcp->ppt_data = NULL;
++ tcp->ppt_data_first = NULL;
++ tcp->tccps = tmp;
++
++ for (i = 0; i < j2k->image->numcomps; i++) {
++ tcp->tccps[i] = j2k->default_tcp->tccps[i];
++ }
++ cp->tcps[j2k->curtileno].first = 0;
++ }
++}
++
++static void j2k_write_sod(opj_j2k_t *j2k, void *tile_coder) {
++ int l, layno;
++ int totlen;
++ opj_tcp_t *tcp = NULL;
++ opj_image_info_t *image_info = NULL;
++
++ opj_tcd_t *tcd = (opj_tcd_t*)tile_coder; /* cast is needed because of conflicts in header inclusions */
++ opj_cp_t *cp = j2k->cp;
++ opj_cio_t *cio = j2k->cio;
++
++ cio_write(cio, J2K_MS_SOD, 2);
++ if (j2k->curtileno == 0) {
++ j2k->sod_start = cio_tell(cio) + j2k->pos_correction;
++ }
++
++ /* INDEX >> */
++ image_info = j2k->image_info;
++ if (image_info && image_info->index_on) {
++ image_info->tile[j2k->curtileno].end_header = cio_tell(cio) + j2k->pos_correction - 1;
++ }
++ /* << INDEX */
++
++ tcp = &cp->tcps[j2k->curtileno];
++ for (layno = 0; layno < tcp->numlayers; layno++) {
++ tcp->rates[layno] -= tcp->rates[layno] ? (j2k->sod_start / (cp->th * cp->tw)) : 0;
++ }
++ if(image_info) {
++ image_info->num = 0;
++ }
++
++ l = tcd_encode_tile(tcd, j2k->curtileno, cio_getbp(cio), cio_numbytesleft(cio) - 2, image_info);
++
++ /* Writing Psot in SOT marker */
++ totlen = cio_tell(cio) + l - j2k->sot_start;
++ cio_seek(cio, j2k->sot_start + 6);
++ cio_write(cio, totlen, 4);
++ cio_seek(cio, j2k->sot_start + totlen);
++}
++
++static void j2k_read_sod(opj_j2k_t *j2k) {
++ int len, truncate = 0, i;
++ unsigned char *data = NULL, *data_ptr = NULL;
++
++ opj_cio_t *cio = j2k->cio;
++ int curtileno = j2k->curtileno;
++
++ len = int_min(j2k->eot - cio_getbp(cio), cio_numbytesleft(cio) + 1);
++
++ if (len == cio_numbytesleft(cio) + 1) {
++ truncate = 1; /* Case of a truncate codestream */
++ }
++
++ data = (unsigned char *) opj_malloc((j2k->tile_len[curtileno] + len) * sizeof(unsigned char));
++
++ for (i = 0; i < j2k->tile_len[curtileno]; i++) {
++ data[i] = j2k->tile_data[curtileno][i];
++ }
++
++ data_ptr = data + j2k->tile_len[curtileno];
++ for (i = 0; i < len; i++) {
++ data_ptr[i] = cio_read(cio, 1);
++ }
++
++ j2k->tile_len[curtileno] += len;
++ opj_free(j2k->tile_data[curtileno]);
++ j2k->tile_data[curtileno] = data;
++
++ if (!truncate) {
++ j2k->state = J2K_STATE_TPHSOT;
++ } else {
++ j2k->state = J2K_STATE_NEOC; /* RAJOUTE !! */
++ }
++}
++
++static void j2k_write_rgn(opj_j2k_t *j2k, int compno, int tileno) {
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = &cp->tcps[tileno];
++ opj_cio_t *cio = j2k->cio;
++ int numcomps = j2k->image->numcomps;
++
++ cio_write(cio, J2K_MS_RGN, 2); /* RGN */
++ cio_write(cio, numcomps <= 256 ? 5 : 6, 2); /* Lrgn */
++ cio_write(cio, compno, numcomps <= 256 ? 1 : 2); /* Crgn */
++ cio_write(cio, 0, 1); /* Srgn */
++ cio_write(cio, tcp->tccps[compno].roishift, 1); /* SPrgn */
++}
++
++static void j2k_read_rgn(opj_j2k_t *j2k) {
++ int len, compno, roisty;
++
++ opj_cp_t *cp = j2k->cp;
++ opj_tcp_t *tcp = j2k->state == J2K_STATE_TPH ? &cp->tcps[j2k->curtileno] : j2k->default_tcp;
++ opj_cio_t *cio = j2k->cio;
++ int numcomps = j2k->image->numcomps;
++
++ len = cio_read(cio, 2); /* Lrgn */
++ compno = cio_read(cio, numcomps <= 256 ? 1 : 2); /* Crgn */
++ roisty = cio_read(cio, 1); /* Srgn */
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++ /* totlen is negative or larger than the bytes left!!! */
++ if (compno >= numcomps) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: bad component number in RGN (%d when there are only %d)\n",
++ compno, numcomps);
++ if (!JPWL_ASSUME || JPWL_ASSUME)
++ exit(1);
++ }
++ };
++#endif /* USE_JPWL */
++/* <<UniPG */
++ tcp->tccps[compno].roishift = cio_read(cio, 1); /* SPrgn */
++}
++
++static void j2k_write_eoc(opj_j2k_t *j2k) {
++ opj_cio_t *cio = j2k->cio;
++ /* opj_event_msg(j2k->cinfo, "%.8x: EOC\n", cio_tell(cio) + j2k->pos_correction); */
++ cio_write(cio, J2K_MS_EOC, 2);
++}
++
++static void j2k_read_eoc(opj_j2k_t *j2k) {
++ int i, tileno;
++
++#ifndef NO_PACKETS_DECODING
++ opj_tcd_t *tcd = tcd_create(j2k->cinfo);
++ tcd_malloc_decode(tcd, j2k->image, j2k->cp);
++ for (i = 0; i < j2k->cp->tileno_size; i++) {
++ tileno = j2k->cp->tileno[i];
++ tcd_decode_tile(tcd, j2k->tile_data[tileno], j2k->tile_len[tileno], tileno);
++ opj_free(j2k->tile_data[tileno]);
++ j2k->tile_data[tileno] = NULL;
++ }
++ tcd_free_decode(tcd);
++ tcd_destroy(tcd);
++#else
++ for (i = 0; i < j2k->cp->tileno_size; i++) {
++ tileno = j2k->cp->tileno[i];
++ opj_free(j2k->tile_data[tileno]);
++ j2k->tile_data[tileno] = NULL;
++ }
++#endif
++
++ j2k->state = J2K_STATE_MT;
++}
++
++typedef struct opj_dec_mstabent {
++ /** marker value */
++ int id;
++ /** value of the state when the marker can appear */
++ int states;
++ /** action linked to the marker */
++ void (*handler) (opj_j2k_t *j2k);
++} opj_dec_mstabent_t;
++
++opj_dec_mstabent_t j2k_dec_mstab[] = {
++ {J2K_MS_SOC, J2K_STATE_MHSOC, j2k_read_soc},
++ {J2K_MS_SOT, J2K_STATE_MH | J2K_STATE_TPHSOT, j2k_read_sot},
++ {J2K_MS_SOD, J2K_STATE_TPH, j2k_read_sod},
++ {J2K_MS_EOC, J2K_STATE_TPHSOT, j2k_read_eoc},
++ {J2K_MS_SIZ, J2K_STATE_MHSIZ, j2k_read_siz},
++ {J2K_MS_COD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_cod},
++ {J2K_MS_COC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_coc},
++ {J2K_MS_RGN, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_rgn},
++ {J2K_MS_QCD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_qcd},
++ {J2K_MS_QCC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_qcc},
++ {J2K_MS_POC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_poc},
++ {J2K_MS_TLM, J2K_STATE_MH, j2k_read_tlm},
++ {J2K_MS_PLM, J2K_STATE_MH, j2k_read_plm},
++ {J2K_MS_PLT, J2K_STATE_TPH, j2k_read_plt},
++ {J2K_MS_PPM, J2K_STATE_MH, j2k_read_ppm},
++ {J2K_MS_PPT, J2K_STATE_TPH, j2k_read_ppt},
++ {J2K_MS_SOP, 0, 0},
++ {J2K_MS_CRG, J2K_STATE_MH, j2k_read_crg},
++ {J2K_MS_COM, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_com},
++/* UniPG>> */
++#ifdef USE_JPWL
++ {J2K_MS_EPC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epc},
++ {J2K_MS_EPB, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epb},
++ {J2K_MS_ESD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_esd},
++ {J2K_MS_RED, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_red},
++#endif /* USE_JPWL */
++/* <<UniPG */
++ {0, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_unk}
++};
++
++static void j2k_read_unk(opj_j2k_t *j2k) {
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "Unknown marker\n");
++/* UniPG>> */
++#ifdef USE_JPWL
++ if (j2k->cp->correct) {
++ int m = 0, id, i;
++ int min_id = 0, min_dist = 17, cur_dist = 0, tmp_id;
++ cio_seek(j2k->cio, cio_tell(j2k->cio) - 2);
++ id = cio_read(j2k->cio, 2);
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: really don't know this marker %x\n",
++ id);
++ if (!JPWL_ASSUME) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "- possible synch loss due to uncorrectable channel errors => Exiting\n");
++ exit(1);
++ }
++ /* OK, activate this at your own risk!!! */
++ /* we look for the marker at the minimum hamming distance from this */
++ while (j2k_dec_mstab[m].id) {
++
++ /* 1's where they differ */
++ tmp_id = j2k_dec_mstab[m].id ^ id;
++
++ /* compute the hamming distance between our id and the current */
++ cur_dist = 0;
++ for (i = 0; i < 16; i++) {
++ if ((tmp_id >> i) & 0x0001) {
++ cur_dist++;
++ }
++ }
++
++ /* if current distance is smaller, set the minimum */
++ if (cur_dist < min_dist) {
++ min_dist = cur_dist;
++ min_id = j2k_dec_mstab[m].id;
++ }
++
++ /* jump to the next marker */
++ m++;
++ }
++
++ /* do we substitute the marker? */
++ if (min_dist < JPWL_MAXIMUM_HAMMING) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "- marker %x is at distance %d from the read %x\n",
++ min_id, min_dist, id);
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "- trying to substitute in place and crossing fingers!\n");
++ cio_seek(j2k->cio, cio_tell(j2k->cio) - 2);
++ cio_write(j2k->cio, min_id, 2);
++
++ /* rewind */
++ cio_seek(j2k->cio, cio_tell(j2k->cio) - 2);
++
++ }
++
++ };
++#endif /* USE_JPWL */
++/* <<UniPG */
++}
++
++/**
++Read the lookup table containing all the marker, status and action
++@param id Marker value
++*/
++static opj_dec_mstabent_t *j2k_dec_mstab_lookup(int id) {
++ opj_dec_mstabent_t *e;
++ for (e = j2k_dec_mstab; e->id != 0; e++) {
++ if (e->id == id) {
++ break;
++ }
++ }
++ return e;
++}
++
++/* ----------------------------------------------------------------------- */
++/* J2K / JPT decoder interface */
++/* ----------------------------------------------------------------------- */
++
++opj_j2k_t* j2k_create_decompress(opj_common_ptr cinfo) {
++ opj_j2k_t *j2k = (opj_j2k_t*)opj_malloc(sizeof(opj_j2k_t));
++ if(j2k) {
++ j2k->cinfo = cinfo;
++ j2k->default_tcp = (opj_tcp_t*)opj_malloc(sizeof(opj_tcp_t));
++ if(!j2k->default_tcp) {
++ opj_free(j2k);
++ return NULL;
++ }
++ }
++ return j2k;
++}
++
++void j2k_destroy_decompress(opj_j2k_t *j2k) {
++ int i = 0;
++
++ if(j2k->tile_len != NULL) {
++ opj_free(j2k->tile_len);
++ }
++ if(j2k->tile_data != NULL) {
++ opj_free(j2k->tile_data);
++ }
++ if(j2k->default_tcp != NULL) {
++ opj_tcp_t *default_tcp = j2k->default_tcp;
++ if(default_tcp->ppt_data_first != NULL) {
++ opj_free(default_tcp->ppt_data_first);
++ }
++ if(j2k->default_tcp->tccps != NULL) {
++ opj_free(j2k->default_tcp->tccps);
++ }
++ opj_free(j2k->default_tcp);
++ }
++ if(j2k->cp != NULL) {
++ opj_cp_t *cp = j2k->cp;
++ if(cp->tcps != NULL) {
++ for(i = 0; i < cp->tw * cp->th; i++) {
++ if(cp->tcps[i].ppt_data_first != NULL) {
++ opj_free(cp->tcps[i].ppt_data_first);
++ }
++ if(cp->tcps[i].tccps != NULL) {
++ opj_free(cp->tcps[i].tccps);
++ }
++ }
++ opj_free(cp->tcps);
++ }
++ if(cp->ppm_data_first != NULL) {
++ opj_free(cp->ppm_data_first);
++ }
++ if(cp->tileno != NULL) {
++ opj_free(cp->tileno);
++ }
++ if(cp->comment != NULL) {
++ opj_free(cp->comment);
++ }
++
++ opj_free(cp);
++ }
++
++ opj_free(j2k);
++}
++
++void j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters) {
++ if(j2k && parameters) {
++ /* create and initialize the coding parameters structure */
++ opj_cp_t *cp = (opj_cp_t*)opj_malloc(sizeof(opj_cp_t));
++ cp->reduce = parameters->cp_reduce;
++ cp->layer = parameters->cp_layer;
++ cp->limit_decoding = parameters->cp_limit_decoding;
++/* UniPG>> */
++#ifdef USE_JPWL
++ cp->correct = parameters->jpwl_correct;
++ cp->exp_comps = parameters->jpwl_exp_comps;
++ cp->max_tiles = parameters->jpwl_max_tiles;
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++ /* keep a link to cp so that we can destroy it later in j2k_destroy_decompress */
++ j2k->cp = cp;
++ }
++}
++
++opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio) {
++ opj_image_t *image = NULL;
++
++ opj_common_ptr cinfo = j2k->cinfo;
++
++ j2k->cio = cio;
++
++ /* create an empty image */
++ image = opj_image_create0();
++ j2k->image = image;
++
++ j2k->state = J2K_STATE_MHSOC;
++
++ for (;;) {
++ opj_dec_mstabent_t *e;
++ int id = cio_read(cio, 2);
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ /* we try to honor JPWL correction power */
++ if (j2k->cp->correct) {
++
++ int orig_pos = cio_tell(cio);
++ bool status;
++
++ /* call the corrector */
++ status = jpwl_correct(j2k);
++
++ /* go back to where you were */
++ cio_seek(cio, orig_pos - 2);
++
++ /* re-read the marker */
++ id = cio_read(cio, 2);
++
++ /* check whether it begins with ff */
++ if (id >> 8 != 0xff) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR,
++ "JPWL: possible bad marker %x at %d\n",
++ id, cio_tell(cio) - 2);
++ if (!JPWL_ASSUME)
++ exit(1);
++ /* we try to correct */
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- trying to adjust this\n");
++ id = id | 0xff00;
++ cio_seek(cio, cio_tell(cio) - 2);
++ cio_write(cio, id, 2);
++ opj_event_msg(j2k->cinfo, EVT_WARNING, "- setting marker to %x\n",
++ id);
++ }
++
++ }
++#endif /* USE_JPWL */
++/* <<UniPG */
++ if (id >> 8 != 0xff) {
++ opj_image_destroy(image);
++ opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
++ return 0;
++ }
++ e = j2k_dec_mstab_lookup(id);
++ // Check if the marker is known
++ if (!(j2k->state & e->states)) {
++ opj_image_destroy(image);
++ opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
++ return 0;
++ }
++ // Check if the decoding is limited to the main header
++ if (e->id == J2K_MS_SOT && j2k->cp->limit_decoding == LIMIT_TO_MAIN_HEADER) {
++ opj_event_msg(cinfo, EVT_INFO, "Main Header decoded.\n");
++ return image;
++ }
++
++ if (e->handler) {
++ (*e->handler)(j2k);
++ }
++ if (j2k->state == J2K_STATE_MT) {
++ break;
++ }
++ if (j2k->state == J2K_STATE_NEOC) {
++ break;
++ }
++ }
++ if (j2k->state == J2K_STATE_NEOC) {
++ j2k_read_eoc(j2k);
++ }
++
++ if (j2k->state != J2K_STATE_MT) {
++ opj_event_msg(cinfo, EVT_WARNING, "Incomplete bitstream\n");
++ }
++
++ return image;
++}
++
++/*
++* Read a JPT-stream and decode file
++*
++*/
++opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio) {
++ opj_image_t *image = NULL;
++ opj_jpt_msg_header_t header;
++ int position;
++
++ opj_common_ptr cinfo = j2k->cinfo;
++
++ j2k->cio = cio;
++
++ /* create an empty image */
++ image = opj_image_create0();
++
++ j2k->state = J2K_STATE_MHSOC;
++
++ /* Initialize the header */
++ jpt_init_msg_header(&header);
++ /* Read the first header of the message */
++ jpt_read_msg_header(cinfo, cio, &header);
++
++ position = cio_tell(cio);
++ if (header.Class_Id != 6) { /* 6 : Main header data-bin message */
++ opj_image_destroy(image);
++ opj_event_msg(cinfo, EVT_ERROR, "[JPT-stream] : Expecting Main header first [class_Id %d] !\n", header.Class_Id);
++ return 0;
++ }
++
++ for (;;) {
++ opj_dec_mstabent_t *e = NULL;
++ int id;
++
++ if (!cio_numbytesleft(cio)) {
++ j2k_read_eoc(j2k);
++ return image;
++ }
++ /* data-bin read -> need to read a new header */
++ if ((unsigned int) (cio_tell(cio) - position) == header.Msg_length) {
++ jpt_read_msg_header(cinfo, cio, &header);
++ position = cio_tell(cio);
++ if (header.Class_Id != 4) { /* 4 : Tile data-bin message */
++ opj_image_destroy(image);
++ opj_event_msg(cinfo, EVT_ERROR, "[JPT-stream] : Expecting Tile info !\n");
++ return 0;
++ }
++ }
++
++ id = cio_read(cio, 2);
++ if (id >> 8 != 0xff) {
++ opj_image_destroy(image);
++ opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
++ return 0;
++ }
++ e = j2k_dec_mstab_lookup(id);
++ if (!(j2k->state & e->states)) {
++ opj_image_destroy(image);
++ opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
++ return 0;
++ }
++ if (e->handler) {
++ (*e->handler)(j2k);
++ }
++ if (j2k->state == J2K_STATE_MT) {
++ break;
++ }
++ if (j2k->state == J2K_STATE_NEOC) {
++ break;
++ }
++ }
++ if (j2k->state == J2K_STATE_NEOC) {
++ j2k_read_eoc(j2k);
++ }
++
++ if (j2k->state != J2K_STATE_MT) {
++ opj_event_msg(cinfo, EVT_WARNING, "Incomplete bitstream\n");
++ }
++
++ return image;
++}
++
++/* ----------------------------------------------------------------------- */
++/* J2K encoder interface */
++/* ----------------------------------------------------------------------- */
++
++opj_j2k_t* j2k_create_compress(opj_common_ptr cinfo) {
++ opj_j2k_t *j2k = (opj_j2k_t*)opj_malloc(sizeof(opj_j2k_t));
++ if(j2k) {
++ j2k->cinfo = cinfo;
++ }
++ return j2k;
++}
++
++void j2k_destroy_compress(opj_j2k_t *j2k) {
++ int tileno;
++
++ if(!j2k) return;
++
++ if(j2k->image_info != NULL) {
++ opj_image_info_t *image_info = j2k->image_info;
++ if (image_info->index_on && j2k->cp) {
++ opj_cp_t *cp = j2k->cp;
++ for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
++ opj_tile_info_t *tile_info = &image_info->tile[tileno];
++ opj_free(tile_info->thresh);
++ opj_free(tile_info->packet);
++ }
++ opj_free(image_info->tile);
++ }
++ opj_free(image_info);
++ }
++ if(j2k->cp != NULL) {
++ opj_cp_t *cp = j2k->cp;
++
++ if(cp->comment) {
++ opj_free(cp->comment);
++ }
++ if(cp->matrice) {
++ opj_free(cp->matrice);
++ }
++ for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
++ opj_free(cp->tcps[tileno].tccps);
++ }
++ opj_free(cp->tcps);
++ opj_free(cp);
++ }
++
++ opj_free(j2k);
++}
++
++void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_t *image) {
++ int i, j, tileno, numpocs_tile;
++ opj_cp_t *cp = NULL;
++
++ if(!j2k || !parameters || ! image) {
++ return;
++ }
++
++ /* create and initialize the coding parameters structure */
++ cp = (opj_cp_t*)opj_malloc(sizeof(opj_cp_t));
++
++ /* keep a link to cp so that we can destroy it later in j2k_destroy_compress */
++ j2k->cp = cp;
++
++ /* set default values for cp */
++ cp->tw = 1;
++ cp->th = 1;
++
++ /*
++ copy user encoding parameters
++ */
++
++ cp->disto_alloc = parameters->cp_disto_alloc;
++ cp->fixed_alloc = parameters->cp_fixed_alloc;
++ cp->fixed_quality = parameters->cp_fixed_quality;
++
++ /* mod fixed_quality */
++ if(parameters->cp_matrice) {
++ size_t array_size = parameters->tcp_numlayers * parameters->numresolution * 3 * sizeof(int);
++ cp->matrice = (int *) opj_malloc(array_size);
++ memcpy(cp->matrice, parameters->cp_matrice, array_size);
++ }
++
++ /* creation of an index file ? */
++ cp->index_on = parameters->index_on;
++ if(cp->index_on) {
++ j2k->image_info = (opj_image_info_t*)opj_malloc(sizeof(opj_image_info_t));
++ }
++
++ /* tiles */
++ cp->tdx = parameters->cp_tdx;
++ cp->tdy = parameters->cp_tdy;
++
++ /* tile offset */
++ cp->tx0 = parameters->cp_tx0;
++ cp->ty0 = parameters->cp_ty0;
++
++ /* comment string */
++ if(parameters->cp_comment) {
++ cp->comment = (char*)opj_malloc(strlen(parameters->cp_comment) + 1);
++ if(cp->comment) {
++ strcpy(cp->comment, parameters->cp_comment);
++ }
++ }
++
++ /*
++ calculate other encoding parameters
++ */
++
++ if (parameters->tile_size_on) {
++ cp->tw = int_ceildiv(image->x1 - cp->tx0, cp->tdx);
++ cp->th = int_ceildiv(image->y1 - cp->ty0, cp->tdy);
++ } else {
++ cp->tdx = image->x1 - cp->tx0;
++ cp->tdy = image->y1 - cp->ty0;
++ }
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ /*
++ calculate JPWL encoding parameters
++ */
++
++ if (parameters->jpwl_epc_on) {
++ int i;
++
++ /* set JPWL on */
++ cp->epc_on = true;
++ cp->info_on = false; /* no informative technique */
++
++ /* set EPB on */
++ if ((parameters->jpwl_hprot_MH > 0) || (parameters->jpwl_hprot_TPH[0] > 0)) {
++ cp->epb_on = true;
++
++ cp->hprot_MH = parameters->jpwl_hprot_MH;
++ for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {
++ cp->hprot_TPH_tileno[i] = parameters->jpwl_hprot_TPH_tileno[i];
++ cp->hprot_TPH[i] = parameters->jpwl_hprot_TPH[i];
++ }
++ /* if tile specs are not specified, copy MH specs */
++ if (cp->hprot_TPH[0] == -1) {
++ cp->hprot_TPH_tileno[0] = 0;
++ cp->hprot_TPH[0] = parameters->jpwl_hprot_MH;
++ }
++ for (i = 0; i < JPWL_MAX_NO_PACKSPECS; i++) {
++ cp->pprot_tileno[i] = parameters->jpwl_pprot_tileno[i];
++ cp->pprot_packno[i] = parameters->jpwl_pprot_packno[i];
++ cp->pprot[i] = parameters->jpwl_pprot[i];
++ }
++ }
++
++ /* set ESD writing */
++ if ((parameters->jpwl_sens_size == 1) || (parameters->jpwl_sens_size == 2)) {
++ cp->esd_on = true;
++
++ cp->sens_size = parameters->jpwl_sens_size;
++ cp->sens_addr = parameters->jpwl_sens_addr;
++ cp->sens_range = parameters->jpwl_sens_range;
++
++ cp->sens_MH = parameters->jpwl_sens_MH;
++ for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {
++ cp->sens_TPH_tileno[i] = parameters->jpwl_sens_TPH_tileno[i];
++ cp->sens_TPH[i] = parameters->jpwl_sens_TPH[i];
++ }
++ }
++
++ /* always set RED writing to false: we are at the encoder */
++ cp->red_on = false;
++
++ } else {
++ cp->epc_on = false;
++ }
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++ /* initialize the mutiple tiles */
++ /* ---------------------------- */
++ cp->tcps = (opj_tcp_t *) opj_malloc(cp->tw * cp->th * sizeof(opj_tcp_t));
++
++ for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
++ opj_tcp_t *tcp = &cp->tcps[tileno];
++ tcp->numlayers = parameters->tcp_numlayers;
++ for (j = 0; j < tcp->numlayers; j++) {
++ if (cp->fixed_quality) { /* add fixed_quality */
++ tcp->distoratio[j] = parameters->tcp_distoratio[j];
++ } else {
++ tcp->rates[j] = parameters->tcp_rates[j];
++ }
++ }
++ tcp->csty = parameters->csty;
++ tcp->prg = parameters->prog_order;
++ tcp->mct = image->numcomps == 3 ? 1 : 0;
++
++ numpocs_tile = 0;
++ tcp->POC = 0;
++ if (parameters->numpocs) {
++ /* initialisation of POC */
++ tcp->POC = 1;
++ for (i = 0; i < parameters->numpocs; i++) {
++ if((tileno == parameters->POC[i].tile - 1) || (parameters->POC[i].tile == -1)) {
++ opj_poc_t *tcp_poc = &tcp->pocs[numpocs_tile];
++ tcp_poc->resno0 = parameters->POC[numpocs_tile].resno0;
++ tcp_poc->compno0 = parameters->POC[numpocs_tile].compno0;
++ tcp_poc->layno1 = parameters->POC[numpocs_tile].layno1;
++ tcp_poc->resno1 = parameters->POC[numpocs_tile].resno1;
++ tcp_poc->compno1 = parameters->POC[numpocs_tile].compno1;
++ tcp_poc->prg = parameters->POC[numpocs_tile].prg;
++ tcp_poc->tile = parameters->POC[numpocs_tile].tile;
++ numpocs_tile++;
++ }
++ }
++ }
++ tcp->numpocs = numpocs_tile;
++
++ tcp->tccps = (opj_tccp_t *) opj_malloc(image->numcomps * sizeof(opj_tccp_t));
++
++ for (i = 0; i < image->numcomps; i++) {
++ opj_tccp_t *tccp = &tcp->tccps[i];
++ tccp->csty = parameters->csty & 0x01; /* 0 => one precinct || 1 => custom precinct */
++ tccp->numresolutions = parameters->numresolution;
++ tccp->cblkw = int_floorlog2(parameters->cblockw_init);
++ tccp->cblkh = int_floorlog2(parameters->cblockh_init);
++ tccp->cblksty = parameters->mode;
++ tccp->qmfbid = parameters->irreversible ? 0 : 1;
++ tccp->qntsty = parameters->irreversible ? J2K_CCP_QNTSTY_SEQNT : J2K_CCP_QNTSTY_NOQNT;
++ tccp->numgbits = 2;
++ if (i == parameters->roi_compno) {
++ tccp->roishift = parameters->roi_shift;
++ } else {
++ tccp->roishift = 0;
++ }
++ if (parameters->csty & J2K_CCP_CSTY_PRT) {
++ int p = 0;
++ for (j = tccp->numresolutions - 1; j >= 0; j--) {
++ if (p < parameters->res_spec) {
++ if (parameters->prcw_init[p] < 1) {
++ tccp->prcw[j] = 1;
++ } else {
++ tccp->prcw[j] = int_floorlog2(parameters->prcw_init[p]);
++ }
++ if (parameters->prch_init[p] < 1) {
++ tccp->prch[j] = 1;
++ } else {
++ tccp->prch[j] = int_floorlog2(parameters->prch_init[p]);
++ }
++ } else {
++ int res_spec = parameters->res_spec;
++ int size_prcw = parameters->prcw_init[res_spec - 1] >> (p - (res_spec - 1));
++ int size_prch = parameters->prch_init[res_spec - 1] >> (p - (res_spec - 1));
++ if (size_prcw < 1) {
++ tccp->prcw[j] = 1;
++ } else {
++ tccp->prcw[j] = int_floorlog2(size_prcw);
++ }
++ if (size_prch < 1) {
++ tccp->prch[j] = 1;
++ } else {
++ tccp->prch[j] = int_floorlog2(size_prch);
++ }
++ }
++ p++;
++ /*printf("\nsize precinct for level %d : %d,%d\n", j,tccp->prcw[j], tccp->prch[j]); */
++ }
++ } else {
++ for (j = 0; j < tccp->numresolutions; j++) {
++ tccp->prcw[j] = 15;
++ tccp->prch[j] = 15;
++ }
++ }
++
++ dwt_calc_explicit_stepsizes(tccp, image->comps[i].prec);
++ }
++ }
++}
++
++/**
++Create an index file
++@param j2k
++@param cio
++@param image_info
++@param index Index filename
++@return Returns 1 if successful, returns 0 otherwise
++*/
++static int j2k_create_index(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_info_t *image_info, char *index) {
++ int tileno, compno, layno, resno, precno, pack_nb, x, y;
++ FILE *stream = NULL;
++ double total_disto = 0;
++
++ image_info->codestream_size = cio_tell(cio) + j2k->pos_correction; /* Correction 14/4/03 suite rmq de Patrick */
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ /* if JPWL is enabled and the name coincides with our own set
++ then discard the creation of the file: this was just done to
++ enable indexing, we do not want an index file
++ */
++ if (j2k->cp->epc_on && !strcmp(index, JPWL_PRIVATEINDEX_NAME))
++ return 1;
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++ stream = fopen(index, "w");
++ if (!stream) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to open %s for writing\n", index);
++ return 0;
++ }
++
++ fprintf(stream, "%d %d\n", image_info->image_w, image_info->image_h);
++ fprintf(stream, "%d\n", image_info->prog);
++ fprintf(stream, "%d %d\n", image_info->tile_x, image_info->tile_y);
++ fprintf(stream, "%d %d\n", image_info->tw, image_info->th);
++ fprintf(stream, "%d\n", image_info->comp);
++ fprintf(stream, "%d\n", image_info->layer);
++ fprintf(stream, "%d\n", image_info->decomposition);
++
++ for (resno = image_info->decomposition; resno >= 0; resno--) {
++ fprintf(stream, "[%d,%d] ",
++ (1 << image_info->tile[0].pdx[resno]), (1 << image_info->tile[0].pdx[resno])); /* based on tile 0 */
++ }
++ fprintf(stream, "\n");
++ fprintf(stream, "%d\n", image_info->main_head_end);
++ fprintf(stream, "%d\n", image_info->codestream_size);
++
++ for (tileno = 0; tileno < image_info->tw * image_info->th; tileno++) {
++ fprintf(stream, "%4d %9d %9d %9d %9e %9d %9e\n",
++ image_info->tile[tileno].num_tile,
++ image_info->tile[tileno].start_pos,
++ image_info->tile[tileno].end_header,
++ image_info->tile[tileno].end_pos,
++ image_info->tile[tileno].distotile, image_info->tile[tileno].nbpix,
++ image_info->tile[tileno].distotile / image_info->tile[tileno].nbpix);
++ }
++
++ for (tileno = 0; tileno < image_info->tw * image_info->th; tileno++) {
++ int start_pos, end_pos;
++ double disto = 0;
++ pack_nb = 0;
++
++ /*
++ fprintf(stream, "pkno tileno layerno resno compno precno start_pos end_pos deltaSE \n");
++ */
++
++ if (image_info->prog == LRCP) { /* LRCP */
++ /*
++ fprintf(stream, "pack_nb tileno layno resno compno precno start_pos end_pos disto");
++ */
++ for (layno = 0; layno < image_info->layer; layno++) {
++ for (resno = 0; resno < image_info->decomposition + 1; resno++) {
++ for (compno = 0; compno < image_info->comp; compno++) {
++ int prec_max = image_info->tile[tileno].pw[resno] * image_info->tile[tileno].ph[resno];
++ for (precno = 0; precno < prec_max; precno++) {
++ start_pos = image_info->tile[tileno].packet[pack_nb].start_pos;
++ end_pos = image_info->tile[tileno].packet[pack_nb].end_pos;
++ disto = image_info->tile[tileno].packet[pack_nb].disto;
++ fprintf(stream, "%4d %6d %7d %5d %6d %6d %9d %9d %8e\n",
++ pack_nb, tileno, layno, resno, compno, precno, start_pos, end_pos, disto);
++ total_disto += disto;
++ pack_nb++;
++ }
++ }
++ }
++ }
++ } /* LRCP */
++ else if (image_info->prog == RLCP) { /* RLCP */
++ /*
++ fprintf(stream, "pack_nb tileno resno layno compno precno start_pos end_pos disto");
++ */
++ for (resno = 0; resno < image_info->decomposition + 1; resno++) {
++ for (layno = 0; layno < image_info->layer; layno++) {
++ for (compno = 0; compno < image_info->comp; compno++) {
++ int prec_max = image_info->tile[tileno].pw[resno] * image_info->tile[tileno].ph[resno];
++ for (precno = 0; precno < prec_max; precno++) {
++ start_pos = image_info->tile[tileno].packet[pack_nb].start_pos;
++ end_pos = image_info->tile[tileno].packet[pack_nb].end_pos;
++ disto = image_info->tile[tileno].packet[pack_nb].disto;
++ fprintf(stream, "%4d %6d %5d %7d %6d %6d %9d %9d %8e\n",
++ pack_nb, tileno, resno, layno, compno, precno, start_pos, end_pos, disto);
++ total_disto += disto;
++ pack_nb++;
++ }
++ }
++ }
++ }
++ } /* RLCP */
++ else if (image_info->prog == RPCL) { /* RPCL */
++ /*
++ fprintf(stream, "\npack_nb tileno resno precno compno layno start_pos end_pos disto\n");
++ */
++ for (resno = 0; resno < image_info->decomposition + 1; resno++) {
++ /* I suppose components have same XRsiz, YRsiz */
++ int x0 = image_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)image_info->tw ) * image_info->tw * image_info->tile_x;
++ int y0 = image_info->tile_Ox + (int)floor( (float)tileno/(float)image_info->tw ) * image_info->tile_y;
++ int x1 = x0 + image_info->tile_x;
++ int y1 = y0 + image_info->tile_y;
++ for(y = y0; y < y1; y++) {
++ for(x = x0; x < x1; x++) {
++ for (compno = 0; compno < image_info->comp; compno++) {
++ int prec_max = image_info->tile[tileno].pw[resno] * image_info->tile[tileno].ph[resno];
++ for (precno = 0; precno < prec_max; precno++) {
++ int pcnx = image_info->tile[tileno].pw[resno];
++ int pcx = (int) pow( 2, image_info->tile[tileno].pdx[resno] + image_info->decomposition - resno );
++ int pcy = (int) pow( 2, image_info->tile[tileno].pdy[resno] + image_info->decomposition - resno );
++ int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
++ int precno_y = (int) floor( (float)precno/(float)pcnx );
++ if (precno_y*pcy == y ) {
++ if (precno_x*pcx == x ) {
++ for (layno = 0; layno < image_info->layer; layno++) {
++ start_pos = image_info->tile[tileno].packet[pack_nb].start_pos;
++ end_pos = image_info->tile[tileno].packet[pack_nb].end_pos;
++ disto = image_info->tile[tileno].packet[pack_nb].disto;
++ fprintf(stream, "%4d %6d %5d %6d %6d %7d %9d %9d %8e\n",
++ pack_nb, tileno, resno, precno, compno, layno, start_pos, end_pos, disto);
++ total_disto += disto;
++ pack_nb++;
++ }
++ }
++ }
++ } /* precno */
++ } /* compno */
++ } /* x = x0..x1 */
++ } /* y = y0..y1 */
++ } /* resno */
++ } /* RPCL */
++ else if (image_info->prog == PCRL) { /* PCRL */
++ /* I suppose components have same XRsiz, YRsiz */
++ int x0 = image_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)image_info->tw ) * image_info->tw * image_info->tile_x;
++ int y0 = image_info->tile_Ox + (int)floor( (float)tileno/(float)image_info->tw ) * image_info->tile_y;
++ int x1 = x0 + image_info->tile_x;
++ int y1 = y0 + image_info->tile_y;
++ /*
++ fprintf(stream, "\npack_nb tileno precno compno resno layno start_pos end_pos disto\n");
++ */
++ for(y = y0; y < y1; y++) {
++ for(x = x0; x < x1; x++) {
++ for (compno = 0; compno < image_info->comp; compno++) {
++ for (resno = 0; resno < image_info->decomposition + 1; resno++) {
++ int prec_max = image_info->tile[tileno].pw[resno] * image_info->tile[tileno].ph[resno];
++ for (precno = 0; precno < prec_max; precno++) {
++ int pcnx = image_info->tile[tileno].pw[resno];
++ int pcx = (int) pow( 2, image_info->tile[tileno].pdx[resno] + image_info->decomposition - resno );
++ int pcy = (int) pow( 2, image_info->tile[tileno].pdy[resno] + image_info->decomposition - resno );
++ int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
++ int precno_y = (int) floor( (float)precno/(float)pcnx );
++ if (precno_y*pcy == y ) {
++ if (precno_x*pcx == x ) {
++ for (layno = 0; layno < image_info->layer; layno++) {
++ start_pos = image_info->tile[tileno].packet[pack_nb].start_pos;
++ end_pos = image_info->tile[tileno].packet[pack_nb].end_pos;
++ disto = image_info->tile[tileno].packet[pack_nb].disto;
++ fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %8e\n",
++ pack_nb, tileno, precno, compno, resno, layno, start_pos, end_pos, disto);
++ total_disto += disto;
++ pack_nb++;
++ }
++ }
++ }
++ } /* precno */
++ } /* resno */
++ } /* compno */
++ } /* x = x0..x1 */
++ } /* y = y0..y1 */
++ } /* PCRL */
++ else { /* CPRL */
++ /*
++ fprintf(stream, "\npack_nb tileno compno precno resno layno start_pos end_pos disto\n");
++ */
++ for (compno = 0; compno < image_info->comp; compno++) {
++ /* I suppose components have same XRsiz, YRsiz */
++ int x0 = image_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)image_info->tw ) * image_info->tw * image_info->tile_x;
++ int y0 = image_info->tile_Ox + (int)floor( (float)tileno/(float)image_info->tw ) * image_info->tile_y;
++ int x1 = x0 + image_info->tile_x;
++ int y1 = y0 + image_info->tile_y;
++ for(y = y0; y < y1; y++) {
++ for(x = x0; x < x1; x++) {
++ for (resno = 0; resno < image_info->decomposition + 1; resno++) {
++ int prec_max = image_info->tile[tileno].pw[resno] * image_info->tile[tileno].ph[resno];
++ for (precno = 0; precno < prec_max; precno++) {
++ int pcnx = image_info->tile[tileno].pw[resno];
++ int pcx = (int) pow( 2, image_info->tile[tileno].pdx[resno] + image_info->decomposition - resno );
++ int pcy = (int) pow( 2, image_info->tile[tileno].pdy[resno] + image_info->decomposition - resno );
++ int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
++ int precno_y = (int) floor( (float)precno/(float)pcnx );
++ if (precno_y*pcy == y ) {
++ if (precno_x*pcx == x ) {
++ for (layno = 0; layno < image_info->layer; layno++) {
++ start_pos = image_info->tile[tileno].packet[pack_nb].start_pos;
++ end_pos = image_info->tile[tileno].packet[pack_nb].end_pos;
++ disto = image_info->tile[tileno].packet[pack_nb].disto;
++ fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %8e\n",
++ pack_nb, tileno, compno, precno, resno, layno, start_pos, end_pos, disto);
++ total_disto += disto;
++ pack_nb++;
++ }
++ }
++ }
++ } /* precno */
++ } /* resno */
++ } /* x = x0..x1 */
++ } /* y = y0..y1 */
++ } /* comno */
++ } /* CPRL */
++ } /* tileno */
++
++ fprintf(stream, "%8e\n", image_info->D_max); /* SE max */
++ fprintf(stream, "%.8e\n", total_disto); /* SE totale */
++ fclose(stream);
++
++ return 1;
++}
++
++bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, char *index) {
++ int tileno, compno;
++ opj_image_info_t *image_info = NULL;
++ opj_cp_t *cp = NULL;
++
++ opj_tcd_t *tcd = NULL; /* TCD component */
++
++ j2k->cio = cio;
++ j2k->image = image;
++
++ cp = j2k->cp;
++
++ /* j2k_dump_cp(stdout, image, cp); */
++
++ /* INDEX >> */
++ image_info = j2k->image_info;
++ if (image_info && cp->index_on) {
++ image_info->index_on = cp->index_on;
++ image_info->tile = (opj_tile_info_t *) opj_malloc(cp->tw * cp->th * sizeof(opj_tile_info_t));
++ image_info->image_w = image->x1 - image->x0;
++ image_info->image_h = image->y1 - image->y0;
++ image_info->prog = (&cp->tcps[0])->prg;
++ image_info->tw = cp->tw;
++ image_info->th = cp->th;
++ image_info->tile_x = cp->tdx; /* new version parser */
++ image_info->tile_y = cp->tdy; /* new version parser */
++ image_info->tile_Ox = cp->tx0; /* new version parser */
++ image_info->tile_Oy = cp->ty0; /* new version parser */
++ image_info->comp = image->numcomps;
++ image_info->layer = (&cp->tcps[0])->numlayers;
++ image_info->decomposition = (&cp->tcps[0])->tccps->numresolutions - 1;
++ image_info->D_max = 0; /* ADD Marcela */
++ }
++ /* << INDEX */
++
++ j2k_write_soc(j2k);
++ j2k_write_siz(j2k);
++/* UniPG>> */
++#ifdef USE_JPWL
++ /** THIS CODE IS NOT USED */
++ //if(image_info && image_info->index_on && cp->epc_on)
++ // j2k_write_epc(j2k);
++#endif /* USE_JPWL */
++/* <<UniPG */
++ j2k_write_cod(j2k);
++ j2k_write_qcd(j2k);
++ for (compno = 0; compno < image->numcomps; compno++) {
++ opj_tcp_t *tcp = &cp->tcps[0];
++ if (tcp->tccps[compno].roishift)
++ j2k_write_rgn(j2k, compno, 0);
++ }
++ if (cp->comment != NULL) {
++ j2k_write_com(j2k);
++ }
++ /* INDEX >> */
++ if(image_info && image_info->index_on) {
++ image_info->main_head_end = cio_tell(cio) - 1;
++ }
++ /* << INDEX */
++
++ /* create the tile encoder */
++ tcd = tcd_create(j2k->cinfo);
++
++ /* encode each tile */
++
++ for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
++ opj_event_msg(j2k->cinfo, EVT_INFO, "tile number %d / %d\n", tileno + 1, cp->tw * cp->th);
++
++ j2k->curtileno = tileno;
++
++ /* initialisation before tile encoding */
++ if (tileno == 0) {
++ tcd_malloc_encode(tcd, image, cp, j2k->curtileno);
++ } else {
++ tcd_init_encode(tcd, image, cp, j2k->curtileno);
++ }
++
++ /* INDEX >> */
++ if(image_info && image_info->index_on) {
++ image_info->tile[j2k->curtileno].num_tile = j2k->curtileno;
++ image_info->tile[j2k->curtileno].start_pos = cio_tell(cio) + j2k->pos_correction;
++ }
++ /* << INDEX */
++
++ j2k_write_sot(j2k);
++
++ for (compno = 1; compno < image->numcomps; compno++) {
++ j2k_write_coc(j2k, compno);
++ j2k_write_qcc(j2k, compno);
++ }
++ if (cp->tcps[tileno].numpocs) {
++ j2k_write_poc(j2k);
++ }
++
++ j2k_write_sod(j2k, tcd);
++
++ /* INDEX >> */
++ if(image_info && image_info->index_on) {
++ image_info->tile[j2k->curtileno].end_pos = cio_tell(cio) + j2k->pos_correction - 1;
++ }
++ /* << INDEX */
++
++
++ /*
++ if (tile->PPT) { // BAD PPT !!!
++ FILE *PPT_file;
++ int i;
++ PPT_file=fopen("PPT","rb");
++ fprintf(stderr,"%c%c%c%c",255,97,tile->len_ppt/256,tile->len_ppt%256);
++ for (i=0;i<tile->len_ppt;i++) {
++ unsigned char elmt;
++ fread(&elmt, 1, 1, PPT_file);
++ fwrite(&elmt,1,1,f);
++ }
++ fclose(PPT_file);
++ unlink("PPT");
++ }
++ */
++
++ }
++
++ /* destroy the tile encoder */
++ tcd_free_encode(tcd);
++ tcd_destroy(tcd);
++
++ j2k_write_eoc(j2k);
++
++ /* Creation of the index file */
++ if(image_info && image_info->index_on) {
++ if(!j2k_create_index(j2k, cio, image_info, index)) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to create index file %s\n", index);
++ return false;
++ }
++ }
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ /*
++ preparation of JPWL marker segments: can be finalized only when the whole
++ codestream is known
++ */
++ if(image_info && image_info->index_on && cp->epc_on) {
++
++ /* let's begin creating a marker list, according to user wishes */
++ jpwl_prepare_marks(j2k, cio, image);
++
++ /* now we dump the JPWL markers on the codestream */
++ jpwl_dump_marks(j2k, cio, image);
++
++ /* do not know exactly what is this for,
++ but it gets called during index creation */
++ j2k->pos_correction = 0;
++
++ /* Re-creation of the index file, with updated info */
++ if(image_info && image_info->index_on) {
++ if(!j2k_create_index(j2k, cio, image_info, index)) {
++ opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to re-create index file %s\n", index);
++ return false;
++ }
++ }
++
++ /* now we finalize the marker contents */
++ /*jpwl_finalize_marks(j2k, cio, image);*/
++
++ }
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++ return true;
++}
++
+diff -Naur OpenJPEG/libopenjpeg/j2k.c.rej OpenJPEG-patched/libopenjpeg/j2k.c.rej
+--- OpenJPEG/libopenjpeg/j2k.c.rej 1970-01-01 01:00:00.000000000 +0100
++++ OpenJPEG-patched/libopenjpeg/j2k.c.rej 2007-03-17 14:18:44.000000000 +0100
+@@ -0,0 +1,16 @@
++***************
++*** 1522,1527 ****
++ opj_cp_t *cp = (opj_cp_t*)opj_malloc(sizeof(opj_cp_t));
++ cp->reduce = parameters->cp_reduce;
++ cp->layer = parameters->cp_layer;
++ /* UniPG>> */
++ #ifdef USE_JPWL
++ cp->correct = parameters->jpwl_correct;
++--- 1524,1530 ----
++ opj_cp_t *cp = (opj_cp_t*)opj_malloc(sizeof(opj_cp_t));
++ cp->reduce = parameters->cp_reduce;
++ cp->layer = parameters->cp_layer;
+++ cp->limit_tags = parameters->cp_limit_tags;
++ /* UniPG>> */
++ #ifdef USE_JPWL
++ cp->correct = parameters->jpwl_correct;
+diff -Naur OpenJPEG/libopenjpeg/j2k.h OpenJPEG-patched/libopenjpeg/j2k.h
+--- OpenJPEG/libopenjpeg/j2k.h 2007-02-19 10:59:29.000000000 +0100
++++ OpenJPEG-patched/libopenjpeg/j2k.h 2007-03-17 14:20:28.000000000 +0100
+@@ -200,6 +200,8 @@
+ /** if == NO_LIMITATION, decode entire codestream; if == LIMIT_TO_MAIN_HEADER then only decode the main header */
+ OPJ_LIMIT_DECODING limit_decoding;
+ /** 0 = no index || 1 = index */
++ /** if != 0, then only decode specific tags, abort on any other; if == 0 decode all tags */
++ OPJ_LIMIT_TAGS limit_tags;
+ int index_on;
+ /** XTOsiz */
+ int tx0;
+diff -Naur OpenJPEG/libopenjpeg/j2k.h.orig OpenJPEG-patched/libopenjpeg/j2k.h.orig
+--- OpenJPEG/libopenjpeg/j2k.h.orig 1970-01-01 01:00:00.000000000 +0100
++++ OpenJPEG-patched/libopenjpeg/j2k.h.orig 2007-02-19 10:59:29.000000000 +0100
+@@ -0,0 +1,484 @@
++/*
++ * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
++ * Copyright (c) 2002-2007, Professor Benoit Macq
++ * Copyright (c) 2001-2003, David Janssens
++ * Copyright (c) 2002-2003, Yannick Verschueren
++ * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
++ * Copyright (c) 2005, Herve Drolon, FreeImage Team
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ */
++#ifndef __J2K_H
++#define __J2K_H
++/**
++@file j2k.h
++@brief The JPEG-2000 Codestream Reader/Writer (J2K)
++
++The functions in J2K.C have for goal to read/write the several parts of the codestream: markers and data.
++*/
++
++/** @defgroup J2K J2K - JPEG-2000 codestream reader/writer */
++/*@{*/
++
++#define J2K_CP_CSTY_PRT 0x01
++#define J2K_CP_CSTY_SOP 0x02
++#define J2K_CP_CSTY_EPH 0x04
++#define J2K_CCP_CSTY_PRT 0x01
++#define J2K_CCP_CBLKSTY_LAZY 0x01
++#define J2K_CCP_CBLKSTY_RESET 0x02
++#define J2K_CCP_CBLKSTY_TERMALL 0x04
++#define J2K_CCP_CBLKSTY_VSC 0x08
++#define J2K_CCP_CBLKSTY_PTERM 0x10
++#define J2K_CCP_CBLKSTY_SEGSYM 0x20
++#define J2K_CCP_QNTSTY_NOQNT 0
++#define J2K_CCP_QNTSTY_SIQNT 1
++#define J2K_CCP_QNTSTY_SEQNT 2
++
++/* ----------------------------------------------------------------------- */
++
++#define J2K_MS_SOC 0xff4f /**< SOC marker value */
++#define J2K_MS_SOT 0xff90 /**< SOT marker value */
++#define J2K_MS_SOD 0xff93 /**< SOD marker value */
++#define J2K_MS_EOC 0xffd9 /**< EOC marker value */
++#define J2K_MS_SIZ 0xff51 /**< SIZ marker value */
++#define J2K_MS_COD 0xff52 /**< COD marker value */
++#define J2K_MS_COC 0xff53 /**< COC marker value */
++#define J2K_MS_RGN 0xff5e /**< RGN marker value */
++#define J2K_MS_QCD 0xff5c /**< QCD marker value */
++#define J2K_MS_QCC 0xff5d /**< QCC marker value */
++#define J2K_MS_POC 0xff5f /**< POC marker value */
++#define J2K_MS_TLM 0xff55 /**< TLM marker value */
++#define J2K_MS_PLM 0xff57 /**< PLM marker value */
++#define J2K_MS_PLT 0xff58 /**< PLT marker value */
++#define J2K_MS_PPM 0xff60 /**< PPM marker value */
++#define J2K_MS_PPT 0xff61 /**< PPT marker value */
++#define J2K_MS_SOP 0xff91 /**< SOP marker value */
++#define J2K_MS_EPH 0xff92 /**< EPH marker value */
++#define J2K_MS_CRG 0xff63 /**< CRG marker value */
++#define J2K_MS_COM 0xff64 /**< COM marker value */
++/* UniPG>> */
++#ifdef USE_JPWL
++#define J2K_MS_EPC 0xff68 /**< EPC marker value (Part11) */
++#define J2K_MS_EPB 0xff66 /**< EPB marker value (Part11) */
++#define J2K_MS_ESD 0xff67 /**< ESD marker value (Part11) */
++#define J2K_MS_RED 0xff69 /**< RED marker value (Part11) */
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++/* ----------------------------------------------------------------------- */
++
++/**
++Values that specify the status of the decoding process when decoding the main header.
++These values may be combined with a | operator.
++*/
++typedef enum J2K_STATUS {
++ J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
++ J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
++ J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
++ J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
++ J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
++ J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
++ J2K_STATE_NEOC = 0x0040 /**< the decoding process must not expect a EOC marker because the codestream is truncated */
++} J2K_STATUS;
++
++/* ----------------------------------------------------------------------- */
++
++/**
++Quantization stepsize
++*/
++typedef struct opj_stepsize {
++ /** exponent */
++ int expn;
++ /** mantissa */
++ int mant;
++} opj_stepsize_t;
++
++/**
++Tile-component coding parameters
++*/
++typedef struct opj_tccp {
++ /** coding style */
++ int csty;
++ /** number of resolutions */
++ int numresolutions;
++ /** code-blocks width */
++ int cblkw;
++ /** code-blocks height */
++ int cblkh;
++ /** code-block coding style */
++ int cblksty;
++ /** discrete wavelet transform identifier */
++ int qmfbid;
++ /** quantisation style */
++ int qntsty;
++ /** stepsizes used for quantization */
++ opj_stepsize_t stepsizes[J2K_MAXBANDS];
++ /** number of guard bits */
++ int numgbits;
++ /** Region Of Interest shift */
++ int roishift;
++ /** precinct width */
++ int prcw[J2K_MAXRLVLS];
++ /** precinct height */
++ int prch[J2K_MAXRLVLS];
++} opj_tccp_t;
++
++/**
++Tile coding parameters :
++this structure is used to store coding/decoding parameters common to all
++tiles (information like COD, COC in main header)
++*/
++typedef struct opj_tcp {
++ /** 1 : first part-tile of a tile */
++ int first;
++ /** coding style */
++ int csty;
++ /** progression order */
++ OPJ_PROG_ORDER prg;
++ /** number of layers */
++ int numlayers;
++ /** multi-component transform identifier */
++ int mct;
++ /** rates of layers */
++ float rates[100];
++ /** number of progression order changes */
++ int numpocs;
++ /** indicates if a POC marker has been used O:NO, 1:YES */
++ int POC;
++ /** progression order changes */
++ opj_poc_t pocs[32];
++ /** packet header store there for futur use in t2_decode_packet */
++ unsigned char *ppt_data;
++ /** pointer remaining on the first byte of the first header if ppt is used */
++ unsigned char *ppt_data_first;
++ /** If ppt == 1 --> there was a PPT marker for the present tile */
++ int ppt;
++ /** used in case of multiple marker PPT (number of info already stored) */
++ int ppt_store;
++ /** ppmbug1 */
++ int ppt_len;
++ /** add fixed_quality */
++ float distoratio[100];
++ /** tile-component coding parameters */
++ opj_tccp_t *tccps;
++} opj_tcp_t;
++
++/**
++Coding parameters
++*/
++typedef struct opj_cp {
++ /** allocation by rate/distortion */
++ int disto_alloc;
++ /** allocation by fixed layer */
++ int fixed_alloc;
++ /** add fixed_quality */
++ int fixed_quality;
++ /** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */
++ int reduce;
++ /** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
++ int layer;
++ /** if == NO_LIMITATION, decode entire codestream; if == LIMIT_TO_MAIN_HEADER then only decode the main header */
++ OPJ_LIMIT_DECODING limit_decoding;
++ /** 0 = no index || 1 = index */
++ int index_on;
++ /** XTOsiz */
++ int tx0;
++ /** YTOsiz */
++ int ty0;
++ /** XTsiz */
++ int tdx;
++ /** YTsiz */
++ int tdy;
++ /** comment for coding */
++ char *comment;
++ /** number of tiles in width */
++ int tw;
++ /** number of tiles in heigth */
++ int th;
++ /** ID number of the tiles present in the codestream */
++ int *tileno;
++ /** size of the vector tileno */
++ int tileno_size;
++ /** packet header store there for futur use in t2_decode_packet */
++ unsigned char *ppm_data;
++ /** pointer remaining on the first byte of the first header if ppm is used */
++ unsigned char *ppm_data_first;
++ /** if ppm == 1 --> there was a PPM marker for the present tile */
++ int ppm;
++ /** use in case of multiple marker PPM (number of info already store) */
++ int ppm_store;
++ /** use in case of multiple marker PPM (case on non-finished previous info) */
++ int ppm_previous;
++ /** ppmbug1 */
++ int ppm_len;
++ /** tile coding parameters */
++ opj_tcp_t *tcps;
++ /** fixed layer */
++ int *matrice;
++/* UniPG>> */
++#ifdef USE_JPWL
++ /** enables writing of EPC in MH, thus activating JPWL */
++ bool epc_on;
++ /** enables writing of EPB, in case of activated JPWL */
++ bool epb_on;
++ /** enables writing of ESD, in case of activated JPWL */
++ bool esd_on;
++ /** enables writing of informative techniques of ESD, in case of activated JPWL */
++ bool info_on;
++ /** enables writing of RED, in case of activated JPWL */
++ bool red_on;
++ /** error protection method for MH (0,1,16,32,37-128) */
++ int hprot_MH;
++ /** tile number of header protection specification (>=0) */
++ int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
++ /** error protection methods for TPHs (0,1,16,32,37-128) */
++ int hprot_TPH[JPWL_MAX_NO_TILESPECS];
++ /** tile number of packet protection specification (>=0) */
++ int pprot_tileno[JPWL_MAX_NO_PACKSPECS];
++ /** packet number of packet protection specification (>=0) */
++ int pprot_packno[JPWL_MAX_NO_PACKSPECS];
++ /** error protection methods for packets (0,1,16,32,37-128) */
++ int pprot[JPWL_MAX_NO_PACKSPECS];
++ /** enables writing of ESD, (0/2/4 bytes) */
++ int sens_size;
++ /** sensitivity addressing size (0=auto/2/4 bytes) */
++ int sens_addr;
++ /** sensitivity range (0-3) */
++ int sens_range;
++ /** sensitivity method for MH (-1,0-7) */
++ int sens_MH;
++ /** tile number of sensitivity specification (>=0) */
++ int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
++ /** sensitivity methods for TPHs (-1,0-7) */
++ int sens_TPH[JPWL_MAX_NO_TILESPECS];
++ /** enables JPWL correction at the decoder */
++ bool correct;
++ /** expected number of components at the decoder */
++ int exp_comps;
++ /** maximum number of tiles at the decoder */
++ int max_tiles;
++#endif /* USE_JPWL */
++/* <<UniPG */
++} opj_cp_t;
++
++/**
++Information concerning a packet inside tile
++*/
++typedef struct opj_packet_info {
++ /** start position */
++ int start_pos;
++ /** end position */
++ int end_pos;
++ /** ADD for Marcela */
++ double disto;
++} opj_packet_info_t;
++
++/**
++Index structure : information regarding tiles inside image
++*/
++typedef struct opj_tile_info {
++ /** value of thresh for each layer by tile cfr. Marcela */
++ double *thresh;
++ /** number of tile */
++ int num_tile;
++ /** start position */
++ int start_pos;
++ /** end position of the header */
++ int end_header;
++ /** end position */
++ int end_pos;
++ /** precinct number for each resolution level (width) */
++ int pw[33];
++ /** precinct number for each resolution level (height) */
++ int ph[33];
++ /** precinct size (in power of 2), in X for each resolution level */
++ int pdx[33];
++ /** precinct size (in power of 2), in Y for each resolution level */
++ int pdy[33];
++ /** information concerning packets inside tile */
++ opj_packet_info_t *packet;
++ /** add fixed_quality */
++ int nbpix;
++ /** add fixed_quality */
++ double distotile;
++} opj_tile_info_t;
++
++/**
++Index structure
++*/
++typedef struct opj_image_info {
++ /** 0 = no index || 1 = index */
++ int index_on;
++ /** maximum distortion reduction on the whole image (add for Marcela) */
++ double D_max;
++ /** packet number */
++ int num;
++ /** writing the packet in the index with t2_encode_packets */
++ int index_write;
++ /** image width */
++ int image_w;
++ /** image height */
++ int image_h;
++ /** progression order */
++ OPJ_PROG_ORDER prog;
++ /** tile size in x */
++ int tile_x;
++ /** tile size in y */
++ int tile_y;
++ /** */
++ int tile_Ox;
++ /** */
++ int tile_Oy;
++ /** number of tiles in X */
++ int tw;
++ /** number of tiles in Y */
++ int th;
++ /** component numbers */
++ int comp;
++ /** number of layer */
++ int layer;
++ /** number of decomposition */
++ int decomposition;
++ /** main header position */
++ int main_head_end;
++ /** codestream's size */
++ int codestream_size;
++ /** information regarding tiles inside image */
++ opj_tile_info_t *tile;
++} opj_image_info_t;
++
++/**
++JPEG-2000 codestream reader/writer
++*/
++typedef struct opj_j2k {
++ /** codec context */
++ opj_common_ptr cinfo;
++
++ /** locate in which part of the codestream the decoder is (main header, tile header, end) */
++ int state;
++ /** number of the tile curently concern by coding/decoding */
++ int curtileno;
++ /**
++ locate the position of the end of the tile in the codestream,
++ used to detect a truncated codestream (in j2k_read_sod)
++ */
++ unsigned char *eot;
++ /**
++ locate the start position of the SOT marker of the current coded tile:
++ after encoding the tile, a jump (in j2k_write_sod) is done to the SOT marker to store the value of its length.
++ */
++ int sot_start;
++ int sod_start;
++ /**
++ as the J2K-file is written in several parts during encoding,
++ it enables to make the right correction in position return by cio_tell
++ */
++ int pos_correction;
++ /** array used to store the data of each tile */
++ unsigned char **tile_data;
++ /** array used to store the length of each tile */
++ int *tile_len;
++ /**
++ decompression only :
++ store decoding parameters common to all tiles (information like COD, COC in main header)
++ */
++ opj_tcp_t *default_tcp;
++ /** pointer to the encoded / decoded image */
++ opj_image_t *image;
++ /** pointer to the coding parameters */
++ opj_cp_t *cp;
++ /** helper used to write the index file */
++ opj_image_info_t *image_info;
++ /** pointer to the byte i/o stream */
++ opj_cio_t *cio;
++} opj_j2k_t;
++
++/** @name Exported functions */
++/*@{*/
++/* ----------------------------------------------------------------------- */
++/**
++Creates a J2K decompression structure
++@param cinfo Codec context info
++@return Returns a handle to a J2K decompressor if successful, returns NULL otherwise
++*/
++opj_j2k_t* j2k_create_decompress(opj_common_ptr cinfo);
++/**
++Destroy a J2K decompressor handle
++@param j2k J2K decompressor handle to destroy
++*/
++void j2k_destroy_decompress(opj_j2k_t *j2k);
++/**
++Setup the decoder decoding parameters using user parameters.
++Decoding parameters are returned in j2k->cp.
++@param j2k J2K decompressor handle
++@param parameters decompression parameters
++*/
++void j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters);
++/**
++Decode an image from a JPEG-2000 codestream
++@param j2k J2K decompressor handle
++@param cio Input buffer stream
++@return Returns a decoded image if successful, returns NULL otherwise
++*/
++opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio);
++/**
++Decode an image form a JPT-stream (JPEG 2000, JPIP)
++@param j2k J2K decompressor handle
++@param cio Input buffer stream
++@return Returns a decoded image if successful, returns NULL otherwise
++*/
++opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio);
++/**
++Creates a J2K compression structure
++@param cinfo Codec context info
++@return Returns a handle to a J2K compressor if successful, returns NULL otherwise
++*/
++opj_j2k_t* j2k_create_compress(opj_common_ptr cinfo);
++/**
++Destroy a J2K compressor handle
++@param j2k J2K compressor handle to destroy
++*/
++void j2k_destroy_compress(opj_j2k_t *j2k);
++/**
++Setup the encoder parameters using the current image and using user parameters.
++Coding parameters are returned in j2k->cp.
++@param j2k J2K compressor handle
++@param parameters compression parameters
++@param image input filled image
++*/
++void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_t *image);
++/**
++Encode an image into a JPEG-2000 codestream
++@param j2k J2K compressor handle
++@param cio Output buffer stream
++@param image Image to encode
++@param index Name of the index file if required, NULL otherwise
++@return Returns true if successful, returns false otherwise
++*/
++bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, char *index);
++/* ----------------------------------------------------------------------- */
++/*@}*/
++
++/*@}*/
++
++#endif /* __J2K_H */
+diff -Naur OpenJPEG/libopenjpeg/openjpeg.h OpenJPEG-patched/libopenjpeg/openjpeg.h
+--- OpenJPEG/libopenjpeg/openjpeg.h 2007-02-23 11:48:11.000000000 +0100
++++ OpenJPEG-patched/libopenjpeg/openjpeg.h 2007-03-17 14:18:28.000000000 +0100
+@@ -319,6 +319,41 @@
+
+ } opj_cparameters_t;
+
++/** Stop after tags. */
++typedef enum LIMIT_TAGS {
++ OPJ_TAG_SOC = 0x000001, /**< start of codestream */
++ OPJ_TAG_SOT = 0x000002, /**< start of tile-part*/
++ OPJ_TAG_SOD = 0x000004, /**< start of data */
++ OPJ_TAG_EOC = 0x000008, /**< end of codestream */
++ OPJ_TAG_SIZ = 0x000010, /**< image and tile size */
++ OPJ_TAG_COD = 0x000020, /**< coding style default */
++ OPJ_TAG_COC = 0x000040, /**< coding style component */
++ OPJ_TAG_RGN = 0x000080, /**< region-of-interest */
++ OPJ_TAG_QCD = 0x000100, /**< quantization default */
++ OPJ_TAG_QCC = 0x000200, /**< quantization component */
++ OPJ_TAG_POC = 0x000400, /**< progression order change */
++ OPJ_TAG_TLM = 0x000800, /**< tile-part lengths */
++ OPJ_TAG_PLM = 0x001000, /**< packet length, main header */
++ OPJ_TAG_PLT = 0x002000, /**< packet length, tile-part header */
++ OPJ_TAG_PPM = 0x004000, /**< packet packet headers, main header */
++ OPJ_TAG_PPT = 0x008000, /**< packet packet headers, tile-part header */
++ OPJ_TAG_SOP = 0x010000, /**< SOP marker value */
++ OPJ_TAG_EPH = 0x020000, /**< EPH marker value */
++ OPJ_TAG_CRG = 0x040000, /**< component registration */
++ OPJ_TAG_COM = 0x080000, /**< comment */
++#ifdef USE_JPWL
++/* UniPG>> */
++ OPJ_TAG_EPC = 0x100000, /**< EPC marker value (Part11) */
++ OPJ_TAG_EPB = 0x200000, /**< EPB marker value (Part11) */
++ OPJ_TAG_ESD = 0x400000, /**< ESD marker value (Part11) */
++ OPJ_TAG_RED = 0x800000, /**< RED marker value (Part11) */
++#endif /* USE_JPWL */
++/* <<UniPG */
++} OPJ_LIMIT_TAGS;
++
++/** The needed tags to decode just the size of the image. */
++#define OPJ_LIMIT_FOR_SIZE (OPJ_LIMIT_TAGS)(OPJ_TAG_SOC | OPJ_TAG_SIZ )
++
+ /**
+ Decompression parameters
+ */
+@@ -338,6 +373,15 @@
+ if == 0 or not used, all the quality layers are decoded
+ */
+ int cp_layer;
++ /**
++ Limits the tags that are decoded.
++ This is a bitwise OR of the tags to be decoded. If a tag is
++ encountered that isn't in the list decoding ceases and the function
++ returns.
++ if != 0 only the given tags are decoded.
++ if == 0 all tags are decoded.
++ */
++ OPJ_LIMIT_TAGS cp_limit_tags;
+
+ /**
+ Specify whether the decoding should be done on the entire codestream, or be limited to the main header
+diff -Naur OpenJPEG/libopenjpeg/openjpeg.h.orig OpenJPEG-patched/libopenjpeg/openjpeg.h.orig
+--- OpenJPEG/libopenjpeg/openjpeg.h.orig 1970-01-01 01:00:00.000000000 +0100
++++ OpenJPEG-patched/libopenjpeg/openjpeg.h.orig 2007-02-23 11:48:11.000000000 +0100
+@@ -0,0 +1,704 @@
++ /*
++ * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
++ * Copyright (c) 2002-2007, Professor Benoit Macq
++ * Copyright (c) 2001-2003, David Janssens
++ * Copyright (c) 2002-2003, Yannick Verschueren
++ * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
++ * Copyright (c) 2005, Herve Drolon, FreeImage Team
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ */
++#ifndef OPENJPEG_H
++#define OPENJPEG_H
++
++#define OPENJPEG_VERSION "1.1.1"
++
++/*
++==========================================================
++ Compiler directives
++==========================================================
++*/
++
++#if defined(OPJ_STATIC) || !(defined(WIN32) || defined(__WIN32__))
++#define OPJ_API
++#define OPJ_CALLCONV
++#else
++#define OPJ_CALLCONV __stdcall
++/*
++The following ifdef block is the standard way of creating macros which make exporting
++from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
++symbol defined on the command line. this symbol should not be defined on any project
++that uses this DLL. This way any other project whose source files include this file see
++OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
++defined with this macro as being exported.
++*/
++#ifdef OPJ_EXPORTS
++#define OPJ_API __declspec(dllexport)
++#else
++#define OPJ_API __declspec(dllimport)
++#endif /* OPJ_EXPORTS */
++#endif /* !OPJ_STATIC || !WIN32 */
++
++#ifndef __cplusplus
++#if defined(HAVE_STDBOOL_H)
++/*
++The C language implementation does correctly provide the standard header
++file "stdbool.h".
++ */
++#include <stdbool.h>
++#else
++/*
++The C language implementation does not provide the standard header file
++"stdbool.h" as required by ISO/IEC 9899:1999. Try to compensate for this
++braindamage below.
++*/
++#if !defined(bool)
++#define bool int
++#endif
++#if !defined(true)
++#define true 1
++#endif
++#if !defined(false)
++#define false 0
++#endif
++#endif
++#endif /* __cplusplus */
++
++/*
++==========================================================
++ Useful constant definitions
++==========================================================
++*/
++
++#define OPJ_PATH_LEN 4096 /**< Maximum allowed size for filenames */
++
++#define J2K_MAXRLVLS 33 /**< Number of maximum resolution level authorized */
++#define J2K_MAXBANDS (3*J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
++
++/* UniPG>> */
++#ifdef USE_JPWL
++#define JPWL_MAX_NO_TILESPECS 16 /**< Maximum number of tile parts expected by JPWL: increase at your will */
++#define JPWL_MAX_NO_PACKSPECS 16 /**< Maximum number of packet parts expected by JPWL: increase at your will */
++#define JPWL_MAX_NO_MARKERS 512 /**< Maximum number of JPWL markers: increase at your will */
++#define JPWL_PRIVATEINDEX_NAME "jpwl_index_privatefilename" /**< index file name used when JPWL is on */
++#define JPWL_EXPECTED_COMPONENTS 3 /**< Expect this number of components, so you'll find better the first EPB */
++#define JPWL_MAXIMUM_TILES 8192 /**< Expect this maximum number of tiles, to avoid some crashes */
++#define JPWL_MAXIMUM_HAMMING 2 /**< Expect this maximum number of bit errors in marker id's */
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++/*
++==========================================================
++ enum definitions
++==========================================================
++*/
++
++/** Progression order */
++typedef enum PROG_ORDER {
++ PROG_UNKNOWN = -1, /**< place-holder */
++ LRCP = 0, /**< layer-resolution-component-precinct order */
++ RLCP = 1, /**< resolution-layer-component-precinct order */
++ RPCL = 2, /**< resolution-precinct-component-layer order */
++ PCRL = 3, /**< precinct-component-resolution-layer order */
++ CPRL = 4 /**< component-precinct-resolution-layer order */
++} OPJ_PROG_ORDER;
++
++/**
++Supported image color spaces
++*/
++typedef enum COLOR_SPACE {
++ CLRSPC_UNKNOWN = -1, /**< place-holder */
++ CLRSPC_SRGB = 1, /**< sRGB */
++ CLRSPC_GRAY = 2, /**< grayscale */
++ CLRSPC_SYCC = 3 /**< YUV */
++} OPJ_COLOR_SPACE;
++
++/**
++Supported codec
++*/
++typedef enum CODEC_FORMAT {
++ CODEC_UNKNOWN = -1, /**< place-holder */
++ CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */
++ CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */
++ CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */
++} OPJ_CODEC_FORMAT;
++
++/**
++Limit decoding to certain portions of the codestream.
++*/
++typedef enum LIMIT_DECODING {
++ NO_LIMITATION = 0, /**< No limitation for the decoding. The entire codestream will de decoded */
++ LIMIT_TO_MAIN_HEADER = 1 /**< The decoding is limited to the Main Header */
++} OPJ_LIMIT_DECODING;
++
++/*
++==========================================================
++ event manager typedef definitions
++==========================================================
++*/
++
++/**
++Callback function prototype for events
++@param msg Event message
++@param client_data
++*/
++typedef void (*opj_msg_callback) (const char *msg, void *client_data);
++
++/**
++Message handler object
++used for
++<ul>
++<li>Error messages
++<li>Warning messages
++<li>Debugging messages
++</ul>
++*/
++typedef struct opj_event_mgr {
++ /** Error message callback if available, NULL otherwise */
++ opj_msg_callback error_handler;
++ /** Warning message callback if available, NULL otherwise */
++ opj_msg_callback warning_handler;
++ /** Debug message callback if available, NULL otherwise */
++ opj_msg_callback info_handler;
++} opj_event_mgr_t;
++
++
++/*
++==========================================================
++ codec typedef definitions
++==========================================================
++*/
++
++/**
++Progression order changes
++*/
++typedef struct opj_poc {
++ int resno0, compno0;
++ int layno1, resno1, compno1;
++ OPJ_PROG_ORDER prg;
++ int tile;
++ char progorder[4];
++} opj_poc_t;
++
++/**
++Compression parameters
++*/
++typedef struct opj_cparameters {
++ /** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
++ bool tile_size_on;
++ /** XTOsiz */
++ int cp_tx0;
++ /** YTOsiz */
++ int cp_ty0;
++ /** XTsiz */
++ int cp_tdx;
++ /** YTsiz */
++ int cp_tdy;
++ /** allocation by rate/distortion */
++ int cp_disto_alloc;
++ /** allocation by fixed layer */
++ int cp_fixed_alloc;
++ /** add fixed_quality */
++ int cp_fixed_quality;
++ /** fixed layer */
++ int *cp_matrice;
++ /** comment for coding */
++ char *cp_comment;
++ /** csty : coding style */
++ int csty;
++ /** progression order (default LRCP) */
++ OPJ_PROG_ORDER prog_order;
++ /** progression order changes */
++ opj_poc_t POC[32];
++ /** number of progression order changes (POC), default to 0 */
++ int numpocs;
++ /** number of layers */
++ int tcp_numlayers;
++ /** rates of layers */
++ float tcp_rates[100];
++ /** different psnr for successive layers */
++ float tcp_distoratio[100];
++ /** number of resolutions */
++ int numresolution;
++ /** initial code block width, default to 64 */
++ int cblockw_init;
++ /** initial code block height, default to 64 */
++ int cblockh_init;
++ /** mode switch (cblk_style) */
++ int mode;
++ /** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */
++ int irreversible;
++ /** region of interest: affected component in [0..3], -1 means no ROI */
++ int roi_compno;
++ /** region of interest: upshift value */
++ int roi_shift;
++ /* number of precinct size specifications */
++ int res_spec;
++ /** initial precinct width */
++ int prcw_init[J2K_MAXRLVLS];
++ /** initial precinct height */
++ int prch_init[J2K_MAXRLVLS];
++
++ /**@name command line encoder parameters (not used inside the library) */
++ /*@{*/
++ /** input file name */
++ char infile[OPJ_PATH_LEN];
++ /** output file name */
++ char outfile[OPJ_PATH_LEN];
++ /** creation of an index file, default to 0 (false) */
++ int index_on;
++ /** index file name */
++ char index[OPJ_PATH_LEN];
++ /** subimage encoding: origin image offset in x direction */
++ int image_offset_x0;
++ /** subimage encoding: origin image offset in y direction */
++ int image_offset_y0;
++ /** subsampling value for dx */
++ int subsampling_dx;
++ /** subsampling value for dy */
++ int subsampling_dy;
++ /** input file format 0: PGX, 1: PxM, 2: BMP */
++ int decod_format;
++ /** output file format 0: J2K, 1: JP2, 2: JPT */
++ int cod_format;
++ /*@}*/
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ /**@name JPWL encoding parameters */
++ /*@{*/
++ /** enables writing of EPC in MH, thus activating JPWL */
++ bool jpwl_epc_on;
++ /** error protection method for MH (0,1,16,32,37-128) */
++ int jpwl_hprot_MH;
++ /** tile number of header protection specification (>=0) */
++ int jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
++ /** error protection methods for TPHs (0,1,16,32,37-128) */
++ int jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS];
++ /** tile number of packet protection specification (>=0) */
++ int jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS];
++ /** packet number of packet protection specification (>=0) */
++ int jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS];
++ /** error protection methods for packets (0,1,16,32,37-128) */
++ int jpwl_pprot[JPWL_MAX_NO_PACKSPECS];
++ /** enables writing of ESD, (0=no/1/2 bytes) */
++ int jpwl_sens_size;
++ /** sensitivity addressing size (0=auto/2/4 bytes) */
++ int jpwl_sens_addr;
++ /** sensitivity range (0-3) */
++ int jpwl_sens_range;
++ /** sensitivity method for MH (-1=no,0-7) */
++ int jpwl_sens_MH;
++ /** tile number of sensitivity specification (>=0) */
++ int jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
++ /** sensitivity methods for TPHs (-1=no,0-7) */
++ int jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS];
++ /*@}*/
++#endif /* USE_JPWL */
++/* <<UniPG */
++
++} opj_cparameters_t;
++
++/**
++Decompression parameters
++*/
++typedef struct opj_dparameters {
++ /**
++ Set the number of highest resolution levels to be discarded.
++ The image resolution is effectively divided by 2 to the power of the number of discarded levels.
++ The reduce factor is limited by the smallest total number of decomposition levels among tiles.
++ if != 0, then original dimension divided by 2^(reduce);
++ if == 0 or not used, image is decoded to the full resolution
++ */
++ int cp_reduce;
++ /**
++ Set the maximum number of quality layers to decode.
++ If there are less quality layers than the specified number, all the quality layers are decoded.
++ if != 0, then only the first "layer" layers are decoded;
++ if == 0 or not used, all the quality layers are decoded
++ */
++ int cp_layer;
++
++ /**
++ Specify whether the decoding should be done on the entire codestream, or be limited to the main header
++ Limiting the decoding to the main header makes it possible to extract the characteristics of the codestream
++ if == NO_LIMITATION, the entire codestream is decoded;
++ if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
++ */
++ OPJ_LIMIT_DECODING cp_limit_decoding;
++
++ /**@name command line encoder parameters (not used inside the library) */
++ /*@{*/
++ /** input file name */
++ char infile[OPJ_PATH_LEN];
++ /** output file name */
++ char outfile[OPJ_PATH_LEN];
++ /** input file format 0: J2K, 1: JP2, 2: JPT */
++ int decod_format;
++ /** output file format 0: PGX, 1: PxM, 2: BMP */
++ int cod_format;
++ /*@}*/
++
++/* UniPG>> */
++#ifdef USE_JPWL
++ /**@name JPWL decoding parameters */
++ /*@{*/
++ /** activates the JPWL correction capabilities */
++ bool jpwl_correct;
++ /** expected number of components */
++ int jpwl_exp_comps;
++ /** maximum number of tiles */
++ int jpwl_max_tiles;
++ /*@}*/
++#endif /* USE_JPWL */
++/* <<UniPG */
++} opj_dparameters_t;
++
++/** Common fields between JPEG-2000 compression and decompression master structs. */
++
++#define opj_common_fields \
++ opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
++ void * client_data; /**< Available for use by application */\
++ bool is_decompressor; /**< So common code can tell which is which */\
++ OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
++ void *j2k_handle; /**< pointer to the J2K codec */\
++ void *jp2_handle /**< pointer to the JP2 codec */
++
++/* Routines that are to be used by both halves of the library are declared
++ * to receive a pointer to this structure. There are no actual instances of
++ * opj_common_struct_t, only of opj_cinfo_t and opj_dinfo_t.
++ */
++typedef struct opj_common_struct {
++ opj_common_fields; /* Fields common to both master struct types */
++ /* Additional fields follow in an actual opj_cinfo_t or
++ * opj_dinfo_t. All three structs must agree on these
++ * initial fields! (This would be a lot cleaner in C++.)
++ */
++} opj_common_struct_t;
++
++typedef opj_common_struct_t * opj_common_ptr;
++
++/**
++Compression context info
++*/
++typedef struct opj_cinfo {
++ /** Fields shared with opj_dinfo_t */
++ opj_common_fields;
++ /* other specific fields go here */
++} opj_cinfo_t;
++
++/**
++Decompression context info
++*/
++typedef struct opj_dinfo {
++ /** Fields shared with opj_cinfo_t */
++ opj_common_fields;
++ /* other specific fields go here */
++} opj_dinfo_t;
++
++/*
++==========================================================
++ I/O stream typedef definitions
++==========================================================
++*/
++
++/*
++ * Stream open flags.
++ */
++/** The stream was opened for reading. */
++#define OPJ_STREAM_READ 0x0001
++/** The stream was opened for writing. */
++#define OPJ_STREAM_WRITE 0x0002
++
++/**
++Byte input-output stream (CIO)
++*/
++typedef struct opj_cio {
++ /** codec context */
++ opj_common_ptr cinfo;
++
++ /** open mode (read/write) either OPJ_STREAM_READ or OPJ_STREAM_WRITE */
++ int openmode;
++ /** pointer to the start of the buffer */
++ unsigned char *buffer;
++ /** buffer size in bytes */
++ int length;
++
++ /** pointer to the start of the stream */
++ unsigned char *start;
++ /** pointer to the end of the stream */
++ unsigned char *end;
++ /** pointer to the current position */
++ unsigned char *bp;
++} opj_cio_t;
++
++/*
++==========================================================
++ image typedef definitions
++==========================================================
++*/
++
++/**
++Defines a single image component
++*/
++typedef struct opj_image_comp {
++ /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
++ int dx;
++ /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
++ int dy;
++ /** data width */
++ int w;
++ /** data height */
++ int h;
++ /** x component offset compared to the whole image */
++ int x0;
++ /** y component offset compared to the whole image */
++ int y0;
++ /** precision */
++ int prec;
++ /** image depth in bits */
++ int bpp;
++ /** signed (1) / unsigned (0) */
++ int sgnd;
++ /** number of decoded resolution */
++ int resno_decoded;
++ /** number of division by 2 of the out image compared to the original size of image */
++ int factor;
++ /** image component data */
++ int *data;
++} opj_image_comp_t;
++
++/**
++Defines image data and characteristics
++*/
++typedef struct opj_image {
++ /** XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area */
++ int x0;
++ /** YOsiz: vertical offset from the origin of the reference grid to the top side of the image area */
++ int y0;
++ /** Xsiz: width of the reference grid */
++ int x1;
++ /** Ysiz: height of the reference grid */
++ int y1;
++ /** number of components in the image */
++ int numcomps;
++ /** color space: sRGB, Greyscale or YUV */
++ OPJ_COLOR_SPACE color_space;
++ /** image components */
++ opj_image_comp_t *comps;
++} opj_image_t;
++
++/**
++Component parameters structure used by the opj_image_create function
++*/
++typedef struct opj_image_comptparm {
++ /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
++ int dx;
++ /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
++ int dy;
++ /** data width */
++ int w;
++ /** data height */
++ int h;
++ /** x component offset compared to the whole image */
++ int x0;
++ /** y component offset compared to the whole image */
++ int y0;
++ /** precision */
++ int prec;
++ /** image depth in bits */
++ int bpp;
++ /** signed (1) / unsigned (0) */
++ int sgnd;
++} opj_image_cmptparm_t;
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++
++/*
++==========================================================
++ openjpeg version
++==========================================================
++*/
++
++OPJ_API const char * OPJ_CALLCONV opj_version();
++
++/*
++==========================================================
++ image functions definitions
++==========================================================
++*/
++
++/**
++Create an image
++@param numcmpts number of components
++@param cmptparms components parameters
++@param clrspc image color space
++@return returns a new image structure if successful, returns NULL otherwise
++*/
++OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);
++
++/**
++Deallocate any resources associated with an image
++@param image image to be destroyed
++*/
++OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image);
++
++/*
++==========================================================
++ stream functions definitions
++==========================================================
++*/
++
++/**
++Open and allocate a memory stream for read / write.
++On reading, the user must provide a buffer containing encoded data. The buffer will be
++wrapped by the returned CIO handle.
++On writing, buffer parameters must be set to 0: a buffer will be allocated by the library
++to contain encoded data.
++@param cinfo Codec context info
++@param buffer Reading: buffer address. Writing: NULL
++@param length Reading: buffer length. Writing: 0
++@return Returns a CIO handle if successful, returns NULL otherwise
++*/
++OPJ_API opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length);
++
++/**
++Close and free a CIO handle
++@param cio CIO handle to free
++*/
++OPJ_API void OPJ_CALLCONV opj_cio_close(opj_cio_t *cio);
++
++/**
++Get position in byte stream
++@param cio CIO handle
++@return Returns the position in bytes
++*/
++OPJ_API int OPJ_CALLCONV cio_tell(opj_cio_t *cio);
++/**
++Set position in byte stream
++@param cio CIO handle
++@param pos Position, in number of bytes, from the beginning of the stream
++*/
++OPJ_API void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos);
++
++/*
++==========================================================
++ event manager functions definitions
++==========================================================
++*/
++
++OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context);
++
++/*
++==========================================================
++ codec functions definitions
++==========================================================
++*/
++/**
++Creates a J2K/JPT/JP2 decompression structure
++@param format Decoder to select
++@return Returns a handle to a decompressor if successful, returns NULL otherwise
++*/
++OPJ_API opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format);
++/**
++Destroy a decompressor handle
++@param dinfo decompressor handle to destroy
++*/
++OPJ_API void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo);
++/**
++Set decoding parameters to default values
++@param parameters Decompression parameters
++*/
++OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters);
++/**
++Setup the decoder decoding parameters using user parameters.
++Decoding parameters are returned in j2k->cp.
++@param dinfo decompressor handle
++@param parameters decompression parameters
++*/
++OPJ_API void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters);
++/**
++Decode an image from a JPEG-2000 codestream
++@param dinfo decompressor handle
++@param cio Input buffer stream
++@return Returns a decoded image if successful, returns NULL otherwise
++*/
++OPJ_API opj_image_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio);
++/**
++Creates a J2K/JP2 compression structure
++@param format Coder to select
++@return Returns a handle to a compressor if successful, returns NULL otherwise
++*/
++OPJ_API opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format);
++/**
++Destroy a compressor handle
++@param cinfo compressor handle to destroy
++*/
++OPJ_API void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo);
++/**
++Set encoding parameters to default values, that means :
++<ul>
++<li>Lossless
++<li>1 tile
++<li>Size of precinct : 2^15 x 2^15 (means 1 precinct)
++<li>Size of code-block : 64 x 64
++<li>Number of resolutions: 6
++<li>No SOP marker in the codestream
++<li>No EPH marker in the codestream
++<li>No sub-sampling in x or y direction
++<li>No mode switch activated
++<li>Progression order: LRCP
++<li>No index file
++<li>No ROI upshifted
++<li>No offset of the origin of the image
++<li>No offset of the origin of the tiles
++<li>Reversible DWT 5-3
++</ul>
++@param parameters Compression parameters
++*/
++OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters);
++/**
++Setup the encoder parameters using the current image and using user parameters.
++@param cinfo compressor handle
++@param parameters compression parameters
++@param image input filled image
++*/
++OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image);
++/**
++Encode an image into a JPEG-2000 codestream
++@param cinfo compressor handle
++@param cio Output buffer stream
++@param image Image to encode
++@param index Name of the index file if required, NULL otherwise
++@return Returns true if successful, returns false otherwise
++*/
++OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* OPENJPEG_H */
diff --git a/media-libs/openjpeg/files/digest-openjpeg-1.1.1 b/media-libs/openjpeg/files/digest-openjpeg-1.1.1
new file mode 100644
index 0000000..c726c97
--- /dev/null
+++ b/media-libs/openjpeg/files/digest-openjpeg-1.1.1
@@ -0,0 +1,3 @@
+MD5 55ce1119efd3efb3d689ca2105afd10e openjpeg_v1_1_1.tar.gz 1406460
+RMD160 08b2318441075a8704d6b9b0ac3d9d277c44d85e openjpeg_v1_1_1.tar.gz 1406460
+SHA256 6076db131bfaa966a691d718044e5b5cdbec028436be3b7a3f146d1a0e3a7ec6 openjpeg_v1_1_1.tar.gz 1406460
diff --git a/media-libs/openjpeg/files/openjpeg-1.1.1-gentoo.patch b/media-libs/openjpeg/files/openjpeg-1.1.1-gentoo.patch
new file mode 100644
index 0000000..fdb0b9c
--- /dev/null
+++ b/media-libs/openjpeg/files/openjpeg-1.1.1-gentoo.patch
@@ -0,0 +1,20 @@
+diff -Naur OpenJPEG.orig/Makefile OpenJPEG/Makefile
+--- OpenJPEG.orig/Makefile 2007-02-13 17:49:00.000000000 +0900
++++ OpenJPEG/Makefile 2007-02-24 11:47:31.000000000 +0900
+@@ -36,7 +36,7 @@
+ dist: OpenJPEG
+ mkdir -p dist
+ cp *.a dist
+- mv *.so dist
++ cp *.so dist
+ cp libopenjpeg/openjpeg.h dist
+
+ dos2unix:
+@@ -57,7 +57,6 @@
+ install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+ install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
+ ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
+- ldconfig
+
+ clean:
+ rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
diff --git a/media-libs/openjpeg/openjpeg-1.1.1.ebuild b/media-libs/openjpeg/openjpeg-1.1.1.ebuild
new file mode 100644
index 0000000..008ef72
--- /dev/null
+++ b/media-libs/openjpeg/openjpeg-1.1.1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="An open-source JPEG 2000 codec written in C"
+HOMEPAGE="http://www.openjpeg.org/"
+SRC_URI="http://www.openjpeg.org/openjpeg_v${PV//./_}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64 ~x86"
+IUSE=""
+
+S="${WORKDIR}/OpenJPEG"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-gentoo.patch
+ epatch "${FILESDIR}"/OPJ_limit_tags_for_decode_UPDATED.patch
+}
+
+src_compile() {
+ append-flags -fPIC
+ emake CC="$(tc-getCC)" COMPILERFLAGS="${CFLAGS}" || die "emake failed"
+}
+
+src_install() {
+ dodir /usr/$(get_libdir)
+ emake INSTALLDIR="${D}usr/$(get_libdir)" install || die "install failed"
+
+ insinto /usr/include
+ doins libopenjpeg/openjpeg.h
+
+ dodoc ChangeLog README.linux
+}