This commit was generated by cvs2svn to compensate for changes in r178848,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
4d360d633e
@ -1,6 +1,6 @@
|
||||
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
and Clark Cooper
|
||||
Copyright (c) 2001, 2002 Expat maintainers.
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
@ -1,3 +1,73 @@
|
||||
Release 2.0.1 Tue June 5 2007
|
||||
- Fixed bugs #1515266, 1515600: The character data handler's calling
|
||||
of XML_StopParser() was not handled properly; if the parser was
|
||||
stopped and the handler set to NULL, the parser would segfault.
|
||||
- Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed
|
||||
some character constants to be ASCII encoded.
|
||||
- Minor cleanups of the test harness.
|
||||
- Fixed xmlwf bug #1513566: "out of memory" error on file size zero.
|
||||
- Fixed outline.c bug #1543233: missing a final XML_ParserFree() call.
|
||||
- Fixes and improvements for Windows platform:
|
||||
bugs #1409451, #1476160, 1548182, 1602769, 1717322.
|
||||
- Build fixes for various platforms:
|
||||
HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180.
|
||||
All Unix: #1554618 (refreshed config.sub/config.guess).
|
||||
#1490371, #1613457: support both, DESTDIR and INSTALL_ROOT,
|
||||
without relying on GNU-Make specific features.
|
||||
#1647805: Patched configure.in to work better with Intel compiler.
|
||||
- Fixes to Makefile.in to have make check work correctly:
|
||||
bugs #1408143, #1535603, #1536684.
|
||||
- Added Open Watcom support: patch #1523242.
|
||||
|
||||
Release 2.0.0 Wed Jan 11 2006
|
||||
- We no longer use the "check" library for C unit testing; we
|
||||
always use the (partial) internal implementation of the API.
|
||||
- Report XML_NS setting via XML_GetFeatureList().
|
||||
- Fixed headers for use from C++.
|
||||
- XML_GetCurrentLineNumber() and XML_GetCurrentColumnNumber()
|
||||
now return unsigned integers.
|
||||
- Added XML_LARGE_SIZE switch to enable 64-bit integers for
|
||||
byte indexes and line/column numbers.
|
||||
- Updated to use libtool 1.5.22 (the most recent).
|
||||
- Added support for AmigaOS.
|
||||
- Some mostly minor bug fixes. SF issues include: 1006708,
|
||||
1021776, 1023646, 1114960, 1156398, 1221160, 1271642.
|
||||
|
||||
Release 1.95.8 Fri Jul 23 2004
|
||||
- Major new feature: suspend/resume. Handlers can now request
|
||||
that a parse be suspended for later resumption or aborted
|
||||
altogether. See "Temporarily Stopping Parsing" in the
|
||||
documentation for more details.
|
||||
- Some mostly minor bug fixes, but compilation should no
|
||||
longer generate warnings on most platforms. SF issues
|
||||
include: 827319, 840173, 846309, 888329, 896188, 923913,
|
||||
928113, 961698, 985192.
|
||||
|
||||
Release 1.95.7 Mon Oct 20 2003
|
||||
- Fixed enum XML_Status issue (reported on SourceForge many
|
||||
times), so compilers that are properly picky will be happy.
|
||||
- Introduced an XMLCALL macro to control the calling
|
||||
convention used by the Expat API; this macro should be used
|
||||
to annotate prototypes and definitions of callback
|
||||
implementations in code compiled with a calling convention
|
||||
other than the default convention for the host platform.
|
||||
- Improved ability to build without the configure-generated
|
||||
expat_config.h header. This is useful for applications
|
||||
which embed Expat rather than linking in the library.
|
||||
- Fixed a variety of bugs: see SF issues 458907, 609603,
|
||||
676844, 679754, 692878, 692964, 695401, 699323, 699487,
|
||||
820946.
|
||||
- Improved hash table lookups.
|
||||
- Added more regression tests and improved documentation.
|
||||
|
||||
Release 1.95.6 Tue Jan 28 2003
|
||||
- Added XML_FreeContentModel().
|
||||
- Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree().
|
||||
- Fixed a variety of bugs: see SF issues 615606, 616863,
|
||||
618199, 653180, 673791.
|
||||
- Enhanced the regression test suite.
|
||||
- Man page improvements: includes SF issue 632146.
|
||||
|
||||
Release 1.95.5 Fri Sep 6 2002
|
||||
- Added XML_UseForeignDTD() for improved SAX2 support.
|
||||
- Added XML_GetFeatureList().
|
||||
@ -7,7 +77,7 @@ Release 1.95.5 Fri Sep 6 2002
|
||||
- Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected.
|
||||
- Finally fixed bug where default handler would report DTD
|
||||
events that were already handled by another handler.
|
||||
Initial patch contributed by Darryl Miller.
|
||||
Initial patch contributed by Darryl Miles.
|
||||
- Removed unnecessary DllMain() function that caused static
|
||||
linking into a DLL to be difficult.
|
||||
- Added VC++ projects for building static libraries.
|
||||
|
@ -1,22 +1,33 @@
|
||||
Changes
|
||||
COPYING
|
||||
MANIFEST
|
||||
Makefile.in
|
||||
README
|
||||
configure
|
||||
configure.in
|
||||
expat_config.h.in
|
||||
bcb5/ExpatGroup.bpg
|
||||
bcb5/ReadMe.txt
|
||||
amiga/stdlib.c
|
||||
amiga/launch.c
|
||||
amiga/expat_vectors.c
|
||||
amiga/expat_lib.c
|
||||
amiga/expat.xml
|
||||
amiga/README.txt
|
||||
amiga/Makefile
|
||||
amiga/include/proto/expat.h
|
||||
amiga/include/libraries/expat.h
|
||||
amiga/include/interfaces/expat.h
|
||||
amiga/include/inline4/expat.h
|
||||
bcb5/README.txt
|
||||
bcb5/all_projects.bpg
|
||||
bcb5/elements.bpf
|
||||
bcb5/elements.bpr
|
||||
bcb5/elements.mak
|
||||
bcb5/libexpat.bpf
|
||||
bcb5/libexpat.bpr
|
||||
bcb5/libexpat.mak
|
||||
bcb5/libexpatw.bpf
|
||||
bcb5/libexpatw.bpr
|
||||
bcb5/libexpatw.mak
|
||||
bcb5/expat.bpf
|
||||
bcb5/expat.bpr
|
||||
bcb5/expat.mak
|
||||
bcb5/expat_static.bpf
|
||||
bcb5/expat_static.bpr
|
||||
bcb5/expat_static.mak
|
||||
bcb5/expatw.bpf
|
||||
bcb5/expatw.bpr
|
||||
bcb5/expatw.mak
|
||||
bcb5/expatw_static.bpf
|
||||
bcb5/expatw_static.bpr
|
||||
bcb5/expatw_static.mak
|
||||
bcb5/libexpat_mtd.def
|
||||
bcb5/libexpatw_mtd.def
|
||||
bcb5/makefile.mak
|
||||
bcb5/outline.bpf
|
||||
bcb5/outline.bpr
|
||||
@ -25,30 +36,54 @@ bcb5/setup.bat
|
||||
bcb5/xmlwf.bpf
|
||||
bcb5/xmlwf.bpr
|
||||
bcb5/xmlwf.mak
|
||||
conftools/PrintPath
|
||||
conftools/ac_c_bigendian_cross.m4
|
||||
conftools/config.guess
|
||||
conftools/config.sub
|
||||
conftools/expat.m4
|
||||
conftools/install-sh
|
||||
conftools/libtool.m4
|
||||
conftools/ltmain.sh
|
||||
conftools/mkinstalldirs
|
||||
doc/expat.png
|
||||
doc/reference.html
|
||||
doc/style.css
|
||||
doc/valid-xhtml10.png
|
||||
doc/xmlwf.1
|
||||
doc/xmlwf.sgml
|
||||
COPYING
|
||||
Changes
|
||||
MANIFEST
|
||||
Makefile.in
|
||||
README
|
||||
configure
|
||||
configure.in
|
||||
expat_config.h.in
|
||||
expat.dsw
|
||||
conftools/PrintPath
|
||||
conftools/ac_c_bigendian_cross.m4
|
||||
conftools/config.guess
|
||||
conftools/config.sub
|
||||
conftools/expat.m4
|
||||
conftools/get-version.sh
|
||||
conftools/install-sh
|
||||
conftools/libtool.m4
|
||||
conftools/ltmain.sh
|
||||
conftools/mkinstalldirs
|
||||
examples/elements.c
|
||||
examples/elements.dsp
|
||||
examples/outline.c
|
||||
examples/outline.dsp
|
||||
lib/Makefile.MPW
|
||||
lib/amigaconfig.h
|
||||
lib/ascii.h
|
||||
lib/asciitab.h
|
||||
lib/expat.dsp
|
||||
lib/expat.h
|
||||
lib/expat_external.h
|
||||
lib/expat_static.dsp
|
||||
lib/expatw.dsp
|
||||
lib/expatw_static.dsp
|
||||
lib/iasciitab.h
|
||||
lib/internal.h
|
||||
lib/latin1tab.h
|
||||
lib/libexpat.def
|
||||
lib/libexpatw.def
|
||||
lib/macconfig.h
|
||||
lib/nametab.h
|
||||
lib/utf8tab.h
|
||||
lib/winconfig.h
|
||||
lib/xmlparse.c
|
||||
lib/xmlrole.c
|
||||
lib/xmlrole.h
|
||||
@ -57,17 +92,24 @@ lib/xmltok.h
|
||||
lib/xmltok_impl.c
|
||||
lib/xmltok_impl.h
|
||||
lib/xmltok_ns.c
|
||||
lib/winconfig.h
|
||||
tests/benchmark/README.txt
|
||||
tests/benchmark/benchmark.c
|
||||
tests/benchmark/benchmark.dsp
|
||||
tests/benchmark/benchmark.dsw
|
||||
tests/README.txt
|
||||
tests/chardata.c
|
||||
tests/chardata.h
|
||||
tests/minicheck.c
|
||||
tests/minicheck.h
|
||||
tests/runtests.c
|
||||
tests/runtestspp.cpp
|
||||
tests/xmltest.sh
|
||||
vms/README.vms
|
||||
vms/descrip.mms
|
||||
vms/expat_config.h
|
||||
vms/README.vms
|
||||
win32/expat.iss
|
||||
win32/MANIFEST.txt
|
||||
win32/README.txt
|
||||
win32/expat.iss
|
||||
xmlwf/codepage.c
|
||||
xmlwf/codepage.h
|
||||
xmlwf/ct.c
|
||||
@ -82,4 +124,5 @@ xmlwf/xmlmime.h
|
||||
xmlwf/xmltchar.h
|
||||
xmlwf/xmlurl.h
|
||||
xmlwf/xmlwf.c
|
||||
xmlwf/xmlwf.dsp
|
||||
xmlwf/xmlwin32url.cxx
|
||||
|
@ -30,7 +30,7 @@ exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
mandir = ${prefix}/man/man1
|
||||
man1dir = @mandir@/man1
|
||||
|
||||
top_builddir = .
|
||||
|
||||
@ -41,9 +41,10 @@ INSTALL_DATA = @INSTALL_DATA@
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs
|
||||
|
||||
MANFILE = $(srcdir)/doc/xmlwf.1
|
||||
APIHEADER = $(srcdir)/lib/expat.h
|
||||
APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h
|
||||
LIBRARY = libexpat.la
|
||||
|
||||
DESTDIR = $(INSTALL_ROOT)
|
||||
|
||||
default: buildlib xmlwf/xmlwf
|
||||
|
||||
@ -55,9 +56,12 @@ clean:
|
||||
cd lib && rm -f $(LIBRARY) *.o *.lo && rm -rf .libs _libs
|
||||
cd xmlwf && rm -f xmlwf *.o *.lo && rm -rf .libs _libs
|
||||
cd examples && rm -f elements outline *.o *.lo && rm -rf .libs _libs
|
||||
cd tests && rm -rf .libs runtests runtests.o chardata.o
|
||||
cd tests && rm -rf .libs runtests runtests.o runtestspp runtestspp.o
|
||||
cd tests && rm -f chardata.o minicheck.o
|
||||
rm -rf .libs libexpat.la
|
||||
find . -name core | xargs rm -f
|
||||
rm -f examples/core tests/core xmlwf/core
|
||||
|
||||
clobber: clean
|
||||
|
||||
distclean: clean
|
||||
rm -f expat_config.h config.status config.log config.cache libtool
|
||||
@ -67,26 +71,28 @@ extraclean: distclean
|
||||
rm -f expat_config.h.in configure
|
||||
rm -f conftools/ltconfig conftools/ltmain.sh conftools/libtool.m4
|
||||
|
||||
check: tests/runtests
|
||||
check: tests/runtests tests/runtestspp
|
||||
tests/runtests
|
||||
tests/runtestspp
|
||||
|
||||
install: xmlwf/xmlwf installlib
|
||||
$(mkinstalldirs) $(bindir) $(mandir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(bindir)/xmlwf
|
||||
$(INSTALL_DATA) $(MANFILE) $(mandir)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(DESTDIR)$(bindir)/xmlwf
|
||||
$(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir)
|
||||
|
||||
installlib: $(LIBRARY) $(APIHEADER)
|
||||
$(mkinstalldirs) $(libdir) $(includedir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(libdir)/$(LIBRARY)
|
||||
$(INSTALL_DATA) $(APIHEADER) $(includedir)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY)
|
||||
for FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done
|
||||
|
||||
uninstall: uninstalllib
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(bindir)/xmlwf
|
||||
rm -f $(mandir)/xmlwf.1
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf
|
||||
rm -f $(DESTDIR)$(man1dir)/xmlwf.1
|
||||
|
||||
uninstalllib:
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(LIBRARY)
|
||||
rm -f $(includedir)/$(APIHEADER)
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY)
|
||||
rm -f $(DESTDIR)$(includedir)/expat.h
|
||||
rm -f $(DESTDIR)$(includedir)/expat_external.h
|
||||
|
||||
# for VPATH builds (invoked by configure)
|
||||
mkdir-init:
|
||||
@ -95,36 +101,40 @@ mkdir-init:
|
||||
done
|
||||
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
|
||||
INCLUDES = -I$(srcdir)/lib -I.
|
||||
LDFLAGS = @LDFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@ -DHAVE_EXPAT_CONFIG_H
|
||||
CFLAGS = @CFLAGS@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
|
||||
|
||||
### autoconf this?
|
||||
LTFLAGS = --silent
|
||||
|
||||
COMPILE = $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $(INCLUDES)
|
||||
COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS)
|
||||
CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE)
|
||||
LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@
|
||||
LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@
|
||||
LINK_CXX_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(CXXCOMPILE) $(LDFLAGS) -o $@
|
||||
|
||||
LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo
|
||||
$(LIBRARY): $(LIB_OBJS)
|
||||
$(LINK_LIB) $(LIB_OBJS)
|
||||
|
||||
lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \
|
||||
$(top_builddir)/expat_config.h lib/internal.h
|
||||
$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h
|
||||
|
||||
lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \
|
||||
$(top_builddir)/expat_config.h lib/internal.h
|
||||
$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h
|
||||
|
||||
lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \
|
||||
lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \
|
||||
lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \
|
||||
$(top_builddir)/expat_config.h
|
||||
$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h
|
||||
|
||||
|
||||
XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o
|
||||
@ -144,9 +154,13 @@ examples/outline: examples/outline.o $(LIBRARY)
|
||||
$(LINK_EXE) $< $(LIBRARY)
|
||||
|
||||
tests/chardata.o: tests/chardata.c tests/chardata.h
|
||||
tests/minicheck.o: tests/minicheck.c tests/minicheck.h
|
||||
tests/runtests.o: tests/runtests.c tests/chardata.h
|
||||
tests/runtests: tests/runtests.o tests/chardata.o $(LIBRARY)
|
||||
$(LINK_EXE) $^ -lcheck
|
||||
tests/runtests: tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY)
|
||||
$(LINK_EXE) tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY)
|
||||
tests/runtestspp.o: tests/runtestspp.cpp tests/runtests.c tests/chardata.h
|
||||
tests/runtestspp: tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY)
|
||||
$(LINK_CXX_EXE) tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY)
|
||||
|
||||
tests/xmlts.zip:
|
||||
wget --output-document=tests/xmlts.zip \
|
||||
@ -158,8 +172,10 @@ tests/XML-Test-Suite: tests/xmlts.zip
|
||||
run-xmltest: xmlwf/xmlwf tests/XML-Test-Suite
|
||||
tests/xmltest.sh
|
||||
|
||||
.SUFFIXES: .c .lo .o
|
||||
.SUFFIXES: .c .cpp .lo .o
|
||||
|
||||
.cpp.o:
|
||||
$(CXXCOMPILE) -o $@ -c $<
|
||||
.c.o:
|
||||
$(COMPILE) -o $@ -c $<
|
||||
.c.lo:
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
Expat, Release 1.95.5
|
||||
Expat, Release 2.0.1
|
||||
|
||||
This is Expat, a C library for parsing XML, written by James Clark.
|
||||
Expat is a stream-oriented XML parser. This means that you register
|
||||
@ -9,7 +9,7 @@ document being parsed. A start tag is an example of the kind of
|
||||
structures for which you may register handlers.
|
||||
|
||||
Windows users should use the expat_win32bin package, which includes
|
||||
both precompiled libraries and executalbes, and source code for
|
||||
both precompiled libraries and executables, and source code for
|
||||
developers.
|
||||
|
||||
Expat is free software. You may copy, distribute, and modify it under
|
||||
@ -25,8 +25,8 @@ intended to be production grade software.
|
||||
If you are building Expat from a check-out from the CVS repository,
|
||||
you need to run a script that generates the configure script using the
|
||||
GNU autoconf and libtool tools. To do this, you need to have
|
||||
autoconf 2.52 or newer and libtool 1.4 or newer. Run the script like
|
||||
this:
|
||||
autoconf 2.52 or newer and libtool 1.4 or newer (1.5 or newer preferred).
|
||||
Run the script like this:
|
||||
|
||||
./buildconf.sh
|
||||
|
||||
@ -48,15 +48,25 @@ into /home/me/mystuff/lib, /home/me/mystuff/include, and
|
||||
/home/me/mystuff/bin, you can tell configure about that with:
|
||||
|
||||
./configure --prefix=/home/me/mystuff
|
||||
|
||||
Another interesting option is to enable 64-bit integer support for
|
||||
line and column numbers and the over-all byte index:
|
||||
|
||||
./configure CPPFLAGS=-DXML_LARGE_SIZE
|
||||
|
||||
However, such a modification would be a breaking change to the ABI
|
||||
and is therefore not recommended for general use - e.g. as part of
|
||||
a Linux distribution - but rather for builds with special requirements.
|
||||
|
||||
After running the configure script, the "make" command will build
|
||||
things and "make install" will install things into their proper
|
||||
location. Note that you need to have write permission into the
|
||||
directories into which things will be installed.
|
||||
location. Have a look at the "Makefile" to learn about additional
|
||||
"make" options. Note that you need to have write permission into
|
||||
the directories into which things will be installed.
|
||||
|
||||
If you are interested in building Expat to provide document
|
||||
information in UTF-16 rather than the default UTF-8, following these
|
||||
instructions:
|
||||
information in UTF-16 rather than the default UTF-8, follow these
|
||||
instructions (after having run "make distclean"):
|
||||
|
||||
1. For UTF-16 output as unsigned short (and version/error
|
||||
strings as char), run:
|
||||
@ -80,8 +90,23 @@ instructions:
|
||||
(Note the additional "w" in the library name.)
|
||||
|
||||
3. Run "make buildlib" (which builds the library only).
|
||||
Or, to save step 2, run "make buildlib LIBRARY=libexpatw.la".
|
||||
|
||||
4. Run "make installlib" (which installs the library only).
|
||||
Or, if step 2 was omitted, run "make installlib LIBRARY=libexpatw.la".
|
||||
|
||||
Using DESTDIR or INSTALL_ROOT is enabled, with INSTALL_ROOT being the default
|
||||
value for DESTDIR, and the rest of the make file using only DESTDIR.
|
||||
It works as follows:
|
||||
$ make install DESTDIR=/path/to/image
|
||||
overrides the in-makefile set DESTDIR, while both
|
||||
$ INSTALL_ROOT=/path/to/image make install
|
||||
$ make install INSTALL_ROOT=/path/to/image
|
||||
use DESTDIR=$(INSTALL_ROOT), even if DESTDIR eventually is defined in the
|
||||
environment, because variable-setting priority is
|
||||
1) commandline
|
||||
2) in-makefile
|
||||
3) environment
|
||||
|
||||
Note for Solaris users: The "ar" command is usually located in
|
||||
"/usr/ccs/bin", which is not in the default PATH. You will need to
|
||||
@ -109,4 +134,4 @@ Discussion related to the direction of future expat development takes
|
||||
place on expat-discuss@mail.libexpat.org. Archives of this list and
|
||||
other Expat-related lists may be found at:
|
||||
|
||||
http://mail.libexpat.org/mailman-21/listinfo/
|
||||
http://mail.libexpat.org/mailman/listinfo/
|
||||
|
20411
contrib/expat/configure
vendored
20411
contrib/expat/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -25,8 +25,8 @@ 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)],
|
||||
[1.95.x]))
|
||||
AC_INIT(expat, expat_version, expat-bugs@mail.libexpat.org)
|
||||
[2.0.x]))
|
||||
AC_INIT(expat, expat_version, expat-bugs@libexpat.org)
|
||||
undefine([expat_version])
|
||||
|
||||
AC_CONFIG_SRCDIR(Makefile.in)
|
||||
@ -44,9 +44,9 @@ dnl
|
||||
dnl If the API changes incompatibly set LIBAGE back to 0
|
||||
dnl
|
||||
|
||||
LIBCURRENT=4
|
||||
LIBREVISION=0
|
||||
LIBAGE=4
|
||||
LIBCURRENT=6
|
||||
LIBREVISION=2
|
||||
LIBAGE=5
|
||||
|
||||
AC_CONFIG_HEADER(expat_config.h)
|
||||
|
||||
@ -72,15 +72,15 @@ if test "$GCC" = yes ; then
|
||||
dnl
|
||||
OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
|
||||
CFLAGS="$OLDCFLAGS -fexceptions"
|
||||
AC_MSG_CHECKING(whether gcc accepts -fexceptions)
|
||||
AC_TRY_COMPILE(,(void)1,
|
||||
AC_MSG_CHECKING(whether $CC accepts -fexceptions)
|
||||
AC_TRY_LINK( , ,
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
|
||||
CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
@ -89,12 +89,12 @@ dnl work in a cross compile.
|
||||
AC_C_BIGENDIAN_CROSS
|
||||
|
||||
AC_C_CONST
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_FUNCS(memmove bcopy)
|
||||
|
||||
dnl Checks for library functions.
|
||||
|
||||
AC_FUNC_MEMCMP
|
||||
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
|
||||
@ -104,9 +104,39 @@ else
|
||||
fi
|
||||
AC_SUBST(FILEMAP)
|
||||
|
||||
AC_CHECK_FUNCS(memmove bcopy)
|
||||
dnl Needed for the test support code; this was found at
|
||||
dnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html
|
||||
|
||||
dnl some basic configuration
|
||||
# AC_CPP_FUNC
|
||||
# ------------------ #
|
||||
# Checks to see if ANSI C99 CPP variable __func__ works.
|
||||
# If not, perhaps __FUNCTION__ works instead.
|
||||
# If not, we'll just define __func__ to "".
|
||||
AC_DEFUN([AC_CPP_FUNC],
|
||||
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
|
||||
AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
||||
[[char *foo = __func__;]])],
|
||||
[ac_cv_cpp_func=yes],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
||||
[[char *foo = __FUNCTION__;]])],
|
||||
[ac_cv_cpp_func=__FUNCTION__],
|
||||
[ac_cv_cpp_func=no])])])
|
||||
if test $ac_cv_cpp_func = __FUNCTION__; then
|
||||
AC_DEFINE(__func__,__FUNCTION__,
|
||||
[Define to __FUNCTION__ or "" if `__func__' does not conform to
|
||||
ANSI C.])
|
||||
elif test $ac_cv_cpp_func = no; then
|
||||
AC_DEFINE(__func__,"",
|
||||
[Define to __FUNCTION__ or "" if `__func__' does not conform to
|
||||
ANSI C.])
|
||||
fi
|
||||
])# AC_CPP_FUNC
|
||||
|
||||
AC_CPP_FUNC
|
||||
|
||||
|
||||
dnl Some basic configuration:
|
||||
AC_DEFINE([XML_NS], 1,
|
||||
[Define to make XML Namespaces functionality available.])
|
||||
AC_DEFINE([XML_DTD], 1,
|
||||
|
BIN
contrib/expat/doc/expat.png
Executable file
BIN
contrib/expat/doc/expat.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,37 @@
|
||||
body {
|
||||
background-color: white
|
||||
background-color: white;
|
||||
border: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.corner {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.banner {
|
||||
background-color: rgb(110,139,61);
|
||||
color: rgb(255,236,176);
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.banner h1 {
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0em 2em 1em 2em;
|
||||
}
|
||||
|
||||
.releaseno {
|
||||
background-color: rgb(110,139,61);
|
||||
color: rgb(255,236,176);
|
||||
padding-bottom: 0.3em;
|
||||
padding-top: 0.5em;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.noborder {
|
||||
@ -17,6 +49,17 @@ body {
|
||||
margin-right: 10%;
|
||||
}
|
||||
|
||||
.pseudocode {
|
||||
padding-left: 1em;
|
||||
padding-top: .5em;
|
||||
padding-bottom: .5em;
|
||||
border: solid thin;
|
||||
margin: 1em 0;
|
||||
background-color: rgb(250,220,180);
|
||||
margin-left: 2em;
|
||||
margin-right: 10%;
|
||||
}
|
||||
|
||||
.handler {
|
||||
width: 100%;
|
||||
border-top-width: thin;
|
||||
@ -49,3 +92,10 @@ body {
|
||||
dd {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.cpp-symbols dt {
|
||||
font-family: monospace;
|
||||
}
|
||||
.cpp-symbols dd {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
BIN
contrib/expat/doc/valid-xhtml10.png
Executable file
BIN
contrib/expat/doc/valid-xhtml10.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
@ -3,7 +3,7 @@
|
||||
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
|
||||
.\" Please send any bug reports, improvements, comments, patches,
|
||||
.\" etc. to Steve Cheng <steve@ggi-project.org>.
|
||||
.TH "XMLWF" "1" "22 April 2002" "" ""
|
||||
.TH "XMLWF" "1" "24 January 2003" "" ""
|
||||
.SH NAME
|
||||
xmlwf \- Determines if an XML document is well-formed
|
||||
.SH SYNOPSIS
|
||||
@ -12,12 +12,13 @@ xmlwf \- Determines if an XML document is well-formed
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
\fBxmlwf\fR uses the Expat library to determine
|
||||
if an XML document is well-formed. It is non-validating.
|
||||
\fBxmlwf\fR uses the Expat library to
|
||||
determine if an XML document is well-formed. It is
|
||||
non-validating.
|
||||
.PP
|
||||
If you do not specify any files on the command-line,
|
||||
and you have a recent version of xmlwf, the input
|
||||
file will be read from stdin.
|
||||
If you do not specify any files on the command-line, and you
|
||||
have a recent version of \fBxmlwf\fR, the
|
||||
input file will be read from standard input.
|
||||
.SH "WELL-FORMED DOCUMENTS"
|
||||
.PP
|
||||
A well-formed document must adhere to the
|
||||
@ -26,7 +27,8 @@ following rules:
|
||||
\(bu
|
||||
The file begins with an XML declaration. For instance,
|
||||
<?xml version="1.0" standalone="yes"?>.
|
||||
\fBNOTE:\fR xmlwf does not currently
|
||||
\fBNOTE:\fR
|
||||
\fBxmlwf\fR does not currently
|
||||
check for a valid XML declaration.
|
||||
.TP 0.2i
|
||||
\(bu
|
||||
@ -48,33 +50,37 @@ or double).
|
||||
.PP
|
||||
If the document has a DTD, and it strictly complies with that
|
||||
DTD, then the document is also considered \fBvalid\fR.
|
||||
xmlwf is a non-validating parser -- it does not check the DTD.
|
||||
However, it does support external entities (see the -x option).
|
||||
\fBxmlwf\fR is a non-validating parser --
|
||||
it does not check the DTD. However, it does support
|
||||
external entities (see the \fB-x\fR option).
|
||||
.SH "OPTIONS"
|
||||
.PP
|
||||
When an option includes an argument, you may specify the argument either
|
||||
separate ("d output") or mashed ("-doutput"). xmlwf supports both.
|
||||
separately ("\fB-d\fR output") or concatenated with the
|
||||
option ("\fB-d\fRoutput"). \fBxmlwf\fR
|
||||
supports both.
|
||||
.TP
|
||||
\fB-c\fR
|
||||
If the input file is well-formed and xmlwf doesn't
|
||||
encounter any errors, the input file is simply copied to
|
||||
If the input file is well-formed and \fBxmlwf\fR
|
||||
doesn't encounter any errors, the input file is simply copied to
|
||||
the output directory unchanged.
|
||||
This implies no namespaces (turns off -n) and
|
||||
requires -d to specify an output file.
|
||||
This implies no namespaces (turns off \fB-n\fR) and
|
||||
requires \fB-d\fR to specify an output file.
|
||||
.TP
|
||||
\fB-d output-dir\fR
|
||||
Specifies a directory to contain transformed
|
||||
representations of the input files.
|
||||
By default, -d outputs a canonical representation
|
||||
By default, \fB-d\fR outputs a canonical representation
|
||||
(described below).
|
||||
You can select different output formats using -c and -m.
|
||||
You can select different output formats using \fB-c\fR
|
||||
and \fB-m\fR.
|
||||
|
||||
The output filenames will
|
||||
be exactly the same as the input filenames or "STDIN" if the input is
|
||||
coming from STDIN. Therefore, you must be careful that the
|
||||
coming from standard input. Therefore, you must be careful that the
|
||||
output file does not go into the same directory as the input
|
||||
file. Otherwise, xmlwf will delete the input file before
|
||||
it generates the output file (just like running
|
||||
file. Otherwise, \fBxmlwf\fR will delete the
|
||||
input file before it generates the output file (just like running
|
||||
cat < file > file in most shells).
|
||||
|
||||
Two structurally equivalent XML documents have a byte-for-byte
|
||||
@ -86,36 +92,45 @@ http://www.jclark.com/xml/canonxml.html .
|
||||
.TP
|
||||
\fB-e encoding\fR
|
||||
Specifies the character encoding for the document, overriding
|
||||
any document encoding declaration. xmlwf
|
||||
has four built-in encodings:
|
||||
any document encoding declaration. \fBxmlwf\fR
|
||||
supports four built-in encodings:
|
||||
US-ASCII,
|
||||
UTF-8,
|
||||
UTF-16, and
|
||||
ISO-8859-1.
|
||||
Also see the -w option.
|
||||
Also see the \fB-w\fR option.
|
||||
.TP
|
||||
\fB-m\fR
|
||||
Outputs some strange sort of XML file that completely
|
||||
describes the the input file, including character postitions.
|
||||
Requires -d to specify an output file.
|
||||
describes the input file, including character positions.
|
||||
Requires \fB-d\fR to specify an output file.
|
||||
.TP
|
||||
\fB-n\fR
|
||||
Turns on namespace processing. (describe namespaces)
|
||||
-c disables namespaces.
|
||||
\fB-c\fR disables namespaces.
|
||||
.TP
|
||||
\fB-p\fR
|
||||
Tells xmlwf to process external DTDs and parameter
|
||||
entities.
|
||||
|
||||
Normally xmlwf never parses parameter entities.
|
||||
-p tells it to always parse them.
|
||||
-p implies -x.
|
||||
Normally \fBxmlwf\fR never parses parameter
|
||||
entities. \fB-p\fR tells it to always parse them.
|
||||
\fB-p\fR implies \fB-x\fR.
|
||||
.TP
|
||||
\fB-r\fR
|
||||
Normally xmlwf memory-maps the XML file before parsing.
|
||||
-r turns off memory-mapping and uses normal file IO calls instead.
|
||||
Normally \fBxmlwf\fR memory-maps the XML file
|
||||
before parsing; this can result in faster parsing on many
|
||||
platforms.
|
||||
\fB-r\fR turns off memory-mapping and uses normal file
|
||||
IO calls instead.
|
||||
Of course, memory-mapping is automatically turned off
|
||||
when reading from STDIN.
|
||||
when reading from standard input.
|
||||
|
||||
Use of memory-mapping can cause some platforms to report
|
||||
substantially higher memory usage for
|
||||
\fBxmlwf\fR, but this appears to be a matter of
|
||||
the operating system reporting memory in a strange way; there is
|
||||
not a leak in \fBxmlwf\fR.
|
||||
.TP
|
||||
\fB-s\fR
|
||||
Prints an error if the document is not standalone.
|
||||
@ -127,17 +142,21 @@ Turns on timings. This tells Expat to parse the entire file,
|
||||
but not perform any processing.
|
||||
This gives a fairly accurate idea of the raw speed of Expat itself
|
||||
without client overhead.
|
||||
-t turns off most of the output options (-d, -m -c, ...).
|
||||
\fB-t\fR turns off most of the output options
|
||||
(\fB-d\fR, \fB-m\fR, \fB-c\fR,
|
||||
\&...).
|
||||
.TP
|
||||
\fB-v\fR
|
||||
Prints the version of the Expat library being used, and then exits.
|
||||
Prints the version of the Expat library being used, including some
|
||||
information on the compile-time configuration of the library, and
|
||||
then exits.
|
||||
.TP
|
||||
\fB-w\fR
|
||||
Enables Windows code pages.
|
||||
Normally, xmlwf will throw an error if it runs across
|
||||
an encoding that it is not equipped to handle itself. With
|
||||
-w, xmlwf will try to use a Windows code page. See
|
||||
also -e.
|
||||
Enables support for Windows code pages.
|
||||
Normally, \fBxmlwf\fR will throw an error if it
|
||||
runs across an encoding that it is not equipped to handle itself. With
|
||||
\fB-w\fR, xmlwf will try to use a Windows code
|
||||
page. See also \fB-e\fR.
|
||||
.TP
|
||||
\fB-x\fR
|
||||
Turns on parsing external entities.
|
||||
@ -164,34 +183,48 @@ And here are some examples of external entities:
|
||||
.fi
|
||||
.TP
|
||||
\fB--\fR
|
||||
For some reason, xmlwf specifically ignores "--"
|
||||
anywhere it appears on the command line.
|
||||
(Two hyphens.)
|
||||
Terminates the list of options. This is only needed if a filename
|
||||
starts with a hyphen. For example:
|
||||
|
||||
.nf
|
||||
xmlwf -- -myfile.xml
|
||||
.fi
|
||||
|
||||
will run \fBxmlwf\fR on the file
|
||||
\fI-myfile.xml\fR.
|
||||
.PP
|
||||
Older versions of xmlwf do not support reading from STDIN.
|
||||
Older versions of \fBxmlwf\fR do not support
|
||||
reading from standard input.
|
||||
.SH "OUTPUT"
|
||||
.PP
|
||||
If an input file is not well-formed, xmlwf outputs
|
||||
a single line describing the problem to STDOUT.
|
||||
If a file is well formed, xmlwf outputs nothing.
|
||||
If an input file is not well-formed,
|
||||
\fBxmlwf\fR prints a single line describing
|
||||
the problem to standard output. If a file is well formed,
|
||||
\fBxmlwf\fR outputs nothing.
|
||||
Note that the result code is \fBnot\fR set.
|
||||
.SH "BUGS"
|
||||
.PP
|
||||
According to the W3C standard, an XML file without a
|
||||
declaration at the beginning is not considered well-formed.
|
||||
However, xmlwf allows this to pass.
|
||||
However, \fBxmlwf\fR allows this to pass.
|
||||
.PP
|
||||
xmlwf returns a 0 - noerr result, even if the file is
|
||||
not well-formed. There is no good way for a program to use
|
||||
xmlwf to quickly check a file -- it must parse xmlwf's STDOUT.
|
||||
\fBxmlwf\fR returns a 0 - noerr result,
|
||||
even if the file is not well-formed. There is no good way for
|
||||
a program to use \fBxmlwf\fR to quickly
|
||||
check a file -- it must parse \fBxmlwf\fR's
|
||||
standard output.
|
||||
.PP
|
||||
The errors should go to STDERR, not stdout.
|
||||
The errors should go to standard error, not standard output.
|
||||
.PP
|
||||
There should be a way to get -d to send its output to STDOUT
|
||||
rather than forcing the user to send it to a file.
|
||||
There should be a way to get \fB-d\fR to send its
|
||||
output to standard output rather than forcing the user to send
|
||||
it to a file.
|
||||
.PP
|
||||
I have no idea why anyone would want to use the -d, -c
|
||||
and -m options. If someone could explain it to me, I'd
|
||||
like to add this information to this manpage.
|
||||
I have no idea why anyone would want to use the
|
||||
\fB-d\fR, \fB-c\fR, and
|
||||
\fB-m\fR options. If someone could explain it to
|
||||
me, I'd like to add this information to this manpage.
|
||||
.SH "ALTERNATIVES"
|
||||
.PP
|
||||
Here are some XML validators on the web:
|
||||
@ -201,3 +234,18 @@ http://www.hcrc.ed.ac.uk/~richard/xml-check.html
|
||||
http://www.stg.brown.edu/service/xmlvalid/
|
||||
http://www.scripting.com/frontier5/xml/code/xmlValidator.html
|
||||
http://www.xml.com/pub/a/tools/ruwf/check.html
|
||||
.fi
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
|
||||
.nf
|
||||
The Expat home page: http://www.libexpat.org/
|
||||
The W3 XML specification: http://www.w3.org/TR/REC-xml
|
||||
.fi
|
||||
.SH "AUTHOR"
|
||||
.PP
|
||||
This manual page was written by Scott Bronson <bronson@rinspin.com> for
|
||||
the Debian GNU/Linux system (but may be used by others). Permission is
|
||||
granted to copy, distribute and/or modify this document under
|
||||
the terms of the GNU Free Documentation
|
||||
License, Version 1.1.
|
||||
|
@ -79,14 +79,15 @@ manpage.1: manpage.sgml
|
||||
<title>DESCRIPTION</title>
|
||||
|
||||
<para>
|
||||
<command>&dhpackage;</command> uses the Expat library to determine
|
||||
if an XML document is well-formed. It is non-validating.
|
||||
<command>&dhpackage;</command> uses the Expat library to
|
||||
determine if an XML document is well-formed. It is
|
||||
non-validating.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you do not specify any files on the command-line,
|
||||
and you have a recent version of &dhpackage;, the input
|
||||
file will be read from stdin.
|
||||
If you do not specify any files on the command-line, and you
|
||||
have a recent version of <command>&dhpackage;</command>, the
|
||||
input file will be read from standard input.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
@ -103,7 +104,8 @@ manpage.1: manpage.sgml
|
||||
<listitem><para>
|
||||
The file begins with an XML declaration. For instance,
|
||||
<literal><?xml version="1.0" standalone="yes"?></literal>.
|
||||
<emphasis>NOTE:</emphasis> &dhpackage; does not currently
|
||||
<emphasis>NOTE:</emphasis>
|
||||
<command>&dhpackage;</command> does not currently
|
||||
check for a valid XML declaration.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
@ -128,8 +130,9 @@ manpage.1: manpage.sgml
|
||||
<para>
|
||||
If the document has a DTD, and it strictly complies with that
|
||||
DTD, then the document is also considered <emphasis>valid</emphasis>.
|
||||
&dhpackage; is a non-validating parser -- it does not check the DTD.
|
||||
However, it does support external entities (see the -x option).
|
||||
<command>&dhpackage;</command> is a non-validating parser --
|
||||
it does not check the DTD. However, it does support
|
||||
external entities (see the <option>-x</option> option).
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
@ -138,7 +141,9 @@ manpage.1: manpage.sgml
|
||||
|
||||
<para>
|
||||
When an option includes an argument, you may specify the argument either
|
||||
separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
separately ("<option>-d</option> output") or concatenated with the
|
||||
option ("<option>-d</option>output"). <command>&dhpackage;</command>
|
||||
supports both.
|
||||
</para>
|
||||
|
||||
<variablelist>
|
||||
@ -147,11 +152,11 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<term><option>-c</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the input file is well-formed and &dhpackage; doesn't
|
||||
encounter any errors, the input file is simply copied to
|
||||
If the input file is well-formed and <command>&dhpackage;</command>
|
||||
doesn't encounter any errors, the input file is simply copied to
|
||||
the output directory unchanged.
|
||||
This implies no namespaces (turns off -n) and
|
||||
requires -d to specify an output file.
|
||||
This implies no namespaces (turns off <option>-n</option>) and
|
||||
requires <option>-d</option> to specify an output file.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -162,17 +167,18 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<para>
|
||||
Specifies a directory to contain transformed
|
||||
representations of the input files.
|
||||
By default, -d outputs a canonical representation
|
||||
By default, <option>-d</option> outputs a canonical representation
|
||||
(described below).
|
||||
You can select different output formats using -c and -m.
|
||||
You can select different output formats using <option>-c</option>
|
||||
and <option>-m</option>.
|
||||
</para>
|
||||
<para>
|
||||
The output filenames will
|
||||
be exactly the same as the input filenames or "STDIN" if the input is
|
||||
coming from STDIN. Therefore, you must be careful that the
|
||||
coming from standard input. Therefore, you must be careful that the
|
||||
output file does not go into the same directory as the input
|
||||
file. Otherwise, &dhpackage; will delete the input file before
|
||||
it generates the output file (just like running
|
||||
file. Otherwise, <command>&dhpackage;</command> will delete the
|
||||
input file before it generates the output file (just like running
|
||||
<literal>cat < file > file</literal> in most shells).
|
||||
</para>
|
||||
<para>
|
||||
@ -191,13 +197,13 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies the character encoding for the document, overriding
|
||||
any document encoding declaration. &dhpackage;
|
||||
has four built-in encodings:
|
||||
any document encoding declaration. <command>&dhpackage;</command>
|
||||
supports four built-in encodings:
|
||||
<literal>US-ASCII</literal>,
|
||||
<literal>UTF-8</literal>,
|
||||
<literal>UTF-16</literal>, and
|
||||
<literal>ISO-8859-1</literal>.
|
||||
Also see the -w option.
|
||||
<literal>ISO-8859-1</literal>.
|
||||
Also see the <option>-w</option> option.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -208,7 +214,7 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<para>
|
||||
Outputs some strange sort of XML file that completely
|
||||
describes the the input file, including character postitions.
|
||||
Requires -d to specify an output file.
|
||||
Requires <option>-d</option> to specify an output file.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -218,7 +224,7 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<listitem>
|
||||
<para>
|
||||
Turns on namespace processing. (describe namespaces)
|
||||
-c disables namespaces.
|
||||
<option>-c</option> disables namespaces.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -231,9 +237,9 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
entities.
|
||||
</para>
|
||||
<para>
|
||||
Normally &dhpackage; never parses parameter entities.
|
||||
-p tells it to always parse them.
|
||||
-p implies -x.
|
||||
Normally <command>&dhpackage;</command> never parses parameter
|
||||
entities. <option>-p</option> tells it to always parse them.
|
||||
<option>-p</option> implies <option>-x</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -242,11 +248,21 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<term><option>-r</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Normally &dhpackage; memory-maps the XML file before parsing.
|
||||
-r turns off memory-mapping and uses normal file IO calls instead.
|
||||
Normally <command>&dhpackage;</command> memory-maps the XML file
|
||||
before parsing; this can result in faster parsing on many
|
||||
platforms.
|
||||
<option>-r</option> turns off memory-mapping and uses normal file
|
||||
IO calls instead.
|
||||
Of course, memory-mapping is automatically turned off
|
||||
when reading from STDIN.
|
||||
when reading from standard input.
|
||||
</para>
|
||||
<para>
|
||||
Use of memory-mapping can cause some platforms to report
|
||||
substantially higher memory usage for
|
||||
<command>&dhpackage;</command>, but this appears to be a matter of
|
||||
the operating system reporting memory in a strange way; there is
|
||||
not a leak in <command>&dhpackage;</command>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -269,7 +285,9 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
but not perform any processing.
|
||||
This gives a fairly accurate idea of the raw speed of Expat itself
|
||||
without client overhead.
|
||||
-t turns off most of the output options (-d, -m -c, ...).
|
||||
<option>-t</option> turns off most of the output options
|
||||
(<option>-d</option>, <option>-m</option>, <option>-c</option>,
|
||||
...).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -278,7 +296,9 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<term><option>-v</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Prints the version of the Expat library being used, and then exits.
|
||||
Prints the version of the Expat library being used, including some
|
||||
information on the compile-time configuration of the library, and
|
||||
then exits.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -287,11 +307,11 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<term><option>-w</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Enables Windows code pages.
|
||||
Normally, &dhpackage; will throw an error if it runs across
|
||||
an encoding that it is not equipped to handle itself. With
|
||||
-w, &dhpackage; will try to use a Windows code page. See
|
||||
also -e.
|
||||
Enables support for Windows code pages.
|
||||
Normally, <command>&dhpackage;</command> will throw an error if it
|
||||
runs across an encoding that it is not equipped to handle itself. With
|
||||
<option>-w</option>, &dhpackage; will try to use a Windows code
|
||||
page. See also <option>-e</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -334,24 +354,34 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<term><option>--</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
For some reason, &dhpackage; specifically ignores "--"
|
||||
anywhere it appears on the command line.
|
||||
(Two hyphens.)
|
||||
Terminates the list of options. This is only needed if a filename
|
||||
starts with a hyphen. For example:
|
||||
</para>
|
||||
<literallayout>
|
||||
&dhpackage; -- -myfile.xml
|
||||
</literallayout>
|
||||
<para>
|
||||
will run <command>&dhpackage;</command> on the file
|
||||
<filename>-myfile.xml</filename>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
Older versions of &dhpackage; do not support reading from STDIN.
|
||||
Older versions of <command>&dhpackage;</command> do not support
|
||||
reading from standard input.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>OUTPUT</title>
|
||||
<para>
|
||||
If an input file is not well-formed, &dhpackage; outputs
|
||||
a single line describing the problem to STDOUT.
|
||||
If a file is well formed, &dhpackage; outputs nothing.
|
||||
If an input file is not well-formed,
|
||||
<command>&dhpackage;</command> prints a single line describing
|
||||
the problem to standard output. If a file is well formed,
|
||||
<command>&dhpackage;</command> outputs nothing.
|
||||
Note that the result code is <emphasis>not</emphasis> set.
|
||||
</para>
|
||||
</refsect1>
|
||||
@ -361,24 +391,28 @@ separate ("d output") or mashed ("-doutput"). &dhpackage; supports both.
|
||||
<para>
|
||||
According to the W3C standard, an XML file without a
|
||||
declaration at the beginning is not considered well-formed.
|
||||
However, &dhpackage; allows this to pass.
|
||||
However, <command>&dhpackage;</command> allows this to pass.
|
||||
</para>
|
||||
<para>
|
||||
&dhpackage; returns a 0 - noerr result, even if the file is
|
||||
not well-formed. There is no good way for a program to use
|
||||
xmlwf to quickly check a file -- it must parse xmlwf's STDOUT.
|
||||
</para>
|
||||
<para>
|
||||
The errors should go to STDERR, not stdout.
|
||||
</para>
|
||||
<para>
|
||||
There should be a way to get -d to send its output to STDOUT
|
||||
rather than forcing the user to send it to a file.
|
||||
<command>&dhpackage;</command> returns a 0 - noerr result,
|
||||
even if the file is not well-formed. There is no good way for
|
||||
a program to use <command>&dhpackage;</command> to quickly
|
||||
check a file -- it must parse <command>&dhpackage;</command>'s
|
||||
standard output.
|
||||
</para>
|
||||
<para>
|
||||
I have no idea why anyone would want to use the -d, -c
|
||||
and -m options. If someone could explain it to me, I'd
|
||||
like to add this information to this manpage.
|
||||
The errors should go to standard error, not standard output.
|
||||
</para>
|
||||
<para>
|
||||
There should be a way to get <option>-d</option> to send its
|
||||
output to standard output rather than forcing the user to send
|
||||
it to a file.
|
||||
</para>
|
||||
<para>
|
||||
I have no idea why anyone would want to use the
|
||||
<option>-d</option>, <option>-c</option>, and
|
||||
<option>-m</option> options. If someone could explain it to
|
||||
me, I'd like to add this information to this manpage.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
@ -392,7 +426,6 @@ http://www.hcrc.ed.ac.uk/~richard/xml-check.html
|
||||
http://www.stg.brown.edu/service/xmlvalid/
|
||||
http://www.scripting.com/frontier5/xml/code/xmlValidator.html
|
||||
http://www.xml.com/pub/a/tools/ruwf/check.html
|
||||
(on a page with no less than 15 ads! Shame!)
|
||||
</literallayout>
|
||||
|
||||
</para>
|
||||
|
@ -2,26 +2,41 @@
|
||||
reads an XML document from standard input and writes a line with
|
||||
the name of each element to standard output indenting child
|
||||
elements by one tab stop more than their parent element.
|
||||
It must be used with Expat compiled for UTF-8 output.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "expat.h"
|
||||
|
||||
static void
|
||||
#if defined(__amigaos__) && defined(__USE_INLINE__)
|
||||
#include <proto/expat.h>
|
||||
#endif
|
||||
|
||||
#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"
|
||||
#endif
|
||||
|
||||
static void XMLCALL
|
||||
startElement(void *userData, const char *name, const char **atts)
|
||||
{
|
||||
int i;
|
||||
int *depthPtr = userData;
|
||||
int *depthPtr = (int *)userData;
|
||||
for (i = 0; i < *depthPtr; i++)
|
||||
putchar('\t');
|
||||
puts(name);
|
||||
*depthPtr += 1;
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
endElement(void *userData, const char *name)
|
||||
{
|
||||
int *depthPtr = userData;
|
||||
int *depthPtr = (int *)userData;
|
||||
*depthPtr -= 1;
|
||||
}
|
||||
|
||||
@ -35,11 +50,11 @@ main(int argc, char *argv[])
|
||||
XML_SetUserData(parser, &depth);
|
||||
XML_SetElementHandler(parser, startElement, endElement);
|
||||
do {
|
||||
size_t len = fread(buf, 1, sizeof(buf), stdin);
|
||||
int len = (int)fread(buf, 1, sizeof(buf), stdin);
|
||||
done = len < sizeof(buf);
|
||||
if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) {
|
||||
fprintf(stderr,
|
||||
"%s at line %d\n",
|
||||
"%s at line %" XML_FMT_INT_MOD "u\n",
|
||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||
XML_GetCurrentLineNumber(parser));
|
||||
return 1;
|
||||
|
@ -18,19 +18,34 @@
|
||||
*
|
||||
* Read an XML document from standard input and print an element
|
||||
* outline on standard output.
|
||||
* Must be used with Expat compiled for UTF-8 output.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <expat.h>
|
||||
|
||||
#if defined(__amigaos__) && defined(__USE_INLINE__)
|
||||
#include <proto/expat.h>
|
||||
#endif
|
||||
|
||||
#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"
|
||||
#endif
|
||||
|
||||
#define BUFFSIZE 8192
|
||||
|
||||
char Buff[BUFFSIZE];
|
||||
|
||||
int Depth;
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
start(void *data, const char *el, const char **attr)
|
||||
{
|
||||
int i;
|
||||
@ -48,7 +63,7 @@ start(void *data, const char *el, const char **attr)
|
||||
Depth++;
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
end(void *data, const char *el)
|
||||
{
|
||||
Depth--;
|
||||
@ -69,7 +84,7 @@ main(int argc, char *argv[])
|
||||
int done;
|
||||
int len;
|
||||
|
||||
len = fread(Buff, 1, BUFFSIZE, stdin);
|
||||
len = (int)fread(Buff, 1, BUFFSIZE, stdin);
|
||||
if (ferror(stdin)) {
|
||||
fprintf(stderr, "Read error\n");
|
||||
exit(-1);
|
||||
@ -77,7 +92,7 @@ main(int argc, char *argv[])
|
||||
done = feof(stdin);
|
||||
|
||||
if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) {
|
||||
fprintf(stderr, "Parse error at line %d:\n%s\n",
|
||||
fprintf(stderr, "Parse error at line %" XML_FMT_INT_MOD "u:\n%s\n",
|
||||
XML_GetCurrentLineNumber(p),
|
||||
XML_ErrorString(XML_GetErrorCode(p)));
|
||||
exit(-1);
|
||||
@ -86,5 +101,6 @@ main(int argc, char *argv[])
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
XML_ParserFree(p);
|
||||
return 0;
|
||||
}
|
||||
|
@ -79,6 +79,9 @@
|
||||
/* Define to make XML Namespaces functionality available. */
|
||||
#undef XML_NS
|
||||
|
||||
/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */
|
||||
#undef __func__
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
||||
#define ASCII_9 0x39
|
||||
|
||||
#define ASCII_TAB 0x09
|
||||
#define ASCII_SPACE 0x20
|
||||
#define ASCII_SPACE 0x20
|
||||
#define ASCII_EXCL 0x21
|
||||
#define ASCII_QUOT 0x22
|
||||
#define ASCII_AMP 0x26
|
||||
@ -83,3 +83,10 @@
|
||||
#define ASCII_LSQB 0x5B
|
||||
#define ASCII_RSQB 0x5D
|
||||
#define ASCII_UNDERSCORE 0x5F
|
||||
#define ASCII_LPAREN 0x28
|
||||
#define ASCII_RPAREN 0x29
|
||||
#define ASCII_FF 0x0C
|
||||
#define ASCII_SLASH 0x2F
|
||||
#define ASCII_HASH 0x23
|
||||
#define ASCII_PIPE 0x7C
|
||||
#define ASCII_COMMA 0x2C
|
||||
|
@ -2,61 +2,55 @@
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlParse_INCLUDED
|
||||
#define XmlParse_INCLUDED 1
|
||||
#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
|
||||
#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
|
||||
#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler
|
||||
#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler
|
||||
#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef XMLPARSEAPI
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
#ifdef _STATIC
|
||||
#define XMLPARSEAPI(type) type __cdecl
|
||||
#else
|
||||
#define XMLPARSEAPI(type) __declspec(dllimport) type __cdecl
|
||||
#endif
|
||||
#else
|
||||
#define XMLPARSEAPI(type) type
|
||||
#endif
|
||||
#endif /* not defined XMLPARSEAPI */
|
||||
#include "expat_external.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
struct XML_ParserStruct;
|
||||
typedef struct XML_ParserStruct *XML_Parser;
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
#else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE */
|
||||
|
||||
/* Should this be defined using stdbool.h when C99 is available? */
|
||||
typedef unsigned char XML_Bool;
|
||||
#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
|
||||
stanza can be added to code that still needs to support older
|
||||
versions of Expat 1.95.x:
|
||||
|
||||
#ifndef XML_STATUS_OK
|
||||
#define XML_STATUS_OK 1
|
||||
#define XML_STATUS_ERROR 0
|
||||
#endif
|
||||
|
||||
Otherwise, the #define hackery is quite ugly and would have been
|
||||
dropped.
|
||||
*/
|
||||
enum XML_Status {
|
||||
XML_STATUS_ERROR = 0,
|
||||
#define XML_STATUS_ERROR XML_STATUS_ERROR
|
||||
XML_STATUS_OK = 1,
|
||||
#define XML_STATUS_OK XML_STATUS_OK
|
||||
XML_STATUS_SUSPENDED = 2
|
||||
#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
|
||||
};
|
||||
|
||||
enum XML_Error {
|
||||
XML_ERROR_NONE,
|
||||
XML_ERROR_NO_MEMORY,
|
||||
@ -84,7 +78,24 @@ enum XML_Error {
|
||||
XML_ERROR_UNEXPECTED_STATE,
|
||||
XML_ERROR_ENTITY_DECLARED_IN_PE,
|
||||
XML_ERROR_FEATURE_REQUIRES_XML_DTD,
|
||||
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
|
||||
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,
|
||||
/* Added in 1.95.7. */
|
||||
XML_ERROR_UNBOUND_PREFIX,
|
||||
/* Added in 1.95.8. */
|
||||
XML_ERROR_UNDECLARING_PREFIX,
|
||||
XML_ERROR_INCOMPLETE_PE,
|
||||
XML_ERROR_XML_DECL,
|
||||
XML_ERROR_TEXT_DECL,
|
||||
XML_ERROR_PUBLICID,
|
||||
XML_ERROR_SUSPENDED,
|
||||
XML_ERROR_NOT_SUSPENDED,
|
||||
XML_ERROR_ABORTED,
|
||||
XML_ERROR_FINISHED,
|
||||
XML_ERROR_SUSPEND_PE,
|
||||
/* Added in 2.0. */
|
||||
XML_ERROR_RESERVED_PREFIX_XML,
|
||||
XML_ERROR_RESERVED_PREFIX_XMLNS,
|
||||
XML_ERROR_RESERVED_NAMESPACE_URI
|
||||
};
|
||||
|
||||
enum XML_Content_Type {
|
||||
@ -136,9 +147,9 @@ struct XML_cp {
|
||||
description of the model argument. It's the caller's responsibility
|
||||
to free model when finished with it.
|
||||
*/
|
||||
typedef void (*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,
|
||||
@ -152,12 +163,13 @@ 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 (*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,
|
||||
@ -171,10 +183,10 @@ 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 (*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,
|
||||
@ -201,14 +213,14 @@ XML_ParserCreate(const XML_Char *encoding);
|
||||
URI, the namespace separator character, and the local part of the
|
||||
name. If the namespace separator is '\0' then the namespace URI
|
||||
and the local part will be concatenated without any separator.
|
||||
When a namespace is not declared, the name and prefix will be
|
||||
passed through without expansion.
|
||||
It is a programming error to use the separator '\0' with namespace
|
||||
triplets (see XML_SetReturnNSTriplet).
|
||||
*/
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
|
||||
|
||||
|
||||
/* Constructs a new parser using the memory management suit referred to
|
||||
/* 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
|
||||
namespace processing as described above. The character pointed at
|
||||
@ -225,7 +237,7 @@ XML_ParserCreate_MM(const XML_Char *encoding,
|
||||
/* Prepare a parser object to be re-used. This is particularly
|
||||
valuable when memory allocation overhead is disproportionatly high,
|
||||
such as when a large number of small documnents need to be parsed.
|
||||
All handlers are cleared from the parser, except for the
|
||||
All handlers are cleared from the parser, except for the
|
||||
unknownEncodingHandler. The parser's external state is re-initialized
|
||||
except for the values of ns and ns_triplets.
|
||||
|
||||
@ -237,29 +249,31 @@ 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 (*XML_StartElementHandler)(void *userData,
|
||||
const XML_Char *name,
|
||||
const XML_Char **atts);
|
||||
typedef void (XMLCALL *XML_StartElementHandler) (void *userData,
|
||||
const XML_Char *name,
|
||||
const XML_Char **atts);
|
||||
|
||||
typedef void (*XML_EndElementHandler)(void *userData,
|
||||
const XML_Char *name);
|
||||
typedef void (XMLCALL *XML_EndElementHandler) (void *userData,
|
||||
const XML_Char *name);
|
||||
|
||||
|
||||
/* s is not 0 terminated. */
|
||||
typedef void (*XML_CharacterDataHandler)(void *userData,
|
||||
const XML_Char *s,
|
||||
int len);
|
||||
typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,
|
||||
const XML_Char *s,
|
||||
int len);
|
||||
|
||||
/* target and data are 0 terminated */
|
||||
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
|
||||
const XML_Char *target,
|
||||
const XML_Char *data);
|
||||
typedef void (XMLCALL *XML_ProcessingInstructionHandler) (
|
||||
void *userData,
|
||||
const XML_Char *target,
|
||||
const XML_Char *data);
|
||||
|
||||
/* data is 0 terminated */
|
||||
typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
|
||||
typedef void (XMLCALL *XML_CommentHandler) (void *userData,
|
||||
const XML_Char *data);
|
||||
|
||||
typedef void (*XML_StartCdataSectionHandler)(void *userData);
|
||||
typedef void (*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
|
||||
@ -267,21 +281,22 @@ typedef void (*XML_EndCdataSectionHandler)(void *userData);
|
||||
(comments, markup declarations), or characters that are part of a
|
||||
construct which could be reported but for which no handler has been
|
||||
supplied. The characters are passed exactly as they were in the XML
|
||||
document except that they will be encoded in UTF-8 or UTF-16.
|
||||
document except that they will be encoded in UTF-8 or UTF-16.
|
||||
Line boundaries are not normalized. Note that a byte order mark
|
||||
character is not passed to the default handler. There are no
|
||||
guarantees about how characters are divided between calls to the
|
||||
default handler: for example, a comment might be split between
|
||||
multiple calls.
|
||||
*/
|
||||
typedef void (*XML_DefaultHandler)(void *userData,
|
||||
const XML_Char *s,
|
||||
int len);
|
||||
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 (*XML_StartDoctypeDeclHandler)(void *userData,
|
||||
typedef void (XMLCALL *XML_StartDoctypeDeclHandler) (
|
||||
void *userData,
|
||||
const XML_Char *doctypeName,
|
||||
const XML_Char *sysid,
|
||||
const XML_Char *pubid,
|
||||
@ -291,7 +306,7 @@ typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
|
||||
closing > is encountered, but after processing any external
|
||||
subset.
|
||||
*/
|
||||
typedef void (*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
|
||||
@ -311,16 +326,17 @@ typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
|
||||
Note that is_parameter_entity can't be changed to XML_Bool, since
|
||||
that would break binary compatibility.
|
||||
*/
|
||||
typedef void (*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);
|
||||
@ -334,22 +350,24 @@ XML_SetEntityDeclHandler(XML_Parser parser,
|
||||
entityName, systemId and notationName arguments will never be
|
||||
NULL. The other arguments may be.
|
||||
*/
|
||||
typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
const XML_Char *notationName);
|
||||
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 (*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
|
||||
@ -357,23 +375,25 @@ typedef void (*XML_NotationDeclHandler)(void *userData,
|
||||
declaration handlers. For an xmlns attribute, prefix will be
|
||||
NULL. For an xmlns="" attribute, uri will be NULL.
|
||||
*/
|
||||
typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
|
||||
const XML_Char *prefix,
|
||||
const XML_Char *uri);
|
||||
typedef void (XMLCALL *XML_StartNamespaceDeclHandler) (
|
||||
void *userData,
|
||||
const XML_Char *prefix,
|
||||
const XML_Char *uri);
|
||||
|
||||
typedef void (*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
|
||||
have standalone="yes". If this handler returns 0, then processing
|
||||
will not continue, and the parser will return a
|
||||
have standalone="yes". If this handler returns XML_STATUS_ERROR,
|
||||
then processing will not continue, and the parser will return a
|
||||
XML_ERROR_NOT_STANDALONE error.
|
||||
If parameter entity parsing is enabled, then in addition to the
|
||||
conditions above this handler will only be called if the referenced
|
||||
entity was actually read.
|
||||
*/
|
||||
typedef int (*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
|
||||
@ -399,20 +419,22 @@ typedef int (*XML_NotStandaloneHandler)(void *userData);
|
||||
expected by the context argument to XML_ExternalEntityParserCreate;
|
||||
context is valid only until the handler returns, so if the
|
||||
referenced entity is to be parsed later, it must be copied.
|
||||
context is NULL only when the entity is a parameter entity.
|
||||
|
||||
The handler should return 0 if processing should not continue
|
||||
because of a fatal error in the handling of the external entity.
|
||||
In this case the calling parser will return an
|
||||
The handler should return XML_STATUS_ERROR if processing should not
|
||||
continue because of a fatal error in the handling of the external
|
||||
entity. In this case the calling parser will return an
|
||||
XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
|
||||
|
||||
Note that unlike other handlers the first argument is the parser,
|
||||
not userData.
|
||||
*/
|
||||
typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
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
|
||||
@ -424,9 +446,10 @@ typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
|
||||
the event would be out of sync with the reporting of the
|
||||
declarations or attribute values
|
||||
*/
|
||||
typedef void (*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
|
||||
@ -483,8 +506,8 @@ typedef void (*XML_SkippedEntityHandler)(void *userData,
|
||||
typedef struct {
|
||||
int map[256];
|
||||
void *data;
|
||||
int (*convert)(void *data, const char *s);
|
||||
void (*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.
|
||||
@ -496,15 +519,16 @@ typedef struct {
|
||||
the encoding declaration.
|
||||
|
||||
If the callback can provide information about the encoding, it must
|
||||
fill in the XML_Encoding structure, and return 1. Otherwise it
|
||||
must return 0.
|
||||
fill in the XML_Encoding structure, and return XML_STATUS_OK.
|
||||
Otherwise it must return XML_STATUS_ERROR.
|
||||
|
||||
If info does not describe a suitable encoding, then the parser will
|
||||
return an XML_UNKNOWN_ENCODING error.
|
||||
*/
|
||||
typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
|
||||
const XML_Char *name,
|
||||
XML_Encoding *info);
|
||||
typedef int (XMLCALL *XML_UnknownEncodingHandler) (
|
||||
void *encodingHandlerData,
|
||||
const XML_Char *name,
|
||||
XML_Encoding *info);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetElementHandler(XML_Parser parser,
|
||||
@ -512,10 +536,12 @@ XML_SetElementHandler(XML_Parser parser,
|
||||
XML_EndElementHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
|
||||
XML_SetStartElementHandler(XML_Parser parser,
|
||||
XML_StartElementHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
|
||||
XML_SetEndElementHandler(XML_Parser parser,
|
||||
XML_EndElementHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetCharacterDataHandler(XML_Parser parser,
|
||||
@ -604,7 +630,8 @@ XML_SetExternalEntityRefHandler(XML_Parser parser,
|
||||
instead of the parser object.
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
|
||||
XML_SetExternalEntityRefHandlerArg(XML_Parser parser,
|
||||
void *arg);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetSkippedEntityHandler(XML_Parser parser,
|
||||
@ -650,9 +677,9 @@ XML_SetUserData(XML_Parser parser, void *userData);
|
||||
XML_ParserCreate. On success XML_SetEncoding returns non-zero,
|
||||
zero otherwise.
|
||||
Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
|
||||
has no effect and returns zero.
|
||||
has no effect and returns XML_STATUS_ERROR.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
|
||||
|
||||
/* If this function is called, then the parser will be passed as the
|
||||
@ -667,6 +694,9 @@ XML_UseParserAsHandlerArg(XML_Parser parser);
|
||||
specified in the document. In such a case the parser will call the
|
||||
externalEntityRefHandler with a value of NULL for the systemId
|
||||
argument (the publicId and context arguments will be NULL as well).
|
||||
Note: For the purpose of checking WFC: Entity Declared, passing
|
||||
useDTD == XML_TRUE will make the parser behave as if the document
|
||||
had a DTD with an external subset.
|
||||
Note: If this function is called, then this must be done before
|
||||
the first call to XML_Parse or XML_ParseBuffer, since it will
|
||||
have no effect after that. Returns
|
||||
@ -686,10 +716,10 @@ XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
|
||||
left to the application: this value will be passed through as the
|
||||
base argument to the XML_ExternalEntityRefHandler,
|
||||
XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base
|
||||
argument will be copied. Returns zero if out of memory, non-zero
|
||||
otherwise.
|
||||
argument will be copied. Returns XML_STATUS_ERROR if out of memory,
|
||||
XML_STATUS_OK otherwise.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_SetBase(XML_Parser parser, const XML_Char *base);
|
||||
|
||||
XMLPARSEAPI(const XML_Char *)
|
||||
@ -716,28 +746,11 @@ XML_GetIdAttributeIndex(XML_Parser parser);
|
||||
detected. The last call to XML_Parse must have isFinal true; len
|
||||
may be zero for this call (or any other).
|
||||
|
||||
The XML_Status enum gives the possible return values for the
|
||||
XML_Parse and XML_ParseBuffer functions. Though the return values
|
||||
for these functions has always been described as a Boolean value,
|
||||
the implementation, at least for the 1.95.x series, has always
|
||||
returned exactly one of these values. The preprocessor #defines
|
||||
are included so this stanza can be added to code that still needs
|
||||
to support older versions of Expat 1.95.x:
|
||||
|
||||
#ifndef XML_STATUS_OK
|
||||
#define XML_STATUS_OK 1
|
||||
#define XML_STATUS_ERROR 0
|
||||
#endif
|
||||
|
||||
Otherwise, the #define hackery is quite ugly and would have been dropped.
|
||||
Though the return values for these functions has always been
|
||||
described as a Boolean value, the implementation, at least for the
|
||||
1.95.x series, has always returned exactly one of the XML_Status
|
||||
values.
|
||||
*/
|
||||
enum XML_Status {
|
||||
XML_STATUS_ERROR = 0,
|
||||
#define XML_STATUS_ERROR XML_STATUS_ERROR
|
||||
XML_STATUS_OK = 1
|
||||
#define XML_STATUS_OK XML_STATUS_OK
|
||||
};
|
||||
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
|
||||
|
||||
@ -747,6 +760,75 @@ XML_GetBuffer(XML_Parser parser, int len);
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
||||
|
||||
/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.
|
||||
Must be called from within a call-back handler, except when aborting
|
||||
(resumable = 0) an already suspended parser. Some call-backs may
|
||||
still follow because they would otherwise get lost. Examples:
|
||||
- endElementHandler() for empty elements when stopped in
|
||||
startElementHandler(),
|
||||
- endNameSpaceDeclHandler() when stopped in endElementHandler(),
|
||||
and possibly others.
|
||||
|
||||
Can be called from most handlers, including DTD related call-backs,
|
||||
except when parsing an external parameter entity and resumable != 0.
|
||||
Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
|
||||
Possible error codes:
|
||||
- XML_ERROR_SUSPENDED: when suspending an already suspended parser.
|
||||
- XML_ERROR_FINISHED: when the parser has already finished.
|
||||
- XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.
|
||||
|
||||
When resumable != 0 (true) then parsing is suspended, that is,
|
||||
XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED.
|
||||
Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()
|
||||
return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.
|
||||
|
||||
*Note*:
|
||||
This will be applied to the current parser instance only, that is, if
|
||||
there is a parent parser then it will continue parsing when the
|
||||
externalEntityRefHandler() returns. It is up to the implementation of
|
||||
the externalEntityRefHandler() to call XML_StopParser() on the parent
|
||||
parser (recursively), if one wants to stop parsing altogether.
|
||||
|
||||
When suspended, parsing can be resumed by calling XML_ResumeParser().
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_StopParser(XML_Parser parser, XML_Bool resumable);
|
||||
|
||||
/* Resumes parsing after it has been suspended with XML_StopParser().
|
||||
Must not be called from within a handler call-back. Returns same
|
||||
status codes as XML_Parse() or XML_ParseBuffer().
|
||||
Additional error code XML_ERROR_NOT_SUSPENDED possible.
|
||||
|
||||
*Note*:
|
||||
This must be called on the most deeply nested child parser instance
|
||||
first, and on its parent parser only after the child parser has finished,
|
||||
to be applied recursively until the document entity's parser is restarted.
|
||||
That is, the parent parser will not resume by itself and it is up to the
|
||||
application to call XML_ResumeParser() on it at the appropriate moment.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_ResumeParser(XML_Parser parser);
|
||||
|
||||
enum XML_Parsing {
|
||||
XML_INITIALIZED,
|
||||
XML_PARSING,
|
||||
XML_FINISHED,
|
||||
XML_SUSPENDED
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
enum XML_Parsing parsing;
|
||||
XML_Bool finalBuffer;
|
||||
} XML_ParsingStatus;
|
||||
|
||||
/* Returns status of parser with respect to being initialized, parsing,
|
||||
finished, or suspended and processing the final buffer.
|
||||
XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,
|
||||
XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
|
||||
|
||||
/* Creates an XML_Parser object that can parse an external general
|
||||
entity; context is a '\0'-terminated string specifying the parse
|
||||
context; encoding is a '\0'-terminated string giving the name of
|
||||
@ -760,7 +842,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
||||
an ExternalEntityRefHandler so longer as the parser has not yet
|
||||
been freed. The new parser is completely independent and may
|
||||
safely be used in a separate thread. The handlers and userData are
|
||||
initialized from the parser argument. Returns 0 if out of memory.
|
||||
initialized from the parser argument. Returns NULL if out of memory.
|
||||
Otherwise returns a new XML_Parser object.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
@ -801,24 +883,31 @@ XMLPARSEAPI(int)
|
||||
XML_SetParamEntityParsing(XML_Parser parser,
|
||||
enum XML_ParamEntityParsing parsing);
|
||||
|
||||
/* If XML_Parse or XML_ParseBuffer have returned 0, then
|
||||
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
|
||||
XML_GetErrorCode returns information about the error.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Error)
|
||||
XML_GetErrorCode(XML_Parser parser);
|
||||
|
||||
/* These functions return information about the current parse
|
||||
location. They may be called when XML_Parse or XML_ParseBuffer
|
||||
return 0; in this case the location is the location of the
|
||||
character at which the error was detected.
|
||||
|
||||
They may also be called from any other callback called to report
|
||||
some parse event; in this the location is the location of the first
|
||||
of the sequence of characters that generated the event.
|
||||
location. They may be called from any callback called to report
|
||||
some parse event; in this case the location is the location of the
|
||||
first of the sequence of characters that generated the event. When
|
||||
called from callbacks generated by declarations in the document
|
||||
prologue, the location identified isn't as neatly defined, but will
|
||||
be within the relevant markup. When called outside of the callback
|
||||
functions, the position indicated will be just past the last parse
|
||||
event (regardless of whether there was an associated callback).
|
||||
|
||||
They may also be called after returning from a call to XML_Parse
|
||||
or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then
|
||||
the location is the location of the character at which the error
|
||||
was detected; otherwise the location is the location of the last
|
||||
parse event, as described above.
|
||||
*/
|
||||
XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser);
|
||||
XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
|
||||
|
||||
/* Return the number of bytes in the current event.
|
||||
Returns 0 if the event is in an internal entity.
|
||||
@ -846,6 +935,20 @@ XML_GetInputContext(XML_Parser parser,
|
||||
#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
|
||||
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
|
||||
|
||||
/* Frees the content model passed to the element declaration handler */
|
||||
XMLPARSEAPI(void)
|
||||
XML_FreeContentModel(XML_Parser parser, XML_Content *model);
|
||||
|
||||
/* Exposing the memory handling functions used in Expat */
|
||||
XMLPARSEAPI(void *)
|
||||
XML_MemMalloc(XML_Parser parser, size_t size);
|
||||
|
||||
XMLPARSEAPI(void *)
|
||||
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_MemFree(XML_Parser parser, void *ptr);
|
||||
|
||||
/* Frees memory used by the parser. */
|
||||
XMLPARSEAPI(void)
|
||||
XML_ParserFree(XML_Parser parser);
|
||||
@ -879,13 +982,15 @@ enum XML_FeatureEnum {
|
||||
XML_FEATURE_CONTEXT_BYTES,
|
||||
XML_FEATURE_MIN_SIZE,
|
||||
XML_FEATURE_SIZEOF_XML_CHAR,
|
||||
XML_FEATURE_SIZEOF_XML_LCHAR
|
||||
XML_FEATURE_SIZEOF_XML_LCHAR,
|
||||
XML_FEATURE_NS,
|
||||
XML_FEATURE_LARGE_SIZE
|
||||
/* Additional features must be added to the end of this enum. */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
enum XML_FeatureEnum feature;
|
||||
XML_LChar *name;
|
||||
const XML_LChar *name;
|
||||
long int value;
|
||||
} XML_Feature;
|
||||
|
||||
@ -898,12 +1003,12 @@ XML_GetFeatureList(void);
|
||||
releases. Micro is bumped with each release, and set to 0 with each
|
||||
change to major or minor version.
|
||||
*/
|
||||
#define XML_MAJOR_VERSION 1
|
||||
#define XML_MINOR_VERSION 95
|
||||
#define XML_MICRO_VERSION 5
|
||||
#define XML_MAJOR_VERSION 2
|
||||
#define XML_MINOR_VERSION 0
|
||||
#define XML_MICRO_VERSION 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not XmlParse_INCLUDED */
|
||||
#endif /* not Expat_INCLUDED */
|
||||
|
115
contrib/expat/lib/expat_external.h
Executable file
115
contrib/expat/lib/expat_external.h
Executable file
@ -0,0 +1,115 @@
|
||||
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef Expat_External_INCLUDED
|
||||
#define Expat_External_INCLUDED 1
|
||||
|
||||
/* 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
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
"library boundary." This will default to cdecl, and
|
||||
try really hard to tell the compiler that's what we
|
||||
want.
|
||||
|
||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||
to be imported from a dynamically loaded library
|
||||
(.dll, .so, or .sl, depending on your platform).
|
||||
|
||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||
expected to be directly useful in client code is XMLCALL.
|
||||
|
||||
Note that on at least some Unix versions, the Expat library must be
|
||||
compiled with the cdecl calling convention as the default since
|
||||
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
|
||||
/* 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
|
||||
do so.
|
||||
|
||||
If this is the case for your platform, please file a bug report
|
||||
with information on how to identify your platform via the C
|
||||
pre-processor and how to specify the same calling convention as the
|
||||
platform's malloc() implementation.
|
||||
*/
|
||||
#define XMLCALL
|
||||
#endif
|
||||
#endif /* not defined XMLCALL */
|
||||
|
||||
|
||||
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
|
||||
#ifndef XML_BUILDING_EXPAT
|
||||
/* using Expat from an application */
|
||||
|
||||
#ifdef XML_USE_MSC_EXTENSIONS
|
||||
#define XMLIMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* not defined XML_STATIC */
|
||||
|
||||
|
||||
/* If we didn't define it above, define it away: */
|
||||
#ifndef XMLIMPORT
|
||||
#define XMLIMPORT
|
||||
#endif
|
||||
|
||||
|
||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
#else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#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
|
||||
typedef long long XML_Index;
|
||||
typedef unsigned long long XML_Size;
|
||||
#endif
|
||||
#else
|
||||
typedef long XML_Index;
|
||||
typedef unsigned long XML_Size;
|
||||
#endif /* XML_LARGE_SIZE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not Expat_External_INCLUDED */
|
@ -3,32 +3,59 @@
|
||||
Internal definitions used by Expat. This is not needed to compile
|
||||
client code.
|
||||
|
||||
The following definitions are made:
|
||||
The following calling convention macros are defined for frequently
|
||||
called functions:
|
||||
|
||||
FASTCALL -- Used for most internal functions to specify that the
|
||||
fastest possible calling convention be used.
|
||||
FASTCALL - Used for those internal functions that have a simple
|
||||
body and a low number of arguments and local variables.
|
||||
|
||||
inline -- Used for selected internal functions for which inlining
|
||||
may improve performance on some platforms.
|
||||
PTRCALL - Used for functions called though function pointers.
|
||||
|
||||
PTRFASTCALL - Like PTRCALL, but for low number of arguments.
|
||||
|
||||
inline - Used for selected internal functions for which inlining
|
||||
may improve performance on some platforms.
|
||||
|
||||
Note: Use of these macros is based on judgement, not hard rules,
|
||||
and therefore subject to change.
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/* Last minute instability reported with egcs on a RedHat Linux 7.3
|
||||
box; argh!
|
||||
#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.
|
||||
|
||||
Instability reported with egcs on a RedHat Linux 7.3.
|
||||
Let's comment out:
|
||||
#define FASTCALL __attribute__((stdcall, regparm(3)))
|
||||
and let's try this:
|
||||
*/
|
||||
/* #define FASTCALL __attribute__((stdcall, regparm(3))) */
|
||||
#elif defined(WIN32)
|
||||
/* XXX This seems to have an unexpected negative effect on Windows so
|
||||
we'll disable it for now on that platform. It may be reconsidered
|
||||
for a future release if it can be made more effective.
|
||||
*/
|
||||
/* #define FASTCALL __fastcall */
|
||||
#define FASTCALL __attribute__((regparm(3)))
|
||||
#define PTRFASTCALL __attribute__((regparm(3)))
|
||||
#endif
|
||||
|
||||
/* Using __fastcall seems to have an unexpected negative effect under
|
||||
MS VC++, especially for function pointers, so we won't use it for
|
||||
now on that platform. It may be reconsidered for a future release
|
||||
if it can be made more effective.
|
||||
Likely reason: __fastcall on Windows is like stdcall, therefore
|
||||
the compiler cannot perform stack optimizations for call clusters.
|
||||
*/
|
||||
|
||||
/* Make sure all of these are defined if they aren't already. */
|
||||
|
||||
#ifndef FASTCALL
|
||||
#define FASTCALL
|
||||
#endif
|
||||
|
||||
#ifndef PTRCALL
|
||||
#define PTRCALL
|
||||
#endif
|
||||
|
||||
#ifndef PTRFASTCALL
|
||||
#define PTRFASTCALL
|
||||
#endif
|
||||
|
||||
#ifndef XML_MIN_SIZE
|
||||
#if !defined(__cplusplus) && !defined(inline)
|
||||
#ifdef __GNUC__
|
||||
|
@ -1,30 +1,30 @@
|
||||
/*================================================================
|
||||
** Copyright 2000, Clark Cooper
|
||||
** All rights reserved.
|
||||
**
|
||||
** This is free software. You are permitted to copy, distribute, or modify
|
||||
** it under the terms of the MIT/X license (contained in the COPYING file
|
||||
** with this distribution.)
|
||||
*/
|
||||
|
||||
#ifndef WINCONFIG_H
|
||||
#define WINCONFIG_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
#define XML_NS 1
|
||||
#define XML_DTD 1
|
||||
#define XML_CONTEXT_BYTES 1024
|
||||
|
||||
/* we will assume all Windows platforms are little endian */
|
||||
#define BYTEORDER 1234
|
||||
|
||||
/* Windows has memmove() available. */
|
||||
#define HAVE_MEMMOVE
|
||||
|
||||
#endif /* ndef WINCONFIG_H */
|
||||
/*================================================================
|
||||
** Copyright 2000, Clark Cooper
|
||||
** All rights reserved.
|
||||
**
|
||||
** This is free software. You are permitted to copy, distribute, or modify
|
||||
** it under the terms of the MIT/X license (contained in the COPYING file
|
||||
** with this distribution.)
|
||||
*/
|
||||
|
||||
#ifndef WINCONFIG_H
|
||||
#define WINCONFIG_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
#define XML_NS 1
|
||||
#define XML_DTD 1
|
||||
#define XML_CONTEXT_BYTES 1024
|
||||
|
||||
/* we will assume all Windows platforms are little endian */
|
||||
#define BYTEORDER 1234
|
||||
|
||||
/* Windows has memmove() available. */
|
||||
#define HAVE_MEMMOVE
|
||||
|
||||
#endif /* ndef WINCONFIG_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,14 +2,23 @@
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef COMPILED_FROM_DSP
|
||||
#include "winconfig.h"
|
||||
#elif defined(MACOS_CLASSIC)
|
||||
#include "macconfig.h"
|
||||
#elif defined(__amigaos4__)
|
||||
#include "amigaconfig.h"
|
||||
#elif defined(__WATCOMC__)
|
||||
#include "watcomconfig.h"
|
||||
#else
|
||||
#ifdef HAVE_EXPAT_CONFIG_H
|
||||
#include <expat_config.h>
|
||||
#endif
|
||||
#endif /* ndef COMPILED_FROM_DSP */
|
||||
|
||||
#include "expat_external.h"
|
||||
#include "internal.h"
|
||||
#include "xmlrole.h"
|
||||
#include "ascii.h"
|
||||
@ -46,12 +55,16 @@ static const char KW_IDREF[] = {
|
||||
ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
|
||||
static const char KW_IDREFS[] = {
|
||||
ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
|
||||
#ifdef XML_DTD
|
||||
static const char KW_IGNORE[] = {
|
||||
ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' };
|
||||
#endif
|
||||
static const char KW_IMPLIED[] = {
|
||||
ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' };
|
||||
#ifdef XML_DTD
|
||||
static const char KW_INCLUDE[] = {
|
||||
ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' };
|
||||
#endif
|
||||
static const char KW_NDATA[] = {
|
||||
ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
|
||||
static const char KW_NMTOKEN[] = {
|
||||
@ -85,11 +98,11 @@ static const char KW_SYSTEM[] = {
|
||||
#define setTopLevel(state) ((state)->handler = internalSubset)
|
||||
#endif /* not XML_DTD */
|
||||
|
||||
typedef int FASTCALL PROLOG_HANDLER(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc);
|
||||
typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc);
|
||||
|
||||
static PROLOG_HANDLER
|
||||
prolog0, prolog1, prolog2,
|
||||
@ -111,7 +124,7 @@ static PROLOG_HANDLER
|
||||
|
||||
static int FASTCALL common(PROLOG_STATE *state, int tok);
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
prolog0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -148,7 +161,7 @@ prolog0(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
prolog1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -179,7 +192,7 @@ prolog1(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
prolog2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -200,7 +213,7 @@ prolog2(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
doctype0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -218,7 +231,7 @@ doctype0(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
doctype1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -248,7 +261,7 @@ doctype1(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
doctype2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -265,7 +278,7 @@ doctype2(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
doctype3(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -282,7 +295,7 @@ doctype3(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
doctype4(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -302,7 +315,7 @@ doctype4(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
doctype5(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -319,7 +332,7 @@ doctype5(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
internalSubset(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -368,13 +381,15 @@ internalSubset(PROLOG_STATE *state,
|
||||
case XML_TOK_CLOSE_BRACKET:
|
||||
state->handler = doctype5;
|
||||
return XML_ROLE_DOCTYPE_NONE;
|
||||
case XML_TOK_NONE:
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
externalSubset0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -387,7 +402,7 @@ externalSubset0(PROLOG_STATE *state,
|
||||
return externalSubset1(state, tok, ptr, end, enc);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
externalSubset1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -419,7 +434,7 @@ externalSubset1(PROLOG_STATE *state,
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -439,7 +454,7 @@ entity0(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -456,7 +471,7 @@ entity1(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -484,7 +499,7 @@ entity2(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity3(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -501,7 +516,7 @@ entity3(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity4(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -518,7 +533,7 @@ entity4(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity5(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -541,7 +556,7 @@ entity5(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity6(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -559,7 +574,7 @@ entity6(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity7(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -587,7 +602,7 @@ entity7(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity8(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -604,7 +619,7 @@ entity8(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity9(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -621,7 +636,7 @@ entity9(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
entity10(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -638,7 +653,7 @@ entity10(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
notation0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -655,7 +670,7 @@ notation0(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
notation1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -679,7 +694,7 @@ notation1(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
notation2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -696,7 +711,7 @@ notation2(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
notation3(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -714,7 +729,7 @@ notation3(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
notation4(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -735,7 +750,7 @@ notation4(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -753,7 +768,7 @@ attlist0(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -774,7 +789,7 @@ attlist1(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -786,7 +801,7 @@ attlist2(PROLOG_STATE *state,
|
||||
return XML_ROLE_ATTLIST_NONE;
|
||||
case XML_TOK_NAME:
|
||||
{
|
||||
static const char *types[] = {
|
||||
static const char * const types[] = {
|
||||
KW_CDATA,
|
||||
KW_ID,
|
||||
KW_IDREF,
|
||||
@ -815,7 +830,7 @@ attlist2(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist3(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -834,7 +849,7 @@ attlist3(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist4(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -854,7 +869,7 @@ attlist4(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist5(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -871,7 +886,7 @@ attlist5(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist6(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -888,7 +903,7 @@ attlist6(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist7(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -909,7 +924,7 @@ attlist7(PROLOG_STATE *state,
|
||||
}
|
||||
|
||||
/* default value */
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist8(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -949,7 +964,7 @@ attlist8(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
attlist9(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -966,7 +981,7 @@ attlist9(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -984,7 +999,7 @@ element0(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1014,7 +1029,7 @@ element1(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1054,7 +1069,7 @@ element2(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element3(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1079,7 +1094,7 @@ element3(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element4(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1097,7 +1112,7 @@ element4(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element5(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1118,7 +1133,7 @@ element5(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element6(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1148,7 +1163,7 @@ element6(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
element7(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1198,7 +1213,7 @@ element7(PROLOG_STATE *state,
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
condSect0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1222,7 +1237,7 @@ condSect0(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
condSect1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1240,7 +1255,7 @@ condSect1(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
condSect2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1259,7 +1274,7 @@ condSect2(PROLOG_STATE *state,
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
declClose(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
@ -1276,7 +1291,7 @@ declClose(PROLOG_STATE *state,
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
error(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifdef __VMS
|
||||
/* 0 1 2 3 0 1 2 3
|
||||
1234567890123456789012345678901 1234567890123456789012345678901 */
|
||||
#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
|
||||
#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
|
||||
#endif
|
||||
|
||||
#include "xmltok.h"
|
||||
@ -85,7 +85,7 @@ enum {
|
||||
};
|
||||
|
||||
typedef struct prolog_state {
|
||||
int (FASTCALL *handler) (struct prolog_state *state,
|
||||
int (PTRCALL *handler) (struct prolog_state *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
|
@ -2,14 +2,23 @@
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef COMPILED_FROM_DSP
|
||||
#include "winconfig.h"
|
||||
#elif defined(MACOS_CLASSIC)
|
||||
#include "macconfig.h"
|
||||
#elif defined(__amigaos4__)
|
||||
#include "amigaconfig.h"
|
||||
#elif defined(__WATCOMC__)
|
||||
#include "watcomconfig.h"
|
||||
#else
|
||||
#ifdef HAVE_EXPAT_CONFIG_H
|
||||
#include <expat_config.h>
|
||||
#endif
|
||||
#endif /* ndef COMPILED_FROM_DSP */
|
||||
|
||||
#include "expat_external.h"
|
||||
#include "internal.h"
|
||||
#include "xmltok.h"
|
||||
#include "nametab.h"
|
||||
@ -112,19 +121,19 @@
|
||||
|| \
|
||||
((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
isNever(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
utf8_isName2(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
utf8_isName3(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
|
||||
@ -132,13 +141,13 @@ utf8_isName3(const ENCODING *enc, const char *p)
|
||||
|
||||
#define utf8_isName4 isNever
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
utf8_isNmstrt2(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
utf8_isNmstrt3(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
|
||||
@ -146,19 +155,19 @@ utf8_isNmstrt3(const ENCODING *enc, const char *p)
|
||||
|
||||
#define utf8_isNmstrt4 isNever
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
utf8_isInvalid2(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return UTF8_INVALID2((const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
utf8_isInvalid3(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return UTF8_INVALID3((const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
utf8_isInvalid4(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return UTF8_INVALID4((const unsigned char *)p);
|
||||
@ -168,21 +177,21 @@ struct normal_encoding {
|
||||
ENCODING enc;
|
||||
unsigned char type[256];
|
||||
#ifdef XML_MIN_SIZE
|
||||
int (FASTCALL *byteType)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isNameMin)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isNmstrtMin)(const ENCODING *, const char *);
|
||||
int (FASTCALL *byteToAscii)(const ENCODING *, const char *);
|
||||
int (FASTCALL *charMatches)(const ENCODING *, const char *, int);
|
||||
int (PTRFASTCALL *byteType)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isNameMin)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *byteToAscii)(const ENCODING *, const char *);
|
||||
int (PTRCALL *charMatches)(const ENCODING *, const char *, int);
|
||||
#endif /* XML_MIN_SIZE */
|
||||
int (FASTCALL *isName2)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isName3)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isName4)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isNmstrt2)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isNmstrt3)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isNmstrt4)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isInvalid2)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isInvalid3)(const ENCODING *, const char *);
|
||||
int (FASTCALL *isInvalid4)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isName2)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isName3)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isName4)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isInvalid2)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isInvalid3)(const ENCODING *, const char *);
|
||||
int (PTRFASTCALL *isInvalid4)(const ENCODING *, const char *);
|
||||
};
|
||||
|
||||
#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc))
|
||||
@ -234,7 +243,7 @@ static int FASTCALL checkCharRefNumber(int);
|
||||
(((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
|
||||
|
||||
#ifdef XML_MIN_SIZE
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
sb_byteType(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return SB_BYTE_TYPE(enc, p);
|
||||
@ -248,7 +257,7 @@ sb_byteType(const ENCODING *enc, const char *p)
|
||||
#ifdef XML_MIN_SIZE
|
||||
#define BYTE_TO_ASCII(enc, p) \
|
||||
(AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p))
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
sb_byteToAscii(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return *p;
|
||||
@ -277,7 +286,7 @@ sb_byteToAscii(const ENCODING *enc, const char *p)
|
||||
#ifdef XML_MIN_SIZE
|
||||
#define CHAR_MATCHES(enc, p, c) \
|
||||
(AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c))
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
sb_charMatches(const ENCODING *enc, const char *p, int c)
|
||||
{
|
||||
return *p == c;
|
||||
@ -288,7 +297,9 @@ sb_charMatches(const ENCODING *enc, const char *p, int c)
|
||||
#endif
|
||||
|
||||
#define PREFIX(ident) normal_ ## ident
|
||||
#define XML_TOK_IMPL_C
|
||||
#include "xmltok_impl.c"
|
||||
#undef XML_TOK_IMPL_C
|
||||
|
||||
#undef MINBPC
|
||||
#undef BYTE_TYPE
|
||||
@ -307,7 +318,7 @@ enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */
|
||||
UTF8_cval4 = 0xf0
|
||||
};
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
utf8_toUtf8(const ENCODING *enc,
|
||||
const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim)
|
||||
@ -326,7 +337,7 @@ utf8_toUtf8(const ENCODING *enc,
|
||||
*toP = to;
|
||||
}
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
utf8_toUtf16(const ENCODING *enc,
|
||||
const char **fromP, const char *fromLim,
|
||||
unsigned short **toP, const unsigned short *toLim)
|
||||
@ -414,7 +425,7 @@ static const struct normal_encoding internal_utf8_encoding = {
|
||||
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
|
||||
};
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
latin1_toUtf8(const ENCODING *enc,
|
||||
const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim)
|
||||
@ -439,7 +450,7 @@ latin1_toUtf8(const ENCODING *enc,
|
||||
}
|
||||
}
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
latin1_toUtf16(const ENCODING *enc,
|
||||
const char **fromP, const char *fromLim,
|
||||
unsigned short **toP, const unsigned short *toLim)
|
||||
@ -472,7 +483,7 @@ static const struct normal_encoding latin1_encoding = {
|
||||
STANDARD_VTABLE(sb_)
|
||||
};
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
ascii_toUtf8(const ENCODING *enc,
|
||||
const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim)
|
||||
@ -505,7 +516,7 @@ static const struct normal_encoding ascii_encoding = {
|
||||
STANDARD_VTABLE(sb_)
|
||||
};
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
unicode_byte_type(char hi, char lo)
|
||||
{
|
||||
switch ((unsigned char)hi) {
|
||||
@ -525,7 +536,7 @@ unicode_byte_type(char hi, char lo)
|
||||
}
|
||||
|
||||
#define DEFINE_UTF16_TO_UTF8(E) \
|
||||
static void FASTCALL \
|
||||
static void PTRCALL \
|
||||
E ## toUtf8(const ENCODING *enc, \
|
||||
const char **fromP, const char *fromLim, \
|
||||
char **toP, const char *toLim) \
|
||||
@ -588,7 +599,7 @@ E ## toUtf8(const ENCODING *enc, \
|
||||
}
|
||||
|
||||
#define DEFINE_UTF16_TO_UTF16(E) \
|
||||
static void FASTCALL \
|
||||
static void PTRCALL \
|
||||
E ## toUtf16(const ENCODING *enc, \
|
||||
const char **fromP, const char *fromLim, \
|
||||
unsigned short **toP, const unsigned short *toLim) \
|
||||
@ -638,31 +649,31 @@ DEFINE_UTF16_TO_UTF16(big2_)
|
||||
|
||||
#ifdef XML_MIN_SIZE
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
little2_byteType(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return LITTLE2_BYTE_TYPE(enc, p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
little2_byteToAscii(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return LITTLE2_BYTE_TO_ASCII(enc, p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
little2_charMatches(const ENCODING *enc, const char *p, int c)
|
||||
{
|
||||
return LITTLE2_CHAR_MATCHES(enc, p, c);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
little2_isNameMin(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
little2_isNmstrtMin(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p);
|
||||
@ -678,14 +689,16 @@ little2_isNmstrtMin(const ENCODING *enc, const char *p)
|
||||
#define MINBPC(enc) 2
|
||||
/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
|
||||
#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p)
|
||||
#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p)
|
||||
#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p)
|
||||
#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c)
|
||||
#define IS_NAME_CHAR(enc, p, n) 0
|
||||
#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)
|
||||
#define IS_NMSTRT_CHAR(enc, p, n) (0)
|
||||
#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)
|
||||
|
||||
#define XML_TOK_IMPL_C
|
||||
#include "xmltok_impl.c"
|
||||
#undef XML_TOK_IMPL_C
|
||||
|
||||
#undef MINBPC
|
||||
#undef BYTE_TYPE
|
||||
@ -701,7 +714,7 @@ little2_isNmstrtMin(const ENCODING *enc, const char *p)
|
||||
|
||||
#ifdef XML_NS
|
||||
|
||||
static const struct normal_encoding little2_encoding_ns = {
|
||||
static const struct normal_encoding little2_encoding_ns = {
|
||||
{ VTABLE, 2, 0,
|
||||
#if BYTEORDER == 1234
|
||||
1
|
||||
@ -718,7 +731,7 @@ static const struct normal_encoding little2_encoding_ns = {
|
||||
|
||||
#endif
|
||||
|
||||
static const struct normal_encoding little2_encoding = {
|
||||
static const struct normal_encoding little2_encoding = {
|
||||
{ VTABLE, 2, 0,
|
||||
#if BYTEORDER == 1234
|
||||
1
|
||||
@ -739,7 +752,7 @@ static const struct normal_encoding little2_encoding = {
|
||||
|
||||
#ifdef XML_NS
|
||||
|
||||
static const struct normal_encoding internal_little2_encoding_ns = {
|
||||
static const struct normal_encoding internal_little2_encoding_ns = {
|
||||
{ VTABLE, 2, 0, 1 },
|
||||
{
|
||||
#include "iasciitab.h"
|
||||
@ -750,7 +763,7 @@ static const struct normal_encoding internal_little2_encoding_ns = {
|
||||
|
||||
#endif
|
||||
|
||||
static const struct normal_encoding internal_little2_encoding = {
|
||||
static const struct normal_encoding internal_little2_encoding = {
|
||||
{ VTABLE, 2, 0, 1 },
|
||||
{
|
||||
#define BT_COLON BT_NMSTRT
|
||||
@ -777,31 +790,31 @@ static const struct normal_encoding internal_little2_encoding = {
|
||||
|
||||
#ifdef XML_MIN_SIZE
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
big2_byteType(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return BIG2_BYTE_TYPE(enc, p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
big2_byteToAscii(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return BIG2_BYTE_TO_ASCII(enc, p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
big2_charMatches(const ENCODING *enc, const char *p, int c)
|
||||
{
|
||||
return BIG2_CHAR_MATCHES(enc, p, c);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
big2_isNameMin(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return BIG2_IS_NAME_CHAR_MINBPC(enc, p);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
big2_isNmstrtMin(const ENCODING *enc, const char *p)
|
||||
{
|
||||
return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p);
|
||||
@ -817,14 +830,16 @@ big2_isNmstrtMin(const ENCODING *enc, const char *p)
|
||||
#define MINBPC(enc) 2
|
||||
/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
|
||||
#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p)
|
||||
#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p)
|
||||
#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p)
|
||||
#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c)
|
||||
#define IS_NAME_CHAR(enc, p, n) 0
|
||||
#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p)
|
||||
#define IS_NMSTRT_CHAR(enc, p, n) (0)
|
||||
#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)
|
||||
|
||||
#define XML_TOK_IMPL_C
|
||||
#include "xmltok_impl.c"
|
||||
#undef XML_TOK_IMPL_C
|
||||
|
||||
#undef MINBPC
|
||||
#undef BYTE_TYPE
|
||||
@ -922,14 +937,14 @@ streqci(const char *s1, const char *s2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
initUpdatePosition(const ENCODING *enc, const char *ptr,
|
||||
const char *end, POSITION *pos)
|
||||
{
|
||||
normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int
|
||||
toAscii(const ENCODING *enc, const char *ptr, const char *end)
|
||||
{
|
||||
char buf[1];
|
||||
@ -948,7 +963,7 @@ isSpace(int c)
|
||||
case 0x20:
|
||||
case 0xD:
|
||||
case 0xA:
|
||||
case 0x9:
|
||||
case 0x9:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -957,7 +972,7 @@ isSpace(int c)
|
||||
/* Return 1 if there's just optional white space or there's an S
|
||||
followed by name=val.
|
||||
*/
|
||||
static int FASTCALL
|
||||
static int
|
||||
parsePseudoAttribute(const ENCODING *enc,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
@ -1174,7 +1189,7 @@ checkCharRefNumber(int result)
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
int FASTCALL
|
||||
XmlUtf8Encode(int c, char *buf)
|
||||
{
|
||||
enum {
|
||||
@ -1211,7 +1226,7 @@ XmlUtf8Encode(int c, char *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int FASTCALL
|
||||
XmlUtf16Encode(int charNum, unsigned short *buf)
|
||||
{
|
||||
if (charNum < 0)
|
||||
@ -1231,7 +1246,7 @@ XmlUtf16Encode(int charNum, unsigned short *buf)
|
||||
|
||||
struct unknown_encoding {
|
||||
struct normal_encoding normal;
|
||||
int (*convert)(void *userData, const char *p);
|
||||
CONVERTER convert;
|
||||
void *userData;
|
||||
unsigned short utf16[256];
|
||||
char utf8[256][4];
|
||||
@ -1245,7 +1260,7 @@ XmlSizeOfUnknownEncoding(void)
|
||||
return sizeof(struct unknown_encoding);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
unknown_isName(const ENCODING *enc, const char *p)
|
||||
{
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
@ -1255,7 +1270,7 @@ unknown_isName(const ENCODING *enc, const char *p)
|
||||
return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
unknown_isNmstrt(const ENCODING *enc, const char *p)
|
||||
{
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
@ -1265,7 +1280,7 @@ unknown_isNmstrt(const ENCODING *enc, const char *p)
|
||||
return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
unknown_isInvalid(const ENCODING *enc, const char *p)
|
||||
{
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
@ -1273,7 +1288,7 @@ unknown_isInvalid(const ENCODING *enc, const char *p)
|
||||
return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
|
||||
}
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
unknown_toUtf8(const ENCODING *enc,
|
||||
const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim)
|
||||
@ -1307,7 +1322,7 @@ unknown_toUtf8(const ENCODING *enc,
|
||||
}
|
||||
}
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
unknown_toUtf16(const ENCODING *enc,
|
||||
const char **fromP, const char *fromLim,
|
||||
unsigned short **toP, const unsigned short *toLim)
|
||||
@ -1330,11 +1345,11 @@ unknown_toUtf16(const ENCODING *enc,
|
||||
ENCODING *
|
||||
XmlInitUnknownEncoding(void *mem,
|
||||
int *table,
|
||||
int (*convert)(void *userData, const char *p),
|
||||
CONVERTER convert,
|
||||
void *userData)
|
||||
{
|
||||
int i;
|
||||
struct unknown_encoding *e = mem;
|
||||
struct unknown_encoding *e = (struct unknown_encoding *)mem;
|
||||
for (i = 0; i < (int)sizeof(struct normal_encoding); i++)
|
||||
((char *)mem)[i] = ((char *)&latin1_encoding)[i];
|
||||
for (i = 0; i < 128; i++)
|
||||
@ -1446,7 +1461,7 @@ static const char KW_UTF_16LE[] = {
|
||||
static int FASTCALL
|
||||
getEncodingIndex(const char *name)
|
||||
{
|
||||
static const char *encodingNames[] = {
|
||||
static const char * const encodingNames[] = {
|
||||
KW_ISO_8859_1,
|
||||
KW_US_ASCII,
|
||||
KW_UTF_8,
|
||||
@ -1478,8 +1493,8 @@ getEncodingIndex(const char *name)
|
||||
*/
|
||||
|
||||
|
||||
static int FASTCALL
|
||||
initScan(const ENCODING **encodingTable,
|
||||
static int
|
||||
initScan(const ENCODING * const *encodingTable,
|
||||
const INIT_ENCODING *enc,
|
||||
int state,
|
||||
const char *ptr,
|
||||
@ -1603,7 +1618,9 @@ initScan(const ENCODING **encodingTable,
|
||||
|
||||
#define NS(x) x
|
||||
#define ns(x) x
|
||||
#define XML_TOK_NS_C
|
||||
#include "xmltok_ns.c"
|
||||
#undef XML_TOK_NS_C
|
||||
#undef NS
|
||||
#undef ns
|
||||
|
||||
@ -1612,7 +1629,9 @@ initScan(const ENCODING **encodingTable,
|
||||
#define NS(x) x ## NS
|
||||
#define ns(x) x ## _ns
|
||||
|
||||
#define XML_TOK_NS_C
|
||||
#include "xmltok_ns.c"
|
||||
#undef XML_TOK_NS_C
|
||||
|
||||
#undef NS
|
||||
#undef ns
|
||||
@ -1620,7 +1639,7 @@ initScan(const ENCODING **encodingTable,
|
||||
ENCODING *
|
||||
XmlInitUnknownEncodingNS(void *mem,
|
||||
int *table,
|
||||
int (*convert)(void *userData, const char *p),
|
||||
CONVERTER convert,
|
||||
void *userData)
|
||||
{
|
||||
ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
|
||||
|
@ -17,7 +17,7 @@ extern "C" {
|
||||
*/
|
||||
#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 */
|
||||
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
|
||||
@ -111,8 +111,8 @@ extern "C" {
|
||||
|
||||
typedef struct position {
|
||||
/* first line and first column are 0 not 1 */
|
||||
unsigned long lineNumber;
|
||||
unsigned long columnNumber;
|
||||
XML_Size lineNumber;
|
||||
XML_Size columnNumber;
|
||||
} POSITION;
|
||||
|
||||
typedef struct {
|
||||
@ -125,49 +125,49 @@ typedef struct {
|
||||
struct encoding;
|
||||
typedef struct encoding ENCODING;
|
||||
|
||||
typedef int (FASTCALL *SCANNER)(const ENCODING *,
|
||||
const char *,
|
||||
const char *,
|
||||
const char **);
|
||||
typedef int (PTRCALL *SCANNER)(const ENCODING *,
|
||||
const char *,
|
||||
const char *,
|
||||
const char **);
|
||||
|
||||
struct encoding {
|
||||
SCANNER scanners[XML_N_STATES];
|
||||
SCANNER literalScanners[XML_N_LITERAL_TYPES];
|
||||
int (FASTCALL *sameName)(const ENCODING *,
|
||||
const char *,
|
||||
const char *);
|
||||
int (FASTCALL *nameMatchesAscii)(const ENCODING *,
|
||||
const char *,
|
||||
const char *,
|
||||
const char *);
|
||||
int (FASTCALL *nameLength)(const ENCODING *, const char *);
|
||||
const char *(FASTCALL *skipS)(const ENCODING *, const char *);
|
||||
int (FASTCALL *getAtts)(const ENCODING *enc,
|
||||
const char *ptr,
|
||||
int attsMax,
|
||||
ATTRIBUTE *atts);
|
||||
int (FASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
|
||||
int (FASTCALL *predefinedEntityName)(const ENCODING *,
|
||||
const char *,
|
||||
const char *);
|
||||
void (FASTCALL *updatePosition)(const ENCODING *,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
POSITION *);
|
||||
int (FASTCALL *isPublicId)(const ENCODING *enc,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const char **badPtr);
|
||||
void (FASTCALL *utf8Convert)(const ENCODING *enc,
|
||||
int (PTRCALL *sameName)(const ENCODING *,
|
||||
const char *,
|
||||
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);
|
||||
void (PTRCALL *utf8Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim,
|
||||
char **toP,
|
||||
const char *toLim);
|
||||
void (PTRCALL *utf16Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim,
|
||||
char **toP,
|
||||
const char *toLim);
|
||||
void (FASTCALL *utf16Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim,
|
||||
unsigned short **toP,
|
||||
const unsigned short *toLim);
|
||||
unsigned short **toP,
|
||||
const unsigned short *toLim);
|
||||
int minBytesPerChar;
|
||||
char isUtf8;
|
||||
char isUtf16;
|
||||
@ -263,47 +263,51 @@ 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,
|
||||
const char **encodingNamePtr,
|
||||
const ENCODING **namedEncodingPtr,
|
||||
int *standalonePtr);
|
||||
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);
|
||||
|
||||
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING *XmlGetUtf8InternalEncoding(void);
|
||||
const ENCODING *XmlGetUtf16InternalEncoding(void);
|
||||
int XmlUtf8Encode(int charNumber, char *buf);
|
||||
int XmlUtf16Encode(int charNumber, unsigned short *buf);
|
||||
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING *XmlGetUtf8InternalEncoding(void);
|
||||
const ENCODING *XmlGetUtf16InternalEncoding(void);
|
||||
int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
|
||||
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
|
||||
int XmlSizeOfUnknownEncoding(void);
|
||||
|
||||
int XmlSizeOfUnknownEncoding(void);
|
||||
ENCODING *
|
||||
|
||||
typedef int (XMLCALL *CONVERTER) (void *userData, const char *p);
|
||||
|
||||
ENCODING *
|
||||
XmlInitUnknownEncoding(void *mem,
|
||||
int *table,
|
||||
int (*conv)(void *userData, const char *p),
|
||||
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,
|
||||
const char **encodingNamePtr,
|
||||
const ENCODING **namedEncodingPtr,
|
||||
int *standalonePtr);
|
||||
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING *XmlGetUtf8InternalEncodingNS(void);
|
||||
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
|
||||
ENCODING *
|
||||
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);
|
||||
|
||||
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING *XmlGetUtf8InternalEncodingNS(void);
|
||||
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
|
||||
ENCODING *
|
||||
XmlInitUnknownEncodingNS(void *mem,
|
||||
int *table,
|
||||
int (*conv)(void *userData, const char *p),
|
||||
CONVERTER convert,
|
||||
void *userData);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
/* This file is included! */
|
||||
#ifdef XML_TOK_IMPL_C
|
||||
|
||||
#ifndef IS_INVALID_CHAR
|
||||
#define IS_INVALID_CHAR(enc, ptr, n) (0)
|
||||
#endif
|
||||
@ -86,7 +89,7 @@
|
||||
|
||||
/* ptr points to character following "<!-" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanComment)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -124,7 +127,7 @@ PREFIX(scanComment)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
/* ptr points to character following "<!" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -171,7 +174,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
|
||||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, int *tokPtr)
|
||||
{
|
||||
@ -216,7 +219,7 @@ PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
/* ptr points to character following "<?" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -278,7 +281,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
|
||||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -298,7 +301,7 @@ PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr,
|
||||
return XML_TOK_CDATA_SECT_OPEN;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -376,7 +379,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
/* ptr points to character following "</" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -425,7 +428,7 @@ PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
/* ptr points to character following "&#X" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -457,7 +460,7 @@ PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
/* ptr points to character following "&#" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -489,7 +492,7 @@ PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
/* ptr points to character following "&" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -519,7 +522,7 @@ PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
|
||||
/* ptr points to character following first character of attribute name */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -678,7 +681,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
|
||||
/* ptr points to character following "<" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -778,7 +781,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -877,12 +880,12 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
|
||||
/* ptr points to character following "%" */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
return -XML_TOK_PERCENT;
|
||||
switch (BYTE_TYPE(enc, ptr)) {
|
||||
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
|
||||
case BT_S: case BT_LF: case BT_CR: case BT_PERCNT:
|
||||
@ -906,7 +909,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -933,7 +936,7 @@ PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
return -XML_TOK_POUND_NAME;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(scanLit)(int open, const ENCODING *enc,
|
||||
const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
@ -965,7 +968,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc,
|
||||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -1196,7 +1199,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
return -tok;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -1254,7 +1257,7 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
|
||||
return XML_TOK_DATA_CHARS;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -1311,7 +1314,7 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **nextTokPtr)
|
||||
{
|
||||
@ -1364,7 +1367,7 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **badPtr)
|
||||
{
|
||||
@ -1424,7 +1427,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
first attsMax attributes are stored in atts.
|
||||
*/
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
|
||||
int attsMax, ATTRIBUTE *atts)
|
||||
{
|
||||
@ -1517,7 +1520,7 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
|
||||
/* not reached */
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
|
||||
{
|
||||
int result = 0;
|
||||
@ -1561,7 +1564,7 @@ PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
|
||||
return checkCharRefNumber(result);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
|
||||
const char *end)
|
||||
{
|
||||
@ -1615,7 +1618,7 @@ PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
|
||||
{
|
||||
for (;;) {
|
||||
@ -1679,7 +1682,7 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
|
||||
/* not reached */
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
|
||||
const char *end1, const char *ptr2)
|
||||
{
|
||||
@ -1692,7 +1695,7 @@ PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
|
||||
return ptr1 == end1;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRFASTCALL
|
||||
PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
|
||||
{
|
||||
const char *start = ptr;
|
||||
@ -1714,12 +1717,12 @@ PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
|
||||
ptr += MINBPC(enc);
|
||||
break;
|
||||
default:
|
||||
return ptr - start;
|
||||
return (int)(ptr - start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char * FASTCALL
|
||||
static const char * PTRFASTCALL
|
||||
PREFIX(skipS)(const ENCODING *enc, const char *ptr)
|
||||
{
|
||||
for (;;) {
|
||||
@ -1735,7 +1738,7 @@ PREFIX(skipS)(const ENCODING *enc, const char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
static void FASTCALL
|
||||
static void PTRCALL
|
||||
PREFIX(updatePosition)(const ENCODING *enc,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
@ -1750,7 +1753,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
|
||||
LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
|
||||
#undef LEAD_CASE
|
||||
case BT_LF:
|
||||
pos->columnNumber = (unsigned)-1;
|
||||
pos->columnNumber = (XML_Size)-1;
|
||||
pos->lineNumber++;
|
||||
ptr += MINBPC(enc);
|
||||
break;
|
||||
@ -1759,7 +1762,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
|
||||
ptr += MINBPC(enc);
|
||||
pos->columnNumber = (unsigned)-1;
|
||||
pos->columnNumber = (XML_Size)-1;
|
||||
break;
|
||||
default:
|
||||
ptr += MINBPC(enc);
|
||||
@ -1776,3 +1779,5 @@ PREFIX(updatePosition)(const ENCODING *enc,
|
||||
#undef CHECK_NAME_CASES
|
||||
#undef CHECK_NMSTRT_CASE
|
||||
#undef CHECK_NMSTRT_CASES
|
||||
|
||||
#endif /* XML_TOK_IMPL_C */
|
||||
|
@ -1,3 +1,10 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
/* This file is included! */
|
||||
#ifdef XML_TOK_NS_C
|
||||
|
||||
const ENCODING *
|
||||
NS(XmlGetUtf8InternalEncoding)(void)
|
||||
{
|
||||
@ -19,7 +26,7 @@ NS(XmlGetUtf16InternalEncoding)(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static const ENCODING *NS(encodings)[] = {
|
||||
static const ENCODING * const NS(encodings)[] = {
|
||||
&ns(latin1_encoding).enc,
|
||||
&ns(ascii_encoding).enc,
|
||||
&ns(utf8_encoding).enc,
|
||||
@ -29,7 +36,7 @@ static const ENCODING *NS(encodings)[] = {
|
||||
&ns(utf8_encoding).enc /* NO_ENC */
|
||||
};
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -37,7 +44,7 @@ NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
XML_PROLOG_STATE, ptr, end, nextTokPtr);
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int PTRCALL
|
||||
NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@ -104,3 +111,5 @@ NS(XmlParseXmlDecl)(int isGeneralTextEntity,
|
||||
encoding,
|
||||
standalone);
|
||||
}
|
||||
|
||||
#endif /* XML_TOK_NS_C */
|
||||
|
@ -3,12 +3,12 @@ tests provide general unit testing and regression coverage. The tests
|
||||
are not expected to be useful examples of Expat usage; see the
|
||||
examples/ directory for that.
|
||||
|
||||
The Expat tests use the "Check" unit testing framework for C. More
|
||||
information on Check can be found at:
|
||||
The Expat tests use a partial internal implementation of the "Check"
|
||||
unit testing framework for C. More information on Check can be found at:
|
||||
|
||||
http://check.sourceforge.net/
|
||||
|
||||
Check 0.8 must be installed before the unit tests can be compiled & run.
|
||||
Expat must be built and installed before "make check" can be executed.
|
||||
|
||||
Since both Check and this test suite are young, it can all change in a
|
||||
later version.
|
||||
|
16
contrib/expat/tests/benchmark/README.txt
Executable file
16
contrib/expat/tests/benchmark/README.txt
Executable file
@ -0,0 +1,16 @@
|
||||
Use this benchmark command line utility as follows:
|
||||
|
||||
benchmark [-n] <file name> <buffer size> <# iterations>
|
||||
|
||||
The command line arguments are:
|
||||
|
||||
-n ... optional; if supplied, namespace processing is turned on
|
||||
<file name> ... name/path of test xml file
|
||||
<buffer size> ... size of processing buffer;
|
||||
the file is parsed in chunks of this size
|
||||
<# iterations> ... how often will the file be parsed
|
||||
|
||||
Returns:
|
||||
|
||||
The time (in seconds) it takes to parse the test file,
|
||||
averaged over the number of iterations.
|
114
contrib/expat/tests/benchmark/benchmark.c
Executable file
114
contrib/expat/tests/benchmark/benchmark.c
Executable file
@ -0,0 +1,114 @@
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "expat.h"
|
||||
|
||||
#if defined(__amigaos__) && defined(__USE_INLINE__)
|
||||
#include <proto/expat.h>
|
||||
#endif
|
||||
|
||||
#ifdef XML_LARGE_SIZE
|
||||
#define XML_FMT_INT_MOD "ll"
|
||||
#else
|
||||
#define XML_FMT_INT_MOD "l"
|
||||
#endif
|
||||
|
||||
static void
|
||||
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;
|
||||
struct stat fileAttr;
|
||||
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
|
||||
usage(argv[0], 1);
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
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]);
|
||||
if (bufferSize <= 0 || nrOfLoops <= 0) {
|
||||
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);
|
||||
|
||||
if (ns)
|
||||
parser = XML_ParserCreateNS(NULL, '!');
|
||||
else
|
||||
parser = XML_ParserCreate(NULL);
|
||||
|
||||
i = 0;
|
||||
XMLBufEnd = XMLBuf + fileSize;
|
||||
while (i < nrOfLoops) {
|
||||
XMLBufPtr = XMLBuf;
|
||||
isFinal = 0;
|
||||
tstart = clock();
|
||||
do {
|
||||
int parseBufferSize = XMLBufEnd - XMLBufPtr;
|
||||
if (parseBufferSize <= bufferSize)
|
||||
isFinal = 1;
|
||||
else
|
||||
parseBufferSize = bufferSize;
|
||||
if (!XML_Parse (parser, XMLBufPtr, parseBufferSize, isFinal)) {
|
||||
fprintf (stderr, "error '%s' 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);
|
||||
tend = clock();
|
||||
cpuTime += ((double) (tend - tstart)) / CLOCKS_PER_SEC;
|
||||
XML_ParserReset(parser, NULL);
|
||||
i++;
|
||||
}
|
||||
|
||||
XML_ParserFree (parser);
|
||||
free (XMLBuf);
|
||||
|
||||
printf ("%d loops, with buffer size %d. Average time per loop: %f\n",
|
||||
nrOfLoops, bufferSize, cpuTime / (double) nrOfLoops);
|
||||
return 0;
|
||||
}
|
88
contrib/expat/tests/benchmark/benchmark.dsp
Executable file
88
contrib/expat/tests/benchmark/benchmark.dsp
Executable file
@ -0,0 +1,88 @@
|
||||
# Microsoft Developer Studio Project File - Name="benchmark" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=benchmark - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "benchmark.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "benchmark.mak" CFG="benchmark - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "benchmark - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "benchmark - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "benchmark - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
|
||||
# ADD RSC /l 0x1009 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "benchmark - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\lib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
|
||||
# ADD RSC /l 0x1009 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "benchmark - Win32 Release"
|
||||
# Name "benchmark - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\benchmark.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
44
contrib/expat/tests/benchmark/benchmark.dsw
Executable file
44
contrib/expat/tests/benchmark/benchmark.dsw
Executable file
@ -0,0 +1,44 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "benchmark"=.\benchmark.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name expat
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "expat"=..\..\lib\expat.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@ -1,10 +1,19 @@
|
||||
/* chardata.c
|
||||
*
|
||||
*
|
||||
*/
|
||||
/* Copyright (c) 1998-2003 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
|
||||
chardata.c
|
||||
*/
|
||||
|
||||
#ifdef HAVE_EXPAT_CONFIG_H
|
||||
#include <expat_config.h>
|
||||
#endif
|
||||
#ifdef HAVE_CHECK_H
|
||||
#include <check.h>
|
||||
#else
|
||||
#include "minicheck.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <check.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -4,6 +4,10 @@
|
||||
and attribute content.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef XML_CHARDATA_H
|
||||
#define XML_CHARDATA_H 1
|
||||
|
||||
@ -30,3 +34,7 @@ int CharData_CheckXMLChars(CharData *storage, const XML_Char *s);
|
||||
|
||||
|
||||
#endif /* XML_CHARDATA_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
182
contrib/expat/tests/minicheck.c
Executable file
182
contrib/expat/tests/minicheck.c
Executable file
@ -0,0 +1,182 @@
|
||||
/* Miniature re-implementation of the "check" library.
|
||||
*
|
||||
* This is intended to support just enough of check to run the Expat
|
||||
* tests. This interface is based entirely on the portion of the
|
||||
* check library being used.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "minicheck.h"
|
||||
|
||||
Suite *
|
||||
suite_create(char *name)
|
||||
{
|
||||
Suite *suite = (Suite *) calloc(1, sizeof(Suite));
|
||||
if (suite != NULL) {
|
||||
suite->name = name;
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
|
||||
TCase *
|
||||
tcase_create(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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
if (new_tests != tc->tests) {
|
||||
free(tc->tests);
|
||||
tc->tests = new_tests;
|
||||
}
|
||||
tc->allocated = nalloc;
|
||||
}
|
||||
tc->tests[tc->ntests] = test;
|
||||
tc->ntests++;
|
||||
}
|
||||
|
||||
SRunner *
|
||||
srunner_create(Suite *suite)
|
||||
{
|
||||
SRunner *runner = calloc(1, sizeof(SRunner));
|
||||
if (runner != NULL) {
|
||||
runner->suite = suite;
|
||||
}
|
||||
return runner;
|
||||
}
|
||||
|
||||
static jmp_buf env;
|
||||
|
||||
static char const *_check_current_function = NULL;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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++;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
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 condition, const char *file, int line, 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)
|
||||
printf("%s", msg);
|
||||
longjmp(env, 1);
|
||||
}
|
||||
|
||||
int
|
||||
srunner_ntests_failed(SRunner *runner)
|
||||
{
|
||||
assert(runner != NULL);
|
||||
return runner->nfailures;
|
||||
}
|
||||
|
||||
void
|
||||
srunner_free(SRunner *runner)
|
||||
{
|
||||
free(runner->suite);
|
||||
free(runner);
|
||||
}
|
89
contrib/expat/tests/minicheck.h
Executable file
89
contrib/expat/tests/minicheck.h
Executable file
@ -0,0 +1,89 @@
|
||||
/* Miniature re-implementation of the "check" library.
|
||||
*
|
||||
* This is intended to support just enough of check to run the Expat
|
||||
* tests. This interface is based entirely on the portion of the
|
||||
* check library being used.
|
||||
*
|
||||
* This is *source* compatible, but not necessary *link* compatible.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CK_NOFORK 0
|
||||
#define CK_FORK 1
|
||||
|
||||
#define CK_SILENT 0
|
||||
#define CK_NORMAL 1
|
||||
#define CK_VERBOSE 2
|
||||
|
||||
/* Workaround for 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(__osf__) && defined(__cplusplus)
|
||||
#define __func__ __FUNCTION__
|
||||
#endif
|
||||
|
||||
#define START_TEST(testname) static void testname(void) { \
|
||||
_check_set_test_info(__func__, __FILE__, __LINE__); \
|
||||
{
|
||||
#define END_TEST } }
|
||||
|
||||
#define fail(msg) _fail_unless(0, __FILE__, __LINE__, msg)
|
||||
|
||||
typedef void (*tcase_setup_function)(void);
|
||||
typedef void (*tcase_teardown_function)(void);
|
||||
typedef void (*tcase_test_function)(void);
|
||||
|
||||
typedef struct SRunner SRunner;
|
||||
typedef struct Suite Suite;
|
||||
typedef struct TCase TCase;
|
||||
|
||||
struct SRunner {
|
||||
Suite *suite;
|
||||
int nchecks;
|
||||
int nfailures;
|
||||
};
|
||||
|
||||
struct Suite {
|
||||
char *name;
|
||||
TCase *tests;
|
||||
};
|
||||
|
||||
struct TCase {
|
||||
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);
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes for the actual implementation.
|
||||
*/
|
||||
|
||||
void _fail_unless(int condition, const char *file, int line, char *msg);
|
||||
Suite *suite_create(char *name);
|
||||
TCase *tcase_create(char *name);
|
||||
void suite_add_tcase(Suite *suite, TCase *tc);
|
||||
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);
|
||||
void srunner_run_all(SRunner *runner, int verbosity);
|
||||
int srunner_ntests_failed(SRunner *runner);
|
||||
void srunner_free(SRunner *runner);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
6
contrib/expat/tests/runtestspp.cpp
Executable file
6
contrib/expat/tests/runtestspp.cpp
Executable file
@ -0,0 +1,6 @@
|
||||
// C++ compilation harness for the test suite.
|
||||
//
|
||||
// This is used to ensure the Expat headers can be included from C++
|
||||
// and have everything work as expected.
|
||||
//
|
||||
#include "runtests.c"
|
@ -31,32 +31,40 @@ OUTPUT="$TS/out/"
|
||||
# OUTPUT=/home/tmp/xml-testsuite-out/
|
||||
|
||||
|
||||
# RunXmlwfNotWF file reldir
|
||||
# reldir includes trailing slash
|
||||
RunXmlwfNotWF() {
|
||||
$XMLWF $1 $2 > outfile || return $?
|
||||
file="$1"
|
||||
reldir="$2"
|
||||
$XMLWF -p "$file" > outfile || return $?
|
||||
read outdata < outfile
|
||||
if test "$outdata" = "" ; then
|
||||
echo "Well formed: $3$2"
|
||||
echo "Expected well-formed: $reldir$file"
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# RunXmlwfWF file reldir
|
||||
# reldir includes trailing slash
|
||||
RunXmlwfWF() {
|
||||
$XMLWF $1 -d "$OUTPUT$3" $2 > outfile || return $?
|
||||
file="$1"
|
||||
reldir="$2"
|
||||
$XMLWF -p -d "$OUTPUT$reldir" "$file" > outfile || return $?
|
||||
read outdata < outfile
|
||||
if test "$outdata" = "" ; then
|
||||
if [ -f out/$2 ] ; then
|
||||
diff "$OUTPUT$3$2" out/$2 > outfile
|
||||
if [ -f "out/$file" ] ; then
|
||||
diff "$OUTPUT$reldir$file" "out/$file" > outfile
|
||||
if [ -s outfile ] ; then
|
||||
cp outfile $OUTPUT$3${2}.diff
|
||||
echo "Output differs: $3$2"
|
||||
cp outfile "$OUTPUT$reldir$file.diff"
|
||||
echo "Output differs: $reldir$file"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
echo "In $3: $outdata"
|
||||
echo "In $reldir: $outdata"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@ -64,40 +72,42 @@ RunXmlwfWF() {
|
||||
SUCCESS=0
|
||||
ERROR=0
|
||||
|
||||
UpdateStatus() {
|
||||
if [ "$1" -eq 0 ] ; then
|
||||
SUCCESS=`expr $SUCCESS + 1`
|
||||
else
|
||||
ERROR=`expr $ERROR + 1`
|
||||
fi
|
||||
}
|
||||
|
||||
##########################
|
||||
# well-formed test cases #
|
||||
##########################
|
||||
|
||||
cd "$TS/xmlconf"
|
||||
for xmldir in ibm/valid/P*/ \
|
||||
ibm/invalid/P*/ \
|
||||
xmltest/valid/ext-sa/ \
|
||||
xmltest/valid/not-sa/ \
|
||||
xmltest/invalid/ \
|
||||
xmltest/invalid/not-sa/ \
|
||||
xmltest/valid/sa/ \
|
||||
sun/valid/ \
|
||||
sun/invalid/ ; do
|
||||
for xmldir in ibm/valid/P* \
|
||||
ibm/invalid/P* \
|
||||
xmltest/valid/ext-sa \
|
||||
xmltest/valid/not-sa \
|
||||
xmltest/invalid \
|
||||
xmltest/invalid/not-sa \
|
||||
xmltest/valid/sa \
|
||||
sun/valid \
|
||||
sun/invalid ; do
|
||||
cd "$TS/xmlconf/$xmldir"
|
||||
mkdir -p "$OUTPUT$xmldir"
|
||||
for xmlfile in *.xml ; do
|
||||
if RunXmlwfWF -p "$xmlfile" "$xmldir" ; then
|
||||
SUCCESS=`expr $SUCCESS + 1`
|
||||
else
|
||||
ERROR=`expr $ERROR + 1`
|
||||
fi
|
||||
RunXmlwfWF "$xmlfile" "$xmldir/"
|
||||
UpdateStatus $?
|
||||
done
|
||||
rm outfile
|
||||
done
|
||||
|
||||
cd "$TS/xmlconf/oasis"
|
||||
mkdir -p "$OUTPUT"oasis/
|
||||
mkdir -p "$OUTPUT"oasis
|
||||
for xmlfile in *pass*.xml ; do
|
||||
if RunXmlwfWF -p "$xmlfile" "oasis/" ; then
|
||||
SUCCESS=`expr $SUCCESS + 1`
|
||||
else
|
||||
ERROR=`expr $ERROR + 1`
|
||||
fi
|
||||
RunXmlwfWF "$xmlfile" "oasis/"
|
||||
UpdateStatus $?
|
||||
done
|
||||
rm outfile
|
||||
|
||||
@ -106,30 +116,24 @@ rm outfile
|
||||
##############################
|
||||
|
||||
cd "$TS/xmlconf"
|
||||
for xmldir in ibm/not-wf/P*/ \
|
||||
ibm/not-wf/misc/ \
|
||||
xmltest/not-wf/ext-sa/ \
|
||||
xmltest/not-wf/not-sa/ \
|
||||
xmltest/not-wf/sa/ \
|
||||
sun/not-wf/ ; do
|
||||
for xmldir in ibm/not-wf/P* \
|
||||
ibm/not-wf/misc \
|
||||
xmltest/not-wf/ext-sa \
|
||||
xmltest/not-wf/not-sa \
|
||||
xmltest/not-wf/sa \
|
||||
sun/not-wf ; do
|
||||
cd "$TS/xmlconf/$xmldir"
|
||||
for xmlfile in *.xml ; do
|
||||
if RunXmlwfNotWF -p "$xmlfile" "$xmldir" ; then
|
||||
SUCCESS=`expr $SUCCESS + 1`
|
||||
else
|
||||
ERROR=`expr $ERROR + 1`
|
||||
fi
|
||||
RunXmlwfNotWF "$xmlfile" "$xmldir/"
|
||||
UpdateStatus $?
|
||||
done
|
||||
rm outfile
|
||||
done
|
||||
|
||||
cd "$TS/xmlconf/oasis"
|
||||
for xmlfile in *fail*.xml ; do
|
||||
if RunXmlwfNotWF -p "$xmlfile" "oasis/" ; then
|
||||
SUCCESS=`expr $SUCCESS + 1`
|
||||
else
|
||||
ERROR=`expr $ERROR + 1`
|
||||
fi
|
||||
RunXmlwfNotWF "$xmlfile" "oasis/"
|
||||
UpdateStatus $?
|
||||
done
|
||||
rm outfile
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "codepage.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__)))
|
||||
#define STRICT 1
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
|
||||
@ -20,12 +20,12 @@ codepageMap(int cp, int *map)
|
||||
for (i = 0; i < 256; i++)
|
||||
map[i] = -1;
|
||||
if (info.MaxCharSize > 1) {
|
||||
for (i = 0; i < MAX_LEADBYTES; i++) {
|
||||
for (i = 0; i < MAX_LEADBYTES; i+=2) {
|
||||
int j, lim;
|
||||
if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0)
|
||||
break;
|
||||
lim = info.LeadByte[i + 1];
|
||||
for (j = info.LeadByte[i]; j < lim; j++)
|
||||
for (j = info.LeadByte[i]; j <= lim; j++)
|
||||
map[j] = -2;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
#ifndef __LINUX__
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
#ifndef S_IFREG
|
||||
#define S_IFREG _S_IFREG
|
||||
@ -53,19 +65,29 @@ filemap(const char *name,
|
||||
return 0;
|
||||
}
|
||||
nbytes = sb.st_size;
|
||||
/* malloc will return NULL with nbytes == 0, handle files with size 0 */
|
||||
if (nbytes == 0) {
|
||||
static const char c = '\0';
|
||||
processor(&c, 0, name, arg);
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
p = malloc(nbytes);
|
||||
if (!p) {
|
||||
fprintf(stderr, "%s: out of memory\n", name);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
n = read(fd, p, nbytes);
|
||||
if (n < 0) {
|
||||
perror(name);
|
||||
free(p);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
if (n != nbytes) {
|
||||
fprintf(stderr, "%s: read unexpected number of bytes\n", name);
|
||||
free(p);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,6 +44,13 @@ filemap(const char *name,
|
||||
}
|
||||
|
||||
nbytes = sb.st_size;
|
||||
/* mmap fails for zero length files */
|
||||
if (nbytes == 0) {
|
||||
static const char c = '\0';
|
||||
processor(&c, 0, name, arg);
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ,
|
||||
MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
|
||||
if (p == (void *)-1) {
|
||||
|
@ -7,20 +7,32 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef COMPILED_FROM_DSP
|
||||
#include "winconfig.h"
|
||||
#else
|
||||
#include "expat_config.h"
|
||||
#endif
|
||||
#elif defined(MACOS_CLASSIC)
|
||||
#include "macconfig.h"
|
||||
#elif defined(__amigaos__)
|
||||
#include "amigaconfig.h"
|
||||
#elif defined(__WATCOMC__)
|
||||
#include "watcomconfig.h"
|
||||
#elif defined(HAVE_EXPAT_CONFIG_H)
|
||||
#include <expat_config.h>
|
||||
#endif /* ndef COMPILED_FROM_DSP */
|
||||
|
||||
#include "expat.h"
|
||||
#include "xmlfile.h"
|
||||
#include "xmltchar.h"
|
||||
#include "filemap.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__)))
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#if defined(__amigaos__) && defined(__USE_INLINE__)
|
||||
#include <proto/expat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -48,10 +60,10 @@ typedef struct {
|
||||
static void
|
||||
reportError(XML_Parser parser, const XML_Char *filename)
|
||||
{
|
||||
int code = XML_GetErrorCode(parser);
|
||||
enum XML_Error code = XML_GetErrorCode(parser);
|
||||
const XML_Char *message = XML_ErrorString(code);
|
||||
if (message)
|
||||
ftprintf(stdout, T("%s:%d:%d: %s\n"),
|
||||
ftprintf(stdout, T("%s:%" XML_FMT_INT_MOD "u:%" XML_FMT_INT_MOD "u: %s\n"),
|
||||
filename,
|
||||
XML_GetErrorLineNumber(parser),
|
||||
XML_GetErrorColumnNumber(parser),
|
||||
@ -59,14 +71,15 @@ reportError(XML_Parser parser, const XML_Char *filename)
|
||||
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)
|
||||
{
|
||||
XML_Parser parser = ((PROCESS_ARGS *)args)->parser;
|
||||
int *retPtr = ((PROCESS_ARGS *)args)->retPtr;
|
||||
if (XML_Parse(parser, data, size, 1) == XML_STATUS_ERROR) {
|
||||
if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) {
|
||||
reportError(parser, filename);
|
||||
*retPtr = 0;
|
||||
}
|
||||
@ -74,7 +87,7 @@ processFile(const void *data, size_t size,
|
||||
*retPtr = 1;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#if (defined(WIN32) || defined(__WATCOMC__))
|
||||
|
||||
static int
|
||||
isAsciiLetter(XML_Char c)
|
||||
@ -92,7 +105,7 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId,
|
||||
*toFree = 0;
|
||||
if (!base
|
||||
|| *systemId == T('/')
|
||||
#ifdef WIN32
|
||||
#if (defined(WIN32) || defined(__WATCOMC__))
|
||||
|| *systemId == T('\\')
|
||||
|| (isAsciiLetter(systemId[0]) && systemId[1] == T(':'))
|
||||
#endif
|
||||
@ -106,7 +119,7 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId,
|
||||
s = *toFree;
|
||||
if (tcsrchr(s, T('/')))
|
||||
s = tcsrchr(s, T('/')) + 1;
|
||||
#ifdef WIN32
|
||||
#if (defined(WIN32) || defined(__WATCOMC__))
|
||||
if (tcsrchr(s, T('\\')))
|
||||
s = tcsrchr(s, T('\\')) + 1;
|
||||
#endif
|
||||
@ -152,7 +165,7 @@ processStream(const XML_Char *filename, XML_Parser parser)
|
||||
}
|
||||
for (;;) {
|
||||
int nread;
|
||||
char *buf = XML_GetBuffer(parser, READ_SIZE);
|
||||
char *buf = (char *)XML_GetBuffer(parser, READ_SIZE);
|
||||
if (!buf) {
|
||||
if (filename != NULL)
|
||||
close(fd);
|
||||
|
@ -5,6 +5,16 @@
|
||||
#define XML_MAP_FILE 01
|
||||
#define XML_EXTERNAL_ENTITIES 02
|
||||
|
||||
#ifdef XML_LARGE_SIZE
|
||||
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
|
||||
#define XML_FMT_INT_MOD "I64"
|
||||
#else
|
||||
#define XML_FMT_INT_MOD "ll"
|
||||
#endif
|
||||
#else
|
||||
#define XML_FMT_INT_MOD "l"
|
||||
#endif
|
||||
|
||||
extern int XML_ProcessFile(XML_Parser parser,
|
||||
const XML_Char *filename,
|
||||
unsigned flags);
|
||||
|
@ -16,14 +16,18 @@
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#if defined(__amigaos__) && defined(__USE_INLINE__)
|
||||
#include <proto/expat.h>
|
||||
#endif
|
||||
|
||||
/* This ensures proper sorting. */
|
||||
|
||||
#define NSSEP T('\001')
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
characterData(void *userData, const XML_Char *s, int len)
|
||||
{
|
||||
FILE *fp = userData;
|
||||
FILE *fp = (FILE *)userData;
|
||||
for (; len > 0; --len, ++s) {
|
||||
switch (*s) {
|
||||
case T('&'):
|
||||
@ -113,19 +117,19 @@ attcmp(const void *att1, const void *att2)
|
||||
return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
startElement(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
int nAtts;
|
||||
const XML_Char **p;
|
||||
FILE *fp = userData;
|
||||
FILE *fp = (FILE *)userData;
|
||||
puttc(T('<'), fp);
|
||||
fputts(name, fp);
|
||||
|
||||
p = atts;
|
||||
while (*p)
|
||||
++p;
|
||||
nAtts = (p - atts) >> 1;
|
||||
nAtts = (int)((p - atts) >> 1);
|
||||
if (nAtts > 1)
|
||||
qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp);
|
||||
while (*atts) {
|
||||
@ -137,10 +141,10 @@ startElement(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
puttc(T('>'), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
endElement(void *userData, const XML_Char *name)
|
||||
{
|
||||
FILE *fp = userData;
|
||||
FILE *fp = (FILE *)userData;
|
||||
puttc(T('<'), fp);
|
||||
puttc(T('/'), fp);
|
||||
fputts(name, fp);
|
||||
@ -159,13 +163,13 @@ nsattcmp(const void *p1, const void *p2)
|
||||
return tcscmp(att1, att2);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
int nAtts;
|
||||
int nsi;
|
||||
const XML_Char **p;
|
||||
FILE *fp = userData;
|
||||
FILE *fp = (FILE *)userData;
|
||||
const XML_Char *sep;
|
||||
puttc(T('<'), fp);
|
||||
|
||||
@ -185,7 +189,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
p = atts;
|
||||
while (*p)
|
||||
++p;
|
||||
nAtts = (p - atts) >> 1;
|
||||
nAtts = (int)((p - atts) >> 1);
|
||||
if (nAtts > 1)
|
||||
qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp);
|
||||
while (*atts) {
|
||||
@ -208,10 +212,10 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
puttc(T('>'), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
endElementNS(void *userData, const XML_Char *name)
|
||||
{
|
||||
FILE *fp = userData;
|
||||
FILE *fp = (FILE *)userData;
|
||||
const XML_Char *sep;
|
||||
puttc(T('<'), fp);
|
||||
puttc(T('/'), fp);
|
||||
@ -227,11 +231,11 @@ endElementNS(void *userData, const XML_Char *name)
|
||||
|
||||
#ifndef W3C14N
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
processingInstruction(void *userData, const XML_Char *target,
|
||||
const XML_Char *data)
|
||||
{
|
||||
FILE *fp = userData;
|
||||
FILE *fp = (FILE *)userData;
|
||||
puttc(T('<'), fp);
|
||||
puttc(T('?'), fp);
|
||||
fputts(target, fp);
|
||||
@ -243,57 +247,57 @@ processingInstruction(void *userData, const XML_Char *target,
|
||||
|
||||
#endif /* not W3C14N */
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
defaultCharacterData(void *userData, const XML_Char *s, int len)
|
||||
{
|
||||
XML_DefaultCurrent((XML_Parser) userData);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
defaultStartElement(void *userData, const XML_Char *name,
|
||||
const XML_Char **atts)
|
||||
{
|
||||
XML_DefaultCurrent((XML_Parser) userData);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
defaultEndElement(void *userData, const XML_Char *name)
|
||||
{
|
||||
XML_DefaultCurrent((XML_Parser) userData);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
defaultProcessingInstruction(void *userData, const XML_Char *target,
|
||||
const XML_Char *data)
|
||||
{
|
||||
XML_DefaultCurrent((XML_Parser) userData);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
nopCharacterData(void *userData, const XML_Char *s, int len)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
nopEndElement(void *userData, const XML_Char *name)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
nopProcessingInstruction(void *userData, const XML_Char *target,
|
||||
const XML_Char *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
markup(void *userData, const XML_Char *s, int len)
|
||||
{
|
||||
FILE *fp = XML_GetUserData((XML_Parser) userData);
|
||||
FILE *fp = (FILE *)XML_GetUserData((XML_Parser) userData);
|
||||
for (; len > 0; --len, ++s)
|
||||
puttc(*s, fp);
|
||||
}
|
||||
@ -303,9 +307,10 @@ metaLocation(XML_Parser parser)
|
||||
{
|
||||
const XML_Char *uri = XML_GetBase(parser);
|
||||
if (uri)
|
||||
ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri);
|
||||
ftprintf(XML_GetUserData(parser),
|
||||
T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""),
|
||||
ftprintf((FILE *)XML_GetUserData(parser), T(" uri=\"%s\""), uri);
|
||||
ftprintf((FILE *)XML_GetUserData(parser),
|
||||
T(" byte=\"%" XML_FMT_INT_MOD "d\" nbytes=\"%d\" \
|
||||
line=\"%" XML_FMT_INT_MOD "u\" col=\"%" XML_FMT_INT_MOD "u\""),
|
||||
XML_GetCurrentByteIndex(parser),
|
||||
XML_GetCurrentByteCount(parser),
|
||||
XML_GetCurrentLineNumber(parser),
|
||||
@ -315,21 +320,21 @@ metaLocation(XML_Parser parser)
|
||||
static void
|
||||
metaStartDocument(void *userData)
|
||||
{
|
||||
fputts(T("<document>\n"), XML_GetUserData((XML_Parser) userData));
|
||||
fputts(T("<document>\n"), (FILE *)XML_GetUserData((XML_Parser) userData));
|
||||
}
|
||||
|
||||
static void
|
||||
metaEndDocument(void *userData)
|
||||
{
|
||||
fputts(T("</document>\n"), XML_GetUserData((XML_Parser) userData));
|
||||
fputts(T("</document>\n"), (FILE *)XML_GetUserData((XML_Parser) userData));
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaStartElement(void *userData, const XML_Char *name,
|
||||
const XML_Char **atts)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
const XML_Char **specifiedAttsEnd
|
||||
= atts + XML_GetSpecifiedAttributeCount(parser);
|
||||
const XML_Char **idAttPtr;
|
||||
@ -345,7 +350,7 @@ metaStartElement(void *userData, const XML_Char *name,
|
||||
fputts(T(">\n"), fp);
|
||||
do {
|
||||
ftprintf(fp, T("<attribute name=\"%s\" value=\""), atts[0]);
|
||||
characterData(fp, atts[1], tcslen(atts[1]));
|
||||
characterData(fp, atts[1], (int)tcslen(atts[1]));
|
||||
if (atts >= specifiedAttsEnd)
|
||||
fputts(T("\" defaulted=\"yes\"/>\n"), fp);
|
||||
else if (atts == idAttPtr)
|
||||
@ -359,66 +364,66 @@ metaStartElement(void *userData, const XML_Char *name,
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaEndElement(void *userData, const XML_Char *name)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<endtag name=\"%s\""), name);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaProcessingInstruction(void *userData, const XML_Char *target,
|
||||
const XML_Char *data)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<pi target=\"%s\" data=\""), target);
|
||||
characterData(fp, data, tcslen(data));
|
||||
characterData(fp, data, (int)tcslen(data));
|
||||
puttc(T('"'), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaComment(void *userData, const XML_Char *data)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
fputts(T("<comment data=\""), fp);
|
||||
characterData(fp, data, tcslen(data));
|
||||
characterData(fp, data, (int)tcslen(data));
|
||||
puttc(T('"'), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaStartCdataSection(void *userData)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
fputts(T("<startcdata"), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaEndCdataSection(void *userData)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
fputts(T("<endcdata"), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaCharacterData(void *userData, const XML_Char *s, int len)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
fputts(T("<chars str=\""), fp);
|
||||
characterData(fp, s, len);
|
||||
puttc(T('"'), fp);
|
||||
@ -426,7 +431,7 @@ metaCharacterData(void *userData, const XML_Char *s, int len)
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaStartDoctypeDecl(void *userData,
|
||||
const XML_Char *doctypeName,
|
||||
const XML_Char *sysid,
|
||||
@ -434,23 +439,23 @@ metaStartDoctypeDecl(void *userData,
|
||||
int has_internal_subset)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaEndDoctypeDecl(void *userData)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
fputts(T("<enddoctype"), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaNotationDecl(void *userData,
|
||||
const XML_Char *notationName,
|
||||
const XML_Char *base,
|
||||
@ -458,13 +463,13 @@ metaNotationDecl(void *userData,
|
||||
const XML_Char *publicId)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<notation name=\"%s\""), notationName);
|
||||
if (publicId)
|
||||
ftprintf(fp, T(" public=\"%s\""), publicId);
|
||||
if (systemId) {
|
||||
fputts(T(" system=\""), fp);
|
||||
characterData(fp, systemId, tcslen(systemId));
|
||||
characterData(fp, systemId, (int)tcslen(systemId));
|
||||
puttc(T('"'), fp);
|
||||
}
|
||||
metaLocation(parser);
|
||||
@ -472,7 +477,7 @@ metaNotationDecl(void *userData,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaEntityDecl(void *userData,
|
||||
const XML_Char *entityName,
|
||||
int is_param,
|
||||
@ -484,7 +489,7 @@ metaEntityDecl(void *userData,
|
||||
const XML_Char *notationName)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
|
||||
if (value) {
|
||||
ftprintf(fp, T("<entity name=\"%s\""), entityName);
|
||||
@ -498,7 +503,7 @@ metaEntityDecl(void *userData,
|
||||
if (publicId)
|
||||
ftprintf(fp, T(" public=\"%s\""), publicId);
|
||||
fputts(T(" system=\""), fp);
|
||||
characterData(fp, systemId, tcslen(systemId));
|
||||
characterData(fp, systemId, (int)tcslen(systemId));
|
||||
puttc(T('"'), fp);
|
||||
ftprintf(fp, T(" notation=\"%s\""), notationName);
|
||||
metaLocation(parser);
|
||||
@ -509,50 +514,50 @@ metaEntityDecl(void *userData,
|
||||
if (publicId)
|
||||
ftprintf(fp, T(" public=\"%s\""), publicId);
|
||||
fputts(T(" system=\""), fp);
|
||||
characterData(fp, systemId, tcslen(systemId));
|
||||
characterData(fp, systemId, (int)tcslen(systemId));
|
||||
puttc(T('"'), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaStartNamespaceDecl(void *userData,
|
||||
const XML_Char *prefix,
|
||||
const XML_Char *uri)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
fputts(T("<startns"), fp);
|
||||
if (prefix)
|
||||
ftprintf(fp, T(" prefix=\"%s\""), prefix);
|
||||
if (uri) {
|
||||
fputts(T(" ns=\""), fp);
|
||||
characterData(fp, uri, tcslen(uri));
|
||||
characterData(fp, uri, (int)tcslen(uri));
|
||||
fputts(T("\"/>\n"), fp);
|
||||
}
|
||||
else
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static void
|
||||
static void XMLCALL
|
||||
metaEndNamespaceDecl(void *userData, const XML_Char *prefix)
|
||||
{
|
||||
XML_Parser parser = (XML_Parser) userData;
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
FILE *fp = (FILE *)XML_GetUserData(parser);
|
||||
if (!prefix)
|
||||
fputts(T("<endns/>\n"), fp);
|
||||
else
|
||||
ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
|
||||
}
|
||||
|
||||
static int
|
||||
static int XMLCALL
|
||||
unknownEncodingConvert(void *data, const char *p)
|
||||
{
|
||||
return codepageConvert(*(int *)data, p);
|
||||
}
|
||||
|
||||
static int
|
||||
static int XMLCALL
|
||||
unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
|
||||
{
|
||||
int cp;
|
||||
@ -571,7 +576,7 @@ unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
|
||||
if (!s)
|
||||
return 0;
|
||||
cp *= 10;
|
||||
cp += s - digits;
|
||||
cp += (int)(s - digits);
|
||||
if (cp >= 0x10000)
|
||||
return 0;
|
||||
}
|
||||
@ -588,7 +593,7 @@ unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
static int XMLCALL
|
||||
notStandalone(void *userData)
|
||||
{
|
||||
return 0;
|
||||
@ -602,7 +607,7 @@ showVersion(XML_Char *prog)
|
||||
const XML_Feature *features = XML_GetFeatureList();
|
||||
while ((ch = *s) != 0) {
|
||||
if (ch == '/'
|
||||
#ifdef WIN32
|
||||
#if (defined(WIN32) || defined(__WATCOMC__))
|
||||
|| ch == '\\'
|
||||
#endif
|
||||
)
|
||||
@ -645,7 +650,8 @@ tmain(int argc, XML_Char **argv)
|
||||
int outputType = 0;
|
||||
int useNamespaces = 0;
|
||||
int requireStandalone = 0;
|
||||
int paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
|
||||
enum XML_ParamEntityParsing paramEntityParsing =
|
||||
XML_PARAM_ENTITY_PARSING_NEVER;
|
||||
int useStdin = 0;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -766,17 +772,28 @@ tmain(int argc, XML_Char **argv)
|
||||
XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
|
||||
}
|
||||
else if (outputDir) {
|
||||
const XML_Char * delim = T("/");
|
||||
const XML_Char *file = useStdin ? T("STDIN") : argv[i];
|
||||
if (tcsrchr(file, T('/')))
|
||||
file = tcsrchr(file, T('/')) + 1;
|
||||
#ifdef WIN32
|
||||
if (tcsrchr(file, T('\\')))
|
||||
file = tcsrchr(file, T('\\')) + 1;
|
||||
if (!useStdin) {
|
||||
/* Jump after last (back)slash */
|
||||
const XML_Char * lastDelim = tcsrchr(file, delim[0]);
|
||||
if (lastDelim)
|
||||
file = lastDelim + 1;
|
||||
#if (defined(WIN32) || defined(__WATCOMC__))
|
||||
else {
|
||||
const XML_Char * winDelim = T("\\");
|
||||
lastDelim = tcsrchr(file, winDelim[0]);
|
||||
if (lastDelim) {
|
||||
file = lastDelim + 1;
|
||||
delim = winDelim;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
outName = malloc((tcslen(outputDir) + tcslen(file) + 2)
|
||||
}
|
||||
outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2)
|
||||
* sizeof(XML_Char));
|
||||
tcscpy(outName, outputDir);
|
||||
tcscat(outName, T("/"));
|
||||
tcscat(outName, delim);
|
||||
tcscat(outName, file);
|
||||
fp = tfopen(outName, T("wb"));
|
||||
if (!fp) {
|
||||
|
Loading…
Reference in New Issue
Block a user