MFV r355071: libbsdxml (expat) 2.2.9.

MFC after:	2 weeks
Relnotes:	yes
This commit is contained in:
delphij 2019-11-25 07:48:16 +00:00
commit 084caaa165
64 changed files with 13374 additions and 14409 deletions

View File

@ -2,6 +2,162 @@ NOTE: We are looking for help with a few things:
https://github.com/libexpat/libexpat/labels/help%20wanted
If you can help, please get in touch. Thanks!
Release 2.2.9 Wed Septemper 25 2019
Other changes:
examples: Drop executable bits from elements.c
#349 Windows: Change the name of the Windows DLLs from expat*.dll
to libexpat*.dll once more (regression from 2.2.8, first
fixed in 1.95.3, issue #61 on SourceForge today,
was issue #432456 back then); needs a fix due
case-insensitive file systems on Windows and the fact that
Perl's XML::Parser::Expat compiles into Expat.dll.
#347 Windows: Only define _CRT_RAND_S if not defined
Version info bumped from 7:10:6 to 7:11:6
Special thanks to:
Ben Wagner
Release 2.2.8 Fri Septemper 13 2019
Security fixes:
#317 #318 CVE-2019-15903 -- Fix heap overflow triggered by
XML_GetCurrentLineNumber (or XML_GetCurrentColumnNumber),
and deny internal entities closing the doctype;
fixed in commit c20b758c332d9a13afbbb276d30db1d183a85d43
Bug fixes:
#240 Fix cases where XML_StopParser did not have any effect
when called from inside of an end element handler
#341 xmlwf: Fix exit code for operation without "-d DIRECTORY";
previously, only "-d DIRECTORY" would give you a proper
exit code:
# xmlwf -d . <<<'<not well-formed>' 2>/dev/null ; echo $?
2
# xmlwf <<<'<not well-formed>' 2>/dev/null ; echo $?
0
Now both cases return exit code 2.
Other changes:
#299 #302 Windows: Replace LoadLibrary hack to access
unofficial API function SystemFunction036 (RtlGenRandom)
by using official API function rand_s (needs WinXP+)
#325 Windows: Drop support for Visual Studio <=7.1/2003
and document supported compilers in README.md
#286 Windows: Remove COM code from xmlwf; in case it turns
out needed later, there will be a dedicated repository
below https://github.com/libexpat/ for that code
#322 Windows: Remove explicit MSVC solution and project files.
You can generate Visual Studio solution files through
CMake, e.g.: cmake -G"Visual Studio 15 2017" .
#338 xmlwf: Make "xmlwf -h" help output more friendly
#339 examples: Improve elements.c
#244 #264 Autotools: Add argument --enable-xml-attr-info
#239 #301 Autotools: Add arguments
--with-getrandom
--without-getrandom
--with-sys-getrandom
--without-sys-getrandom
#312 #343 Autotools: Fix linking issues with "./configure LD=clang"
Autotools: Fix "make run-xmltest" for out-of-source builds
#329 #336 CMake: Pull all options from Expat <=2.2.7 into namespace
prefix EXPAT_ with the exception of DOCBOOK_TO_MAN:
- BUILD_doc -> EXPAT_BUILD_DOCS (plural)
- BUILD_examples -> EXPAT_BUILD_EXAMPLES
- BUILD_shared -> EXPAT_SHARED_LIBS
- BUILD_tests -> EXPAT_BUILD_TESTS
- BUILD_tools -> EXPAT_BUILD_TOOLS
- DOCBOOK_TO_MAN -> DOCBOOK_TO_MAN (unchanged)
- INSTALL -> EXPAT_ENABLE_INSTALL
- MSVC_USE_STATIC_CRT -> EXPAT_MSVC_STATIC_CRT
- USE_libbsd -> EXPAT_WITH_LIBBSD
- WARNINGS_AS_ERRORS -> EXPAT_WARNINGS_AS_ERRORS
- XML_CONTEXT_BYTES -> EXPAT_CONTEXT_BYTES
- XML_DEV_URANDOM -> EXPAT_DEV_URANDOM
- XML_DTD -> EXPAT_DTD
- XML_NS -> EXPAT_NS
- XML_UNICODE -> EXPAT_CHAR_TYPE=ushort (!)
- XML_UNICODE_WCHAR_T -> EXPAT_CHAR_TYPE=wchar_t (!)
#244 #264 CMake: Add argument -DEXPAT_ATTR_INFO=(ON|OFF),
default OFF
#326 CMake: Add argument -DEXPAT_LARGE_SIZE=(ON|OFF),
default OFF
#328 CMake: Add argument -DEXPAT_MIN_SIZE=(ON|OFF),
default OFF
#239 #277 CMake: Add arguments
-DEXPAT_WITH_GETRANDOM=(ON|OFF|AUTO), default AUTO
-DEXPAT_WITH_SYS_GETRANDOM=(ON|OFF|AUTO), default AUTO
#326 CMake: Install expat_config.h to include directory
#326 CMake: Generate and install configuration files for
future find_package(expat [..] CONFIG [..])
CMake: Now produces a summary of applied configuration
CMake: Require C++ compiler only when tests are enabled
#330 CMake: Fix compilation for 16bit character types,
i.e. ex -DXML_UNICODE=ON (and ex -DXML_UNICODE_WCHAR_T=ON)
#265 CMake: Fix linking with MinGW
#330 CMake: Add full support for MinGW; to enable, use
-DCMAKE_TOOLCHAIN_FILE=[expat]/cmake/mingw-toolchain.cmake
#330 CMake: Port "make run-xmltest" from GNU Autotools to CMake
#316 CMake: Windows: Make binary postfix match MSVC
Old: expat[d].lib
New: expat[w][d][MD|MT].lib
CMake: Migrate files from Windows to Unix line endings
#308 CMake: Integrate OSS-Fuzz fuzzers, option
-DEXPAT_BUILD_FUZZERS=(ON|OFF), default OFF
#14 Drop an OpenVMS support leftover
#235 #268 ..
#270 #310 ..
#313 #331 #333 Address compiler warnings
#282 #283 ..
#284 #285 Address cppcheck warnings
#294 #295 Address Clang Static Analyzer warnings
#24 #293 Mass-apply clang-format 9 (and ensure conformance during CI)
Version info bumped from 7:9:6 to 7:10:6
Special thanks to:
David Loffredo
Joonun Jang
Khajapasha Mohammed
Kishore Kunche
Marco Maggi
Mitch Phillips
Rolf Ade
xantares
Zhongyuan Zhou
Release 2.2.7 Wed June 19 2019
Security fixes:
#186 #262 CVE-2018-20843 -- Fix extraction of namespace prefixes from
XML names; XML names with multiple colons could end up in
the wrong namespace, and take a high amount of RAM and CPU
resources while processing, opening the door to
use for denial-of-service attacks
Other changes:
#195 #197 Autotools/CMake: Utilize -fvisibility=hidden to stop
exporting non-API symbols
#227 Autotools: Add --without-examples and --without-tests
#228 Autotools: Modernize configure.ac
#245 #246 Autotools: Fix check for -fvisibility=hidden for Clang
#247 #248 Autotools: Fix compilation for lack of docbook2x-man
#236 #258 Autotools: Produce .tar.{gz,lz,xz} release archives
#212 CMake: Make libdir of pkgconfig expat.pc support multilib
#158 #263 CMake: Build man page in PROJECT_BINARY_DIR not _SOURCE_DIR
#219 Remove fallback to bcopy, assume that memmove(3) exists
#257 Use portable "/usr/bin/env bash" shebang (e.g. for OpenBSD)
#243 Windows: Fix syntax of .def module definition files
Version info bumped from 7:8:6 to 7:9:6
Special thanks to:
Benjamin Peterson
Caolán McNamara
Hanno Böck
KangLin
Kishore Kunche
Marco Maggi
Rhodri James
Sebastian Dröge
userwithuid
Yury Gribov
Release 2.2.6 Sun August 12 2018
Bug fixes:
#170 #206 Avoid doing arithmetic with NULL pointers in XML_GetBuffer

View File

@ -8,6 +8,7 @@
*.pc.in
*.vcxproj*
*config.h
cmake
CMake*
Configure*
amiga

View File

@ -30,14 +30,21 @@
AUTOMAKE_OPTIONS = \
dist-bzip2 \
dist-lzip \
dist-xz \
foreign \
no-dist-gzip \
subdir-objects
ACLOCAL_AMFLAGS = -I m4
LIBTOOLFLAGS = --verbose
SUBDIRS = lib examples tests # lib goes first to build first
SUBDIRS = lib # lib goes first to build first
if WITH_EXAMPLES
SUBDIRS += examples
endif
if WITH_TESTS
SUBDIRS += tests
endif
if WITH_XMLWF
SUBDIRS += xmlwf doc
endif
@ -47,41 +54,19 @@ pkgconfigdir = $(libdir)/pkgconfig
_EXTRA_DIST_CMAKE = \
cmake/expat-config.cmake.in \
cmake/mingw-toolchain.cmake \
\
CMakeLists.txt \
CMake.README \
ConfigureChecks.cmake \
expat_config.h.cmake
_EXTRA_DIST_WINDOWS = \
examples/elements.vcxproj \
examples/elements.vcxproj.filters \
examples/outline.vcxproj \
examples/outline.vcxproj.filters \
\
lib/expat_static.vcxproj \
lib/expat_static.vcxproj.filters \
lib/expat.vcxproj \
lib/expat.vcxproj.filters \
lib/expatw_static.vcxproj \
lib/expatw_static.vcxproj.filters \
lib/expatw.vcxproj \
lib/expatw.vcxproj.filters \
\
tests/benchmark/benchmark.sln \
tests/benchmark/benchmark.vcxproj \
\
tests/runtests.sln \
tests/runtests.vcxproj \
tests/runtests.vcxproj.filters \
\
win32/build_expat_iss.bat \
win32/expat.iss \
win32/MANIFEST.txt \
win32/README.txt \
\
xmlwf/xmlwf.vcxproj \
xmlwf/xmlwf.vcxproj.filters \
\
expat.sln
win32/README.txt
EXTRA_DIST = \
$(_EXTRA_DIST_CMAKE) \
@ -91,8 +76,13 @@ EXTRA_DIST = \
conftools/get-version.sh \
conftools/PrintPath \
\
xmlwf/xmlwf_helpgen.py \
xmlwf/xmlwf_helpgen.sh \
\
Changes \
README.md \
\
fix-xmltest-log.sh \
test-driver-wrapper.sh
@ -121,7 +111,8 @@ run-benchmark:
$(MAKE) -C tests/benchmark
./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
tests/xmlts.zip:
.PHONY: download-xmlts-zip
download-xmlts-zip:
if test "$(XMLTS_ZIP)" = ""; then \
wget --output-document=tests/xmlts.zip \
https://www.w3.org/XML/Test/xmlts20080827.zip; \
@ -129,16 +120,26 @@ tests/xmlts.zip:
cp $(XMLTS_ZIP) tests/xmlts.zip; \
fi
tests/xmlconf: tests/xmlts.zip
tests/xmlts.zip:
$(MAKE) download-xmlts-zip
.PHONY: extract-xmlts-zip
extract-xmlts-zip: tests/xmlts.zip
[ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip # vpath workaround
cd tests && unzip -q xmlts.zip
tests/xmlconf: tests/xmlts.zip
$(MAKE) extract-xmlts-zip
.PHONY: run-xmltest
run-xmltest: tests/xmlconf
if WITH_XMLWF
[ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip # vpath workaround
$(MAKE) -C lib
$(MAKE) -C xmlwf
tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log
dos2unix tests/xmltest.log
diff -u tests/xmltest.log.expected tests/xmltest.log
$(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log
$(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log
diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log
else
@echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2
@echo 'ERROR: Please re-configure without --without-xmlwf.' >&2
@ -147,7 +148,7 @@ endif
.PHONY: qa
qa:
./qa.sh address
./qa.sh memory
./qa.sh undefined
./qa.sh coverage
QA_COMPILER=clang QA_SANITIZER=address ./qa.sh
QA_COMPILER=clang QA_SANITIZER=memory ./qa.sh
QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh
QA_COMPILER=gcc QA_PROCESSOR=gcov ./qa.sh

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -118,13 +118,22 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@WITH_XMLWF_TRUE@am__append_1 = xmlwf doc
@WITH_EXAMPLES_TRUE@am__append_1 = examples
@WITH_TESTS_TRUE@am__append_2 = tests
@WITH_XMLWF_TRUE@am__append_3 = xmlwf doc
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@ -199,7 +208,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)expat_config.h.in
# Read a list of newline-separated strings from the standard input,
@ -224,14 +233,15 @@ CSCOPE = cscope
DIST_SUBDIRS = lib examples tests xmlwf doc
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/expat.pc.in \
$(srcdir)/expat_config.h.in $(srcdir)/run.sh.in \
$(top_srcdir)/conftools/compile \
$(top_srcdir)/conftools/ar-lib $(top_srcdir)/conftools/compile \
$(top_srcdir)/conftools/config.guess \
$(top_srcdir)/conftools/config.sub \
$(top_srcdir)/conftools/install-sh \
$(top_srcdir)/conftools/ltmain.sh \
$(top_srcdir)/conftools/missing AUTHORS COPYING \
conftools/compile conftools/config.guess conftools/config.sub \
conftools/install-sh conftools/ltmain.sh conftools/missing
conftools/ar-lib conftools/compile conftools/config.guess \
conftools/config.sub conftools/depcomp conftools/install-sh \
conftools/ltmain.sh conftools/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -267,9 +277,10 @@ am__relativize = \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).tar.lz \
$(distdir).tar.xz
GZIP_ENV = --best
DIST_ARCHIVES = $(distdir).tar.bz2
DIST_TARGETS = dist-bzip2
DIST_TARGETS = dist-lzip dist-xz dist-bzip2 dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@ -402,51 +413,30 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = \
dist-bzip2 \
dist-lzip \
dist-xz \
foreign \
no-dist-gzip \
subdir-objects
ACLOCAL_AMFLAGS = -I m4
LIBTOOLFLAGS = --verbose
SUBDIRS = lib examples tests $(am__append_1)
SUBDIRS = lib $(am__append_1) $(am__append_2) $(am__append_3)
pkgconfig_DATA = expat.pc
pkgconfigdir = $(libdir)/pkgconfig
_EXTRA_DIST_CMAKE = \
cmake/expat-config.cmake.in \
cmake/mingw-toolchain.cmake \
\
CMakeLists.txt \
CMake.README \
ConfigureChecks.cmake \
expat_config.h.cmake
_EXTRA_DIST_WINDOWS = \
examples/elements.vcxproj \
examples/elements.vcxproj.filters \
examples/outline.vcxproj \
examples/outline.vcxproj.filters \
\
lib/expat_static.vcxproj \
lib/expat_static.vcxproj.filters \
lib/expat.vcxproj \
lib/expat.vcxproj.filters \
lib/expatw_static.vcxproj \
lib/expatw_static.vcxproj.filters \
lib/expatw.vcxproj \
lib/expatw.vcxproj.filters \
\
tests/benchmark/benchmark.sln \
tests/benchmark/benchmark.vcxproj \
\
tests/runtests.sln \
tests/runtests.vcxproj \
tests/runtests.vcxproj.filters \
\
win32/build_expat_iss.bat \
win32/expat.iss \
win32/MANIFEST.txt \
win32/README.txt \
\
xmlwf/xmlwf.vcxproj \
xmlwf/xmlwf.vcxproj.filters \
\
expat.sln
win32/README.txt
EXTRA_DIST = \
$(_EXTRA_DIST_CMAKE) \
@ -456,8 +446,13 @@ EXTRA_DIST = \
conftools/get-version.sh \
conftools/PrintPath \
\
xmlwf/xmlwf_helpgen.py \
xmlwf/xmlwf_helpgen.sh \
\
Changes \
README.md \
\
fix-xmltest-log.sh \
test-driver-wrapper.sh
all: expat_config.h
@ -485,8 +480,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -653,7 +648,10 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@ -723,11 +721,9 @@ dist-gzip: distdir
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
@ -994,7 +990,8 @@ run-benchmark:
$(MAKE) -C tests/benchmark
./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
tests/xmlts.zip:
.PHONY: download-xmlts-zip
download-xmlts-zip:
if test "$(XMLTS_ZIP)" = ""; then \
wget --output-document=tests/xmlts.zip \
https://www.w3.org/XML/Test/xmlts20080827.zip; \
@ -1002,25 +999,35 @@ tests/xmlts.zip:
cp $(XMLTS_ZIP) tests/xmlts.zip; \
fi
tests/xmlconf: tests/xmlts.zip
tests/xmlts.zip:
$(MAKE) download-xmlts-zip
.PHONY: extract-xmlts-zip
extract-xmlts-zip: tests/xmlts.zip
[ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip # vpath workaround
cd tests && unzip -q xmlts.zip
tests/xmlconf: tests/xmlts.zip
$(MAKE) extract-xmlts-zip
.PHONY: run-xmltest
run-xmltest: tests/xmlconf
@WITH_XMLWF_TRUE@ [ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip # vpath workaround
@WITH_XMLWF_TRUE@ $(MAKE) -C lib
@WITH_XMLWF_TRUE@ $(MAKE) -C xmlwf
@WITH_XMLWF_TRUE@ tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log
@WITH_XMLWF_TRUE@ dos2unix tests/xmltest.log
@WITH_XMLWF_TRUE@ diff -u tests/xmltest.log.expected tests/xmltest.log
@WITH_XMLWF_TRUE@ $(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log
@WITH_XMLWF_TRUE@ $(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log
@WITH_XMLWF_TRUE@ diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log
@WITH_XMLWF_FALSE@ @echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2
@WITH_XMLWF_FALSE@ @echo 'ERROR: Please re-configure without --without-xmlwf.' >&2
@WITH_XMLWF_FALSE@ @false
.PHONY: qa
qa:
./qa.sh address
./qa.sh memory
./qa.sh undefined
./qa.sh coverage
QA_COMPILER=clang QA_SANITIZER=address ./qa.sh
QA_COMPILER=clang QA_SANITIZER=memory ./qa.sh
QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh
QA_COMPILER=gcc QA_PROCESSOR=gcov ./qa.sh
# 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.

View File

@ -1,8 +1,9 @@
[![Travis CI Build Status](https://travis-ci.org/libexpat/libexpat.svg?branch=master)](https://travis-ci.org/libexpat/libexpat)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat)
[![Packaging status](https://repology.org/badge/tiny-repos/expat.svg)](https://repology.org/metapackage/expat/versions)
# Expat, Release 2.2.6
# Expat, Release 2.2.9
This is Expat, a C library for parsing XML, started by
[James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997.
@ -12,6 +13,11 @@ are called when the parser discovers the associated structures in the
document being parsed. A start tag is an example of the kind of
structures for which you may register handlers.
Expat supports the following compilers:
- GNU GCC >=4.5
- LLVM Clang >=3.5
- Microsoft Visual Studio >=8.0/2005
Windows users should use the
[`expat_win32` package](https://sourceforge.net/projects/expat/files/expat_win32/),
which includes both precompiled libraries and executables, and source code for
@ -124,3 +130,59 @@ information.
A reference manual is available in the file `doc/reference.html` in this
distribution.
The CMake build system is still *experimental* and will replace the primary
build system based on GNU Autotools at some point when it is ready.
For an idea of the available (non-advanced) options for building with CMake:
```console
# rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,'
// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=
// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local
// Path to a program.
DOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man
// build man page for xmlwf
EXPAT_BUILD_DOCS:BOOL=ON
// build the examples for expat library
EXPAT_BUILD_EXAMPLES:BOOL=ON
// build fuzzers for the expat library
EXPAT_BUILD_FUZZERS:BOOL=OFF
// build the tests for expat library
EXPAT_BUILD_TESTS:BOOL=ON
// build the xmlwf tool for expat library
EXPAT_BUILD_TOOLS:BOOL=ON
// Character type to use (char|ushort|wchar_t) [default=char]
EXPAT_CHAR_TYPE:STRING=char
// install expat files in cmake install target
EXPAT_ENABLE_INSTALL:BOOL=ON
// Use /MT flag (static CRT) when compiling in MSVC
EXPAT_MSVC_STATIC_CRT:BOOL=OFF
// build a shared expat library
EXPAT_SHARED_LIBS:BOOL=ON
// Treat all compiler warnings as errors
EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF
// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]
EXPAT_WITH_GETRANDOM:STRING=AUTO
// utilize libbsd (for arc4random_buf)
EXPAT_WITH_LIBBSD:BOOL=OFF
// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]
EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO
```

View File

@ -10,8 +10,8 @@ dnl under the terms of the License (based on the MIT/X license) contained
dnl in the file COPYING that comes with this distribution.
dnl
dnl Ensure that Expat is configured with autoconf 2.58 or newer
AC_PREREQ(2.58)
dnl Ensure that Expat is configured with autoconf 2.69 or newer.
AC_PREREQ(2.69)
dnl Get the version number of Expat, using m4's esyscmd() command to run
dnl the command at m4-generation time. This allows us to create an m4
@ -23,16 +23,18 @@ dnl
dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate
dnl test. I believe this test will work, but I don't have a place with non-
dnl GNU M4 to test it right now.
define([expat_version], ifdef([__gnu__],
[esyscmd(conftools/get-version.sh lib/expat.h)],
[2.2.x]))
m4_define([expat_version],
m4_ifdef([__gnu__],
[esyscmd(conftools/get-version.sh lib/expat.h)],
[2.2.x]))
AC_INIT(expat, expat_version, expat-bugs@libexpat.org)
undefine([expat_version])
m4_undefine([expat_version])
AC_CONFIG_SRCDIR(Makefile.in)
AC_CONFIG_AUX_DIR(conftools)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([Makefile.in])
AC_CONFIG_AUX_DIR([conftools])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
dnl
@ -46,161 +48,207 @@ dnl
dnl If the API changes incompatibly set LIBAGE back to 0
dnl
LIBCURRENT=7 # sync
LIBREVISION=8 # with
LIBAGE=6 # CMakeLists.txt!
LIBCURRENT=7 # sync
LIBREVISION=11 # with
LIBAGE=6 # CMakeLists.txt!
CPPFLAGS="${CPPFLAGS} -DHAVE_EXPAT_CONFIG_H"
AC_CONFIG_HEADER(expat_config.h)
AX_APPEND_FLAG([-DHAVE_EXPAT_CONFIG_H], [CPPFLAGS])
AC_CONFIG_HEADER([expat_config.h])
sinclude(conftools/ac_c_bigendian_cross.m4)
AM_PROG_AR
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
LT_PREREQ([2.4])
LT_INIT([win32-dll])
AC_SUBST(LIBCURRENT)
AC_SUBST(LIBREVISION)
AC_SUBST(LIBAGE)
dnl Checks for programs.
AC_LANG([C])
AC_PROG_CC_C99
AS_IF([test "$GCC" = yes],
[AX_APPEND_COMPILE_FLAGS([-Wall -Wextra], [CFLAGS])
dnl Be careful about adding the -fexceptions option; some versions of
dnl GCC don't support it and it causes extra warnings that are only
dnl distracting; avoid.
AX_APPEND_COMPILE_FLAGS([-fexceptions], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing -Wmissing-prototypes -Wstrict-prototypes], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-pedantic -Wduplicated-cond -Wduplicated-branches -Wlogical-op], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-Wrestrict -Wnull-dereference -Wjump-misses-init -Wdouble-promotion], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-Wshadow -Wformat=2 -Wmisleading-indentation], [CFLAGS])])
AC_LANG_PUSH([C++])
AC_PROG_CXX
AC_PROG_INSTALL
AS_IF([test "$GCC" = yes],
[AX_APPEND_COMPILE_FLAGS([-Wall -Wextra], [CXXFLAGS])
dnl Be careful about adding the -fexceptions option; some versions of
dnl GCC don't support it and it causes extra warnings that are only
dnl distracting; avoid.
AX_APPEND_COMPILE_FLAGS([-fexceptions], [CXXFLAGS])
AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing], [CXXFLAGS])])
AC_LANG_POP([C++])
if test "$GCC" = yes ; then
dnl
dnl Be careful about adding the -fexceptions option; some versions of
dnl GCC don't support it and it causes extra warnings that are only
dnl distracting; avoid.
dnl
OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
CFLAGS="$OLDCFLAGS -fexceptions"
AC_MSG_CHECKING(whether $CC accepts -fexceptions)
AC_TRY_LINK( , ,
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
if test "x$CXXFLAGS" = x ; then
CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
fi
AS_IF([test "$GCC" = yes],
[AX_APPEND_LINK_FLAGS([-fno-strict-aliasing],[LDFLAGS])])
CFLAGS="${CFLAGS} -fno-strict-aliasing"
CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
LDFLAGS="${LDFLAGS} -fno-strict-aliasing"
fi
dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang (issue #312)
AS_CASE(["$LD"],[*clang*],
[AS_CASE(["${host_os}"],
[*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
EXPATCFG_COMPILER_SUPPORTS_VISIBILITY([
AX_APPEND_FLAG([-fvisibility=hidden], [CFLAGS])
AX_APPEND_FLAG([-DXML_ENABLE_VISIBILITY=1], [CFLAGS])])
dnl Checks for header files.
AC_HEADER_STDC
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Note: Avoid using AC_C_BIGENDIAN because it does not
dnl work in a cross compile.
AC_C_BIGENDIAN_CROSS
dnl We define BYTEORDER to 1234 when the platform is little endian; it
dnl defines it to 4321 when the platform is big endian. We also define
dnl WORDS_BIGENDIAN to 1 when the platform is big endian.
dnl
dnl A long time ago (early 2000 years) AC_C_BIGENDIAN was considered
dnl wrong when cross compiling, now (2018, GNU Autoconf 2.69) we assume
dnl it is fine.
AC_C_BIGENDIAN([AC_DEFINE([WORDS_BIGENDIAN], 1)
AS_VAR_SET([BYTEORDER], 4321)],
[AS_VAR_SET([BYTEORDER], 1234)])
AC_DEFINE_UNQUOTED([BYTEORDER], $BYTEORDER, [1234 = LILENDIAN, 4321 = BIGENDIAN])
AC_C_CONST
AC_TYPE_SIZE_T
AC_CHECK_FUNCS(memmove bcopy)
AC_ARG_WITH([xmlwf], [
AS_HELP_STRING([--without-xmlwf], [do not build xmlwf])], [], [with_xmlwf=yes])
AC_ARG_WITH([xmlwf],
[AS_HELP_STRING([--without-xmlwf], [do not build xmlwf])],
[],
[with_xmlwf=yes])
AM_CONDITIONAL([WITH_XMLWF], [test x${with_xmlwf} = xyes])
AM_CONDITIONAL([MINGW], [echo -- "${host}" | ${FGREP} mingw >/dev/null])
AC_ARG_WITH([examples],
[AS_HELP_STRING([--without-examples], [do not build examples @<:@default=included@:>@])],
[],
[with_examples=yes])
AM_CONDITIONAL([WITH_EXAMPLES], [test x${with_examples} = xyes])
AC_ARG_WITH([tests],
[AS_HELP_STRING([--without-tests], [do not build tests @<:@default=included@:>@])],
[],
[with_tests=yes])
AM_CONDITIONAL([WITH_TESTS], [test x${with_tests} = xyes])
AS_VAR_SET([EXPATCFG_ON_MINGW],[no])
AS_CASE("${host_os}",
[mingw*],
[AS_VAR_SET([EXPATCFG_ON_MINGW],[yes])
AC_MSG_NOTICE([detected OS: MinGW])])
AM_CONDITIONAL([MINGW], [test x${EXPATCFG_ON_MINGW} = xyes])
AM_CONDITIONAL([UNICODE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_UNICODE >/dev/null])
AC_ARG_WITH([libbsd], [
AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)])
], [], [with_libbsd=no])
AS_IF([test "x${with_libbsd}" != xno], [
AC_CHECK_LIB([bsd], [arc4random_buf], [], [
AS_IF([test "x${with_libbsd}" = xyes], [
AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.])
])
])
])
AC_ARG_WITH([libbsd],
[AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)])],
[],
[with_libbsd=no])
AS_IF([test "x${with_libbsd}" != xno],
[AC_CHECK_LIB([bsd],
[arc4random_buf],
[],
[AS_IF([test "x${with_libbsd}" = xyes],
[AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.])])])])
AC_MSG_CHECKING([for arc4random_buf (BSD or libbsd)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for arc4random_buf on BSD, for NULL */
#if defined(HAVE_LIBBSD)
# include <bsd/stdlib.h>
#endif
int main() {
arc4random_buf(NULL, 0U);
return 0;
}
])], [
AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1],
[Define to 1 if you have the `arc4random_buf' function.])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
#include <stdlib.h> /* for arc4random_buf on BSD, for NULL */
#if defined(HAVE_LIBBSD)
# include <bsd/stdlib.h>
#endif
int main() {
arc4random_buf(NULL, 0U);
return 0;
}
])],
[AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1], [Define to 1 if you have the `arc4random_buf' function.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([for arc4random (BSD, macOS or libbsd)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#if defined(HAVE_LIBBSD)
# include <bsd/stdlib.h>
#else
# include <stdlib.h>
#endif
int main() {
AC_MSG_CHECKING([for arc4random (BSD, macOS or libbsd)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#if defined(HAVE_LIBBSD)
# include <bsd/stdlib.h>
#else
# include <stdlib.h>
#endif
int main() {
arc4random();
return 0;
}
])], [
AC_DEFINE([HAVE_ARC4RANDOM], [1],
[Define to 1 if you have the `arc4random' function.])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
])
}
])],
[AC_DEFINE([HAVE_ARC4RANDOM], [1], [Define to 1 if you have the `arc4random' function.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])])
AC_ARG_WITH([getrandom],
[AS_HELP_STRING([--with-getrandom],
[enforce the use of getrandom function in the system @<:@default=check@:>@])
AS_HELP_STRING([--without-getrandom],
[skip auto detect of getrandom @<:@default=check@:>@])],
[],
[with_getrandom=check])
AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for NULL */
#include <sys/random.h>
int main() {
return getrandom(NULL, 0U, 0U);
}
])], [
AC_DEFINE([HAVE_GETRANDOM], [1],
[Define to 1 if you have the `getrandom' function.])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
AS_IF([test "x$with_getrandom" != xno],
[AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for NULL */
#include <sys/random.h>
int main() {
return getrandom(NULL, 0U, 0U);
}
])],
[AC_DEFINE([HAVE_GETRANDOM], [1], [Define to 1 if you have the `getrandom' function.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AS_IF([test "x$with_getrandom" = xyes],
[AC_MSG_ERROR([enforced the use of getrandom --with-getrandom, but not detected])])])])
AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for NULL */
#include <unistd.h> /* for syscall */
#include <sys/syscall.h> /* for SYS_getrandom */
int main() {
syscall(SYS_getrandom, NULL, 0, 0);
return 0;
}
])], [
AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1],
[Define to 1 if you have `syscall' and `SYS_getrandom'.])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
])
AC_ARG_WITH([sys_getrandom],
[AS_HELP_STRING([--with-sys-getrandom],
[enforce the use of syscall SYS_getrandom function in the system @<:@default=check@:>@])
AS_HELP_STRING([--without-sys-getrandom],
[skip auto detect of syscall SYS_getrandom @<:@default=check@:>@])],
[],
[with_sys_getrandom=check])
AS_IF([test "x$with_sys_getrandom" != xno],
[AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for NULL */
#include <unistd.h> /* for syscall */
#include <sys/syscall.h> /* for SYS_getrandom */
int main() {
syscall(SYS_getrandom, NULL, 0, 0);
return 0;
}
])],
[AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1], [Define to 1 if you have `syscall' and `SYS_getrandom'.])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AS_IF([test "x$with_sys_getrandom" = xyes],
[AC_MSG_ERROR([enforced the use of syscall SYS_getrandom --with-sys-getrandom, but not detected])])])])
dnl Only needed for xmlwf:
AC_CHECK_HEADERS(fcntl.h unistd.h)
AC_TYPE_OFF_T
AC_FUNC_MMAP
if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
FILEMAP=unixfilemap
else
FILEMAP=readfilemap
fi
AS_IF([test "$ac_cv_func_mmap_fixed_mapped" = "yes"],
[AS_VAR_SET(FILEMAP,unixfilemap)],
[AS_VAR_SET(FILEMAP,readfilemap)])
AC_SUBST(FILEMAP)
@ -212,26 +260,34 @@ AC_DEFINE([XML_DTD], 1,
AC_DEFINE([XML_DEV_URANDOM], 1,
[Define to include code reading entropy from `/dev/urandom'.])
AC_ARG_ENABLE([xml-attr-info],
[AS_HELP_STRING([--enable-xml-attr-info],
[Enable retrieving the byte offsets for attribute names and values @<:@default=no@:>@])],
[],
[enable_xml_attr_info=no])
AS_IF([test "x${enable_xml_attr_info}" = "xyes"],
[AC_DEFINE([XML_ATTR_INFO], 1,
[Define to allow retrieving the byte offsets for attribute names and values.])])
AC_ARG_ENABLE([xml-context],
AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@],
[Retain context around the current parse point;
default is enabled and a size of 1024 bytes])
default is enabled and a size of 1024 bytes])
AS_HELP_STRING([--disable-xml-context],
[Do not retain context around the current parse point]),
[enable_xml_context=${enableval}])
AS_IF([test "x${enable_xml_context}" != "xno"], [
AS_IF([test "x${enable_xml_context}" = "xyes" \
-o "x${enable_xml_context}" = "x"], [
enable_xml_context=1024
])
AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}],
[Define to specify how much context to retain around the current parse point.])
])
[enable_xml_context=${enableval}])
AS_IF([test "x${enable_xml_context}" != "xno"],
[AS_IF([test "x${enable_xml_context}" = "xyes" \
-o "x${enable_xml_context}" = "x"],
[AS_VAR_SET(enable_xml_context,1024)])
AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}],
[Define to specify how much context to retain around the current parse point.])])
AC_ARG_WITH([docbook], [AS_HELP_STRING([--with-docbook],
[enforce XML to man page compilation @<:@default=check@:>@])
AC_ARG_WITH([docbook],
[AS_HELP_STRING([--with-docbook],
[enforce XML to man page compilation @<:@default=check@:>@])
AS_HELP_STRING([--without-docbook],
[skip XML to man page compilation @<:@default=check@:>@])],
[skip XML to man page compilation @<:@default=check@:>@])],
[],
[with_docbook=check])
@ -251,14 +307,13 @@ AS_IF([test "x${DOCBOOK_TO_MAN}" != x -a "x$with_docbook" != xno],
AM_CONDITIONAL(WITH_DOCBOOK, [test "x${DOCBOOK_TO_MAN}" != x])
AC_CONFIG_FILES([Makefile expat.pc])
AC_CONFIG_FILES([
doc/Makefile
examples/Makefile
lib/Makefile
tests/Makefile
tests/benchmark/Makefile
xmlwf/Makefile
])
AC_CONFIG_FILES([Makefile]
[expat.pc]
[doc/Makefile]
[examples/Makefile]
[lib/Makefile]
[tests/Makefile]
[tests/benchmark/Makefile]
[xmlwf/Makefile])
AC_CONFIG_FILES([run.sh], [chmod +x run.sh])
AC_OUTPUT

View File

@ -28,14 +28,17 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
.PHONY: dist-hook # not inside conditional to avoid automake warning
if WITH_DOCBOOK
dist_man_MANS = xmlwf.1
xmlwf.1: xmlwf.xml
if WITH_DOCBOOK
-rm -f $@
$(DOCBOOK_TO_MAN) $<
test -f $@ || mv XMLWF.1 $@
else
dist-hook:
@echo 'ERROR: Configure with --with-docbook for "make dist".' 1>&2
@false
endif

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -122,7 +122,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@ -310,7 +317,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
dist_man_MANS = xmlwf.1
@WITH_DOCBOOK_TRUE@dist_man_MANS = xmlwf.1
EXTRA_DIST = \
expat.png \
reference.html \
@ -338,8 +345,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -405,8 +412,12 @@ ctags CTAGS:
cscope cscopelist:
@WITH_DOCBOOK_TRUE@dist-hook:
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -436,6 +447,9 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
@ -544,25 +558,28 @@ uninstall-man: uninstall-man1
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
clean-local cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man1 install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags-am uninstall uninstall-am uninstall-man \
uninstall-man1
clean-local cscopelist-am ctags-am dist-hook distclean \
distclean-generic distclean-libtool distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-man1 install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
uninstall-am uninstall-man uninstall-man1
.PRECIOUS: Makefile
xmlwf.1: xmlwf.xml
.PHONY: dist-hook # not inside conditional to avoid automake warning
@WITH_DOCBOOK_TRUE@xmlwf.1: xmlwf.xml
@WITH_DOCBOOK_TRUE@ -rm -f $@
@WITH_DOCBOOK_TRUE@ $(DOCBOOK_TO_MAN) $<
@WITH_DOCBOOK_TRUE@ test -f $@ || mv XMLWF.1 $@
@WITH_DOCBOOK_FALSE@dist-hook:
@WITH_DOCBOOK_FALSE@ @echo 'ERROR: Configure with --with-docbook for "make dist".' 1>&2
@WITH_DOCBOOK_FALSE@ @false

View File

@ -276,9 +276,11 @@ directions or Unix directions below.</p>
<p>If you're using the GNU compiler under cygwin, follow the Unix
directions in the next section. Otherwise if you have Microsoft's
Developer Studio installed, then from Windows Explorer double-click on
"expat.vcxproj" in the lib directory and build and install in the usual
manner.</p>
Developer Studio installed,
you can use CMake to generate a <code>.sln</code> file, e.g.
<code>
cmake -G"Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=RelWithDebInfo .
</code>, and build Expat using <code>msbuild /m expat.sln</code> after.</p>
<p>Alternatively, you may download the Win32 binary package that
contains the "expat.h" include file and a pre-built DLL.</p>
@ -2152,7 +2154,7 @@ function behavior. In order to have an effect this must be called
before parsing has started. Returns 1 if successful, 0 when called
after <code>XML_Parse</code> or <code>XML_ParseBuffer</code>.
<p><b>Note:</b>This call is optional, as the parser will auto-generate
a new random salt value if no value has been set at the start of parsing.
a new random salt value if no value has been set at the start of parsing.</p>
<p><b>Note:</b>One should not call <code>XML_SetHashSalt</code> with a
hash salt value of 0, as this value is used as sentinel value to indicate
that <code>XML_SetHashSalt</code> has <b>not</b> been called. Consequently

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -124,7 +124,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@ -158,7 +165,8 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/elements.Po ./$(DEPDIR)/outline.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -359,8 +367,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -395,8 +403,14 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elements.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/outline.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elements.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/outline.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@ -477,7 +491,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -547,7 +564,8 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/elements.Po
-rm -f ./$(DEPDIR)/outline.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@ -593,7 +611,8 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/elements.Po
-rm -f ./$(DEPDIR)/outline.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@ -614,9 +633,9 @@ uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \

View File

@ -38,25 +38,20 @@
#include <expat.h>
#ifdef XML_LARGE_SIZE
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
# define XML_FMT_INT_MOD "I64"
# else
# define XML_FMT_INT_MOD "ll"
# endif
#else
# define XML_FMT_INT_MOD "l"
# define XML_FMT_INT_MOD "l"
#endif
#ifdef XML_UNICODE_WCHAR_T
# include <wchar.h>
# define XML_FMT_STR "ls"
# include <wchar.h>
# define XML_FMT_STR "ls"
#else
# define XML_FMT_STR "s"
# define XML_FMT_STR "s"
#endif
static void XMLCALL
startElement(void *userData, const XML_Char *name, const XML_Char **atts)
{
startElement(void *userData, const XML_Char *name, const XML_Char **atts) {
int i;
int *depthPtr = (int *)userData;
(void)atts;
@ -68,8 +63,7 @@ startElement(void *userData, const XML_Char *name, const XML_Char **atts)
}
static void XMLCALL
endElement(void *userData, const XML_Char *name)
{
endElement(void *userData, const XML_Char *name) {
int *depthPtr = (int *)userData;
(void)name;
@ -77,8 +71,7 @@ endElement(void *userData, const XML_Char *name)
}
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
char buf[BUFSIZ];
XML_Parser parser = XML_ParserCreate(NULL);
int done;
@ -92,13 +85,13 @@ main(int argc, char *argv[])
size_t len = fread(buf, 1, sizeof(buf), stdin);
done = len < sizeof(buf);
if (XML_Parse(parser, buf, (int)len, done) == XML_STATUS_ERROR) {
fprintf(stderr,
"%" XML_FMT_STR " at line %" XML_FMT_INT_MOD "u\n",
fprintf(stderr, "%" XML_FMT_STR " at line %" XML_FMT_INT_MOD "u\n",
XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser));
XML_ParserFree(parser);
return 1;
}
} while (!done);
} while (! done);
XML_ParserFree(parser);
return 0;
}

View File

@ -36,30 +36,25 @@
#include <expat.h>
#ifdef XML_LARGE_SIZE
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
# define XML_FMT_INT_MOD "I64"
# else
# define XML_FMT_INT_MOD "ll"
# endif
#else
# define XML_FMT_INT_MOD "l"
# define XML_FMT_INT_MOD "l"
#endif
#ifdef XML_UNICODE_WCHAR_T
# define XML_FMT_STR "ls"
# define XML_FMT_STR "ls"
#else
# define XML_FMT_STR "s"
# define XML_FMT_STR "s"
#endif
#define BUFFSIZE 8192
#define BUFFSIZE 8192
char Buff[BUFFSIZE];
int Depth;
static void XMLCALL
start(void *data, const XML_Char *el, const XML_Char **attr)
{
start(void *data, const XML_Char *el, const XML_Char **attr) {
int i;
(void)data;
@ -77,8 +72,7 @@ start(void *data, const XML_Char *el, const XML_Char **attr)
}
static void XMLCALL
end(void *data, const XML_Char *el)
{
end(void *data, const XML_Char *el) {
(void)data;
(void)el;
@ -86,8 +80,7 @@ end(void *data, const XML_Char *el)
}
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
XML_Parser p = XML_ParserCreate(NULL);
(void)argc;
(void)argv;

View File

@ -1,6 +1,9 @@
/* expat_config.h.in. Generated from configure.ac by autoheader. */
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* 1234 = LILENDIAN, 4321 = BIGENDIAN */
#undef BYTEORDER
/* Define to 1 if you have the `arc4random' function. */
@ -9,9 +12,6 @@
/* Define to 1 if you have the `arc4random_buf' function. */
#undef HAVE_ARC4RANDOM_BUF
/* Define to 1 if you have the `bcopy' function. */
#undef HAVE_BCOPY
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@ -30,9 +30,6 @@
/* Define to 1 if you have the `bsd' library (-lbsd). */
#undef HAVE_LIBBSD
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@ -96,8 +93,21 @@
/* Version number of package */
#undef VERSION
/* whether byteorder is bigendian */
#undef WORDS_BIGENDIAN
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to allow retrieving the byte offsets for attribute names and values.
*/
#undef XML_ATTR_INFO
/* Define to specify how much context to retain around the current parse
point. */

View File

@ -0,0 +1,48 @@
#! /usr/bin/env bash
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|
# | __// \| |_) | (_| | |_
# \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser
#
# Copyright (c) 2019 Expat development team
# Licensed under the MIT license:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
set -e
filename="${1:-tests/xmltest.log}"
dos2unix "${filename}"
tempfile="$(mktemp)"
sed \
-e 's/^wine: Call .* msvcrt\.dll\._wperror, aborting$/ibm49i02.dtd: No such file or directory/' \
\
-e '/^wine: /d' \
-e '/^Application tried to create a window, but no driver could be loaded.$/d' \
-e '/^Make sure that your X server is running and that $DISPLAY is set correctly.$/d' \
-e '/^err:systray:initialize_systray Could not create tray window$/d' \
-e '/^In ibm\/invalid\/P49\/: Unhandled exception: unimplemented .\+/d' \
\
"${filename}" > "${tempfile}"
mv "${tempfile}" "${filename}"

View File

@ -40,7 +40,6 @@ libexpat_la_LDFLAGS = \
-version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
libexpat_la_SOURCES = \
loadlibrary.c \
xmlparse.c \
xmltok.c \
xmlrole.c

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -125,7 +125,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@ -166,8 +173,7 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(docdir)" \
"$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libexpat_la_LIBADD =
am_libexpat_la_OBJECTS = loadlibrary.lo xmlparse.lo xmltok.lo \
xmlrole.lo
am_libexpat_la_OBJECTS = xmlparse.lo xmltok.lo xmlrole.lo
libexpat_la_OBJECTS = $(am_libexpat_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@ -190,7 +196,9 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/xmlparse.Plo ./$(DEPDIR)/xmlrole.Plo \
./$(DEPDIR)/xmltok.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -378,7 +386,6 @@ libexpat_la_LDFLAGS = \
-version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
libexpat_la_SOURCES = \
loadlibrary.c \
xmlparse.c \
xmltok.c \
xmlrole.c
@ -428,8 +435,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -485,10 +492,15 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadlibrary.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlparse.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrole.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmltok.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlparse.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrole.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmltok.Plo@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@ -611,7 +623,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -684,7 +699,9 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/xmlparse.Plo
-rm -f ./$(DEPDIR)/xmlrole.Plo
-rm -f ./$(DEPDIR)/xmltok.Plo
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@ -731,7 +748,9 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/xmlparse.Plo
-rm -f ./$(DEPDIR)/xmlrole.Plo
-rm -f ./$(DEPDIR)/xmltok.Plo
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@ -753,9 +772,9 @@ uninstall-am: uninstall-docDATA uninstall-includeHEADERS \
.MAKE: install-am install-data-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-data-hook install-docDATA install-dvi \

View File

@ -31,34 +31,34 @@
*/
/* 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,
/* 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,

View File

@ -33,15 +33,6 @@
#ifndef Expat_INCLUDED
#define Expat_INCLUDED 1
#ifdef __VMS
/* 0 1 2 3 0 1 2 3
1234567890123456789012345678901 1234567890123456789012345678901 */
#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler
#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler
#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg
#endif
#include <stdlib.h>
#include "expat_external.h"
@ -53,8 +44,8 @@ struct XML_ParserStruct;
typedef struct XML_ParserStruct *XML_Parser;
typedef unsigned char XML_Bool;
#define XML_TRUE ((XML_Bool) 1)
#define XML_FALSE ((XML_Bool) 0)
#define XML_TRUE ((XML_Bool)1)
#define XML_FALSE ((XML_Bool)0)
/* The XML_Status enum gives the possible return values for several
API functions. The preprocessor #defines are included so this
@ -164,25 +155,23 @@ enum XML_Content_Quant {
typedef struct XML_cp XML_Content;
struct XML_cp {
enum XML_Content_Type type;
enum XML_Content_Quant quant;
XML_Char * name;
unsigned int numchildren;
XML_Content * children;
enum XML_Content_Type type;
enum XML_Content_Quant quant;
XML_Char *name;
unsigned int numchildren;
XML_Content *children;
};
/* This is called for an element declaration. See above for
description of the model argument. It's the caller's responsibility
to free model when finished with it.
*/
typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData,
const XML_Char *name,
XML_Content *model);
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,
const XML_Char *name,
XML_Content *model);
XMLPARSEAPI(void)
XML_SetElementDeclHandler(XML_Parser parser,
XML_ElementDeclHandler eldecl);
XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl);
/* The Attlist declaration handler is called for *each* attribute. So
a single Attlist declaration with multiple attributes declared will
@ -192,17 +181,12 @@ XML_SetElementDeclHandler(XML_Parser parser,
value will be NULL in the case of "#REQUIRED". If "isrequired" is
true and default is non-NULL, then this is a "#FIXED" default.
*/
typedef void (XMLCALL *XML_AttlistDeclHandler) (
void *userData,
const XML_Char *elname,
const XML_Char *attname,
const XML_Char *att_type,
const XML_Char *dflt,
int isrequired);
typedef void(XMLCALL *XML_AttlistDeclHandler)(
void *userData, const XML_Char *elname, const XML_Char *attname,
const XML_Char *att_type, const XML_Char *dflt, int isrequired);
XMLPARSEAPI(void)
XML_SetAttlistDeclHandler(XML_Parser parser,
XML_AttlistDeclHandler attdecl);
XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl);
/* The XML declaration handler is called for *both* XML declarations
and text declarations. The way to distinguish is that the version
@ -212,15 +196,13 @@ XML_SetAttlistDeclHandler(XML_Parser parser,
was no standalone parameter in the declaration, that it was given
as no, or that it was given as yes.
*/
typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData,
const XML_Char *version,
const XML_Char *encoding,
int standalone);
typedef void(XMLCALL *XML_XmlDeclHandler)(void *userData,
const XML_Char *version,
const XML_Char *encoding,
int standalone);
XMLPARSEAPI(void)
XML_SetXmlDeclHandler(XML_Parser parser,
XML_XmlDeclHandler xmldecl);
XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl);
typedef struct {
void *(*malloc_fcn)(size_t size);
@ -248,7 +230,6 @@ XML_ParserCreate(const XML_Char *encoding);
XMLPARSEAPI(XML_Parser)
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
/* Constructs a new parser using the memory management suite referred to
by memsuite. If memsuite is NULL, then use the standard library memory
suite. If namespaceSeparator is non-NULL it creates a parser with
@ -278,31 +259,27 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
/* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated.
*/
typedef void (XMLCALL *XML_StartElementHandler) (void *userData,
const XML_Char *name,
const XML_Char **atts);
typedef void (XMLCALL *XML_EndElementHandler) (void *userData,
const XML_Char *name);
typedef void(XMLCALL *XML_StartElementHandler)(void *userData,
const XML_Char *name,
const XML_Char **atts);
typedef void(XMLCALL *XML_EndElementHandler)(void *userData,
const XML_Char *name);
/* s is not 0 terminated. */
typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,
const XML_Char *s,
int len);
typedef void(XMLCALL *XML_CharacterDataHandler)(void *userData,
const XML_Char *s, int len);
/* target and data are 0 terminated */
typedef void (XMLCALL *XML_ProcessingInstructionHandler) (
void *userData,
const XML_Char *target,
const XML_Char *data);
typedef void(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
const XML_Char *target,
const XML_Char *data);
/* data is 0 terminated */
typedef void (XMLCALL *XML_CommentHandler) (void *userData,
const XML_Char *data);
typedef void(XMLCALL *XML_CommentHandler)(void *userData, const XML_Char *data);
typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData);
typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData);
typedef void(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
typedef void(XMLCALL *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
@ -317,25 +294,23 @@ typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData);
default handler: for example, a comment might be split between
multiple calls.
*/
typedef void (XMLCALL *XML_DefaultHandler) (void *userData,
const XML_Char *s,
int len);
typedef void(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s,
int len);
/* This is called for the start of the DOCTYPE declaration, before
any DTD or internal subset is parsed.
*/
typedef void (XMLCALL *XML_StartDoctypeDeclHandler) (
void *userData,
const XML_Char *doctypeName,
const XML_Char *sysid,
const XML_Char *pubid,
int has_internal_subset);
typedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData,
const XML_Char *doctypeName,
const XML_Char *sysid,
const XML_Char *pubid,
int has_internal_subset);
/* This is called for the start of the DOCTYPE declaration when the
closing > is encountered, but after processing any external
subset.
*/
typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
typedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
/* This is called for entity declarations. The is_parameter_entity
argument will be non-zero if the entity is a parameter entity, zero
@ -355,20 +330,14 @@ typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
Note that is_parameter_entity can't be changed to XML_Bool, since
that would break binary compatibility.
*/
typedef void (XMLCALL *XML_EntityDeclHandler) (
void *userData,
const XML_Char *entityName,
int is_parameter_entity,
const XML_Char *value,
int value_length,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName);
typedef void(XMLCALL *XML_EntityDeclHandler)(
void *userData, const XML_Char *entityName, int is_parameter_entity,
const XML_Char *value, int value_length, const XML_Char *base,
const XML_Char *systemId, const XML_Char *publicId,
const XML_Char *notationName);
XMLPARSEAPI(void)
XML_SetEntityDeclHandler(XML_Parser parser,
XML_EntityDeclHandler handler);
XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);
/* OBSOLETE -- OBSOLETE -- OBSOLETE
This handler has been superseded by the EntityDeclHandler above.
@ -379,24 +348,20 @@ XML_SetEntityDeclHandler(XML_Parser parser,
entityName, systemId and notationName arguments will never be
NULL. The other arguments may be.
*/
typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) (
void *userData,
const XML_Char *entityName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName);
typedef void(XMLCALL *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 (XMLCALL *XML_NotationDeclHandler) (
void *userData,
const XML_Char *notationName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
typedef void(XMLCALL *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
@ -404,14 +369,12 @@ typedef void (XMLCALL *XML_NotationDeclHandler) (
declaration handlers. For an xmlns attribute, prefix will be
NULL. For an xmlns="" attribute, uri will be NULL.
*/
typedef void (XMLCALL *XML_StartNamespaceDeclHandler) (
void *userData,
const XML_Char *prefix,
const XML_Char *uri);
typedef void(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
const XML_Char *prefix,
const XML_Char *uri);
typedef void (XMLCALL *XML_EndNamespaceDeclHandler) (
void *userData,
const XML_Char *prefix);
typedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
const XML_Char *prefix);
/* This is called if the document is not standalone, that is, it has an
external subset or a reference to a parameter entity, but does not
@ -422,7 +385,7 @@ typedef void (XMLCALL *XML_EndNamespaceDeclHandler) (
conditions above this handler will only be called if the referenced
entity was actually read.
*/
typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData);
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData);
/* This is called for a reference to an external parsed general
entity. The referenced entity is not automatically parsed. The
@ -458,12 +421,11 @@ typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData);
Note that unlike other handlers the first argument is the parser,
not userData.
*/
typedef int (XMLCALL *XML_ExternalEntityRefHandler) (
XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
typedef int(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
/* This is called in two situations:
1) An entity reference is encountered for which no declaration
@ -475,10 +437,9 @@ typedef int (XMLCALL *XML_ExternalEntityRefHandler) (
the event would be out of sync with the reporting of the
declarations or attribute values
*/
typedef void (XMLCALL *XML_SkippedEntityHandler) (
void *userData,
const XML_Char *entityName,
int is_parameter_entity);
typedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData,
const XML_Char *entityName,
int is_parameter_entity);
/* This structure is filled in by the XML_UnknownEncodingHandler to
provide information to the parser about encodings that are unknown
@ -535,8 +496,8 @@ typedef void (XMLCALL *XML_SkippedEntityHandler) (
typedef struct {
int map[256];
void *data;
int (XMLCALL *convert)(void *data, const char *s);
void (XMLCALL *release)(void *data);
int(XMLCALL *convert)(void *data, const char *s);
void(XMLCALL *release)(void *data);
} XML_Encoding;
/* This is called for an encoding that is unknown to the parser.
@ -554,23 +515,19 @@ typedef struct {
If info does not describe a suitable encoding, then the parser will
return an XML_UNKNOWN_ENCODING error.
*/
typedef int (XMLCALL *XML_UnknownEncodingHandler) (
void *encodingHandlerData,
const XML_Char *name,
XML_Encoding *info);
typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
const XML_Char *name,
XML_Encoding *info);
XMLPARSEAPI(void)
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,
XML_EndElementHandler end);
XMLPARSEAPI(void)
XML_SetStartElementHandler(XML_Parser parser,
XML_StartElementHandler handler);
XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler);
XMLPARSEAPI(void)
XML_SetEndElementHandler(XML_Parser parser,
XML_EndElementHandler handler);
XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler);
XMLPARSEAPI(void)
XML_SetCharacterDataHandler(XML_Parser parser,
@ -580,8 +537,7 @@ XMLPARSEAPI(void)
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler);
XMLPARSEAPI(void)
XML_SetCommentHandler(XML_Parser parser,
XML_CommentHandler handler);
XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler);
XMLPARSEAPI(void)
XML_SetCdataSectionHandler(XML_Parser parser,
@ -601,20 +557,17 @@ XML_SetEndCdataSectionHandler(XML_Parser parser,
default handler, or to the skipped entity handler, if one is set.
*/
XMLPARSEAPI(void)
XML_SetDefaultHandler(XML_Parser parser,
XML_DefaultHandler handler);
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.
*/
XMLPARSEAPI(void)
XML_SetDefaultHandlerExpand(XML_Parser parser,
XML_DefaultHandler handler);
XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);
XMLPARSEAPI(void)
XML_SetDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start,
XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end);
XMLPARSEAPI(void)
@ -622,16 +575,14 @@ XML_SetStartDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start);
XMLPARSEAPI(void)
XML_SetEndDoctypeDeclHandler(XML_Parser parser,
XML_EndDoctypeDeclHandler end);
XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end);
XMLPARSEAPI(void)
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
XML_UnparsedEntityDeclHandler handler);
XMLPARSEAPI(void)
XML_SetNotationDeclHandler(XML_Parser parser,
XML_NotationDeclHandler handler);
XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler);
XMLPARSEAPI(void)
XML_SetNamespaceDeclHandler(XML_Parser parser,
@ -659,8 +610,7 @@ XML_SetExternalEntityRefHandler(XML_Parser parser,
instead of the parser object.
*/
XMLPARSEAPI(void)
XML_SetExternalEntityRefHandlerArg(XML_Parser parser,
void *arg);
XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);
XMLPARSEAPI(void)
XML_SetSkippedEntityHandler(XML_Parser parser,
@ -740,7 +690,6 @@ XML_UseParserAsHandlerArg(XML_Parser parser);
XMLPARSEAPI(enum XML_Error)
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
/* 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
@ -780,10 +729,10 @@ XML_GetIdAttributeIndex(XML_Parser parser);
info->valueEnd - info->valueStart = 4 bytes.
*/
typedef struct {
XML_Index nameStart; /* Offset to beginning of the attribute name. */
XML_Index nameEnd; /* Offset after the attribute name's last byte. */
XML_Index valueStart; /* Offset to beginning of the attribute value. */
XML_Index valueEnd; /* Offset after the attribute value's last byte. */
XML_Index nameStart; /* Offset to beginning of the attribute name. */
XML_Index nameEnd; /* Offset after the attribute name's last byte. */
XML_Index valueStart; /* Offset to beginning of the attribute value. */
XML_Index valueEnd; /* Offset after the attribute value's last byte. */
} XML_AttrInfo;
/* Returns an array of XML_AttrInfo structures for the attribute/value pairs
@ -863,12 +812,7 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable);
XMLPARSEAPI(enum XML_Status)
XML_ResumeParser(XML_Parser parser);
enum XML_Parsing {
XML_INITIALIZED,
XML_PARSING,
XML_FINISHED,
XML_SUSPENDED
};
enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED };
typedef struct {
enum XML_Parsing parsing;
@ -900,8 +844,7 @@ XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
Otherwise returns a new XML_Parser object.
*/
XMLPARSEAPI(XML_Parser)
XML_ExternalEntityParserCreate(XML_Parser parser,
const XML_Char *context,
XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context,
const XML_Char *encoding);
enum XML_ParamEntityParsing {
@ -945,8 +888,7 @@ XML_SetParamEntityParsing(XML_Parser parser,
Note: If parser == NULL, the function will do nothing and return 0.
*/
XMLPARSEAPI(int)
XML_SetHashSalt(XML_Parser parser,
unsigned long hash_salt);
XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
XML_GetErrorCode returns information about the error.
@ -995,14 +937,12 @@ XML_GetCurrentByteCount(XML_Parser parser);
the handler that makes the call.
*/
XMLPARSEAPI(const char *)
XML_GetInputContext(XML_Parser parser,
int *offset,
int *size);
XML_GetInputContext(XML_Parser parser, int *offset, int *size);
/* For backwards compatibility with previous versions. */
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
/* Frees the content model passed to the element declaration handler */
XMLPARSEAPI(void)
@ -1062,21 +1002,20 @@ enum XML_FeatureEnum {
};
typedef struct {
enum XML_FeatureEnum feature;
const XML_LChar *name;
long int value;
enum XML_FeatureEnum feature;
const XML_LChar *name;
long int value;
} XML_Feature;
XMLPARSEAPI(const XML_Feature *)
XML_GetFeatureList(void);
/* Expat follows the semantic versioning convention.
See http://semver.org.
*/
#define XML_MAJOR_VERSION 2
#define XML_MINOR_VERSION 2
#define XML_MICRO_VERSION 6
#define XML_MICRO_VERSION 9
#ifdef __cplusplus
}

View File

@ -35,10 +35,6 @@
/* External API definitions */
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
# define XML_USE_MSC_EXTENSIONS 1
#endif
/* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to
@ -62,11 +58,11 @@
system headers may assume the cdecl convention.
*/
#ifndef XMLCALL
# if defined(_MSC_VER)
# define XMLCALL __cdecl
# elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
# define XMLCALL __attribute__((cdecl))
# else
# if defined(_MSC_VER)
# define XMLCALL __cdecl
# elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
# define XMLCALL __attribute__((cdecl))
# else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
@ -77,41 +73,46 @@
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
# define XMLCALL
# endif
#endif /* not defined XMLCALL */
# define XMLCALL
# endif
#endif /* not defined XMLCALL */
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
# ifndef XML_BUILDING_EXPAT
#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
# ifndef XML_BUILDING_EXPAT
/* using Expat from an application */
# ifdef XML_USE_MSC_EXTENSIONS
# define XMLIMPORT __declspec(dllimport)
# if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
# define XMLIMPORT __declspec(dllimport)
# endif
# endif
#endif /* not defined XML_STATIC */
# endif
#endif /* not defined XML_STATIC */
#ifndef XML_ENABLE_VISIBILITY
# define XML_ENABLE_VISIBILITY 0
#endif
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
# define XMLIMPORT __attribute__ ((visibility ("default")))
#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
# define XMLIMPORT __attribute__((visibility("default")))
#endif
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
# define XMLIMPORT
# define XMLIMPORT
#endif
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
# define XML_ATTR_MALLOC __attribute__((__malloc__))
#if defined(__GNUC__) \
&& (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
# define XML_ATTR_MALLOC __attribute__((__malloc__))
#else
# define XML_ATTR_MALLOC
# define XML_ATTR_MALLOC
#endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#if defined(__GNUC__) \
&& ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#else
# define XML_ATTR_ALLOC_SIZE(x)
# define XML_ATTR_ALLOC_SIZE(x)
#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
@ -121,35 +122,30 @@ extern "C" {
#endif
#ifdef XML_UNICODE_WCHAR_T
# ifndef XML_UNICODE
# define XML_UNICODE
# endif
# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
# endif
# ifndef XML_UNICODE
# define XML_UNICODE
# endif
# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
# endif
#endif
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
# ifdef XML_UNICODE_WCHAR_T
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
# ifdef XML_UNICODE_WCHAR_T
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
# else
# else
typedef unsigned short XML_Char;
typedef char XML_LChar;
# endif /* XML_UNICODE_WCHAR_T */
#else /* Information is UTF-8 encoded. */
# endif /* XML_UNICODE_WCHAR_T */
#else /* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE */
#endif /* XML_UNICODE */
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
typedef __int64 XML_Index;
typedef unsigned __int64 XML_Size;
# else
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
typedef long long XML_Index;
typedef unsigned long long XML_Size;
# endif
#else
typedef long XML_Index;
typedef unsigned long XML_Size;

View File

@ -32,34 +32,34 @@
/* 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,
/* 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,

View File

@ -49,7 +49,7 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__)
#if defined(__GNUC__) && defined(__i386__) && ! defined(__MINGW32__)
/* We'll use this version by default only where we know it helps.
regparm() generates warnings on Solaris boxes. See SF bug #692878.
@ -59,8 +59,8 @@
#define FASTCALL __attribute__((stdcall, regparm(3)))
and let's try this:
*/
#define FASTCALL __attribute__((regparm(3)))
#define PTRFASTCALL __attribute__((regparm(3)))
# define FASTCALL __attribute__((regparm(3)))
# define PTRFASTCALL __attribute__((regparm(3)))
#endif
/* Using __fastcall seems to have an unexpected negative effect under
@ -74,50 +74,49 @@
/* Make sure all of these are defined if they aren't already. */
#ifndef FASTCALL
#define FASTCALL
# define FASTCALL
#endif
#ifndef PTRCALL
#define PTRCALL
# define PTRCALL
#endif
#ifndef PTRFASTCALL
#define PTRFASTCALL
# define PTRFASTCALL
#endif
#ifndef XML_MIN_SIZE
#if !defined(__cplusplus) && !defined(inline)
#ifdef __GNUC__
#define inline __inline
#endif /* __GNUC__ */
#endif
# if ! defined(__cplusplus) && ! defined(inline)
# ifdef __GNUC__
# define inline __inline
# endif /* __GNUC__ */
# endif
#endif /* XML_MIN_SIZE */
#ifdef __cplusplus
#define inline inline
# define inline inline
#else
#ifndef inline
#define inline
#endif
# ifndef inline
# define inline
# endif
#endif
#ifndef UNUSED_P
# ifdef __GNUC__
# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__))
# else
# define UNUSED_P(p) UNUSED_ ## p
# endif
# define UNUSED_P(p) (void)p
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef XML_ENABLE_VISIBILITY
# if XML_ENABLE_VISIBILITY
__attribute__((visibility("default")))
# endif
#endif
void
_INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef);
_INTERNAL_trim_to_complete_utf8_characters(const char *from,
const char **fromLimRef);
#ifdef __cplusplus
}

View File

@ -31,34 +31,34 @@
*/
/* 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,
/* 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,

View File

@ -31,152 +31,106 @@
*/
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,
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,
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,
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,
};

View File

@ -11,6 +11,10 @@
* --------------------------------------------------------------------------
* HISTORY:
*
* 2019-08-03 (Sebastian Pipping)
* - Mark part of sip24_valid as to be excluded from clang-format
* - Re-format code using clang-format 9
*
* 2018-07-08 (Anton Maklakov)
* - Add "fall through" markers for GCC's -Wimplicit-fallthrough
*
@ -94,186 +98,186 @@
#include <stddef.h> /* size_t */
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600)
/* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */
typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
/* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */
typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h> /* uint64_t uint32_t uint8_t */
# include <stdint.h> /* uint64_t uint32_t uint8_t */
#endif
/*
* Workaround to not require a C++11 compiler for using ULL suffix
* if this code is included and compiled as C++; related GCC warning is:
* warning: use of C++11 long long integer constant [-Wlong-long]
*/
#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low)
#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low)
#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ( (x) >> (64 - (b))))
#define SIP_U32TO8_LE(p, v) \
(p)[0] = (uint8_t)((v) >> 0); \
(p)[1] = (uint8_t)((v) >> 8); \
(p)[2] = (uint8_t)((v) >> 16); \
(p)[3] = (uint8_t)((v) >> 24);
#define SIP_U32TO8_LE(p, v) \
(p)[0] = (uint8_t)((v) >> 0); (p)[1] = (uint8_t)((v) >> 8); \
(p)[2] = (uint8_t)((v) >> 16); (p)[3] = (uint8_t)((v) >> 24);
#define SIP_U64TO8_LE(p, v) \
SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \
SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32));
#define SIP_U64TO8_LE(p, v) \
SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \
SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32));
#define SIP_U8TO64_LE(p) \
(((uint64_t)((p)[0]) << 0) | ((uint64_t)((p)[1]) << 8) \
| ((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24) \
| ((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) \
| ((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56))
#define SIP_U8TO64_LE(p) \
(((uint64_t)((p)[0]) << 0) | \
((uint64_t)((p)[1]) << 8) | \
((uint64_t)((p)[2]) << 16) | \
((uint64_t)((p)[3]) << 24) | \
((uint64_t)((p)[4]) << 32) | \
((uint64_t)((p)[5]) << 40) | \
((uint64_t)((p)[6]) << 48) | \
((uint64_t)((p)[7]) << 56))
#define SIPHASH_INITIALIZER { 0, 0, 0, 0, { 0 }, 0, 0 }
#define SIPHASH_INITIALIZER \
{ 0, 0, 0, 0, {0}, 0, 0 }
struct siphash {
uint64_t v0, v1, v2, v3;
uint64_t v0, v1, v2, v3;
unsigned char buf[8], *p;
uint64_t c;
unsigned char buf[8], *p;
uint64_t c;
}; /* struct siphash */
#define SIP_KEYLEN 16
struct sipkey {
uint64_t k[2];
uint64_t k[2];
}; /* struct sipkey */
#define sip_keyof(k) sip_tokey(&(struct sipkey){ { 0 } }, (k))
#define sip_keyof(k) sip_tokey(&(struct sipkey){{0}}, (k))
static struct sipkey *sip_tokey(struct sipkey *key, const void *src) {
key->k[0] = SIP_U8TO64_LE((const unsigned char *)src);
key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8);
return key;
static struct sipkey *
sip_tokey(struct sipkey *key, const void *src) {
key->k[0] = SIP_U8TO64_LE((const unsigned char *)src);
key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8);
return key;
} /* sip_tokey() */
#ifdef SIPHASH_TOBIN
#define sip_binof(v) sip_tobin((unsigned char[8]){ 0 }, (v))
# define sip_binof(v) sip_tobin((unsigned char[8]){0}, (v))
static void *sip_tobin(void *dst, uint64_t u64) {
SIP_U64TO8_LE((unsigned char *)dst, u64);
return dst;
static void *
sip_tobin(void *dst, uint64_t u64) {
SIP_U64TO8_LE((unsigned char *)dst, u64);
return dst;
} /* sip_tobin() */
#endif /* SIPHASH_TOBIN */
#endif /* SIPHASH_TOBIN */
static void
sip_round(struct siphash *H, const int rounds) {
int i;
static void sip_round(struct siphash *H, const int rounds) {
int i;
for (i = 0; i < rounds; i++) {
H->v0 += H->v1;
H->v1 = SIP_ROTL(H->v1, 13);
H->v1 ^= H->v0;
H->v0 = SIP_ROTL(H->v0, 32);
for (i = 0; i < rounds; i++) {
H->v0 += H->v1;
H->v1 = SIP_ROTL(H->v1, 13);
H->v1 ^= H->v0;
H->v0 = SIP_ROTL(H->v0, 32);
H->v2 += H->v3;
H->v3 = SIP_ROTL(H->v3, 16);
H->v3 ^= H->v2;
H->v2 += H->v3;
H->v3 = SIP_ROTL(H->v3, 16);
H->v3 ^= H->v2;
H->v0 += H->v3;
H->v3 = SIP_ROTL(H->v3, 21);
H->v3 ^= H->v0;
H->v0 += H->v3;
H->v3 = SIP_ROTL(H->v3, 21);
H->v3 ^= H->v0;
H->v2 += H->v1;
H->v1 = SIP_ROTL(H->v1, 17);
H->v1 ^= H->v2;
H->v2 = SIP_ROTL(H->v2, 32);
}
H->v2 += H->v1;
H->v1 = SIP_ROTL(H->v1, 17);
H->v1 ^= H->v2;
H->v2 = SIP_ROTL(H->v2, 32);
}
} /* sip_round() */
static struct siphash *
sip24_init(struct siphash *H, const struct sipkey *key) {
H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0];
H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1];
H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0];
H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1];
static struct siphash *sip24_init(struct siphash *H,
const struct sipkey *key) {
H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0];
H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1];
H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0];
H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1];
H->p = H->buf;
H->c = 0;
H->p = H->buf;
H->c = 0;
return H;
return H;
} /* sip24_init() */
#define sip_endof(a) (&(a)[sizeof(a) / sizeof *(a)])
#define sip_endof(a) (&(a)[sizeof (a) / sizeof *(a)])
static struct siphash *
sip24_update(struct siphash *H, const void *src, size_t len) {
const unsigned char *p = (const unsigned char *)src, *pe = p + len;
uint64_t m;
static struct siphash *sip24_update(struct siphash *H, const void *src,
size_t len) {
const unsigned char *p = (const unsigned char *)src, *pe = p + len;
uint64_t m;
do {
while (p < pe && H->p < sip_endof(H->buf))
*H->p++ = *p++;
do {
while (p < pe && H->p < sip_endof(H->buf))
*H->p++ = *p++;
if (H->p < sip_endof(H->buf))
break;
if (H->p < sip_endof(H->buf))
break;
m = SIP_U8TO64_LE(H->buf);
H->v3 ^= m;
sip_round(H, 2);
H->v0 ^= m;
m = SIP_U8TO64_LE(H->buf);
H->v3 ^= m;
sip_round(H, 2);
H->v0 ^= m;
H->p = H->buf;
H->c += 8;
} while (p < pe);
H->p = H->buf;
H->c += 8;
} while (p < pe);
return H;
return H;
} /* sip24_update() */
static uint64_t
sip24_final(struct siphash *H) {
const char left = (char)(H->p - H->buf);
uint64_t b = (H->c + left) << 56;
static uint64_t sip24_final(struct siphash *H) {
const char left = (char)(H->p - H->buf);
uint64_t b = (H->c + left) << 56;
switch (left) {
case 7:
b |= (uint64_t)H->buf[6] << 48;
/* fall through */
case 6:
b |= (uint64_t)H->buf[5] << 40;
/* fall through */
case 5:
b |= (uint64_t)H->buf[4] << 32;
/* fall through */
case 4:
b |= (uint64_t)H->buf[3] << 24;
/* fall through */
case 3:
b |= (uint64_t)H->buf[2] << 16;
/* fall through */
case 2:
b |= (uint64_t)H->buf[1] << 8;
/* fall through */
case 1:
b |= (uint64_t)H->buf[0] << 0;
/* fall through */
case 0:
break;
}
switch (left) {
case 7: b |= (uint64_t)H->buf[6] << 48;
/* fall through */
case 6: b |= (uint64_t)H->buf[5] << 40;
/* fall through */
case 5: b |= (uint64_t)H->buf[4] << 32;
/* fall through */
case 4: b |= (uint64_t)H->buf[3] << 24;
/* fall through */
case 3: b |= (uint64_t)H->buf[2] << 16;
/* fall through */
case 2: b |= (uint64_t)H->buf[1] << 8;
/* fall through */
case 1: b |= (uint64_t)H->buf[0] << 0;
/* fall through */
case 0: break;
}
H->v3 ^= b;
sip_round(H, 2);
H->v0 ^= b;
H->v2 ^= 0xff;
sip_round(H, 4);
H->v3 ^= b;
sip_round(H, 2);
H->v0 ^= b;
H->v2 ^= 0xff;
sip_round(H, 4);
return H->v0 ^ H->v1 ^ H->v2 ^ H->v3;
return H->v0 ^ H->v1 ^ H->v2 ^ H->v3;
} /* sip24_final() */
static uint64_t siphash24(const void *src, size_t len,
const struct sipkey *key) {
struct siphash state = SIPHASH_INITIALIZER;
return sip24_final(sip24_update(sip24_init(&state, key), src, len));
static uint64_t
siphash24(const void *src, size_t len, const struct sipkey *key) {
struct siphash state = SIPHASH_INITIALIZER;
return sip24_final(sip24_update(sip24_init(&state, key), src, len));
} /* siphash24() */
/*
* SipHash-2-4 output with
* k = 00 01 02 ...
@ -285,107 +289,110 @@ static uint64_t siphash24(const void *src, size_t len,
* ...
* in = 00 01 02 ... 3e (63 bytes)
*/
static int sip24_valid(void) {
static const unsigned char vectors[64][8] = {
{ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, },
{ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, },
{ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, },
{ 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, },
{ 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, },
{ 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, },
{ 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, },
{ 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, },
{ 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, },
{ 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, },
{ 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, },
{ 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, },
{ 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, },
{ 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, },
{ 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, },
{ 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, },
{ 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, },
{ 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, },
{ 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, },
{ 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, },
{ 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, },
{ 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, },
{ 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, },
{ 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, },
{ 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, },
{ 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, },
{ 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, },
{ 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, },
{ 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, },
{ 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, },
{ 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, },
{ 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, },
{ 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, },
{ 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, },
{ 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, },
{ 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, },
{ 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, },
{ 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, },
{ 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, },
{ 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, },
{ 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, },
{ 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, },
{ 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, },
{ 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, },
{ 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, },
{ 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, },
{ 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, },
{ 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, },
{ 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, },
{ 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, },
{ 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, },
{ 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, },
{ 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, },
{ 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, },
{ 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, },
{ 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, },
{ 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, },
{ 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, },
{ 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, },
{ 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, },
{ 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, },
{ 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, },
{ 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, },
{ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }
};
unsigned char in[64];
struct sipkey k;
size_t i;
static int
sip24_valid(void) {
/* clang-format off */
static const unsigned char vectors[64][8] = {
{ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, },
{ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, },
{ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, },
{ 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, },
{ 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, },
{ 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, },
{ 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, },
{ 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, },
{ 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, },
{ 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, },
{ 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, },
{ 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, },
{ 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, },
{ 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, },
{ 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, },
{ 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, },
{ 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, },
{ 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, },
{ 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, },
{ 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, },
{ 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, },
{ 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, },
{ 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, },
{ 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, },
{ 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, },
{ 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, },
{ 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, },
{ 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, },
{ 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, },
{ 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, },
{ 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, },
{ 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, },
{ 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, },
{ 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, },
{ 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, },
{ 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, },
{ 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, },
{ 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, },
{ 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, },
{ 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, },
{ 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, },
{ 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, },
{ 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, },
{ 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, },
{ 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, },
{ 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, },
{ 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, },
{ 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, },
{ 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, },
{ 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, },
{ 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, },
{ 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, },
{ 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, },
{ 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, },
{ 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, },
{ 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, },
{ 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, },
{ 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, },
{ 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, },
{ 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, },
{ 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, },
{ 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, },
{ 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, },
{ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }
};
/* clang-format on */
sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011"
"\012\013\014\015\016\017");
unsigned char in[64];
struct sipkey k;
size_t i;
for (i = 0; i < sizeof in; ++i) {
in[i] = (unsigned char)i;
sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011"
"\012\013\014\015\016\017");
if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i]))
return 0;
}
for (i = 0; i < sizeof in; ++i) {
in[i] = (unsigned char)i;
return 1;
if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i]))
return 0;
}
return 1;
} /* sip24_valid() */
#ifdef SIPHASH_MAIN
#include <stdio.h>
# include <stdio.h>
int main(void) {
const int ok = sip24_valid();
int
main(void) {
const int ok = sip24_valid();
if (ok)
puts("OK");
else
puts("FAIL");
if (ok)
puts("OK");
else
puts("FAIL");
return !ok;
return ! ok;
} /* main() */
#endif /* SIPHASH_MAIN */
#endif /* SIPHASH_H */

View File

@ -31,34 +31,34 @@
*/
/* 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,
/* 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,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@
#ifdef __VMS
/* 0 1 2 3 0 1 2 3
1234567890123456789012345678901 1234567890123456789012345678901 */
#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
# define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
#endif
#include "xmltok.h"
@ -113,11 +113,8 @@ enum {
};
typedef struct prolog_state {
int (PTRCALL *handler) (struct prolog_state *state,
int tok,
const char *ptr,
const char *end,
const ENCODING *enc);
int(PTRCALL *handler)(struct prolog_state *state, int tok, const char *ptr,
const char *end, const ENCODING *enc);
unsigned level;
int role_none;
#ifdef XML_DTD
@ -132,8 +129,8 @@ void XmlPrologStateInit(PROLOG_STATE *);
void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
#endif /* XML_DTD */
#define XmlTokenRole(state, tok, ptr, end, enc) \
(((state)->handler)(state, tok, ptr, end, enc))
#define XmlTokenRole(state, tok, ptr, end, enc) \
(((state)->handler)(state, tok, ptr, end, enc))
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff

View File

@ -38,16 +38,18 @@ extern "C" {
#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 */
#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_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
@ -62,24 +64,24 @@ extern "C" {
#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 */
#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_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 */
#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_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_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
@ -90,14 +92,14 @@ extern "C" {
#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_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 */
@ -112,20 +114,20 @@ extern "C" {
#define XML_TOK_PREFIXED_NAME 41
#ifdef XML_DTD
#define XML_TOK_IGNORE_SECT 42
# define XML_TOK_IGNORE_SECT 42
#endif /* XML_DTD */
#ifdef XML_DTD
#define XML_N_STATES 4
# define XML_N_STATES 4
#else /* not XML_DTD */
#define XML_N_STATES 3
# define XML_N_STATES 3
#endif /* not XML_DTD */
#define XML_PROLOG_STATE 0
#define XML_CONTENT_STATE 1
#define XML_CDATA_SECTION_STATE 2
#ifdef XML_DTD
#define XML_IGNORE_SECTION_STATE 3
# define XML_IGNORE_SECTION_STATE 3
#endif /* XML_DTD */
#define XML_N_LITERAL_TYPES 2
@ -153,52 +155,41 @@ typedef struct {
struct encoding;
typedef struct encoding ENCODING;
typedef int (PTRCALL *SCANNER)(const ENCODING *,
const char *,
const char *,
const char **);
typedef int(PTRCALL *SCANNER)(const ENCODING *, const char *, const char *,
const char **);
enum XML_Convert_Result {
XML_CONVERT_COMPLETED = 0,
XML_CONVERT_INPUT_INCOMPLETE = 1,
XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */
XML_CONVERT_OUTPUT_EXHAUSTED
= 2 /* and therefore potentially input remaining as well */
};
struct encoding {
SCANNER scanners[XML_N_STATES];
SCANNER literalScanners[XML_N_LITERAL_TYPES];
int (PTRCALL *nameMatchesAscii)(const ENCODING *,
const char *,
const char *,
const char *);
int (PTRFASTCALL *nameLength)(const ENCODING *, const char *);
int(PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *,
const char *);
int(PTRFASTCALL *nameLength)(const ENCODING *, const char *);
const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *);
int (PTRCALL *getAtts)(const ENCODING *enc,
const char *ptr,
int attsMax,
ATTRIBUTE *atts);
int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
int (PTRCALL *predefinedEntityName)(const ENCODING *,
const char *,
const char *);
void (PTRCALL *updatePosition)(const ENCODING *,
const char *ptr,
const char *end,
POSITION *);
int (PTRCALL *isPublicId)(const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr);
enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
char **toP,
const char *toLim);
enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
unsigned short **toP,
const unsigned short *toLim);
int(PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax,
ATTRIBUTE *atts);
int(PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
int(PTRCALL *predefinedEntityName)(const ENCODING *, const char *,
const char *);
void(PTRCALL *updatePosition)(const ENCODING *, const char *ptr,
const char *end, POSITION *);
int(PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr,
const char *end, const char **badPtr);
enum XML_Convert_Result(PTRCALL *utf8Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim, char **toP,
const char *toLim);
enum XML_Convert_Result(PTRCALL *utf16Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
unsigned short **toP,
const unsigned short *toLim);
int minBytesPerChar;
char isUtf8;
char isUtf16;
@ -225,66 +216,62 @@ struct encoding {
the prolog outside literals, comments and processing instructions.
*/
#define XmlTok(enc, state, ptr, end, nextTokPtr) \
#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 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 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)
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
#ifdef XML_DTD
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
# define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
#endif /* XML_DTD */
/* 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) \
#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 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 XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
#define XmlNameLength(enc, ptr) \
(((enc)->nameLength)(enc, ptr))
#define XmlNameLength(enc, ptr) (((enc)->nameLength)(enc, ptr))
#define XmlSkipS(enc, ptr) \
(((enc)->skipS)(enc, ptr))
#define XmlSkipS(enc, ptr) (((enc)->skipS)(enc, ptr))
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
(((enc)->getAtts)(enc, ptr, attsMax, atts))
#define XmlCharRefNumber(enc, ptr) \
(((enc)->charRefNumber)(enc, ptr))
#define XmlCharRefNumber(enc, ptr) (((enc)->charRefNumber)(enc, ptr))
#define XmlPredefinedEntityName(enc, ptr, end) \
#define XmlPredefinedEntityName(enc, ptr, end) \
(((enc)->predefinedEntityName)(enc, ptr, end))
#define XmlUpdatePosition(enc, ptr, end, pos) \
#define XmlUpdatePosition(enc, ptr, end, pos) \
(((enc)->updatePosition)(enc, ptr, end, pos))
#define XmlIsPublicId(enc, ptr, end, badPtr) \
#define XmlIsPublicId(enc, ptr, end, badPtr) \
(((enc)->isPublicId)(enc, ptr, end, badPtr))
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
typedef struct {
@ -292,16 +279,11 @@ typedef struct {
const ENCODING **encPtr;
} INIT_ENCODING;
int XmlParseXmlDecl(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **versionEndPtr,
int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc,
const char *ptr, const char *end, const char **badPtr,
const char **versionPtr, const char **versionEndPtr,
const char **encodingNamePtr,
const ENCODING **namedEncodingPtr,
int *standalonePtr);
const ENCODING **namedEncodingPtr, int *standalonePtr);
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING *XmlGetUtf8InternalEncoding(void);
@ -310,34 +292,22 @@ int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
int XmlSizeOfUnknownEncoding(void);
typedef int(XMLCALL *CONVERTER)(void *userData, const char *p);
typedef int (XMLCALL *CONVERTER) (void *userData, const char *p);
ENCODING *XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert,
void *userData);
ENCODING *
XmlInitUnknownEncoding(void *mem,
int *table,
CONVERTER convert,
void *userData);
int XmlParseXmlDeclNS(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **versionEndPtr,
int XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc,
const char *ptr, const char *end, const char **badPtr,
const char **versionPtr, const char **versionEndPtr,
const char **encodingNamePtr,
const ENCODING **namedEncodingPtr,
int *standalonePtr);
const ENCODING **namedEncodingPtr, int *standalonePtr);
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING *XmlGetUtf8InternalEncodingNS(void);
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
ENCODING *
XmlInitUnknownEncodingNS(void *mem,
int *table,
CONVERTER convert,
void *userData);
ENCODING *XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert,
void *userData);
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -31,43 +31,43 @@
*/
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_NONXML, /* e.g. noncharacter-FFFF */
BT_MALFORM, /* illegal, with regard to encoding */
BT_LT, /* less than = "<" */
BT_AMP, /* ampersand = "&" */
BT_RSQB, /* right square bracket = "[" */
BT_LEAD2, /* lead byte of a 2-byte UTF-8 character */
BT_LEAD3, /* lead byte of a 3-byte UTF-8 character */
BT_LEAD4, /* lead byte of a 4-byte UTF-8 character */
BT_TRAIL, /* trailing unit, e.g. second 16-bit unit of a 4-byte char. */
BT_CR, /* carriage return = "\r" */
BT_LF, /* line feed = "\n" */
BT_GT, /* greater than = ">" */
BT_QUOT, /* quotation character = "\"" */
BT_APOS, /* aposthrophe = "'" */
BT_EQUALS, /* equal sign = "=" */
BT_QUEST, /* question mark = "?" */
BT_EXCL, /* exclamation mark = "!" */
BT_SOL, /* solidus, slash = "/" */
BT_SEMI, /* semicolon = ";" */
BT_NUM, /* number sign = "#" */
BT_LSQB, /* left square bracket = "[" */
BT_S, /* white space, e.g. "\t", " "[, "\r"] */
BT_NMSTRT, /* non-hex name start letter = "G".."Z" + "g".."z" + "_" */
BT_COLON, /* colon = ":" */
BT_HEX, /* hex letter = "A".."F" + "a".."f" */
BT_DIGIT, /* digit = "0".."9" */
BT_NAME, /* dot and middle dot = "." + chr(0xb7) */
BT_MINUS, /* 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
BT_PERCNT, /* percent sign = "%" */
BT_LPAR, /* left parenthesis = "(" */
BT_RPAR, /* right parenthesis = "(" */
BT_AST, /* asterisk = "*" */
BT_PLUS, /* plus sign = "+" */
BT_COMMA, /* comma = "," */
BT_VERBAR /* vertical bar = "|" */
};
#include <stddef.h>

View File

@ -33,56 +33,47 @@
#ifdef XML_TOK_NS_C
const ENCODING *
NS(XmlGetUtf8InternalEncoding)(void)
{
NS(XmlGetUtf8InternalEncoding)(void) {
return &ns(internal_utf8_encoding).enc;
}
const ENCODING *
NS(XmlGetUtf16InternalEncoding)(void)
{
#if BYTEORDER == 1234
NS(XmlGetUtf16InternalEncoding)(void) {
# if BYTEORDER == 1234
return &ns(internal_little2_encoding).enc;
#elif BYTEORDER == 4321
# elif BYTEORDER == 4321
return &ns(internal_big2_encoding).enc;
#else
# else
const short n = 1;
return (*(const char *)&n
? &ns(internal_little2_encoding).enc
: &ns(internal_big2_encoding).enc);
#endif
return (*(const char *)&n ? &ns(internal_little2_encoding).enc
: &ns(internal_big2_encoding).enc);
# endif
}
static const ENCODING * const 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 const ENCODING *const 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 PTRCALL
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);
const char **nextTokPtr) {
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE,
ptr, end, nextTokPtr);
}
static int PTRCALL
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);
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)
{
const char *name) {
int i = getEncodingIndex(name);
if (i == UNKNOWN_ENC)
return 0;
@ -96,9 +87,8 @@ NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,
}
static const ENCODING *
NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
{
#define ENCODING_MAX 128
NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) {
# define ENCODING_MAX 128
char buf[ENCODING_MAX];
char *p = buf;
int i;
@ -115,28 +105,14 @@ NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
}
int
NS(XmlParseXmlDecl)(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **versionEndPtr,
const char **encodingName,
const ENCODING **encoding,
int *standalone)
{
return doParseXmlDecl(NS(findEncoding),
isGeneralTextEntity,
enc,
ptr,
end,
badPtr,
versionPtr,
versionEndPtr,
encodingName,
encoding,
standalone);
NS(XmlParseXmlDecl)(int isGeneralTextEntity, const ENCODING *enc,
const char *ptr, const char *end, const char **badPtr,
const char **versionPtr, const char **versionEndPtr,
const char **encodingName, const ENCODING **encoding,
int *standalone) {
return doParseXmlDecl(NS(findEncoding), isGeneralTextEntity, enc, ptr, end,
badPtr, versionPtr, versionEndPtr, encodingName,
encoding, standalone);
}
#endif /* XML_TOK_NS_C */

View File

@ -1,4 +1,4 @@
#! /bin/bash
#! /usr/bin/env bash
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -125,7 +125,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@ -169,7 +176,10 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/chardata.Po ./$(DEPDIR)/memcheck.Po \
./$(DEPDIR)/minicheck.Po ./$(DEPDIR)/runtests.Po \
./$(DEPDIR)/runtestspp.Po ./$(DEPDIR)/structdata.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -231,7 +241,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
check recheck distdir
check recheck distdir distdir-am
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
@ -660,8 +670,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -673,14 +683,6 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libruntests.a: $(libruntests_a_OBJECTS) $(libruntests_a_DEPENDENCIES) $(EXTRA_libruntests_a_DEPENDENCIES)
$(AM_V_at)-rm -f libruntests.a
$(AM_V_AR)$(libruntests_a_AR) libruntests.a $(libruntests_a_OBJECTS) $(libruntests_a_LIBADD)
$(AM_V_at)$(RANLIB) libruntests.a
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
@ -690,6 +692,14 @@ clean-checkPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libruntests.a: $(libruntests_a_OBJECTS) $(libruntests_a_DEPENDENCIES) $(EXTRA_libruntests_a_DEPENDENCIES)
$(AM_V_at)-rm -f libruntests.a
$(AM_V_AR)$(libruntests_a_AR) libruntests.a $(libruntests_a_OBJECTS) $(libruntests_a_LIBADD)
$(AM_V_at)$(RANLIB) libruntests.a
runtests$(EXEEXT): $(runtests_OBJECTS) $(runtests_DEPENDENCIES) $(EXTRA_runtests_DEPENDENCIES)
@rm -f runtests$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(runtests_OBJECTS) $(runtests_LDADD) $(LIBS)
@ -704,12 +714,18 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chardata.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcheck.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minicheck.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtestspp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/structdata.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chardata.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcheck.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minicheck.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtests.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtestspp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/structdata.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@ -978,7 +994,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
fi; \
$$success || exit 1
check-TESTS:
check-TESTS: $(check_PROGRAMS)
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@ -1028,7 +1044,10 @@ runtestspp.log: runtestspp$(EXEEXT)
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -1129,7 +1148,12 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/chardata.Po
-rm -f ./$(DEPDIR)/memcheck.Po
-rm -f ./$(DEPDIR)/minicheck.Po
-rm -f ./$(DEPDIR)/runtests.Po
-rm -f ./$(DEPDIR)/runtestspp.Po
-rm -f ./$(DEPDIR)/structdata.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@ -1175,7 +1199,12 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/chardata.Po
-rm -f ./$(DEPDIR)/memcheck.Po
-rm -f ./$(DEPDIR)/minicheck.Po
-rm -f ./$(DEPDIR)/runtests.Po
-rm -f ./$(DEPDIR)/runtestspp.Po
-rm -f ./$(DEPDIR)/structdata.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@ -1196,20 +1225,21 @@ uninstall-am:
.MAKE: $(am__recursive_targets) check-am install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
check-TESTS check-am clean clean-checkPROGRAMS clean-generic \
clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
recheck tags tags-am uninstall uninstall-am
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--depfiles check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \
uninstall uninstall-am
.PRECIOUS: Makefile

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -124,7 +124,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@ -155,7 +162,8 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/benchmark.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -357,8 +365,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -389,7 +397,13 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@ -470,7 +484,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -540,7 +557,7 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/benchmark.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@ -586,7 +603,7 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/benchmark.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@ -607,9 +624,9 @@ uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \

View File

@ -37,43 +37,40 @@
#include "expat.h"
#ifdef XML_LARGE_SIZE
# define XML_FMT_INT_MOD "ll"
# define XML_FMT_INT_MOD "ll"
#else
# define XML_FMT_INT_MOD "l"
# define XML_FMT_INT_MOD "l"
#endif
#ifdef XML_UNICODE_WCHAR_T
# define XML_FMT_STR "ls"
# define XML_FMT_STR "ls"
#else
# define XML_FMT_STR "s"
# define XML_FMT_STR "s"
#endif
static void
usage(const char *prog, int rc)
{
fprintf(stderr,
"usage: %s [-n] filename bufferSize nr_of_loops\n", prog);
usage(const char *prog, int rc) {
fprintf(stderr, "usage: %s [-n] filename bufferSize nr_of_loops\n", prog);
exit(rc);
}
int main (int argc, char *argv[])
{
XML_Parser parser;
char *XMLBuf, *XMLBufEnd, *XMLBufPtr;
FILE *fd;
int
main(int argc, char *argv[]) {
XML_Parser parser;
char *XMLBuf, *XMLBufEnd, *XMLBufPtr;
FILE *fd;
struct stat fileAttr;
int nrOfLoops, bufferSize, fileSize, i, isFinal;
int j = 0, ns = 0;
clock_t tstart, tend;
double cpuTime = 0.0;
int nrOfLoops, bufferSize, fileSize, i, isFinal;
int j = 0, ns = 0;
clock_t tstart, tend;
double cpuTime = 0.0;
if (argc > 1) {
if (argv[1][0] == '-') {
if (argv[1][1] == 'n' && argv[1][2] == '\0') {
ns = 1;
j = 1;
}
else
} else
usage(argv[0], 1);
}
}
@ -81,28 +78,27 @@ int main (int argc, char *argv[])
if (argc != j + 4)
usage(argv[0], 1);
if (stat (argv[j + 1], &fileAttr) != 0) {
fprintf (stderr, "could not access file '%s'\n", argv[j + 1]);
if (stat(argv[j + 1], &fileAttr) != 0) {
fprintf(stderr, "could not access file '%s'\n", argv[j + 1]);
return 2;
}
fd = fopen (argv[j + 1], "r");
if (!fd) {
fprintf (stderr, "could not open file '%s'\n", argv[j + 1]);
fd = fopen(argv[j + 1], "r");
if (! fd) {
fprintf(stderr, "could not open file '%s'\n", argv[j + 1]);
exit(2);
}
bufferSize = atoi (argv[j + 2]);
nrOfLoops = atoi (argv[j + 3]);
bufferSize = atoi(argv[j + 2]);
nrOfLoops = atoi(argv[j + 3]);
if (bufferSize <= 0 || nrOfLoops <= 0) {
fprintf (stderr,
"buffer size and nr of loops must be greater than zero.\n");
fprintf(stderr, "buffer size and nr of loops must be greater than zero.\n");
exit(3);
}
XMLBuf = malloc (fileAttr.st_size);
fileSize = fread (XMLBuf, sizeof (char), fileAttr.st_size, fd);
fclose (fd);
XMLBuf = malloc(fileAttr.st_size);
fileSize = fread(XMLBuf, sizeof(char), fileAttr.st_size, fd);
fclose(fd);
if (ns)
parser = XML_ParserCreateNS(NULL, '!');
@ -121,29 +117,29 @@ int main (int argc, char *argv[])
isFinal = 1;
else
parseBufferSize = bufferSize;
if (!XML_Parse (parser, XMLBufPtr, parseBufferSize, isFinal)) {
fprintf (stderr,
"error '%" XML_FMT_STR "' at line %" XML_FMT_INT_MOD \
"u character %" XML_FMT_INT_MOD "u\n",
XML_ErrorString (XML_GetErrorCode (parser)),
XML_GetCurrentLineNumber (parser),
XML_GetCurrentColumnNumber (parser));
free (XMLBuf);
XML_ParserFree (parser);
exit (4);
if (! XML_Parse(parser, XMLBufPtr, parseBufferSize, isFinal)) {
fprintf(stderr,
"error '%" XML_FMT_STR "' at line %" XML_FMT_INT_MOD
"u character %" XML_FMT_INT_MOD "u\n",
XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser));
free(XMLBuf);
XML_ParserFree(parser);
exit(4);
}
XMLBufPtr += bufferSize;
} while (!isFinal);
} while (! isFinal);
tend = clock();
cpuTime += ((double) (tend - tstart)) / CLOCKS_PER_SEC;
cpuTime += ((double)(tend - tstart)) / CLOCKS_PER_SEC;
XML_ParserReset(parser, NULL);
i++;
}
XML_ParserFree (parser);
free (XMLBuf);
XML_ParserFree(parser);
free(XMLBuf);
printf ("%d loops, with buffer size %d. Average time per loop: %f\n",
nrOfLoops, bufferSize, cpuTime / (double) nrOfLoops);
printf("%d loops, with buffer size %d. Average time per loop: %f\n",
nrOfLoops, bufferSize, cpuTime / (double)nrOfLoops);
return 0;
}

View File

@ -31,7 +31,7 @@
*/
#ifdef HAVE_EXPAT_CONFIG_H
# include <expat_config.h>
# include <expat_config.h>
#endif
#include "minicheck.h"
@ -41,65 +41,58 @@
#include "chardata.h"
static int
xmlstrlen(const XML_Char *s)
{
int len = 0;
assert(s != NULL);
while (s[len] != 0)
++len;
return len;
}
void
CharData_Init(CharData *storage)
{
assert(storage != NULL);
storage->count = -1;
xmlstrlen(const XML_Char *s) {
int len = 0;
assert(s != NULL);
while (s[len] != 0)
++len;
return len;
}
void
CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len)
{
int maxchars;
CharData_Init(CharData *storage) {
assert(storage != NULL);
storage->count = -1;
}
assert(storage != NULL);
assert(s != NULL);
maxchars = sizeof(storage->data) / sizeof(storage->data[0]);
if (storage->count < 0)
storage->count = 0;
if (len < 0)
len = xmlstrlen(s);
if ((len + storage->count) > maxchars) {
len = (maxchars - storage->count);
}
if (len + storage->count < (int)sizeof(storage->data)) {
memcpy(storage->data + storage->count, s,
len * sizeof(storage->data[0]));
storage->count += len;
}
void
CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) {
int maxchars;
assert(storage != NULL);
assert(s != NULL);
maxchars = sizeof(storage->data) / sizeof(storage->data[0]);
if (storage->count < 0)
storage->count = 0;
if (len < 0)
len = xmlstrlen(s);
if ((len + storage->count) > maxchars) {
len = (maxchars - storage->count);
}
if (len + storage->count < (int)sizeof(storage->data)) {
memcpy(storage->data + storage->count, s, len * sizeof(storage->data[0]));
storage->count += len;
}
}
int
CharData_CheckXMLChars(CharData *storage, const XML_Char *expected)
{
char buffer[1024];
int len = xmlstrlen(expected);
int count;
CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) {
char buffer[1024];
int len = xmlstrlen(expected);
int count;
assert(storage != NULL);
count = (storage->count < 0) ? 0 : storage->count;
if (len != count) {
sprintf(buffer, "wrong number of data characters: got %d, expected %d",
count, len);
fail(buffer);
return 0;
}
if (memcmp(expected, storage->data, len * sizeof(storage->data[0])) != 0) {
fail("got bad data bytes");
return 0;
}
return 1;
assert(storage != NULL);
count = (storage->count < 0) ? 0 : storage->count;
if (len != count) {
sprintf(buffer, "wrong number of data characters: got %d, expected %d",
count, len);
fail(buffer);
return 0;
}
if (memcmp(expected, storage->data, len * sizeof(storage->data[0])) != 0) {
fail("got bad data bytes");
return 0;
}
return 1;
}

View File

@ -36,27 +36,24 @@ extern "C" {
#endif
#ifndef XML_CHARDATA_H
#define XML_CHARDATA_H 1
#ifndef XML_VERSION
#include "expat.h" /* need XML_Char */
#endif
# define XML_CHARDATA_H 1
# ifndef XML_VERSION
# include "expat.h" /* need XML_Char */
# endif
typedef struct {
int count; /* # of chars, < 0 if not set */
XML_Char data[2048];
int count; /* # of chars, < 0 if not set */
XML_Char data[2048];
} CharData;
void CharData_Init(CharData *storage);
void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len);
int CharData_CheckXMLChars(CharData *storage, const XML_Char *s);
#endif /* XML_CHARDATA_H */
#endif /* XML_CHARDATA_H */
#ifdef __cplusplus
}

View File

@ -34,17 +34,16 @@
#include <stdlib.h>
#include "memcheck.h"
/* Structures to keep track of what has been allocated. Speed isn't a
* big issue for the tests this is required for, so we will use a
* doubly-linked list to make deletion easier.
*/
typedef struct allocation_entry {
struct allocation_entry * next;
struct allocation_entry * prev;
void * allocation;
size_t num_bytes;
struct allocation_entry *next;
struct allocation_entry *prev;
void *allocation;
size_t num_bytes;
} AllocationEntry;
static AllocationEntry *alloc_head = NULL;
@ -52,147 +51,140 @@ static AllocationEntry *alloc_tail = NULL;
static AllocationEntry *find_allocation(void *ptr);
/* Allocate some memory and keep track of it. */
void *
tracking_malloc(size_t size)
{
AllocationEntry *entry = malloc(sizeof(AllocationEntry));
tracking_malloc(size_t size) {
AllocationEntry *entry = malloc(sizeof(AllocationEntry));
if (entry == NULL) {
printf("Allocator failure\n");
return NULL;
}
entry->num_bytes = size;
entry->allocation = malloc(size);
if (entry->allocation == NULL) {
free(entry);
return NULL;
}
entry->next = NULL;
if (entry == NULL) {
printf("Allocator failure\n");
return NULL;
}
entry->num_bytes = size;
entry->allocation = malloc(size);
if (entry->allocation == NULL) {
free(entry);
return NULL;
}
entry->next = NULL;
/* Add to the list of allocations */
if (alloc_head == NULL) {
entry->prev = NULL;
alloc_head = alloc_tail = entry;
} else {
entry->prev = alloc_tail;
alloc_tail->next = entry;
alloc_tail = entry;
}
/* Add to the list of allocations */
if (alloc_head == NULL) {
entry->prev = NULL;
alloc_head = alloc_tail = entry;
} else {
entry->prev = alloc_tail;
alloc_tail->next = entry;
alloc_tail = entry;
}
return entry->allocation;
return entry->allocation;
}
static AllocationEntry *
find_allocation(void *ptr)
{
AllocationEntry *entry;
find_allocation(void *ptr) {
AllocationEntry *entry;
for (entry = alloc_head; entry != NULL; entry = entry->next) {
if (entry->allocation == ptr) {
return entry;
}
for (entry = alloc_head; entry != NULL; entry = entry->next) {
if (entry->allocation == ptr) {
return entry;
}
return NULL;
}
return NULL;
}
/* Free some memory and remove the tracking for it */
void
tracking_free(void *ptr)
{
AllocationEntry *entry;
tracking_free(void *ptr) {
AllocationEntry *entry;
if (ptr == NULL) {
/* There won't be an entry for this */
return;
}
if (ptr == NULL) {
/* There won't be an entry for this */
return;
}
entry = find_allocation(ptr);
if (entry != NULL) {
/* This is the relevant allocation. Unlink it */
if (entry->prev != NULL)
entry->prev->next = entry->next;
else
alloc_head = entry->next;
if (entry->next != NULL)
entry->next->prev = entry->prev;
else
alloc_tail = entry->next;
free(entry);
} else {
printf("Attempting to free unallocated memory at %p\n", ptr);
}
free(ptr);
entry = find_allocation(ptr);
if (entry != NULL) {
/* This is the relevant allocation. Unlink it */
if (entry->prev != NULL)
entry->prev->next = entry->next;
else
alloc_head = entry->next;
if (entry->next != NULL)
entry->next->prev = entry->prev;
else
alloc_tail = entry->next;
free(entry);
} else {
printf("Attempting to free unallocated memory at %p\n", ptr);
}
free(ptr);
}
/* Reallocate some memory and keep track of it */
void *
tracking_realloc(void *ptr, size_t size)
{
AllocationEntry *entry;
tracking_realloc(void *ptr, size_t size) {
AllocationEntry *entry;
if (ptr == NULL) {
/* By definition, this is equivalent to malloc(size) */
return tracking_malloc(size);
}
if (size == 0) {
/* By definition, this is equivalent to free(ptr) */
tracking_free(ptr);
return NULL;
}
if (ptr == NULL) {
/* By definition, this is equivalent to malloc(size) */
return tracking_malloc(size);
}
if (size == 0) {
/* By definition, this is equivalent to free(ptr) */
tracking_free(ptr);
return NULL;
}
/* Find the allocation entry for this memory */
entry = find_allocation(ptr);
/* Find the allocation entry for this memory */
entry = find_allocation(ptr);
if (entry == NULL) {
printf("Attempting to realloc unallocated memory at %p\n", ptr);
entry = malloc(sizeof(AllocationEntry));
if (entry == NULL) {
printf("Attempting to realloc unallocated memory at %p\n", ptr);
entry = malloc(sizeof(AllocationEntry));
if (entry == NULL) {
printf("Reallocator failure\n");
return NULL;
}
entry->allocation = realloc(ptr, size);
if (entry->allocation == NULL) {
free(entry);
return NULL;
}
/* Add to the list of allocations */
entry->next = NULL;
if (alloc_head == NULL) {
entry->prev = NULL;
alloc_head = alloc_tail = entry;
} else {
entry->prev = alloc_tail;
alloc_tail->next = entry;
alloc_tail = entry;
}
} else {
entry->allocation = realloc(ptr, size);
if (entry->allocation == NULL) {
/* Realloc semantics say the original is still allocated */
entry->allocation = ptr;
return NULL;
}
printf("Reallocator failure\n");
return NULL;
}
entry->allocation = realloc(ptr, size);
if (entry->allocation == NULL) {
free(entry);
return NULL;
}
entry->num_bytes = size;
return entry->allocation;
/* Add to the list of allocations */
entry->next = NULL;
if (alloc_head == NULL) {
entry->prev = NULL;
alloc_head = alloc_tail = entry;
} else {
entry->prev = alloc_tail;
alloc_tail->next = entry;
alloc_tail = entry;
}
} else {
entry->allocation = realloc(ptr, size);
if (entry->allocation == NULL) {
/* Realloc semantics say the original is still allocated */
entry->allocation = ptr;
return NULL;
}
}
entry->num_bytes = size;
return entry->allocation;
}
int
tracking_report(void)
{
AllocationEntry *entry;
tracking_report(void) {
AllocationEntry *entry;
if (alloc_head == NULL)
return 1;
if (alloc_head == NULL)
return 1;
/* Otherwise we have allocations that haven't been freed */
for (entry = alloc_head; entry != NULL; entry = entry->next)
{
printf("Allocated %lu bytes at %p\n",
(long unsigned)entry->num_bytes, entry->allocation);
}
return 0;
/* Otherwise we have allocations that haven't been freed */
for (entry = alloc_head; entry != NULL; entry = entry->next) {
printf("Allocated %lu bytes at %p\n", (long unsigned)entry->num_bytes,
entry->allocation);
}
return 0;
}

View File

@ -36,7 +36,7 @@ extern "C" {
#endif
#ifndef XML_MEMCHECK_H
#define XML_MEMCHECK_H 1
# define XML_MEMCHECK_H 1
/* Allocation declarations */

View File

@ -40,100 +40,91 @@
#include <assert.h>
#include <string.h>
#include "internal.h" /* for UNUSED_P only */
#include "internal.h" /* for UNUSED_P only */
#include "minicheck.h"
Suite *
suite_create(const char *name)
{
Suite *suite = (Suite *) calloc(1, sizeof(Suite));
if (suite != NULL) {
suite->name = name;
}
return suite;
suite_create(const char *name) {
Suite *suite = (Suite *)calloc(1, sizeof(Suite));
if (suite != NULL) {
suite->name = name;
}
return suite;
}
TCase *
tcase_create(const char *name)
{
TCase *tc = (TCase *) calloc(1, sizeof(TCase));
if (tc != NULL) {
tc->name = name;
}
return tc;
tcase_create(const char *name) {
TCase *tc = (TCase *)calloc(1, sizeof(TCase));
if (tc != NULL) {
tc->name = name;
}
return tc;
}
void
suite_add_tcase(Suite *suite, TCase *tc)
{
assert(suite != NULL);
assert(tc != NULL);
assert(tc->next_tcase == NULL);
suite_add_tcase(Suite *suite, TCase *tc) {
assert(suite != NULL);
assert(tc != NULL);
assert(tc->next_tcase == NULL);
tc->next_tcase = suite->tests;
suite->tests = tc;
tc->next_tcase = suite->tests;
suite->tests = tc;
}
void
tcase_add_checked_fixture(TCase *tc,
tcase_setup_function setup,
tcase_teardown_function teardown)
{
assert(tc != NULL);
tc->setup = setup;
tc->teardown = teardown;
tcase_add_checked_fixture(TCase *tc, tcase_setup_function setup,
tcase_teardown_function teardown) {
assert(tc != NULL);
tc->setup = setup;
tc->teardown = teardown;
}
void
tcase_add_test(TCase *tc, tcase_test_function test)
{
assert(tc != NULL);
if (tc->allocated == tc->ntests) {
int nalloc = tc->allocated + 100;
size_t new_size = sizeof(tcase_test_function) * nalloc;
tcase_test_function *new_tests = realloc(tc->tests, new_size);
assert(new_tests != NULL);
tc->tests = new_tests;
tc->allocated = nalloc;
}
tc->tests[tc->ntests] = test;
tc->ntests++;
tcase_add_test(TCase *tc, tcase_test_function test) {
assert(tc != NULL);
if (tc->allocated == tc->ntests) {
int nalloc = tc->allocated + 100;
size_t new_size = sizeof(tcase_test_function) * nalloc;
tcase_test_function *new_tests = realloc(tc->tests, new_size);
assert(new_tests != NULL);
tc->tests = new_tests;
tc->allocated = nalloc;
}
tc->tests[tc->ntests] = test;
tc->ntests++;
}
static void
tcase_free(TCase *tc)
{
if (! tc) {
return;
}
tcase_free(TCase *tc) {
if (! tc) {
return;
}
free(tc->tests);
free(tc);
free(tc->tests);
free(tc);
}
static void
suite_free(Suite *suite)
{
if (! suite) {
return;
}
suite_free(Suite *suite) {
if (! suite) {
return;
}
while (suite->tests != NULL) {
TCase *next = suite->tests->next_tcase;
tcase_free(suite->tests);
suite->tests = next;
}
free(suite);
while (suite->tests != NULL) {
TCase *next = suite->tests->next_tcase;
tcase_free(suite->tests);
suite->tests = next;
}
free(suite);
}
SRunner *
srunner_create(Suite *suite)
{
SRunner *runner = calloc(1, sizeof(SRunner));
if (runner != NULL) {
runner->suite = suite;
}
return runner;
srunner_create(Suite *suite) {
SRunner *runner = calloc(1, sizeof(SRunner));
if (runner != NULL) {
runner->suite = suite;
}
return runner;
}
static jmp_buf env;
@ -143,100 +134,96 @@ static int _check_current_lineno = -1;
static char const *_check_current_filename = NULL;
void
_check_set_test_info(char const *function, char const *filename, int lineno)
{
_check_current_function = function;
_check_current_lineno = lineno;
_check_current_filename = filename;
_check_set_test_info(char const *function, char const *filename, int lineno) {
_check_current_function = function;
_check_current_lineno = lineno;
_check_current_filename = filename;
}
static void
add_failure(SRunner *runner, int verbosity)
{
runner->nfailures++;
if (verbosity >= CK_VERBOSE) {
printf("%s:%d: %s\n", _check_current_filename,
_check_current_lineno, _check_current_function);
}
add_failure(SRunner *runner, int verbosity) {
runner->nfailures++;
if (verbosity >= CK_VERBOSE) {
printf("%s:%d: %s\n", _check_current_filename, _check_current_lineno,
_check_current_function);
}
}
void
srunner_run_all(SRunner *runner, int verbosity)
{
Suite *suite;
TCase *tc;
assert(runner != NULL);
suite = runner->suite;
tc = suite->tests;
while (tc != NULL) {
int i;
for (i = 0; i < tc->ntests; ++i) {
runner->nchecks++;
srunner_run_all(SRunner *runner, int verbosity) {
Suite *suite;
TCase *volatile tc;
assert(runner != NULL);
suite = runner->suite;
tc = suite->tests;
while (tc != NULL) {
volatile int i;
for (i = 0; i < tc->ntests; ++i) {
runner->nchecks++;
if (tc->setup != NULL) {
/* setup */
if (setjmp(env)) {
add_failure(runner, verbosity);
continue;
}
tc->setup();
}
/* test */
if (setjmp(env)) {
add_failure(runner, verbosity);
continue;
}
(tc->tests[i])();
/* teardown */
if (tc->teardown != NULL) {
if (setjmp(env)) {
add_failure(runner, verbosity);
continue;
}
tc->teardown();
}
if (tc->setup != NULL) {
/* setup */
if (setjmp(env)) {
add_failure(runner, verbosity);
continue;
}
tc = tc->next_tcase;
}
if (verbosity) {
int passed = runner->nchecks - runner->nfailures;
double percentage = ((double) passed) / runner->nchecks;
int display = (int) (percentage * 100);
printf("%d%%: Checks: %d, Failed: %d\n",
display, runner->nchecks, runner->nfailures);
tc->setup();
}
/* test */
if (setjmp(env)) {
add_failure(runner, verbosity);
continue;
}
(tc->tests[i])();
/* teardown */
if (tc->teardown != NULL) {
if (setjmp(env)) {
add_failure(runner, verbosity);
continue;
}
tc->teardown();
}
}
tc = tc->next_tcase;
}
if (verbosity) {
int passed = runner->nchecks - runner->nfailures;
double percentage = ((double)passed) / runner->nchecks;
int display = (int)(percentage * 100);
printf("%d%%: Checks: %d, Failed: %d\n", display, runner->nchecks,
runner->nfailures);
}
}
void
_fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(line), const char *msg)
{
/* Always print the error message so it isn't lost. In this case,
we have a failure, so there's no reason to be quiet about what
it is.
*/
if (msg != NULL) {
const int has_newline = (msg[strlen(msg) - 1] == '\n');
fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n");
}
longjmp(env, 1);
_fail_unless(int condition, const char *file, int line, const char *msg) {
/* Always print the error message so it isn't lost. In this case,
we have a failure, so there's no reason to be quiet about what
it is.
*/
UNUSED_P(condition);
UNUSED_P(file);
UNUSED_P(line);
if (msg != NULL) {
const int has_newline = (msg[strlen(msg) - 1] == '\n');
fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n");
}
longjmp(env, 1);
}
int
srunner_ntests_failed(SRunner *runner)
{
assert(runner != NULL);
return runner->nfailures;
srunner_ntests_failed(SRunner *runner) {
assert(runner != NULL);
return runner->nfailures;
}
void
srunner_free(SRunner *runner)
{
if (! runner) {
return;
}
srunner_free(SRunner *runner) {
if (! runner) {
return;
}
suite_free(runner->suite);
free(runner);
suite_free(runner->suite);
free(runner);
}

View File

@ -41,26 +41,29 @@ extern "C" {
#endif
#define CK_NOFORK 0
#define CK_FORK 1
#define CK_FORK 1
#define CK_SILENT 0
#define CK_NORMAL 1
#define CK_SILENT 0
#define CK_NORMAL 1
#define CK_VERBOSE 2
/* Workaround for Microsoft's compiler and Tru64 Unix systems where the
C compiler has a working __func__, but the C++ compiler only has a
working __FUNCTION__. This could be fixed in configure.in, but it's
not worth it right now. */
#if defined (_MSC_VER) || (defined(__osf__) && defined(__cplusplus))
#define __func__ __FUNCTION__
#if defined(_MSC_VER) || (defined(__osf__) && defined(__cplusplus))
# define __func__ __FUNCTION__
#endif
#define START_TEST(testname) static void testname(void) { \
_check_set_test_info(__func__, __FILE__, __LINE__); \
#define START_TEST(testname) \
static void testname(void) { \
_check_set_test_info(__func__, __FILE__, __LINE__); \
{
#define END_TEST } }
#define END_TEST \
} \
}
#define fail(msg) _fail_unless(0, __FILE__, __LINE__, msg)
#define fail(msg) _fail_unless(0, __FILE__, __LINE__, msg)
typedef void (*tcase_setup_function)(void);
typedef void (*tcase_teardown_function)(void);
@ -71,31 +74,29 @@ typedef struct Suite Suite;
typedef struct TCase TCase;
struct SRunner {
Suite *suite;
int nchecks;
int nfailures;
Suite *suite;
int nchecks;
int nfailures;
};
struct Suite {
const char *name;
TCase *tests;
const char *name;
TCase *tests;
};
struct TCase {
const char *name;
tcase_setup_function setup;
tcase_teardown_function teardown;
tcase_test_function *tests;
int ntests;
int allocated;
TCase *next_tcase;
const char *name;
tcase_setup_function setup;
tcase_teardown_function teardown;
tcase_test_function *tests;
int ntests;
int allocated;
TCase *next_tcase;
};
/* Internal helper. */
void _check_set_test_info(char const *function,
char const *filename, int lineno);
void _check_set_test_info(char const *function, char const *filename,
int lineno);
/*
* Prototypes for the actual implementation.
@ -105,8 +106,7 @@ void _fail_unless(int condition, const char *file, int line, const char *msg);
Suite *suite_create(const char *name);
TCase *tcase_create(const char *name);
void suite_add_tcase(Suite *suite, TCase *tc);
void tcase_add_checked_fixture(TCase *,
tcase_setup_function,
void tcase_add_checked_fixture(TCase *, tcase_setup_function,
tcase_teardown_function);
void tcase_add_test(TCase *tc, tcase_test_function test);
SRunner *srunner_create(Suite *suite);

File diff suppressed because it is too large Load Diff

View File

@ -31,10 +31,9 @@
*/
#ifdef HAVE_EXPAT_CONFIG_H
# include "expat_config.h"
# include "expat_config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
@ -46,117 +45,111 @@
#define STRUCT_EXTENSION_COUNT 8
#ifdef XML_UNICODE_WCHAR_T
# include <wchar.h>
# define XML_FMT_STR "ls"
# define xcstrlen(s) wcslen(s)
# define xcstrcmp(s, t) wcscmp((s), (t))
# include <wchar.h>
# define XML_FMT_STR "ls"
# define xcstrlen(s) wcslen(s)
# define xcstrcmp(s, t) wcscmp((s), (t))
#else
# define XML_FMT_STR "s"
# define xcstrlen(s) strlen(s)
# define xcstrcmp(s, t) strcmp((s), (t))
# define XML_FMT_STR "s"
# define xcstrlen(s) strlen(s)
# define xcstrcmp(s, t) strcmp((s), (t))
#endif
static XML_Char *
xmlstrdup(const XML_Char *s)
{
size_t byte_count = (xcstrlen(s) + 1) * sizeof(XML_Char);
XML_Char *dup = malloc(byte_count);
xmlstrdup(const XML_Char *s) {
size_t byte_count = (xcstrlen(s) + 1) * sizeof(XML_Char);
XML_Char *dup = malloc(byte_count);
assert(dup != NULL);
memcpy(dup, s, byte_count);
return dup;
}
void
StructData_Init(StructData *storage)
{
assert(storage != NULL);
storage->count = 0;
storage->max_count = 0;
storage->entries = NULL;
assert(dup != NULL);
memcpy(dup, s, byte_count);
return dup;
}
void
StructData_AddItem(StructData *storage,
const XML_Char *s,
int data0,
int data1,
int data2)
{
StructDataEntry *entry;
StructData_Init(StructData *storage) {
assert(storage != NULL);
storage->count = 0;
storage->max_count = 0;
storage->entries = NULL;
}
assert(storage != NULL);
assert(s != NULL);
if (storage->count == storage->max_count) {
StructDataEntry *new;
void
StructData_AddItem(StructData *storage, const XML_Char *s, int data0, int data1,
int data2) {
StructDataEntry *entry;
storage->max_count += STRUCT_EXTENSION_COUNT;
new = realloc(storage->entries,
storage->max_count * sizeof(StructDataEntry));
assert(new != NULL);
storage->entries = new;
}
assert(storage != NULL);
assert(s != NULL);
if (storage->count == storage->max_count) {
StructDataEntry *new;
entry = &storage->entries[storage->count];
entry->str = xmlstrdup(s);
entry->data0 = data0;
entry->data1 = data1;
entry->data2 = data2;
storage->count++;
storage->max_count += STRUCT_EXTENSION_COUNT;
new = realloc(storage->entries,
storage->max_count * sizeof(StructDataEntry));
assert(new != NULL);
storage->entries = new;
}
entry = &storage->entries[storage->count];
entry->str = xmlstrdup(s);
entry->data0 = data0;
entry->data1 = data1;
entry->data2 = data2;
storage->count++;
}
/* 'fail()' aborts the function via a longjmp, so there is no point
* in returning a value from this function.
*/
void
StructData_CheckItems(StructData *storage,
const StructDataEntry *expected,
int count)
{
char buffer[1024];
int i;
StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
int count) {
char buffer[1024];
int i;
assert(storage != NULL);
assert(expected != NULL);
if (count != storage->count) {
sprintf(buffer, "wrong number of entries: got %d, expected %d",
storage->count, count);
assert(storage != NULL);
assert(expected != NULL);
if (count != storage->count) {
sprintf(buffer, "wrong number of entries: got %d, expected %d",
storage->count, count);
StructData_Dispose(storage);
fail(buffer);
} else {
for (i = 0; i < count; i++) {
const StructDataEntry *got = &storage->entries[i];
const StructDataEntry *want = &expected[i];
assert(got != NULL);
assert(want != NULL);
if (xcstrcmp(got->str, want->str) != 0) {
StructData_Dispose(storage);
fail(buffer);
}
for (i = 0; i < count; i++)
{
const StructDataEntry *got = &storage->entries[i];
const StructDataEntry *want = &expected[i];
if (xcstrcmp(got->str, want->str) != 0) {
StructData_Dispose(storage);
fail("structure got bad string");
}
if (got->data0 != want->data0 ||
got->data1 != want->data1 ||
got->data2 != want->data2) {
sprintf(buffer,
"struct '%" XML_FMT_STR
"' expected (%d,%d,%d), got (%d,%d,%d)",
got->str,
want->data0, want->data1, want->data2,
got->data0, got->data1, got->data2);
StructData_Dispose(storage);
fail(buffer);
fail("structure got bad string");
} else {
if (got->data0 != want->data0 || got->data1 != want->data1
|| got->data2 != want->data2) {
sprintf(buffer,
"struct '%" XML_FMT_STR
"' expected (%d,%d,%d), got (%d,%d,%d)",
got->str, want->data0, want->data1, want->data2, got->data0,
got->data1, got->data2);
StructData_Dispose(storage);
fail(buffer);
}
}
}
}
}
void
StructData_Dispose(StructData *storage)
{
int i;
StructData_Dispose(StructData *storage) {
int i;
assert(storage != NULL);
for (i = 0; i < storage->count; i++)
free((void *)storage->entries[i].str);
free(storage->entries);
assert(storage != NULL);
for (i = 0; i < storage->count; i++)
free((void *)storage->entries[i].str);
free(storage->entries);
storage->count = 0;
storage->entries = NULL;
}

View File

@ -36,40 +36,34 @@ extern "C" {
#endif
#ifndef XML_STRUCTDATA_H
#define XML_STRUCTDATA_H 1
# define XML_STRUCTDATA_H 1
#include "expat.h"
# include "expat.h"
typedef struct {
const XML_Char *str;
int data0;
int data1;
int data2;
const XML_Char *str;
int data0;
int data1;
int data2;
} StructDataEntry;
typedef struct {
int count; /* Number of entries used */
int max_count; /* Number of StructDataEntry items in `entries` */
StructDataEntry *entries;
int count; /* Number of entries used */
int max_count; /* Number of StructDataEntry items in `entries` */
StructDataEntry *entries;
} StructData;
void StructData_Init(StructData *storage);
void StructData_AddItem(StructData *storage,
const XML_Char *s,
int data0,
int data1,
int data2);
void StructData_AddItem(StructData *storage, const XML_Char *s, int data0,
int data1, int data2);
void StructData_CheckItems(StructData *storage,
const StructDataEntry *expected,
void StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
int count);
void StructData_Dispose(StructData *storage);
#endif /* XML_STRUCTDATA_H */
#endif /* XML_STRUCTDATA_H */
#ifdef __cplusplus
}

View File

@ -22,17 +22,16 @@
shopt -s nullglob
# Note: OUTPUT must terminate with the directory separator.
OUTPUT="$PWD/tests/out/"
TS="$PWD/tests/"
MYDIR="`dirname \"$0\"`"
cd "$MYDIR"
MYDIR="`pwd`"
XMLWF="${1:-`dirname \"$MYDIR\"`/xmlwf/xmlwf}"
# XMLWF=/usr/local/bin/xmlwf
TS="$MYDIR"
# OUTPUT must terminate with the directory separator.
OUTPUT="$TS/out/"
# OUTPUT=/home/tmp/xml-testsuite-out/
# Unicode-aware diff utility
DIFF="$TS/udiffer.py"
DIFF="${MYDIR}/udiffer.py"
# RunXmlwfNotWF file reldir
@ -40,9 +39,7 @@ DIFF="$TS/udiffer.py"
RunXmlwfNotWF() {
file="$1"
reldir="$2"
$XMLWF -p "$file" > outfile || return $?
read outdata < outfile
if test "$outdata" = "" ; then
if $XMLWF -p "$file" > /dev/null; then
echo "Expected not well-formed: $reldir$file"
return 1
else
@ -133,7 +130,6 @@ for xmldir in ibm/not-wf/P* \
RunXmlwfNotWF "$xmlfile" "$xmldir/"
UpdateStatus $?
done
rm outfile
done
cd "$TS/xmlconf/oasis"
@ -141,7 +137,6 @@ for xmlfile in *fail*.xml ; do
RunXmlwfNotWF "$xmlfile" "oasis/"
UpdateStatus $?
done
rm outfile
echo "Passed: $SUCCESS"
echo "Failed: $ERROR"

View File

@ -56,6 +56,4 @@ EXTRA_DIST = \
xmlfile.h \
xmlmime.c \
xmlmime.h \
xmltchar.h \
xmlurl.h \
xmlwin32url.cxx
xmltchar.h

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -125,7 +125,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@ -161,7 +168,10 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/xmlwf-@FILEMAP@.Po \
./$(DEPDIR)/xmlwf-codepage.Po ./$(DEPDIR)/xmlwf-xmlfile.Po \
./$(DEPDIR)/xmlwf-xmlwf.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -355,9 +365,7 @@ EXTRA_DIST = \
xmlfile.h \
xmlmime.c \
xmlmime.h \
xmltchar.h \
xmlurl.h \
xmlwin32url.cxx
xmltchar.h
all: all-am
@ -380,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -452,10 +460,16 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-@FILEMAP@.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-@FILEMAP@.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@ -592,7 +606,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -664,7 +681,10 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po
-rm -f ./$(DEPDIR)/xmlwf-codepage.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@ -710,7 +730,10 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po
-rm -f ./$(DEPDIR)/xmlwf-codepage.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@ -731,7 +754,7 @@ uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \

View File

@ -31,25 +31,24 @@
*/
#include "codepage.h"
#include "internal.h" /* for UNUSED_P only */
#include "internal.h" /* for UNUSED_P only */
#if defined(_WIN32)
#define STRICT 1
#define WIN32_LEAN_AND_MEAN 1
# define STRICT 1
# define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
# include <windows.h>
int
codepageMap(int cp, int *map)
{
codepageMap(int cp, int *map) {
int i;
CPINFO info;
if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2)
if (! GetCPInfo(cp, &info) || info.MaxCharSize > 2)
return 0;
for (i = 0; i < 256; i++)
map[i] = -1;
if (info.MaxCharSize > 1) {
for (i = 0; i < MAX_LEADBYTES; i+=2) {
for (i = 0; i < MAX_LEADBYTES; i += 2) {
int j, lim;
if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0)
break;
@ -59,23 +58,24 @@ codepageMap(int cp, int *map)
}
}
for (i = 0; i < 256; i++) {
if (map[i] == -1) {
char c = (char)i;
unsigned short n;
if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
&c, 1, &n, 1) == 1)
map[i] = n;
}
if (map[i] == -1) {
char c = (char)i;
unsigned short n;
if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, &c, 1,
&n, 1)
== 1)
map[i] = n;
}
}
return 1;
}
int
codepageConvert(int cp, const char *p)
{
codepageConvert(int cp, const char *p) {
unsigned short c;
if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
p, 2, &c, 1) == 1)
if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, p, 2, &c,
1)
== 1)
return c;
return -1;
}
@ -83,14 +83,16 @@ codepageConvert(int cp, const char *p)
#else /* not _WIN32 */
int
codepageMap(int UNUSED_P(cp), int *UNUSED_P(map))
{
codepageMap(int cp, int *map) {
UNUSED_P(cp);
UNUSED_P(map);
return 0;
}
int
codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p))
{
codepageConvert(int cp, const char *p) {
UNUSED_P(cp);
UNUSED_P(p);
return -1;
}

View File

@ -33,8 +33,7 @@
#define CHARSET_MAX 41
static const char *
getTok(const char **pp)
{
getTok(const char **pp) {
enum { inAtom, inString, init, inComment };
int state = init;
const char *tokStart = 0;
@ -102,9 +101,8 @@ getTok(const char **pp)
/* key must be lowercase ASCII */
static int
matchkey(const char *start, const char *end, const char *key)
{
if (!start)
matchkey(const char *start, const char *end, const char *key) {
if (! start)
return 0;
for (; start != end; start++, key++)
if (*start != *key && *start != 'A' + (*key - 'a'))
@ -113,8 +111,7 @@ matchkey(const char *start, const char *end, const char *key)
}
void
getXMLCharset(const char *buf, char *charset)
{
getXMLCharset(const char *buf, char *charset) {
const char *next, *p;
charset[0] = '\0';
@ -122,10 +119,10 @@ getXMLCharset(const char *buf, char *charset)
p = getTok(&next);
if (matchkey(p, next, "text"))
strcpy(charset, "us-ascii");
else if (!matchkey(p, next, "application"))
else if (! matchkey(p, next, "application"))
return;
p = getTok(&next);
if (!p || *p != '/')
if (! p || *p != '/')
return;
p = getTok(&next);
if (matchkey(p, next, "xml"))
@ -151,8 +148,7 @@ getXMLCharset(const char *buf, char *charset)
*s++ = *p;
}
*s++ = '\0';
}
else {
} else {
if (next - p > CHARSET_MAX - 1)
break;
while (p != next)
@ -163,15 +159,13 @@ getXMLCharset(const char *buf, char *charset)
}
}
}
}
else
p = getTok(&next);
} else
p = getTok(&next);
}
}
int
main(int argc, char **argv)
{
main(int argc, char **argv) {
char buf[CHARSET_MAX];
getXMLCharset(argv[1], buf);
printf("charset = \"%s\"\n", buf);

View File

@ -30,10 +30,9 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <limits.h> /* INT_MAX */
#include <limits.h> /* INT_MAX */
#include <stddef.h>
/* The following limit (for XML_Parse's int len) derives from
* this loop in xmparse.c:
*
@ -41,17 +40,14 @@
* bufferSize = (int) (2U * (unsigned) bufferSize);
* } while (bufferSize < neededSize && bufferSize > 0);
*/
#define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1)
#define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1)
#ifdef XML_UNICODE
int filemap(const wchar_t *name,
void (*processor)(const void *, size_t,
const wchar_t *, void *arg),
void (*processor)(const void *, size_t, const wchar_t *, void *arg),
void *arg);
#else
int filemap(const char *name,
void (*processor)(const void *, size_t,
const char *, void *arg),
void (*processor)(const void *, size_t, const char *, void *arg),
void *arg);
#endif

View File

@ -37,40 +37,40 @@
#include <stdio.h>
/* Functions close(2) and read(2) */
#if !defined(_WIN32) && !defined(_WIN64)
# include <unistd.h>
#if ! defined(_WIN32) && ! defined(_WIN64)
# include <unistd.h>
#endif
/* Function "read": */
#if defined(_MSC_VER)
# include <io.h>
/* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */
# define _EXPAT_read _read
# define _EXPAT_read_count_t int
# define _EXPAT_read_req_t unsigned int
#else /* POSIX */
/* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */
# define _EXPAT_read read
# define _EXPAT_read_count_t ssize_t
# define _EXPAT_read_req_t size_t
# include <io.h>
/* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */
# define _EXPAT_read _read
# define _EXPAT_read_count_t int
# define _EXPAT_read_req_t unsigned int
#else /* POSIX */
/* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */
# define _EXPAT_read read
# define _EXPAT_read_count_t ssize_t
# define _EXPAT_read_req_t size_t
#endif
#ifndef S_ISREG
# ifndef S_IFREG
# define S_IFREG _S_IFREG
# endif
# ifndef S_IFMT
# define S_IFMT _S_IFMT
# endif
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# ifndef S_IFREG
# define S_IFREG _S_IFREG
# endif
# ifndef S_IFMT
# define S_IFMT _S_IFMT
# endif
# define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
#endif /* not S_ISREG */
#ifndef O_BINARY
# ifdef _O_BINARY
# define O_BINARY _O_BINARY
# else
# define O_BINARY 0
# endif
# ifdef _O_BINARY
# define O_BINARY _O_BINARY
# else
# define O_BINARY 0
# endif
#endif
#include "xmltchar.h"
@ -79,15 +79,14 @@
int
filemap(const tchar *name,
void (*processor)(const void *, size_t, const tchar *, void *arg),
void *arg)
{
void *arg) {
size_t nbytes;
int fd;
_EXPAT_read_count_t n;
struct stat sb;
void *p;
fd = topen(name, O_RDONLY|O_BINARY);
fd = topen(name, O_RDONLY | O_BINARY);
if (fd < 0) {
tperror(name);
return 0;
@ -97,14 +96,14 @@ filemap(const tchar *name,
close(fd);
return 0;
}
if (!S_ISREG(sb.st_mode)) {
if (! S_ISREG(sb.st_mode)) {
ftprintf(stderr, T("%s: not a regular file\n"), name);
close(fd);
return 0;
}
if (sb.st_size > XML_MAX_CHUNK_LEN) {
close(fd);
return 2; /* Cannot be passed to XML_Parse in one go */
return 2; /* Cannot be passed to XML_Parse in one go */
}
nbytes = sb.st_size;
@ -116,7 +115,7 @@ filemap(const tchar *name,
return 1;
}
p = malloc(nbytes);
if (!p) {
if (! p) {
ftprintf(stderr, T("%s: out of memory\n"), name);
close(fd);
return 0;

View File

@ -40,23 +40,22 @@
#include <unistd.h>
#ifndef MAP_FILE
#define MAP_FILE 0
# define MAP_FILE 0
#endif
#include "xmltchar.h"
#include "filemap.h"
#ifdef XML_UNICODE_WCHAR_T
# define XML_FMT_STR "ls"
# define XML_FMT_STR "ls"
#else
# define XML_FMT_STR "s"
# define XML_FMT_STR "s"
#endif
int
filemap(const tchar *name,
void (*processor)(const void *, size_t, const tchar *, void *arg),
void *arg)
{
void *arg) {
int fd;
size_t nbytes;
struct stat sb;
@ -72,14 +71,14 @@ filemap(const tchar *name,
close(fd);
return 0;
}
if (!S_ISREG(sb.st_mode)) {
if (! S_ISREG(sb.st_mode)) {
close(fd);
fprintf(stderr, "%" XML_FMT_STR ": not a regular file\n", name);
return 0;
}
if (sb.st_size > XML_MAX_CHUNK_LEN) {
close(fd);
return 2; /* Cannot be passed to XML_Parse in one go */
return 2; /* Cannot be passed to XML_Parse in one go */
}
nbytes = sb.st_size;
@ -90,8 +89,8 @@ filemap(const tchar *name,
close(fd);
return 1;
}
p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ,
MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, MAP_FILE | MAP_PRIVATE,
fd, (off_t)0);
if (p == (void *)-1) {
tperror(name);
close(fd);

View File

@ -34,14 +34,14 @@
#define WIN32_LEAN_AND_MEAN 1
#ifdef XML_UNICODE_WCHAR_T
# ifndef XML_UNICODE
# define XML_UNICODE
# endif
# ifndef XML_UNICODE
# define XML_UNICODE
# endif
#endif
#ifdef XML_UNICODE
# define UNICODE
# define _UNICODE
# define UNICODE
# define _UNICODE
#endif /* XML_UNICODE */
#include <windows.h>
#include <stdio.h>
@ -53,8 +53,7 @@ static void win32perror(const TCHAR *);
int
filemap(const TCHAR *name,
void (*processor)(const void *, size_t, const TCHAR *, void *arg),
void *arg)
{
void *arg) {
HANDLE f;
HANDLE m;
DWORD size;
@ -62,7 +61,7 @@ filemap(const TCHAR *name,
void *p;
f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (f == INVALID_HANDLE_VALUE) {
win32perror(name);
return 0;
@ -75,7 +74,7 @@ filemap(const TCHAR *name,
}
if (sizeHi || (size > XML_MAX_CHUNK_LEN)) {
CloseHandle(f);
return 2; /* Cannot be passed to XML_Parse in one go */
return 2; /* Cannot be passed to XML_Parse in one go */
}
/* CreateFileMapping barfs on zero length files */
if (size == 0) {
@ -105,21 +104,15 @@ filemap(const TCHAR *name,
}
static void
win32perror(const TCHAR *s)
{
win32perror(const TCHAR *s) {
LPVOID buf;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &buf,
0,
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0,
NULL)) {
_ftprintf(stderr, _T("%s: %s"), s, buf);
fflush(stderr);
LocalFree(buf);
}
else
} else
_ftprintf(stderr, _T("%s: unknown Windows error\n"), s);
}

View File

@ -37,87 +37,77 @@
#include <fcntl.h>
#ifdef _WIN32
#include "winconfig.h"
# include "winconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H)
#include <expat_config.h>
# include <expat_config.h>
#endif /* ndef _WIN32 */
#include "expat.h"
#include "internal.h" /* for UNUSED_P only */
#include "internal.h" /* for UNUSED_P only */
#include "xmlfile.h"
#include "xmltchar.h"
#include "filemap.h"
#if defined(_MSC_VER)
#include <io.h>
# include <io.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#ifndef O_BINARY
#ifdef _O_BINARY
#define O_BINARY _O_BINARY
#else
#define O_BINARY 0
#endif
# ifdef _O_BINARY
# define O_BINARY _O_BINARY
# else
# define O_BINARY 0
# endif
#endif
#ifdef _DEBUG
#define READ_SIZE 16
# define READ_SIZE 16
#else
#define READ_SIZE (1024*8)
# define READ_SIZE (1024 * 8)
#endif
typedef struct {
XML_Parser parser;
int *retPtr;
} PROCESS_ARGS;
static int
processStream(const XML_Char *filename, XML_Parser parser);
static int processStream(const XML_Char *filename, XML_Parser parser);
static void
reportError(XML_Parser parser, const XML_Char *filename)
{
reportError(XML_Parser parser, const XML_Char *filename) {
enum XML_Error code = XML_GetErrorCode(parser);
const XML_Char *message = XML_ErrorString(code);
if (message)
ftprintf(stdout,
T("%s")
T(":%") T(XML_FMT_INT_MOD) T("u")
T(":%") T(XML_FMT_INT_MOD) T("u")
T(": %s\n"),
filename,
XML_GetErrorLineNumber(parser),
XML_GetErrorColumnNumber(parser),
message);
T("%s") T(":%") T(XML_FMT_INT_MOD) T("u") T(":%")
T(XML_FMT_INT_MOD) T("u") T(": %s\n"),
filename, XML_GetErrorLineNumber(parser),
XML_GetErrorColumnNumber(parser), message);
else
ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code);
}
/* This implementation will give problems on files larger than INT_MAX. */
static void
processFile(const void *data, size_t size,
const XML_Char *filename, void *args)
{
processFile(const void *data, size_t size, const XML_Char *filename,
void *args) {
XML_Parser parser = ((PROCESS_ARGS *)args)->parser;
int *retPtr = ((PROCESS_ARGS *)args)->retPtr;
if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) {
reportError(parser, filename);
*retPtr = 0;
}
else
} else
*retPtr = 1;
}
#if defined(_WIN32)
static int
isAsciiLetter(XML_Char c)
{
isAsciiLetter(XML_Char c) {
return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z'));
}
@ -125,21 +115,19 @@ isAsciiLetter(XML_Char c)
static const XML_Char *
resolveSystemId(const XML_Char *base, const XML_Char *systemId,
XML_Char **toFree)
{
XML_Char **toFree) {
XML_Char *s;
*toFree = 0;
if (!base
|| *systemId == T('/')
if (! base || *systemId == T('/')
#if defined(_WIN32)
|| *systemId == T('\\')
|| (isAsciiLetter(systemId[0]) && systemId[1] == T(':'))
#endif
)
)
return systemId;
*toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)
* sizeof(XML_Char));
if (!*toFree)
if (! *toFree)
return systemId;
tcscpy(*toFree, base);
s = *toFree;
@ -154,18 +142,16 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId,
}
static int
externalEntityRefFilemap(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *UNUSED_P(publicId))
{
externalEntityRefFilemap(XML_Parser parser, const XML_Char *context,
const XML_Char *base, const XML_Char *systemId,
const XML_Char *publicId) {
int result;
XML_Char *s;
const XML_Char *filename;
XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
int filemapRes;
PROCESS_ARGS args;
UNUSED_P(publicId);
args.retPtr = &result;
args.parser = entParser;
filename = resolveSystemId(base, systemId, &s);
@ -176,8 +162,10 @@ externalEntityRefFilemap(XML_Parser parser,
result = 0;
break;
case 2:
ftprintf(stderr, T("%s: file too large for memory-mapping")
T(", switching to streaming\n"), filename);
ftprintf(stderr,
T("%s: file too large for memory-mapping")
T(", switching to streaming\n"),
filename);
result = processStream(filename, entParser);
break;
}
@ -187,13 +175,12 @@ externalEntityRefFilemap(XML_Parser parser,
}
static int
processStream(const XML_Char *filename, XML_Parser parser)
{
processStream(const XML_Char *filename, XML_Parser parser) {
/* passing NULL for filename means read intput from stdin */
int fd = 0; /* 0 is the fileno for stdin */
int fd = 0; /* 0 is the fileno for stdin */
if (filename != NULL) {
fd = topen(filename, O_BINARY|O_RDONLY);
fd = topen(filename, O_BINARY | O_RDONLY);
if (fd < 0) {
tperror(filename);
return 0;
@ -202,7 +189,7 @@ processStream(const XML_Char *filename, XML_Parser parser)
for (;;) {
int nread;
char *buf = (char *)XML_GetBuffer(parser, READ_SIZE);
if (!buf) {
if (! buf) {
if (filename != NULL)
close(fd);
ftprintf(stderr, T("%s: out of memory\n"),
@ -217,7 +204,7 @@ processStream(const XML_Char *filename, XML_Parser parser)
return 0;
}
if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) {
reportError(parser, filename != NULL ? filename : T("STDIN"));
reportError(parser, filename != NULL ? filename : T("STDIN"));
if (filename != NULL)
close(fd);
return 0;
@ -225,23 +212,22 @@ processStream(const XML_Char *filename, XML_Parser parser)
if (nread == 0) {
if (filename != NULL)
close(fd);
break;;
break;
;
}
}
return 1;
}
static int
externalEntityRefStream(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *UNUSED_P(publicId))
{
externalEntityRefStream(XML_Parser parser, const XML_Char *context,
const XML_Char *base, const XML_Char *systemId,
const XML_Char *publicId) {
XML_Char *s;
const XML_Char *filename;
int ret;
XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
UNUSED_P(publicId);
filename = resolveSystemId(base, systemId, &s);
XML_SetBase(entParser, filename);
ret = processStream(filename, entParser);
@ -251,22 +237,18 @@ externalEntityRefStream(XML_Parser parser,
}
int
XML_ProcessFile(XML_Parser parser,
const XML_Char *filename,
unsigned flags)
{
XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags) {
int result;
if (!XML_SetBase(parser, filename)) {
if (! XML_SetBase(parser, filename)) {
ftprintf(stderr, T("%s: out of memory"), filename);
exit(1);
}
if (flags & XML_EXTERNAL_ENTITIES)
XML_SetExternalEntityRefHandler(parser,
(flags & XML_MAP_FILE)
? externalEntityRefFilemap
: externalEntityRefStream);
XML_SetExternalEntityRefHandler(parser, (flags & XML_MAP_FILE)
? externalEntityRefFilemap
: externalEntityRefStream);
if (flags & XML_MAP_FILE) {
int filemapRes;
PROCESS_ARGS args;
@ -278,13 +260,14 @@ XML_ProcessFile(XML_Parser parser,
result = 0;
break;
case 2:
ftprintf(stderr, T("%s: file too large for memory-mapping")
T(", switching to streaming\n"), filename);
ftprintf(stderr,
T("%s: file too large for memory-mapping")
T(", switching to streaming\n"),
filename);
result = processStream(filename, parser);
break;
}
}
else
} else
result = processStream(filename, parser);
return result;
}

View File

@ -34,15 +34,10 @@
#define XML_EXTERNAL_ENTITIES 02
#ifdef XML_LARGE_SIZE
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
#define XML_FMT_INT_MOD "I64"
# define XML_FMT_INT_MOD "ll"
#else
#define XML_FMT_INT_MOD "ll"
#endif
#else
#define XML_FMT_INT_MOD "l"
# define XML_FMT_INT_MOD "l"
#endif
extern int XML_ProcessFile(XML_Parser parser,
const XML_Char *filename,
extern int XML_ProcessFile(XML_Parser parser, const XML_Char *filename,
unsigned flags);

View File

@ -34,8 +34,7 @@
#include "xmlmime.h"
static const char *
getTok(const char **pp)
{
getTok(const char **pp) {
/* inComment means one level of nesting; inComment+1 means two levels etc */
enum { inAtom, inString, init, inComment };
int state = init;
@ -106,9 +105,8 @@ getTok(const char **pp)
/* key must be lowercase ASCII */
static int
matchkey(const char *start, const char *end, const char *key)
{
if (!start)
matchkey(const char *start, const char *end, const char *key) {
if (! start)
return 0;
for (; start != end; start++, key++)
if (*start != *key && *start != 'A' + (*key - 'a'))
@ -117,8 +115,7 @@ matchkey(const char *start, const char *end, const char *key)
}
void
getXMLCharset(const char *buf, char *charset)
{
getXMLCharset(const char *buf, char *charset) {
const char *next, *p;
charset[0] = '\0';
@ -126,16 +123,18 @@ getXMLCharset(const char *buf, char *charset)
p = getTok(&next);
if (matchkey(p, next, "text"))
strcpy(charset, "us-ascii");
else if (!matchkey(p, next, "application"))
else if (! matchkey(p, next, "application"))
return;
p = getTok(&next);
if (!p || *p != '/')
if (! p || *p != '/')
return;
p = getTok(&next);
#if 0
if (!matchkey(p, next, "xml") && charset[0] == '\0')
return;
#endif
/* BEGIN disabled code */
if (0) {
if (! matchkey(p, next, "xml") && charset[0] == '\0')
return;
}
/* END disabled code */
p = getTok(&next);
while (p) {
if (*p == ';') {
@ -157,8 +156,7 @@ getXMLCharset(const char *buf, char *charset)
*s++ = *p;
}
*s++ = '\0';
}
else {
} else {
if (next - p > CHARSET_MAX - 1)
break;
while (p != next)
@ -170,19 +168,17 @@ getXMLCharset(const char *buf, char *charset)
}
break;
}
}
else
p = getTok(&next);
} else
p = getTok(&next);
}
}
#ifdef TEST
#include <stdio.h>
# include <stdio.h>
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
char buf[CHARSET_MAX];
if (argc <= 1)
return 1;

View File

@ -34,41 +34,41 @@
#include "expat_external.h"
#ifdef XML_UNICODE
# ifndef XML_UNICODE_WCHAR_T
# error xmlwf requires a 16-bit Unicode-compatible wchar_t
# endif
# define _PREPEND_BIG_L(x) L ## x
# define T(x) _PREPEND_BIG_L(x)
# define ftprintf fwprintf
# define tfopen _wfopen
# define fputts fputws
# define puttc putwc
# define tcscmp wcscmp
# define tcscpy wcscpy
# define tcscat wcscat
# define tcschr wcschr
# define tcsrchr wcsrchr
# define tcslen wcslen
# define tperror _wperror
# define topen _wopen
# define tmain wmain
# define tremove _wremove
# define tchar wchar_t
# ifndef XML_UNICODE_WCHAR_T
# error xmlwf requires a 16-bit Unicode-compatible wchar_t
# endif
# define _PREPEND_BIG_L(x) L##x
# define T(x) _PREPEND_BIG_L(x)
# define ftprintf fwprintf
# define tfopen _wfopen
# define fputts fputws
# define puttc putwc
# define tcscmp wcscmp
# define tcscpy wcscpy
# define tcscat wcscat
# define tcschr wcschr
# define tcsrchr wcsrchr
# define tcslen wcslen
# define tperror _wperror
# define topen _wopen
# define tmain wmain
# define tremove _wremove
# define tchar wchar_t
#else /* not XML_UNICODE */
# define T(x) x
# define ftprintf fprintf
# define tfopen fopen
# define fputts fputs
# define puttc putc
# define tcscmp strcmp
# define tcscpy strcpy
# define tcscat strcat
# define tcschr strchr
# define tcsrchr strrchr
# define tcslen strlen
# define tperror perror
# define topen open
# define tmain main
# define tremove remove
# define tchar char
# define T(x) x
# define ftprintf fprintf
# define tfopen fopen
# define fputts fputs
# define puttc putc
# define tcscmp strcmp
# define tcscpy strcpy
# define tcscat strcat
# define tcschr strchr
# define tcsrchr strrchr
# define tcslen strlen
# define tperror perror
# define topen open
# define tmain main
# define tremove remove
# define tchar char
#endif /* not XML_UNICODE */

View File

@ -38,16 +38,16 @@
#include "expat.h"
#include "codepage.h"
#include "internal.h" /* for UNUSED_P only */
#include "internal.h" /* for UNUSED_P only */
#include "xmlfile.h"
#include "xmltchar.h"
#ifdef _MSC_VER
# include <crtdbg.h>
# include <crtdbg.h>
#endif
#ifdef XML_UNICODE
# include <wchar.h>
# include <wchar.h>
#endif
/* Structures for handler user data */
@ -64,14 +64,12 @@ typedef struct xmlwfUserData {
const XML_Char *currentDoctypeName;
} XmlwfUserData;
/* This ensures proper sorting. */
#define NSSEP T('\001')
static void XMLCALL
characterData(void *userData, const XML_Char *s, int len)
{
characterData(void *userData, const XML_Char *s, int len) {
FILE *fp = ((XmlwfUserData *)userData)->fp;
for (; len > 0; --len, ++s) {
switch (*s) {
@ -106,8 +104,7 @@ characterData(void *userData, const XML_Char *s, int len)
}
static void
attributeValue(FILE *fp, const XML_Char *s)
{
attributeValue(FILE *fp, const XML_Char *s) {
puttc(T('='), fp);
puttc(T('"'), fp);
assert(s);
@ -158,14 +155,12 @@ attributeValue(FILE *fp, const XML_Char *s)
is equivalent to lexicographically comparing based on the character number. */
static int
attcmp(const void *att1, const void *att2)
{
attcmp(const void *att1, const void *att2) {
return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);
}
static void XMLCALL
startElement(void *userData, const XML_Char *name, const XML_Char **atts)
{
startElement(void *userData, const XML_Char *name, const XML_Char **atts) {
int nAtts;
const XML_Char **p;
FILE *fp = ((XmlwfUserData *)userData)->fp;
@ -188,8 +183,7 @@ startElement(void *userData, const XML_Char *name, const XML_Char **atts)
}
static void XMLCALL
endElement(void *userData, const XML_Char *name)
{
endElement(void *userData, const XML_Char *name) {
FILE *fp = ((XmlwfUserData *)userData)->fp;
puttc(T('<'), fp);
puttc(T('/'), fp);
@ -198,8 +192,7 @@ endElement(void *userData, const XML_Char *name)
}
static int
nsattcmp(const void *p1, const void *p2)
{
nsattcmp(const void *p1, const void *p2) {
const XML_Char *att1 = *(const XML_Char **)p1;
const XML_Char *att2 = *(const XML_Char **)p2;
int sep1 = (tcsrchr(att1, NSSEP) != 0);
@ -210,8 +203,7 @@ nsattcmp(const void *p1, const void *p2)
}
static void XMLCALL
startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
{
startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) {
int nAtts;
int nsi;
const XML_Char **p;
@ -226,8 +218,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
fputts(T(" xmlns:n1"), fp);
attributeValue(fp, name);
nsi = 2;
}
else {
} else {
fputts(name, fp);
nsi = 1;
}
@ -245,8 +236,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
if (sep) {
ftprintf(fp, T("n%d:"), nsi);
fputts(sep + 1, fp);
}
else
} else
fputts(name, fp);
attributeValue(fp, *atts);
if (sep) {
@ -259,8 +249,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
}
static void XMLCALL
endElementNS(void *userData, const XML_Char *name)
{
endElementNS(void *userData, const XML_Char *name) {
FILE *fp = ((XmlwfUserData *)userData)->fp;
const XML_Char *sep;
puttc(T('<'), fp);
@ -269,8 +258,7 @@ endElementNS(void *userData, const XML_Char *name)
if (sep) {
fputts(T("n1:"), fp);
fputts(sep + 1, fp);
}
else
} else
fputts(name, fp);
puttc(T('>'), fp);
}
@ -279,8 +267,7 @@ endElementNS(void *userData, const XML_Char *name)
static void XMLCALL
processingInstruction(void *userData, const XML_Char *target,
const XML_Char *data)
{
const XML_Char *data) {
FILE *fp = ((XmlwfUserData *)userData)->fp;
puttc(T('<'), fp);
puttc(T('?'), fp);
@ -291,9 +278,8 @@ processingInstruction(void *userData, const XML_Char *target,
puttc(T('>'), fp);
}
static XML_Char *xcsdup(const XML_Char *s)
{
static XML_Char *
xcsdup(const XML_Char *s) {
XML_Char *result;
int count = 0;
int numBytes;
@ -311,19 +297,18 @@ static XML_Char *xcsdup(const XML_Char *s)
}
static void XMLCALL
startDoctypeDecl(void *userData,
const XML_Char *doctypeName,
const XML_Char *UNUSED_P(sysid),
const XML_Char *UNUSED_P(publid),
int UNUSED_P(has_internal_subset))
{
startDoctypeDecl(void *userData, const XML_Char *doctypeName,
const XML_Char *sysid, const XML_Char *publid,
int has_internal_subset) {
XmlwfUserData *data = (XmlwfUserData *)userData;
UNUSED_P(sysid);
UNUSED_P(publid);
UNUSED_P(has_internal_subset);
data->currentDoctypeName = xcsdup(doctypeName);
}
static void
freeNotations(XmlwfUserData *data)
{
freeNotations(XmlwfUserData *data) {
NotationList *notationListHead = data->notationListHead;
while (notationListHead != NULL) {
@ -337,8 +322,8 @@ freeNotations(XmlwfUserData *data)
data->notationListHead = NULL;
}
static int xcscmp(const XML_Char *xs, const XML_Char *xt)
{
static int
xcscmp(const XML_Char *xs, const XML_Char *xt) {
while (*xs != 0 && *xt != 0) {
if (*xs < *xt)
return -1;
@ -355,17 +340,15 @@ static int xcscmp(const XML_Char *xs, const XML_Char *xt)
}
static int
notationCmp(const void *a, const void *b)
{
const NotationList * const n1 = *(NotationList **)a;
const NotationList * const n2 = *(NotationList **)b;
notationCmp(const void *a, const void *b) {
const NotationList *const n1 = *(NotationList **)a;
const NotationList *const n2 = *(NotationList **)b;
return xcscmp(n1->notationName, n2->notationName);
}
static void XMLCALL
endDoctypeDecl(void *userData)
{
endDoctypeDecl(void *userData) {
XmlwfUserData *data = (XmlwfUserData *)userData;
NotationList **notations;
int notationCount = 0;
@ -389,9 +372,7 @@ endDoctypeDecl(void *userData)
return;
}
for (p = data->notationListHead, i = 0;
i < notationCount;
p = p->next, i++) {
for (p = data->notationListHead, i = 0; i < notationCount; p = p->next, i++) {
notations[i] = p;
}
qsort(notations, notationCount, sizeof(NotationList *), notationCmp);
@ -415,8 +396,7 @@ endDoctypeDecl(void *userData)
fputts(notations[i]->systemId, data->fp);
puttc(T('\''), data->fp);
}
}
else if (notations[i]->systemId != NULL) {
} else if (notations[i]->systemId != NULL) {
fputts(T(" SYSTEM '"), data->fp);
fputts(notations[i]->systemId, data->fp);
puttc(T('\''), data->fp);
@ -435,16 +415,13 @@ endDoctypeDecl(void *userData)
}
static void XMLCALL
notationDecl(void *userData,
const XML_Char *notationName,
const XML_Char *UNUSED_P(base),
const XML_Char *systemId,
const XML_Char *publicId)
{
notationDecl(void *userData, const XML_Char *notationName, const XML_Char *base,
const XML_Char *systemId, const XML_Char *publicId) {
XmlwfUserData *data = (XmlwfUserData *)userData;
NotationList *entry = malloc(sizeof(NotationList));
const char *errorMessage = "Unable to store NOTATION for output\n";
UNUSED_P(base);
if (entry == NULL) {
fputs(errorMessage, stderr);
return; /* Nothing we can really do about this */
@ -463,8 +440,7 @@ notationDecl(void *userData,
free(entry);
return;
}
}
else {
} else {
entry->systemId = NULL;
}
if (publicId != NULL) {
@ -476,8 +452,7 @@ notationDecl(void *userData,
free(entry);
return;
}
}
else {
} else {
entry->publicId = NULL;
}
@ -488,101 +463,103 @@ notationDecl(void *userData,
#endif /* not W3C14N */
static void XMLCALL
defaultCharacterData(void *userData, const XML_Char *UNUSED_P(s), int UNUSED_P(len))
{
XML_DefaultCurrent((XML_Parser) userData);
defaultCharacterData(void *userData, const XML_Char *s, int len) {
UNUSED_P(s);
UNUSED_P(len);
XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
defaultStartElement(void *userData, const XML_Char *UNUSED_P(name),
const XML_Char **UNUSED_P(atts))
{
XML_DefaultCurrent((XML_Parser) userData);
defaultStartElement(void *userData, const XML_Char *name,
const XML_Char **atts) {
UNUSED_P(name);
UNUSED_P(atts);
XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
defaultEndElement(void *userData, const XML_Char *UNUSED_P(name))
{
XML_DefaultCurrent((XML_Parser) userData);
defaultEndElement(void *userData, const XML_Char *name) {
UNUSED_P(name);
XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
defaultProcessingInstruction(void *userData, const XML_Char *UNUSED_P(target),
const XML_Char *UNUSED_P(data))
{
XML_DefaultCurrent((XML_Parser) userData);
defaultProcessingInstruction(void *userData, const XML_Char *target,
const XML_Char *data) {
UNUSED_P(target);
UNUSED_P(data);
XML_DefaultCurrent((XML_Parser)userData);
}
static void XMLCALL
nopCharacterData(void *UNUSED_P(userData), const XML_Char *UNUSED_P(s), int UNUSED_P(len))
{
nopCharacterData(void *userData, const XML_Char *s, int len) {
UNUSED_P(userData);
UNUSED_P(s);
UNUSED_P(len);
}
static void XMLCALL
nopStartElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts))
{
nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
UNUSED_P(userData);
UNUSED_P(name);
UNUSED_P(atts);
}
static void XMLCALL
nopEndElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name))
{
nopEndElement(void *userData, const XML_Char *name) {
UNUSED_P(userData);
UNUSED_P(name);
}
static void XMLCALL
nopProcessingInstruction(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target),
const XML_Char *UNUSED_P(data))
{
nopProcessingInstruction(void *userData, const XML_Char *target,
const XML_Char *data) {
UNUSED_P(userData);
UNUSED_P(target);
UNUSED_P(data);
}
static void XMLCALL
markup(void *userData, const XML_Char *s, int len)
{
FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp;
markup(void *userData, const XML_Char *s, int len) {
FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp;
for (; len > 0; --len, ++s)
puttc(*s, fp);
}
static void
metaLocation(XML_Parser parser)
{
metaLocation(XML_Parser parser) {
const XML_Char *uri = XML_GetBase(parser);
FILE *fp = ((XmlwfUserData *)XML_GetUserData(parser))->fp;
if (uri)
ftprintf(fp, T(" uri=\"%s\""), uri);
ftprintf(fp,
T(" byte=\"%") T(XML_FMT_INT_MOD) T("d\"")
T(" nbytes=\"%d\"")
T(" line=\"%") T(XML_FMT_INT_MOD) T("u\"")
T(" col=\"%") T(XML_FMT_INT_MOD) T("u\""),
XML_GetCurrentByteIndex(parser),
XML_GetCurrentByteCount(parser),
T(" byte=\"%") T(XML_FMT_INT_MOD) T("d\"") T(" nbytes=\"%d\"")
T(" line=\"%") T(XML_FMT_INT_MOD) T("u\"") T(" col=\"%")
T(XML_FMT_INT_MOD) T("u\""),
XML_GetCurrentByteIndex(parser), XML_GetCurrentByteCount(parser),
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser));
}
static void
metaStartDocument(void *userData)
{
metaStartDocument(void *userData) {
fputts(T("<document>\n"),
((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp);
((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp);
}
static void
metaEndDocument(void *userData)
{
metaEndDocument(void *userData) {
fputts(T("</document>\n"),
((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp);
((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp);
}
static void XMLCALL
metaStartElement(void *userData, const XML_Char *name,
const XML_Char **atts)
{
XML_Parser parser = (XML_Parser) userData;
metaStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
const XML_Char **specifiedAttsEnd
= atts + XML_GetSpecifiedAttributeCount(parser);
= atts + XML_GetSpecifiedAttributeCount(parser);
const XML_Char **idAttPtr;
int idAttIndex = XML_GetIdAttributeIndex(parser);
if (idAttIndex < 0)
@ -605,15 +582,13 @@ metaStartElement(void *userData, const XML_Char *name,
fputts(T("\"/>\n"), fp);
} while (*(atts += 2));
fputts(T("</starttag>\n"), fp);
}
else
} else
fputts(T("/>\n"), fp);
}
static void XMLCALL
metaEndElement(void *userData, const XML_Char *name)
{
XML_Parser parser = (XML_Parser) userData;
metaEndElement(void *userData, const XML_Char *name) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
ftprintf(fp, T("<endtag name=\"%s\""), name);
@ -623,9 +598,8 @@ metaEndElement(void *userData, const XML_Char *name)
static void XMLCALL
metaProcessingInstruction(void *userData, const XML_Char *target,
const XML_Char *data)
{
XML_Parser parser = (XML_Parser) userData;
const XML_Char *data) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = usrData->fp;
ftprintf(fp, T("<pi target=\"%s\" data=\""), target);
@ -636,9 +610,8 @@ metaProcessingInstruction(void *userData, const XML_Char *target,
}
static void XMLCALL
metaComment(void *userData, const XML_Char *data)
{
XML_Parser parser = (XML_Parser) userData;
metaComment(void *userData, const XML_Char *data) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = usrData->fp;
fputts(T("<comment data=\""), fp);
@ -649,9 +622,8 @@ metaComment(void *userData, const XML_Char *data)
}
static void XMLCALL
metaStartCdataSection(void *userData)
{
XML_Parser parser = (XML_Parser) userData;
metaStartCdataSection(void *userData) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
fputts(T("<startcdata"), fp);
@ -660,9 +632,8 @@ metaStartCdataSection(void *userData)
}
static void XMLCALL
metaEndCdataSection(void *userData)
{
XML_Parser parser = (XML_Parser) userData;
metaEndCdataSection(void *userData) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
fputts(T("<endcdata"), fp);
@ -671,9 +642,8 @@ metaEndCdataSection(void *userData)
}
static void XMLCALL
metaCharacterData(void *userData, const XML_Char *s, int len)
{
XML_Parser parser = (XML_Parser) userData;
metaCharacterData(void *userData, const XML_Char *s, int len) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
fputts(T("<chars str=\""), fp);
@ -684,24 +654,23 @@ metaCharacterData(void *userData, const XML_Char *s, int len)
}
static void XMLCALL
metaStartDoctypeDecl(void *userData,
const XML_Char *doctypeName,
const XML_Char *UNUSED_P(sysid),
const XML_Char *UNUSED_P(pubid),
int UNUSED_P(has_internal_subset))
{
XML_Parser parser = (XML_Parser) userData;
metaStartDoctypeDecl(void *userData, const XML_Char *doctypeName,
const XML_Char *sysid, const XML_Char *pubid,
int has_internal_subset) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
UNUSED_P(sysid);
UNUSED_P(pubid);
UNUSED_P(has_internal_subset);
ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
static void XMLCALL
metaEndDoctypeDecl(void *userData)
{
XML_Parser parser = (XML_Parser) userData;
metaEndDoctypeDecl(void *userData) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
fputts(T("<enddoctype"), fp);
@ -710,15 +679,13 @@ metaEndDoctypeDecl(void *userData)
}
static void XMLCALL
metaNotationDecl(void *userData,
const XML_Char *notationName,
const XML_Char *UNUSED_P(base),
const XML_Char *systemId,
const XML_Char *publicId)
{
XML_Parser parser = (XML_Parser) userData;
metaNotationDecl(void *userData, const XML_Char *notationName,
const XML_Char *base, const XML_Char *systemId,
const XML_Char *publicId) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
UNUSED_P(base);
ftprintf(fp, T("<notation name=\"%s\""), notationName);
if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId);
@ -731,30 +698,24 @@ metaNotationDecl(void *userData,
fputts(T("/>\n"), fp);
}
static void XMLCALL
metaEntityDecl(void *userData,
const XML_Char *entityName,
int UNUSED_P(is_param),
const XML_Char *value,
int value_length,
const XML_Char *UNUSED_P(base),
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName)
{
XML_Parser parser = (XML_Parser) userData;
metaEntityDecl(void *userData, const XML_Char *entityName, int is_param,
const XML_Char *value, int value_length, const XML_Char *base,
const XML_Char *systemId, const XML_Char *publicId,
const XML_Char *notationName) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
UNUSED_P(is_param);
UNUSED_P(base);
if (value) {
ftprintf(fp, T("<entity name=\"%s\""), entityName);
metaLocation(parser);
puttc(T('>'), fp);
characterData(data, value, value_length);
fputts(T("</entity/>\n"), fp);
}
else if (notationName) {
} else if (notationName) {
ftprintf(fp, T("<entity name=\"%s\""), entityName);
if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId);
@ -764,8 +725,7 @@ metaEntityDecl(void *userData,
ftprintf(fp, T(" notation=\"%s\""), notationName);
metaLocation(parser);
fputts(T("/>\n"), fp);
}
else {
} else {
ftprintf(fp, T("<entity name=\"%s\""), entityName);
if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId);
@ -778,11 +738,9 @@ metaEntityDecl(void *userData,
}
static void XMLCALL
metaStartNamespaceDecl(void *userData,
const XML_Char *prefix,
const XML_Char *uri)
{
XML_Parser parser = (XML_Parser) userData;
metaStartNamespaceDecl(void *userData, const XML_Char *prefix,
const XML_Char *uri) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
fputts(T("<startns"), fp);
@ -792,37 +750,34 @@ metaStartNamespaceDecl(void *userData,
fputts(T(" ns=\""), fp);
characterData(data, uri, (int)tcslen(uri));
fputts(T("\"/>\n"), fp);
}
else
} else
fputts(T("/>\n"), fp);
}
static void XMLCALL
metaEndNamespaceDecl(void *userData, const XML_Char *prefix)
{
XML_Parser parser = (XML_Parser) userData;
metaEndNamespaceDecl(void *userData, const XML_Char *prefix) {
XML_Parser parser = (XML_Parser)userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp;
if (!prefix)
if (! prefix)
fputts(T("<endns/>\n"), fp);
else
ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
}
static int XMLCALL
unknownEncodingConvert(void *data, const char *p)
{
unknownEncodingConvert(void *data, const char *p) {
return codepageConvert(*(int *)data, p);
}
static int XMLCALL
unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *info)
{
unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) {
int cp;
static const XML_Char prefixL[] = T("windows-");
static const XML_Char prefixU[] = T("WINDOWS-");
int i;
UNUSED_P(userData);
for (i = 0; prefixU[i]; i++)
if (name[i] != prefixU[i] && name[i] != prefixL[i])
return 0;
@ -831,35 +786,34 @@ unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *in
for (; name[i]; i++) {
static const XML_Char digits[] = T("0123456789");
const XML_Char *s = tcschr(digits, name[i]);
if (!s)
if (! s)
return 0;
cp *= 10;
cp += (int)(s - digits);
if (cp >= 0x10000)
return 0;
}
if (!codepageMap(cp, info->map))
if (! codepageMap(cp, info->map))
return 0;
info->convert = unknownEncodingConvert;
/* We could just cast the code page integer to a void *,
and avoid the use of release. */
info->release = free;
info->data = malloc(sizeof(int));
if (!info->data)
if (! info->data)
return 0;
*(int *)info->data = cp;
return 1;
}
static int XMLCALL
notStandalone(void *UNUSED_P(userData))
{
notStandalone(void *userData) {
UNUSED_P(userData);
return 0;
}
static void
showVersion(XML_Char *prog)
{
showVersion(XML_Char *prog) {
XML_Char *s = prog;
XML_Char ch;
const XML_Feature *features = XML_GetFeatureList();
@ -868,7 +822,7 @@ showVersion(XML_Char *prog)
#if defined(_WIN32)
|| ch == '\\'
#endif
)
)
prog = s + 1;
++s;
}
@ -889,10 +843,46 @@ showVersion(XML_Char *prog)
}
static void
usage(const XML_Char *prog, int rc)
{
ftprintf(stderr,
T("usage: %s [-s] [-n] [-p] [-x] [-e encoding] [-w] [-d output-dir] [-c] [-m] [-r] [-t] [-N] [file ...]\n"), prog);
usage(const XML_Char *prog, int rc) {
ftprintf(
stderr,
/* Generated with:
* $ xmlwf/xmlwf_helpgen.sh
*/
/* clang-format off */
T("usage: %s [-s] [-n] [-p] [-x] [-e ENCODING] [-w] [-r] [-d DIRECTORY]\n")
T(" [-c | -m | -t] [-N]\n")
T(" [FILE [FILE ...]]\n")
T("\n")
T("xmlwf - Determines if an XML document is well-formed\n")
T("\n")
T("positional arguments:\n")
T(" FILE files to process (default: STDIN)\n")
T("\n")
T("input control arguments:\n")
T(" -s print an error if the document is not [s]tandalone\n")
T(" -n enable [n]amespace processing\n")
T(" -p enable processing external DTDs and [p]arameter entities\n")
T(" -x enable processing of e[x]ternal entities\n")
T(" -e ENCODING override any in-document [e]ncoding declaration\n")
T(" -w enable support for [W]indows code pages\n")
T(" -r disable memory-mapping and use normal file [r]ead IO calls instead\n")
T("\n")
T("output control arguments:\n")
T(" -d DIRECTORY output [d]estination directory\n")
T(" -c write a [c]opy of input XML, not canonical XML\n")
T(" -m write [m]eta XML, not canonical XML\n")
T(" -t write no XML output for [t]iming of plain parsing\n")
T(" -N enable adding doctype and [n]otation declarations\n")
T("\n")
T("info arguments:\n")
T(" -h show this [h]elp message and exit\n")
T(" -v show program's [v]ersion number and exit\n")
T("\n")
T("libexpat is software libre, licensed under the MIT license.\n")
T("Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!\n")
, /* clang-format on */
prog);
exit(rc);
}
@ -902,8 +892,7 @@ int wmain(int argc, XML_Char **argv);
#endif
int
tmain(int argc, XML_Char **argv)
{
tmain(int argc, XML_Char **argv) {
int i, j;
const XML_Char *outputDir = NULL;
const XML_Char *encoding = NULL;
@ -913,13 +902,13 @@ tmain(int argc, XML_Char **argv)
int useNamespaces = 0;
int requireStandalone = 0;
int requiresNotations = 0;
enum XML_ParamEntityParsing paramEntityParsing =
XML_PARAM_ENTITY_PARSING_NEVER;
enum XML_ParamEntityParsing paramEntityParsing
= XML_PARAM_ENTITY_PARSING_NEVER;
int useStdin = 0;
XmlwfUserData userData = { NULL, NULL, NULL };
XmlwfUserData userData = {NULL, NULL, NULL};
#ifdef _MSC_VER
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
i = 1;
@ -980,8 +969,7 @@ tmain(int argc, XML_Char **argv)
if (++i == argc)
usage(argv[0], 2);
outputDir = argv[i];
}
else
} else
outputDir = argv[i] + j + 1;
i++;
j = 0;
@ -991,8 +979,7 @@ tmain(int argc, XML_Char **argv)
if (++i == argc)
usage(argv[0], 2);
encoding = argv[i];
}
else
} else
encoding = argv[i] + j + 1;
i++;
j = 0;
@ -1043,18 +1030,17 @@ tmain(int argc, XML_Char **argv)
XML_SetElementHandler(parser, nopStartElement, nopEndElement);
XML_SetCharacterDataHandler(parser, nopCharacterData);
XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
}
else if (outputDir) {
const XML_Char * delim = T("/");
} else if (outputDir) {
const XML_Char *delim = T("/");
const XML_Char *file = useStdin ? T("STDIN") : argv[i];
if (!useStdin) {
if (! useStdin) {
/* Jump after last (back)slash */
const XML_Char * lastDelim = tcsrchr(file, delim[0]);
const XML_Char *lastDelim = tcsrchr(file, delim[0]);
if (lastDelim)
file = lastDelim + 1;
#if defined(_WIN32)
else {
const XML_Char * winDelim = T("\\");
const XML_Char *winDelim = T("\\");
lastDelim = tcsrchr(file, winDelim[0]);
if (lastDelim) {
file = lastDelim + 1;
@ -1064,12 +1050,12 @@ tmain(int argc, XML_Char **argv)
#endif
}
outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2)
* sizeof(XML_Char));
* sizeof(XML_Char));
tcscpy(outName, outputDir);
tcscat(outName, delim);
tcscat(outName, file);
userData.fp = tfopen(outName, T("wb"));
if (!userData.fp) {
if (! userData.fp) {
tperror(outName);
exit(1);
}
@ -1126,13 +1112,15 @@ tmain(int argc, XML_Char **argv)
if (outputType == 'm')
metaEndDocument(parser);
fclose(userData.fp);
if (!result) {
if (! result) {
tremove(outName);
exit(2);
}
free(outName);
}
XML_ParserFree(parser);
if (! result) {
exit(2);
}
}
return 0;
}

View File

@ -0,0 +1,69 @@
#! /usr/bin/env python3
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|
# | __// \| |_) | (_| | |_
# \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser
#
# Copyright (c) 2019 Expat development team
# Licensed under the MIT license:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
import argparse
epilog = """
libexpat is software libre, licensed under the MIT license.
Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!
"""
parser = argparse.ArgumentParser(prog='xmlwf', add_help=False,
description='xmlwf - Determines if an XML document is well-formed',
formatter_class=argparse.RawTextHelpFormatter,
epilog=epilog)
input_related = parser.add_argument_group('input control arguments')
input_related.add_argument('-s', action='store_true', help='print an error if the document is not [s]tandalone')
input_related.add_argument('-n', action='store_true', help='enable [n]amespace processing')
input_related.add_argument('-p', action='store_true', help='enable processing external DTDs and [p]arameter entities')
input_related.add_argument('-x', action='store_true', help='enable processing of e[x]ternal entities')
input_related.add_argument('-e', action='store', metavar='ENCODING', help='override any in-document [e]ncoding declaration')
input_related.add_argument('-w', action='store_true', help='enable support for [W]indows code pages')
input_related.add_argument('-r', action='store_true', help='disable memory-mapping and use normal file [r]ead IO calls instead')
output_related = parser.add_argument_group('output control arguments')
output_related.add_argument('-d', action='store', metavar='DIRECTORY', help='output [d]estination directory')
output_mode = output_related.add_mutually_exclusive_group()
output_mode.add_argument('-c', action='store_true', help='write a [c]opy of input XML, not canonical XML')
output_mode.add_argument('-m', action='store_true', help='write [m]eta XML, not canonical XML')
output_mode.add_argument('-t', action='store_true', help='write no XML output for [t]iming of plain parsing')
output_related.add_argument('-N', action='store_true', help='enable adding doctype and [n]otation declarations')
parser.add_argument('files', metavar='FILE', nargs='*', help='files to process (default: STDIN)')
info = parser.add_argument_group('info arguments')
info = info.add_mutually_exclusive_group()
info.add_argument('-h', action='store_true', help='show this [h]elp message and exit')
info.add_argument('-v', action='store_true', help='show program\'s [v]ersion number and exit')
if __name__ == '__main__':
parser.print_help()

View File

@ -0,0 +1,35 @@
#! /usr/bin/env bash
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|
# | __// \| |_) | (_| | |_
# \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser
#
# Copyright (c) 2019 Expat development team
# Licensed under the MIT license:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
./xmlwf/xmlwf_helpgen.py | sed \
-e 's,usage: xmlwf,usage: %s,' \
-e 's, \[-h | -v\],,' \
-e 's,^, T(",' \
-e 's,$,\\n"),'

View File

@ -5,7 +5,10 @@
#include <machine/endian.h>
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* 1234 = LILENDIAN, 4321 = BIGENDIAN */
#if BYTE_ORDER == LITTLE_ENDIAN
#define BYTEORDER 1234
#else
@ -18,9 +21,6 @@
/* Define to 1 if you have the `arc4random_buf' function. */
#define HAVE_ARC4RANDOM_BUF 1
/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@ -39,9 +39,6 @@
/* Define to 1 if you have the `bsd' library (-lbsd). */
/* #undef HAVE_LIBBSD */
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
@ -88,7 +85,7 @@
#define PACKAGE_NAME "expat"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "expat 2.2.6"
#define PACKAGE_STRING "expat 2.2.9"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "expat"
@ -97,21 +94,30 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.2.6"
#define PACKAGE_VERSION "2.2.9"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "2.2.6"
#define VERSION "2.2.9"
/* whether byteorder is bigendian */
#if BYTE_ORDER == BIG_ENDIAN
#define WORDS_BIGENDIAN
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
#undef WORDS_BIGENDIAN
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to allow retrieving the byte offsets for attribute names and values.
*/
/* #undef XML_ATTR_INFO */
/* Define to specify how much context to retain around the current parse
point. */
#define XML_CONTEXT_BYTES 1024

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"/
.Dd November 2, 2018
.Dd November 25, 2019
.Dt LIBBSDXML 3
.Os
.Sh NAME
@ -36,7 +36,7 @@
.Sh DESCRIPTION
The
.Nm
library is a verbatim copy of the eXpat XML library version 2.2.6.
library is a verbatim copy of the eXpat XML library version 2.2.9.
.Pp
The
.Nm