Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
c1aa3d82
Commit
c1aa3d82
authored
Jul 21, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
major update with expat 1.1 and new pyexpat
parent
773b9f8b
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
6091 additions
and
3201 deletions
+6091
-3201
lib/python/Shared/DC/xml/pyexpat/Makefile.pre.in
lib/python/Shared/DC/xml/pyexpat/Makefile.pre.in
+180
-91
lib/python/Shared/DC/xml/pyexpat/Setup.in
lib/python/Shared/DC/xml/pyexpat/Setup.in
+2
-1
lib/python/Shared/DC/xml/pyexpat/expat/Makefile
lib/python/Shared/DC/xml/pyexpat/expat/Makefile
+9
-4
lib/python/Shared/DC/xml/pyexpat/expat/expat.html
lib/python/Shared/DC/xml/pyexpat/expat/expat.html
+52
-21
lib/python/Shared/DC/xml/pyexpat/expat/expat.mak
lib/python/Shared/DC/xml/pyexpat/expat/expat.mak
+1071
-1908
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/hashtable.c
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/hashtable.c
+32
-8
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/hashtable.h
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/hashtable.h
+28
-4
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/xmlparse.c
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/xmlparse.c
+2061
-422
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/xmlparse.h
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/xmlparse.h
+375
-24
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/asciitab.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/asciitab.h
+13
-3
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/dllmain.c
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/dllmain.c
+15
-2
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/iasciitab.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/iasciitab.h
+13
-3
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/latin1tab.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/latin1tab.h
+12
-2
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/utf8tab.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/utf8tab.h
+12
-2
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmldef.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmldef.h
+34
-3
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmlrole.c
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmlrole.c
+21
-3
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmlrole.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmlrole.h
+13
-2
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok.c
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok.c
+1057
-289
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok.h
+83
-28
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_impl.c
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_impl.c
+430
-193
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_impl.h
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_impl.h
+13
-2
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_ns.c
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_ns.c
+96
-0
lib/python/Shared/DC/xml/pyexpat/pyexpat.c
lib/python/Shared/DC/xml/pyexpat/pyexpat.c
+469
-186
No files found.
lib/python/Shared/DC/xml/pyexpat/Makefile.pre.in
View file @
c1aa3d82
# Universal Makefile to build Python extensions.
# Universal Unix Makefile for Python extensions
#
# =============================================
# Instructions:
#
# Short Instructions
# 0) Build and install the basic Python 1.5 distribution. You must
# ------------------
# also install the headers ("make inclinstall") and the binary library
# files ("make libainstall").
# 1. Build and install Python (1.5 or newer).
#
# 2. "make -f Makefile.pre.in boot"
# 1) Edit Makefile.pre.in (not any other file!!!) to change the
# 3. "make"
# definition of installdir (and possibly exec_installdir). These
# You should now have a shared library.
# should match the prefix and exec_prefix used when installing Python.
# Alternatively, you can specify a value for installdir on the
# Long Instructions
# "make -f Makefile.pre.in Makefile" command line (see below). This
# -----------------
# is probably easier since it avoids editing Makefile.pre.in at all...
#
# Build *and install* the basic Python 1.5 distribution. See the
# 2) Copy Setup.in to Setup and edit Setup to change the selection of
# Python README for instructions. (This version of Makefile.pre.in
# modules you want to use. Read the comments in the core Python's
# only withs with Python 1.5, alpha 3 or newer.)
# Modules/Setup.in for more detailed instructions.
#
# Create a file Setup.in for your extension. This file follows the
# 3) Run "make Makefile -f Makefile.pre.in". This creates Makefile
# format of the Modules/Setup.in file; see the instructions there.
# For a simple module called "spam" on file "spammodule.c", it can
# contain a single line:
# spam spammodule.c
# You can build as many modules as you want in the same directory --
# just have a separate line for each of them in the Setup.in file.
# If you want to build your extension as a shared library, insert a
# line containing just the string
# *shared*
# at the top of your Setup.in file.
# Note that the build process copies Setup.in to Setup, and then works
# with Setup. It doesn't overwrite Setup when Setup.in is changed, so
# while you're in the process of debugging your Setup.in file, you may
# want to edit Setup instead, and copy it back to Setup.in later.
# (All this is done so you can distribute your extension easily and
# someone else can select the modules they actually want to build by
# commenting out lines in the Setup file, without editing the
# original. Editing Setup is also used to specify nonstandard
# locations for include or library files.)
# Copy this file (Misc/Makefile.pre.in) to the directory containing
# your extension.
# Run "make -f Makefile.pre.in boot". This creates Makefile
# (producing Makefile.pre and sedscript as intermediate files) and
# (producing Makefile.pre and sedscript as intermediate files) and
# config.c. Values for installdir, srcdir, VPATH, LINKPATH, OPT,
# config.c, incorporating the values for sys.prefix, sys.exec_prefix
# BASELIB and BASESETUP on the make command line will be incorporated
# and sys.version from the installed Python binary. For this to work,
# in the final Makefile.
# the python binary must be on your path. If this fails, try
#
# make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
# 4) Run "make". This creates a Python executable. The set of
# where <prefix> is the prefix used to install Python for installdir
# built-in modules and features is a superset of that of the basic
# (and possibly similar for exec_installdir=<exec_prefix>).
# Python -- additions are taken from ./Setup.
#
# Note: "make boot" implies "make clobber" -- it assumes that when you
# If you don't actually want to install the Python headers and
# bootstrap you may have changed platforms so it removes all previous
# binary library files, you can edit the "Fixed definitions" section
# output files.
# below to point directly into the source and/or build tree.
#
# If you are building your extension as a shared library (your
# Setup.in file starts with *shared*), run "make" or "make sharedmods"
# to build the shared library files. If you are building a statically
# linked Python binary (the only solution of your platform doesn't
# support shared libraries, and sometimes handy if you want to
# distribute or install the resulting Python binary), run "make
# python".
# Note: Each time you edit Makefile.pre.in or Setup, you must run
# Note: Each time you edit Makefile.pre.in or Setup, you must run
# "make Makefile" before running "make".
# "make Makefile" before running "make".
#
# Hint: if you want to use VPATH, you can start in an empty
# Hint: if you want to use VPATH, you can start in an empty
# subdirectory and say (e.g.):
# subdirectory and say (e.g.):
# make -f ../Makefile.pre.in VERSION=1.5 srcdir=.. VPATH=.. Makefile
# make -f ../Makefile.pre.in boot srcdir=.. VPATH=..
# === Variables that you just *have* to customize manually ===
# (You can also specify their values on the command line for
# === Bootstrap variables (edited through "make boot") ===
# "make -f Makefile.pre.in VERSION=1.5 Makefile".)
# The prefix used by "make inclinstall libainstall" of core python
# The prefix used by "make inclinstall libainstall" of core python
installdir
=
/u
fs/jack/src/python/build.irix6/tmp
installdir
=
/u
sr/local
# The exec_prefix used by the same
# The exec_prefix used by the same
exec_installdir
=
$(installdir)
exec_installdir
=
$(installdir)
...
@@ -57,16 +86,16 @@ exec_installdir=$(installdir)
...
@@ -57,16 +86,16 @@ exec_installdir=$(installdir)
srcdir
=
.
srcdir
=
.
VPATH
=
.
VPATH
=
.
# === Variables that you may want to customize ===
# === Variables that you may want to customize
(rarely)
===
#
Add possible -L options here
#
(Static) build target
LINKPATH
=
TARGET
=
python
#
You may want to change this to -O
#
Installed python binary (used only by boot target)
OPT
=
-g
PYTHON
=
python
# Add more -I and -D options here
# Add more -I and -D options here
CFLAGS
=
$(OPT)
-I
$(INCLUDEPY)
-I
$(
LIBPL
)
$(DEFS)
CFLAGS
=
$(OPT)
-I
$(INCLUDEPY)
-I
$(
EXECINCLUDEPY
)
$(DEFS)
# These two variables can be set in Setup to merge extensions.
# These two variables can be set in Setup to merge extensions.
# See example[23].
# See example[23].
...
@@ -84,6 +113,11 @@ MODLIBS= _MODLIBS_
...
@@ -84,6 +113,11 @@ MODLIBS= _MODLIBS_
VERSION
=
@VERSION@
VERSION
=
@VERSION@
CC
=
@CC@
CC
=
@CC@
LINKCC
=
@LINKCC@
SGI_ABI
=
@SGI_ABI@
OPT
=
@OPT@
LDFLAGS
=
@LDFLAGS@
LDLAST
=
@LDLAST@
DEFS
=
@DEFS@
DEFS
=
@DEFS@
LIBS
=
@LIBS@
LIBS
=
@LIBS@
LIBM
=
@LIBM@
LIBM
=
@LIBM@
...
@@ -94,6 +128,7 @@ SO= @SO@
...
@@ -94,6 +128,7 @@ SO= @SO@
LDSHARED
=
@LDSHARED@
LDSHARED
=
@LDSHARED@
CCSHARED
=
@CCSHARED@
CCSHARED
=
@CCSHARED@
LINKFORSHARED
=
@LINKFORSHARED@
LINKFORSHARED
=
@LINKFORSHARED@
#@SET_CCC@
# Install prefix for architecture-independent files
# Install prefix for architecture-independent files
prefix
=
/usr/local
prefix
=
/usr/local
...
@@ -101,8 +136,15 @@ prefix= /usr/local
...
@@ -101,8 +136,15 @@ prefix= /usr/local
# Install prefix for architecture-dependent files
# Install prefix for architecture-dependent files
exec_prefix
=
$(prefix)
exec_prefix
=
$(prefix)
# Uncomment the following two lines for AIX
#LINKCC= $(LIBPL)/makexp_aix $(LIBPL)/python.exp "" $(LIBRARY); $(PURIFY) $(CC)
#LDSHARED= $(LIBPL)/ld_so_aix $(CC) -bI:$(LIBPL)/python.exp
# === Fixed definitions ===
# === Fixed definitions ===
# Shell used by make (some versions default to the login shell, which is bad)
SHELL
=
/bin/sh
# Expanded directories
# Expanded directories
BINDIR
=
$(exec_installdir)
/bin
BINDIR
=
$(exec_installdir)
/bin
LIBDIR
=
$(exec_prefix)
/lib
LIBDIR
=
$(exec_prefix)
/lib
...
@@ -114,40 +156,64 @@ SCRIPTDIR= $(prefix)/lib
...
@@ -114,40 +156,64 @@ SCRIPTDIR= $(prefix)/lib
BINLIBDEST
=
$(LIBDIR)
/python
$(VERSION)
BINLIBDEST
=
$(LIBDIR)
/python
$(VERSION)
LIBDEST
=
$(SCRIPTDIR)
/python
$(VERSION)
LIBDEST
=
$(SCRIPTDIR)
/python
$(VERSION)
INCLUDEPY
=
$(INCLUDEDIR)
/python
$(VERSION)
INCLUDEPY
=
$(INCLUDEDIR)
/python
$(VERSION)
EXECINCLUDEPY
=
$(exec_installdir)
/include/python
$(VERSION)
LIBP
=
$(exec_installdir)
/lib/python
$(VERSION)
LIBP
=
$(exec_installdir)
/lib/python
$(VERSION)
DESTSHARED
=
$(BINLIBDEST)
/site-packages
LIBPL
=
$(LIBP)
/config
LIBPL
=
$(LIBP)
/config
PYTHONLIBS
=
$(LIBPL)
/libModules.a
\
PYTHONLIBS
=
$(LIBPL)
/libpython
$(VERSION)
.a
$(LIBPL)
/libPython.a
\
$(LIBPL)
/libObjects.a
\
$(LIBPL)
/libParser.a
MAKESETUP
=
$(LIBPL)
/makesetup
MAKESETUP
=
$(LIBPL)
/makesetup
MAKEFILE
=
$(LIBPL)
/Makefile
MAKEFILE
=
$(LIBPL)
/Makefile
CONFIGC
=
$(LIBPL)
/config.c
CONFIGC
=
$(LIBPL)
/config.c
CONFIGCIN
=
$(LIBPL)
/config.c.in
CONFIGCIN
=
$(LIBPL)
/config.c.in
SETUP
=
$(LIBPL)
/Setup
SETUP
=
$(LIBPL)
/Setup
.thread
$(LIBPL)
/Setup.local
$(LIBPL)
/Setup
SYSLIBS
=
$(LIBM)
$(LIBC)
SYSLIBS
=
$(LIBM)
$(LIBC)
ADDOBJS
=
$(LIBPL)
/main.o getpath.o config.o
ADDOBJS
=
$(LIBPL)
/python.o config.o
# Portable install script (configure doesn't always guess right)
INSTALL
=
$(LIBPL)
/install-sh
-c
# Shared libraries must be installed with executable mode on some systems;
# rather than figuring out exactly which, we always give them executable mode.
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED
=
${INSTALL}
-m
555
# === Fixed rules ===
# === Fixed rules ===
all
:
python
# Default target. This builds shared libraries only
default
:
sharedmods
sharedmods
:
$(SHAREDMODS)
# Build everything
all
:
static sharedmods
python
:
$(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
# Build shared libraries from our extension modules
$(CC)
$(ADDOBJS)
lib.a
$(PYTHONLIBS)
\
sharedmods
:
$(SHAREDMODS)
$(LINKPATH)
$(BASELIB)
$(MODLIBS)
$(LIBS)
$(SYSLIBS)
-o
python
# Build a static Python binary containing our extension modules
static
:
$(TARGET)
$(TARGET)
:
$(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
$(LINKCC)
$(LDFLAGS)
$(LINKFORSHARED)
\
$(ADDOBJS)
lib.a
$(PYTHONLIBS)
\
$(LINKPATH)
$(BASELIB)
$(MODLIBS)
$(LIBS)
$(SYSLIBS)
\
-o
$(TARGET)
$(LDLAST)
install
:
sharedmods
if
test
!
-d
$(DESTSHARED)
;
then
\
mkdir
$(DESTSHARED)
;
else
true
;
fi
-
for
i
in
X
$(SHAREDMODS)
;
do
\
if
test
$$
i
!=
X
;
\
then
$(INSTALL_SHARED)
$$
i
$(DESTSHARED)
/
$$
i
;
\
fi
;
\
done
# Build the library containing our extension modules
lib.a
:
$(MODOBJS)
lib.a
:
$(MODOBJS)
-
rm
-f
lib.a
-
rm
-f
lib.a
ar cr lib.a
$(MODOBJS)
ar cr lib.a
$(MODOBJS)
-
$(RANLIB)
lib.a
||
\
-
$(RANLIB)
lib.a
echo
"don't worry if ranlib fails -- probably SYSV or equiv"
# This runs makesetup *twice* to use the BASESETUP definition from Setup
# This runs makesetup *twice* to use the BASESETUP definition from Setup
config.c Makefile
:
Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
config.c Makefile
:
Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
...
@@ -155,20 +221,20 @@ config.c Makefile: Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
...
@@ -155,20 +221,20 @@ config.c Makefile: Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
-m
Makefile.pre
-c
$(CONFIGCIN)
Setup
-n
$(BASESETUP)
$(SETUP)
-m
Makefile.pre
-c
$(CONFIGCIN)
Setup
-n
$(BASESETUP)
$(SETUP)
$(MAKE)
-f
Makefile
do
-it-again
$(MAKE)
-f
Makefile
do
-it-again
# Internal target to run makesetup for the second time
do-it-again
:
do-it-again
:
$(MAKESETUP)
\
$(MAKESETUP)
\
-m
Makefile.pre
-c
$(CONFIGCIN)
Setup
-n
$(BASESETUP)
$(SETUP)
-m
Makefile.pre
-c
$(CONFIGCIN)
Setup
-n
$(BASESETUP)
$(SETUP)
# Make config.o from the config.c created by makesetup
config.o
:
config.c
config.o
:
config.c
$(CC)
$(CFLAGS)
-c
config.c
$(CC)
$(CFLAGS)
-c
config.c
getpath.o
:
$(LIBPL)/getpath.c Makefile
$(CC)
$(CFLAGS)
-DPYTHONPATH
=
\"
$(PYTHONPATH)
\"
-c
$(LIBPL)
/getpath.c
# Setup is copied from Setup.in *only* if it doesn't yet exist
# Setup is copied from Setup.in *only* if it doesn't yet exist
Setup
:
Setup
:
cp
$(srcdir)
/Setup.in Setup
cp
$(srcdir)
/Setup.in Setup
# Make the intermediate Makefile.pre from Makefile.pre.in
Makefile.pre
:
Makefile.pre.in sedscript
Makefile.pre
:
Makefile.pre.in sedscript
sed
-f
sedscript
$(srcdir)
/Makefile.pre.in
>
Makefile.pre
sed
-f
sedscript
$(srcdir)
/Makefile.pre.in
>
Makefile.pre
...
@@ -176,12 +242,20 @@ Makefile.pre: Makefile.pre.in sedscript
...
@@ -176,12 +242,20 @@ Makefile.pre: Makefile.pre.in sedscript
P
=
prefix
P
=
prefix
E
=
exec_prefix
E
=
exec_prefix
H
=
Generated automatically from Makefile.pre.in by sedscript.
H
=
Generated automatically from Makefile.pre.in by sedscript.
L
=
LINKFORSHARED
# Make the sed script used to create Makefile.pre from Makefile.pre.in
sedscript
:
$(MAKEFILE)
sedscript
:
$(MAKEFILE)
sed
-n
\
sed
-n
\
-e
'1s/.*/1i\\/p'
\
-e
'1s/.*/1i\\/p'
\
-e
'2s%.*%# $H%p'
\
-e
'2s%.*%# $H%p'
\
-e
'/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p'
\
-e
'/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p'
\
-e
'/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p'
\
-e
'/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p'
\
-e
'/^CCC=/s/^CCC=[ ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p'
\
-e
'/^LINKCC=/s/^LINKCC=[ ]*\(.*\)/s%@LINKCC[@]%\1%/p'
\
-e
'/^OPT=/s/^OPT=[ ]*\(.*\)/s%@OPT[@]%\1%/p'
\
-e
'/^LDFLAGS=/s/^LDFLAGS=[ ]*\(.*\)/s%@LDFLAGS[@]%\1%/p'
\
-e
'/^LDLAST=/s/^LDLAST=[ ]*\(.*\)/s%@LDLAST[@]%\1%/p'
\
-e
'/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p'
\
-e
'/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p'
\
-e
'/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p'
\
-e
'/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p'
\
-e
'/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p'
\
-e
'/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p'
\
...
@@ -191,26 +265,41 @@ sedscript: $(MAKEFILE)
...
@@ -191,26 +265,41 @@ sedscript: $(MAKEFILE)
-e
'/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p'
\
-e
'/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p'
\
-e
'/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p'
\
-e
'/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p'
\
-e
'/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p'
\
-e
'/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p'
\
-e
'/^LINKFORSHARED=/s/^LINKFORSHARED=[ ]*\(.*\)/s%@LINKFORSHARED[@]%\1%/p'
\
-e
'/^SGI_ABI=/s/^SGI_ABI=[ ]*\(.*\)/s%@SGI_ABI[@]%\1%/p'
\
-e
'/^$L=/s/^$L=[ ]*\(.*\)/s%@$L[@]%\1%/p'
\
-e
'/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p'
\
-e
'/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p'
\
-e
'/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p'
\
-e
'/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p'
\
$(MAKEFILE)
>
sedscript
$(MAKEFILE)
>
sedscript
(
\
echo
"/^#@SET_CCC@/d"
>>
sedscript
echo
"/^installdir=/s%=.*%=
$(installdir)
%"
;
\
echo
"/^installdir=/s%=.*%=
$(installdir)
%"
>>
sedscript
echo
"/^exec_installdir=/s%=.*%=
$(exec_installdir)
%"
;
\
echo
"/^exec_installdir=/s%=.*%=
$(exec_installdir)
%"
>>
sedscript
echo
"/^srcdir=/s%=.*%=
$(srcdir)
%"
;
\
echo
"/^srcdir=/s%=.*%=
$(srcdir)
%"
>>
sedscript
echo
"/^VPATH=/s%=.*%=
$(VPATH)
%"
;
\
echo
"/^VPATH=/s%=.*%=
$(VPATH)
%"
>>
sedscript
echo
"/^LINKPATH=/s%=.*%=
$(LINKPATH)
%"
;
\
echo
"/^LINKPATH=/s%=.*%=
$(LINKPATH)
%"
>>
sedscript
echo
"/^OPT=/s%=.*%=
$(OPT)
%"
;
\
echo
"/^BASELIB=/s%=.*%=
$(BASELIB)
%"
>>
sedscript
echo
"/^BASELIB=/s%=.*%=
$(BASELIB)
%"
;
\
echo
"/^BASESETUP=/s%=.*%=
$(BASESETUP)
%"
>>
sedscript
echo
"/^BASESETUP=/s%=.*%=
$(BASESETUP)
%"
;
\
)
>>
sedscript
# Bootstrap target
boot
:
clobber
VERSION
=
`
$(PYTHON)
-c
"import sys; print sys.version[:3]"
`
;
\
installdir
=
`
$(PYTHON)
-c
"import sys; print sys.prefix"
`
;
\
exec_installdir
=
`
$(PYTHON)
-c
"import sys; print sys.exec_prefix"
`
;
\
$(MAKE)
-f
$(srcdir)
/Makefile.pre.in
VPATH
=
$(VPATH)
srcdir
=
$(srcdir)
\
VERSION
=
$$
VERSION
\
installdir
=
$$
installdir
\
exec_installdir
=
$$
exec_installdir
\
Makefile
# Handy target to remove intermediate files and backups
clean
:
clean
:
-
rm
-f
*
.o
*
~
-
rm
-f
*
.o
*
~
# Handy target to remove everything that is easily regenerated
clobber
:
clean
clobber
:
clean
-
rm
-f
python lib.a sedscript config.c Makefile.pre
-
rm
-f
*
.a tags TAGS config.c Makefile.pre
$(TARGET)
sedscript
-
rm
-f
*
.so
*
.sl so_locations
# Handy target to remove everything you don't want to distribute
distclean
:
clobber
distclean
:
clobber
-
rm
-f
Makefile Setup
-
rm
-f
Makefile Setup
lib/python/Shared/DC/xml/pyexpat/Setup.in
View file @
c1aa3d82
*shared*
*shared*
pyexpat pyexpat.o expat/libexpat.a -Iexpat/xmlparse
pyexpat pyexpat.c -DXML_NS -Iexpat/xmlparse -Iexpat/xmltok expat/xmlparse/xmlparse.c expat/xmlparse/hashtable.c expat/xmltok/xmlrole.c expat/xmltok/xmltok.c
lib/python/Shared/DC/xml/pyexpat/expat/Makefile
View file @
c1aa3d82
CC
=
cc
CC
=
gcc
CFLAGS
=
-O2
-Ixmltok
-Ixmlparse
# If you know what your system's byte order is, define XML_BYTE_ORDER:
# use -DXML_BYTE_ORDER=12 for little-endian byte order;
# use -DXML_BYTE_ORDER=21 for big-endian (network) byte order.
# -DXML_NS adds support for checking of lexical aspects of XML namespaces spec
# -DXML_MIN_SIZE makes a smaller but slower parser
CFLAGS
=
-O2
-Ixmltok
-Ixmlparse
-DXML_NS
# Use one of the next two lines; unixfilemap is better if it works.
# Use one of the next two lines; unixfilemap is better if it works.
FILEMAP_OBJ
=
xmlwf/unixfilemap.o
FILEMAP_OBJ
=
xmlwf/unixfilemap.o
#FILEMAP_OBJ=xmlwf/readfilemap.o
#FILEMAP_OBJ=xmlwf/readfilemap.o
OBJS
=
xmltok/xmltok.o
\
OBJS
=
xmltok/xmltok.o
\
xmltok/xmlrole.o
\
xmltok/xmlrole.o
\
xmlwf/xmlwf.o
\
xmlwf/xmlwf.o
\
xmlwf/xmlfile.o
\
xmlwf/codepage.o
\
xmlparse/xmlparse.o
\
xmlparse/xmlparse.o
\
xmlparse/hashtable.o
\
xmlparse/hashtable.o
\
$(FILEMAP_OBJ)
$(FILEMAP_OBJ)
EXE
=
EXE
=
all
:
xmlwf/xmlwf$(EXE)
all
:
xmlwf/xmlwf$(EXE)
libexpat.a
:
$(OBJS)
ar cr libexpat.a
$(OBJS)
xmlwf/xmlwf$(EXE)
:
$(OBJS)
xmlwf/xmlwf$(EXE)
:
$(OBJS)
$(CC)
$(CFLAGS)
-o
$@
$(OBJS)
$(CC)
$(CFLAGS)
-o
$@
$(OBJS)
...
...
lib/python/Shared/DC/xml/pyexpat/expat/expat.html
View file @
c1aa3d82
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HTML>
<TITLE>
expat
</TITLE>
<TITLE>
expat
</TITLE>
<BODY>
<BODY>
<H1>
expat - XML Parser Toolkit
</H1>
<H1>
expat - XML Parser Toolkit
</H1>
<H3>
Version 19980405
</H3>
<P>
<H3>
Version 1.1
</H3>
Copyright (c) 1998 James Clark. Expat is subject to the
<A
HREF=
"MPL-1_0.html"
>
Mozilla Public License Version 1.0
</A>
. You may
<P>
Copyright (c) 1998, 1999 James Clark. Expat is subject to the
<A
not use expat except in compliance with this license. Please contact
HREF=
"http://www.mozilla.org/NPL/NPL-1_1Final.html"
>
Mozilla Public
me if you wish to negotiate an alternative license.
</P><P>
License Version 1.1
</A>
. Alternatively you may use expat under the
<A
Expat is an
<A
HREF=
"http://www.w3.org/TR/1998/REC-xml-19980210"
>
XML
href=
"http://www.gnu.org/copyleft/gpl.html"
>
GNU General Public
1.0
</A>
parser written in C. It aims to be fully conforming. It is
License
</A>
instead. Please contact me if you wish to negotiate an
currently not a validating XML processor.
alternative license.
</P>
Expat can be downloaded from
<A
href =
"ftp://ftp.jclark.com/pub/xml/expat.zip"
>
ftp://ftp.jclark.com/pub/xml/expat.zip
</A>
.
<P>
Expat is an
<A
This is a beta-test version.
</P>
HREF=
"http://www.w3.org/TR/1998/REC-xml-19980210"
>
XML 1.0
</A>
parser
<P>
written in C. It aims to be fully conforming. It is currently not a
The directory
<SAMP>
xmltok
</SAMP>
contains a low-level library for
validating XML processor. The current production version of expat can
tokenizing XML. The interface is documented in
<SAMP>
xmltok/xmltok.h
</SAMP>
.
</P>
be downloaded from
<A
href =
"ftp://ftp.jclark.com/pub/xml/expat.zip"
<P>
>
ftp://ftp.jclark.com/pub/xml/expat.zip
</A>
.
</P>
The directory
<SAMP>
xmlparse
</SAMP>
contains an XML parser library
<P>
The directory
<SAMP>
xmltok
</SAMP>
contains a low-level library for
tokenizing XML. The interface is documented in
<SAMP>
xmltok/xmltok.h
</SAMP>
.
</P>
<P>
The directory
<SAMP>
xmlparse
</SAMP>
contains an XML parser library
which is built on top of the
<SAMP>
xmltok
</SAMP>
library. The
which is built on top of the
<SAMP>
xmltok
</SAMP>
library. The
interface is documented in
<SAMP>
xmlparse/xmlparse.h
</SAMP>
.
</P>
interface is documented in
<SAMP>
xmlparse/xmlparse.h
</SAMP>
. The
<P>
directory
<SAMP>
sample
</SAMP>
contains a simple example program using
The directory
<SAMP>
xmlwf
</SAMP>
contains the
<SAMP>
xmlwf
</SAMP>
this interface;
<SAMP>
sample/build.bat
</SAMP>
is a batch file to build
the example using Visual C++.
</P>
<P>
The directory
<SAMP>
xmlwf
</SAMP>
contains the
<SAMP>
xmlwf
</SAMP>
application, which uses the
<SAMP>
xmlparse
</SAMP>
library. The
application, which uses the
<SAMP>
xmlparse
</SAMP>
library. The
arguments to
<SAMP>
xmlwf
</SAMP>
are one or more files which are each
arguments to
<SAMP>
xmlwf
</SAMP>
are one or more files which are each
to be checked for well-formedness. An option
<SAMP>
-d
to be checked for well-formedness. An option
<SAMP>
-d
...
@@ -33,10 +45,29 @@ file the corresponding <A
...
@@ -33,10 +45,29 @@ file the corresponding <A
href=
"http://www.jclark.com/xml/canonxml.html"
>
canonical XML
</A>
will
href=
"http://www.jclark.com/xml/canonxml.html"
>
canonical XML
</A>
will
be written to
<SAMP>
dir/
<VAR>
f
</VAR></SAMP>
, where
be written to
<SAMP>
dir/
<VAR>
f
</VAR></SAMP>
, where
<SAMP><VAR>
f
</VAR></SAMP>
is the filename (without any path) of the
<SAMP><VAR>
f
</VAR></SAMP>
is the filename (without any path) of the
input file.
</P>
input file. A
<CODE>
-x
</CODE>
option will cause references to
external general entities to be processed. A
<CODE>
-s
</CODE>
option
will make documents that are not standalone cause an error (a document
is considered standalone if either it is intrinsically standalone
because it has no external subset and no references to parameter
entities in the internal subset or it is declared as standalone in the
XML declaration).
</P>
<P>
The
<SAMP>
bin
</SAMP>
directory contains Win32 executables. The
<SAMP>
lib
</SAMP>
directory contains Win32 import libraries.
</P>
<P>
Answers to some frequently asked questions about expat can be found
in the
<A
HREF=
"http://www.jclark.com/xml/expatfaq.html"
>
expat
FAQ
</A>
.
</P>
<P></P>
<P></P>
<ADDRESS>
<ADDRESS>
<A
HREF=
"mailto:jjc@jclark.com"
>
James Clark
</A>
<A
HREF=
"mailto:jjc@jclark.com"
>
James Clark
</A>
</ADDRESS>
</ADDRESS>
</BODY>
</BODY>
</HTML>
</HTML>
lib/python/Shared/DC/xml/pyexpat/expat/expat.mak
View file @
c1aa3d82
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
# TARGTYPE "Win32 (x86) Console Application" 0x0103
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
!IF
"$(CFG)"
==
""
!IF
"$(CFG)"
==
""
CFG
=
xmltok - Win32 Debug
CFG
=
xmltok - Win32 Debug
!MESSAGE
No
configuration
specified.
Defaulting
to
xmltok
-
Win32
Debug.
!MESSAGE
No
configuration
specified.
Defaulting
to
xmltok
-
Win32
Debug.
!ENDIF
!ENDIF
!IF
"$(CFG)"
!=
"xmlwf - Win32 Release"
&&
"$(CFG)"
!=
"xmlwf - Win32 Debug"
&&\
!IF
"$(CFG)"
!=
"xmlwf - Win32 Release"
&&
"$(CFG)"
!=
"xmlwf - Win32 Debug"
&&\
"$(CFG)"
!=
"gennmtab - Win32 Release"
&&
"$(CFG)"
!=
"gennmtab - Win32 Debug"
\
"$(CFG)"
!=
"gennmtab - Win32 Release"
&&
"$(CFG)"
!=
"gennmtab - Win32 Debug"
\
&&
"$(CFG)"
!=
"xmlparse - Win32 Release"
&&
"$(CFG)"
!=\
&&
"$(CFG)"
!=
"xmlparse - Win32 Release"
&&
"$(CFG)"
!=\
"xmlparse - Win32 Debug"
&&
"$(CFG)"
!=
"xmltok - Win32 Release"
&&
"$(CFG)"
!=\
"xmlparse - Win32 Debug"
&&
"$(CFG)"
!=
"xmltok - Win32 Release"
&&
"$(CFG)"
!=\
"xmltok - Win32 Debug"
"xmltok - Win32 Debug"
!MESSAGE
Invalid
configuration
"$(CFG)"
specified.
!MESSAGE
Invalid
configuration
"$(CFG)"
specified.
!MESSAGE
You
can
specify
a
configuration
when
running
NMAKE
on
this
makefile
!MESSAGE
You
can
specify
a
configuration
when
running
NMAKE
on
this
makefile
!MESSAGE by defining the macro CFG on the command line. For example
:
!MESSAGE by defining the macro CFG on the command line. For example
:
!MESSAGE
!MESSAGE
!MESSAGE
NMAKE
/f
"expat.mak"
CFG
=
"xmltok - Win32 Debug"
!MESSAGE
NMAKE
/f
"expat.mak"
CFG
=
"xmltok - Win32 Debug"
!MESSAGE
!MESSAGE
!MESSAGE Possible choices for configuration are
:
!MESSAGE Possible choices for configuration are
:
!MESSAGE
!MESSAGE
!MESSAGE
"xmlwf - Win32 Release"
(based
on
"Win32 (x86) Console Application"
)
!MESSAGE
"xmlwf - Win32 Release"
(based
on
"Win32 (x86) Console Application"
)
!MESSAGE
"xmlwf - Win32 Debug"
(based
on
"Win32 (x86) Console Application"
)
!MESSAGE
"xmlwf - Win32 Debug"
(based
on
"Win32 (x86) Console Application"
)
!MESSAGE
"gennmtab - Win32 Release"
(based
on\
!MESSAGE
"gennmtab - Win32 Release"
(based
on\
"Win32 (x86) Console Application"
)
"Win32 (x86) Console Application"
)
!MESSAGE
"gennmtab - Win32 Debug"
(based
on
"Win32 (x86) Console Application"
)
!MESSAGE
"gennmtab - Win32 Debug"
(based
on
"Win32 (x86) Console Application"
)
!MESSAGE
"xmlparse - Win32 Release"
(based
on\
!MESSAGE
"xmlparse - Win32 Release"
(based
on\
"Win32 (x86) Dynamic-Link Library"
)
"Win32 (x86) Dynamic-Link Library"
)
!MESSAGE
"xmlparse - Win32 Debug"
(based
on
"Win32 (x86) Dynamic-Link Library"
)
!MESSAGE
"xmlparse - Win32 Debug"
(based
on
"Win32 (x86) Dynamic-Link Library"
)
!MESSAGE
"xmltok - Win32 Release"
(based
on
"Win32 (x86) Dynamic-Link Library"
)
!MESSAGE
"xmltok - Win32 Release"
(based
on
"Win32 (x86) Dynamic-Link Library"
)
!MESSAGE
"xmltok - Win32 Debug"
(based
on
"Win32 (x86) Dynamic-Link Library"
)
!MESSAGE
"xmltok - Win32 Debug"
(based
on
"Win32 (x86) Dynamic-Link Library"
)
!MESSAGE
!MESSAGE
!ERROR
An
invalid
configuration
is
specified.
!ERROR
An
invalid
configuration
is
specified.
!ENDIF
!ENDIF
!IF
"$(OS)"
==
"Windows_NT"
!IF
"$(OS)"
==
"Windows_NT"
NULL
=
NULL
=
!ELSE
!ELSE
NULL
=
nul
NULL
=
nul
!ENDIF
!ENDIF
################################################################################
################################################################################
# Begin Project
# Begin Project
# PROP Target_Last_Scanned "xmltok - Win32 Debug"
# PROP Target_Last_Scanned "xmltok - Win32 Debug"
!IF
"$(CFG)"
==
"xmlwf - Win32 Release"
!IF
"$(CFG)"
==
"xmlwf - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "xmlwf\Release"
# PROP BASE Output_Dir "xmlwf\Release"
# PROP BASE Intermediate_Dir "xmlwf\Release"
# PROP BASE Intermediate_Dir "xmlwf\Release"
# PROP BASE Target_Dir "xmlwf"
# PROP BASE Target_Dir "xmlwf"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "xmlwf\Release"
# PROP Output_Dir "xmlwf\Release"
# PROP Intermediate_Dir "xmlwf\Release"
# PROP Intermediate_Dir "xmlwf\Release"
# PROP Target_Dir "xmlwf"
# PROP Target_Dir "xmlwf"
OUTDIR
=
.
\x
mlwf
\R
elease
OUTDIR
=
.
\x
mlwf
\R
elease
INTDIR
=
.
\x
mlwf
\R
elease
INTDIR
=
.
\x
mlwf
\R
elease
ALL
:
"xmlparse - Win32 Release" ".
\b
in
\x
mlwf.exe"
ALL
:
"xmlparse - Win32 Release" ".
\b
in
\x
mlwf.exe"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\c
odepage.obj"
-
@erase
"
$(INTDIR)
\w
in32filemap.obj"
-
@erase
"
$(INTDIR)
\w
in32filemap.obj"
-
@erase
"
$(INTDIR)
\x
mlwf.obj"
-
@erase
"
$(INTDIR)
\x
mlwf.obj"
-
@erase
".
\b
in
\x
mlwf.exe"
-
@erase
".
\b
in
\x
mlwf.exe"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "xmlparse" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "xmlparse" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
CPP_PROJ
=
/nologo /ML /W3 /GX /O2 /I
"."
/I
"xmlparse"
/D
"NDEBUG"
/D
"WIN32"
/D
\
CPP_PROJ
=
/nologo /ML /W3 /GX /O2 /I
"."
/I
"xmlparse"
/D
"NDEBUG"
/D
"WIN32"
/D
\
"_CONSOLE"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
"_CONSOLE"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
XMLPARSEAPI
=
__declspec
(
dllimport
)
/Fp
"
$(INTDIR)
/xmlwf.pch"
/YX /Fo
"
$(INTDIR)
/"
\
XMLPARSEAPI
=
__declspec
(
dllimport
)
/Fp
"
$(INTDIR)
/xmlwf.pch"
/YX /Fo
"
$(INTDIR)
/"
\
/c
/c
CPP_OBJS
=
.
\x
mlwf
\R
elease/
CPP_OBJS
=
.
\x
mlwf
\R
elease/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlwf.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlwf.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
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 BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"bin/xmlwf.exe"
# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"bin/xmlwf.exe"
LINK32_FLAGS
=
setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib
\
LINK32_FLAGS
=
setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib
\
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib\
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib\
odbc32.lib odbccp32.lib /nologo /subsystem
:
console /incremental:no
\
odbc32.lib odbccp32.lib /nologo /subsystem
:
console /incremental:no
\
/pdb
:
"$(OUTDIR)/xmlwf.pdb" /machine:I386 /out:"bin/xmlwf.exe"
/pdb
:
"$(OUTDIR)/xmlwf.pdb" /machine:I386 /out:"bin/xmlwf.exe"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\codepage.obj"
\
"$(INTDIR)\win32filemap.obj"
\
"$(INTDIR)\win32filemap.obj"
\
"$(INTDIR)\xmlwf.obj"
\
"$(INTDIR)\xmlwf.obj"
\
".\xmlparse\Release\xmlparse.lib"
".\xmlparse\Release\xmlparse.lib"
".\bin\xmlwf.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
".\bin\xmlwf.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ELSEIF
"$(CFG)"
==
"xmlwf - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmlwf - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "xmlwf\Debug"
# PROP BASE Output_Dir "xmlwf\Debug"
# PROP BASE Intermediate_Dir "xmlwf\Debug"
# PROP BASE Intermediate_Dir "xmlwf\Debug"
# PROP BASE Target_Dir "xmlwf"
# PROP BASE Target_Dir "xmlwf"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "xmlwf\Debug"
# PROP Output_Dir "xmlwf\Debug"
# PROP Intermediate_Dir "xmlwf\Debug"
# PROP Intermediate_Dir "xmlwf\Debug"
# PROP Target_Dir "xmlwf"
# PROP Target_Dir "xmlwf"
OUTDIR
=
.
\x
mlwf
\D
ebug
OUTDIR
=
.
\x
mlwf
\D
ebug
INTDIR
=
.
\x
mlwf
\D
ebug
INTDIR
=
.
\x
mlwf
\D
ebug
ALL
:
"xmlparse - Win32 Debug" ".
\d
bgbin
\x
mlwf.exe"
ALL
:
"xmlparse - Win32 Debug" ".
\d
bgbin
\x
mlwf.exe"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\c
odepage.obj"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(INTDIR)
\w
in32filemap.obj"
-
@erase
"
$(INTDIR)
\w
in32filemap.obj"
-
@erase
"
$(INTDIR)
\x
mlwf.obj"
-
@erase
"
$(INTDIR)
\x
mlwf.obj"
-
@erase
"
$(OUTDIR)
\x
mlwf.pdb"
-
@erase
"
$(OUTDIR)
\x
mlwf.pdb"
-
@erase
".
\d
bgbin
\x
mlwf.exe"
-
@erase
".
\d
bgbin
\x
mlwf.exe"
-
@erase
".
\d
bgbin
\x
mlwf.ilk"
-
@erase
".
\d
bgbin
\x
mlwf.ilk"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "xmlparse" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "xmlparse" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
CPP_PROJ
=
/nologo /MDd /W3 /Gm /GX /Zi /Od /I
"."
/I
"xmlparse"
/D
"_DEBUG"
/D
\
CPP_PROJ
=
/nologo /MDd /W3 /Gm /GX /Zi /Od /I
"."
/I
"xmlparse"
/D
"_DEBUG"
/D
\
"WIN32"
/D
"_CONSOLE"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
"WIN32"
/D
"_CONSOLE"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
XMLPARSEAPI
=
__declspec
(
dllimport
)
/Fp
"
$(INTDIR)
/xmlwf.pch"
/YX /Fo
"
$(INTDIR)
/"
\
XMLPARSEAPI
=
__declspec
(
dllimport
)
/Fp
"
$(INTDIR)
/xmlwf.pch"
/YX /Fo
"
$(INTDIR)
/"
\
/Fd
"$(INTDIR)/"
/c
/Fd
"$(INTDIR)/"
/c
CPP_OBJS
=
.
\x
mlwf
\D
ebug/
CPP_OBJS
=
.
\x
mlwf
\D
ebug/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlwf.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlwf.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
LINK32
=
link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
LINK32_FLAGS
=
setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib
\
LINK32_FLAGS
=
setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib
\
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib\
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib\
odbc32.lib odbccp32.lib /nologo /subsystem
:
console /incremental:yes
\
odbc32.lib odbccp32.lib /nologo /subsystem
:
console /incremental:yes
\
/pdb
:
"$(OUTDIR)/xmlwf.pdb" /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
/pdb
:
"$(OUTDIR)/xmlwf.pdb" /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\codepage.obj"
\
"$(INTDIR)\win32filemap.obj"
\
"$(INTDIR)\win32filemap.obj"
\
"$(INTDIR)\xmlwf.obj"
\
"$(INTDIR)\xmlwf.obj"
\
".\xmlparse\Debug\xmlparse.lib"
".\xmlparse\Debug\xmlparse.lib"
".\dbgbin\xmlwf.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
".\dbgbin\xmlwf.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ELSEIF
"$(CFG)"
==
"gennmtab - Win32 Release"
!ELSEIF
"$(CFG)"
==
"gennmtab - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "gennmtab\Release"
# PROP BASE Output_Dir "gennmtab\Release"
# PROP BASE Intermediate_Dir "gennmtab\Release"
# PROP BASE Intermediate_Dir "gennmtab\Release"
# PROP BASE Target_Dir "gennmtab"
# PROP BASE Target_Dir "gennmtab"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "gennmtab\Release"
# PROP Output_Dir "gennmtab\Release"
# PROP Intermediate_Dir "gennmtab\Release"
# PROP Intermediate_Dir "gennmtab\Release"
# PROP Target_Dir "gennmtab"
# PROP Target_Dir "gennmtab"
OUTDIR
=
.
\g
ennmtab
\R
elease
OUTDIR
=
.
\g
ennmtab
\R
elease
INTDIR
=
.
\g
ennmtab
\R
elease
INTDIR
=
.
\g
ennmtab
\R
elease
ALL
:
"$(OUTDIR)
\g
ennmtab.exe"
ALL
:
"$(OUTDIR)
\g
ennmtab.exe"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\g
ennmtab.obj"
-
@erase
"
$(INTDIR)
\g
ennmtab.obj"
-
@erase
"
$(OUTDIR)
\g
ennmtab.exe"
-
@erase
"
$(OUTDIR)
\g
ennmtab.exe"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
CPP_PROJ
=
/nologo /ML /W3 /GX /O2 /D
"WIN32"
/D
"NDEBUG"
/D
"_CONSOLE"
\
CPP_PROJ
=
/nologo /ML /W3 /GX /O2 /D
"WIN32"
/D
"NDEBUG"
/D
"_CONSOLE"
\
/Fp
"$(INTDIR)/gennmtab.pch"
/YX
/Fo
"$(INTDIR)/"
/c
/Fp
"$(INTDIR)/gennmtab.pch"
/YX
/Fo
"$(INTDIR)/"
/c
CPP_OBJS
=
.
\g
ennmtab
\R
elease/
CPP_OBJS
=
.
\g
ennmtab
\R
elease/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/gennmtab.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/gennmtab.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
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 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
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
odbccp32.lib /nologo /subsystem
:
console /incremental:no
\
odbccp32.lib /nologo /subsystem
:
console /incremental:no
\
/pdb
:
"$(OUTDIR)/gennmtab.pdb" /machine:I386 /out:"$(OUTDIR)/gennmtab.exe"
/pdb
:
"$(OUTDIR)/gennmtab.pdb" /machine:I386 /out:"$(OUTDIR)/gennmtab.exe"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\gennmtab.obj"
"$(INTDIR)\gennmtab.obj"
"$(OUTDIR)\gennmtab.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
"$(OUTDIR)\gennmtab.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ELSEIF
"$(CFG)"
==
"gennmtab - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"gennmtab - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "gennmtab\Debug"
# PROP BASE Output_Dir "gennmtab\Debug"
# PROP BASE Intermediate_Dir "gennmtab\Debug"
# PROP BASE Intermediate_Dir "gennmtab\Debug"
# PROP BASE Target_Dir "gennmtab"
# PROP BASE Target_Dir "gennmtab"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "gennmtab\Debug"
# PROP Output_Dir "gennmtab\Debug"
# PROP Intermediate_Dir "gennmtab\Debug"
# PROP Intermediate_Dir "gennmtab\Debug"
# PROP Target_Dir "gennmtab"
# PROP Target_Dir "gennmtab"
OUTDIR
=
.
\g
ennmtab
\D
ebug
OUTDIR
=
.
\g
ennmtab
\D
ebug
INTDIR
=
.
\g
ennmtab
\D
ebug
INTDIR
=
.
\g
ennmtab
\D
ebug
ALL
:
"$(OUTDIR)
\g
ennmtab.exe"
ALL
:
"$(OUTDIR)
\g
ennmtab.exe"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\g
ennmtab.obj"
-
@erase
"
$(INTDIR)
\g
ennmtab.obj"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(OUTDIR)
\g
ennmtab.exe"
-
@erase
"
$(OUTDIR)
\g
ennmtab.exe"
-
@erase
"
$(OUTDIR)
\g
ennmtab.ilk"
-
@erase
"
$(OUTDIR)
\g
ennmtab.ilk"
-
@erase
"
$(OUTDIR)
\g
ennmtab.pdb"
-
@erase
"
$(OUTDIR)
\g
ennmtab.pdb"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
CPP_PROJ
=
/nologo /MLd /W3 /Gm /GX /Zi /Od /D
"WIN32"
/D
"_DEBUG"
/D
"_CONSOLE"
\
CPP_PROJ
=
/nologo /MLd /W3 /Gm /GX /Zi /Od /D
"WIN32"
/D
"_DEBUG"
/D
"_CONSOLE"
\
/Fp
"$(INTDIR)/gennmtab.pch"
/YX
/Fo
"$(INTDIR)/"
/Fd
"$(INTDIR)/"
/c
/Fp
"$(INTDIR)/gennmtab.pch"
/YX
/Fo
"$(INTDIR)/"
/Fd
"$(INTDIR)/"
/c
CPP_OBJS
=
.
\g
ennmtab
\D
ebug/
CPP_OBJS
=
.
\g
ennmtab
\D
ebug/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/gennmtab.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/gennmtab.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
LINK32
=
link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
odbccp32.lib /nologo /subsystem
:
console /incremental:yes
\
odbccp32.lib /nologo /subsystem
:
console /incremental:yes
\
/pdb
:
"$(OUTDIR)/gennmtab.pdb" /debug /machine:I386
\
/pdb
:
"$(OUTDIR)/gennmtab.pdb" /debug /machine:I386
\
/out
:
"$(OUTDIR)/gennmtab.exe"
/out
:
"$(OUTDIR)/gennmtab.exe"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\gennmtab.obj"
"$(INTDIR)\gennmtab.obj"
"$(OUTDIR)\gennmtab.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
"$(OUTDIR)\gennmtab.exe"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Release"
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "xmlparse\Release"
# PROP BASE Output_Dir "xmlparse\Release"
# PROP BASE Intermediate_Dir "xmlparse\Release"
# PROP BASE Intermediate_Dir "xmlparse\Release"
# PROP BASE Target_Dir "xmlparse"
# PROP BASE Target_Dir "xmlparse"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "xmlparse\Release"
# PROP Output_Dir "xmlparse\Release"
# PROP Intermediate_Dir "xmlparse\Release"
# PROP Intermediate_Dir "xmlparse\Release"
# PROP Target_Dir "xmlparse"
# PROP Target_Dir "xmlparse"
OUTDIR
=
.
\x
mlparse
\R
elease
OUTDIR
=
.
\x
mlparse
\R
elease
INTDIR
=
.
\x
mlparse
\R
elease
INTDIR
=
.
\x
mlparse
\R
elease
ALL
:
"xmltok - Win32 Release" ".
\b
in
\x
mlparse.dll"
ALL
:
"xmltok - Win32 Release" ".
\b
in
\x
mlparse.dll"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\h
ashtable.obj"
-
@erase
"
$(INTDIR)
\h
ashtable.obj"
-
@erase
"
$(INTDIR)
\x
mlparse.obj"
-
@erase
"
$(INTDIR)
\x
mlparse.obj"
-
@erase
"
$(OUTDIR)
\x
mlparse.exp"
-
@erase
"
$(OUTDIR)
\x
mlparse.exp"
-
@erase
"
$(OUTDIR)
\x
mlparse.lib"
-
@erase
"
$(OUTDIR)
\x
mlparse.lib"
-
@erase
".
\b
in
\x
mlparse.dll"
-
@erase
".
\b
in
\x
mlparse.dll"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "xmltok" /I "xmlwf" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "xmltok" /I "xmlwf" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
CPP_PROJ
=
/nologo /ML /W3 /GX /O2 /I
"xmltok"
/I
"xmlwf"
/D
"NDEBUG"
/D
"WIN32"
\
CPP_PROJ
=
/nologo /ML /W3 /GX /O2 /I
"xmltok"
/I
"xmlwf"
/D
"NDEBUG"
/D
"WIN32"
\
/D
"_WINDOWS"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
/D
"_WINDOWS"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
XMLPARSEAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmlparse.pch"
/YX
\
XMLPARSEAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmlparse.pch"
/YX
\
/Fo
"$(INTDIR)/"
/c
/Fo
"$(INTDIR)/"
/c
CPP_OBJS
=
.
\x
mlparse
\R
elease/
CPP_OBJS
=
.
\x
mlparse
\R
elease/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
MTL
=
mktyplib.exe
MTL
=
mktyplib.exe
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ
=
/nologo /D
"NDEBUG"
/win32
MTL_PROJ
=
/nologo /D
"NDEBUG"
/win32
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlparse.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlparse.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
LINK32
=
link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:0x20000000 /subsystem:windows /dll /machine:I386 /out:"bin/xmlparse.dll"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"bin/xmlparse.dll"
# SUBTRACT LINK32 /profile
# SUBTRACT LINK32 /profile
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
odbccp32.lib /nologo /base
:
0x20000000 /subsystem:windows /dll /incremental:no
\
odbccp32.lib /nologo /subsystem
:
windows /dll /incremental:no
\
/pdb
:
"$(OUTDIR)/xmlparse.pdb" /machine:I386 /out:"bin/xmlparse.dll"
\
/pdb
:
"$(OUTDIR)/xmlparse.pdb" /machine:I386 /out:"bin/xmlparse.dll"
\
/implib
:
"$(OUTDIR)/xmlparse.lib"
/implib
:
"$(OUTDIR)/xmlparse.lib"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\hashtable.obj"
\
"$(INTDIR)\hashtable.obj"
\
"$(INTDIR)\xmlparse.obj"
\
"$(INTDIR)\xmlparse.obj"
\
".\xmltok\Release\xmltok.lib"
".\xmltok\Release\xmltok.lib"
".\bin\xmlparse.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
".\bin\xmlparse.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "xmlparse\Debug"
# PROP BASE Output_Dir "xmlparse\Debug"
# PROP BASE Intermediate_Dir "xmlparse\Debug"
# PROP BASE Intermediate_Dir "xmlparse\Debug"
# PROP BASE Target_Dir "xmlparse"
# PROP BASE Target_Dir "xmlparse"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "xmlparse\Debug"
# PROP Output_Dir "xmlparse\Debug"
# PROP Intermediate_Dir "xmlparse\Debug"
# PROP Intermediate_Dir "xmlparse\Debug"
# PROP Target_Dir "xmlparse"
# PROP Target_Dir "xmlparse"
OUTDIR
=
.
\x
mlparse
\D
ebug
OUTDIR
=
.
\x
mlparse
\D
ebug
INTDIR
=
.
\x
mlparse
\D
ebug
INTDIR
=
.
\x
mlparse
\D
ebug
ALL
:
"xmltok - Win32 Debug" ".
\d
bgbin
\x
mlparse.dll"
ALL
:
"xmltok - Win32 Debug" ".
\d
bgbin
\x
mlparse.dll"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\h
ashtable.obj"
-
@erase
"
$(INTDIR)
\h
ashtable.obj"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(INTDIR)
\x
mlparse.obj"
-
@erase
"
$(INTDIR)
\x
mlparse.obj"
-
@erase
"
$(OUTDIR)
\x
mlparse.exp"
-
@erase
"
$(OUTDIR)
\x
mlparse.exp"
-
@erase
"
$(OUTDIR)
\x
mlparse.lib"
-
@erase
"
$(OUTDIR)
\x
mlparse.lib"
-
@erase
"
$(OUTDIR)
\x
mlparse.pdb"
-
@erase
"
$(OUTDIR)
\x
mlparse.pdb"
-
@erase
".
\d
bgbin
\x
mlparse.dll"
-
@erase
".
\d
bgbin
\x
mlparse.dll"
-
@erase
".
\d
bgbin
\x
mlparse.ilk"
-
@erase
".
\d
bgbin
\x
mlparse.ilk"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "xmltok" /I "xmlwf" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "xmltok" /I "xmlwf" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
CPP_PROJ
=
/nologo /MDd /W3 /Gm /GX /Zi /Od /I
"xmltok"
/I
"xmlwf"
/D
"_DEBUG"
/D
\
CPP_PROJ
=
/nologo /MDd /W3 /Gm /GX /Zi /Od /I
"xmltok"
/I
"xmlwf"
/D
"_DEBUG"
/D
\
"WIN32"
/D
"_WINDOWS"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
"WIN32"
/D
"_WINDOWS"
/D
XMLTOKAPI
=
__declspec
(
dllimport
)
/D
\
XMLPARSEAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmlparse.pch"
/YX
\
XMLPARSEAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmlparse.pch"
/YX
\
/Fo
"$(INTDIR)/"
/Fd
"$(INTDIR)/"
/c
/Fo
"$(INTDIR)/"
/Fd
"$(INTDIR)/"
/c
CPP_OBJS
=
.
\x
mlparse
\D
ebug/
CPP_OBJS
=
.
\x
mlparse
\D
ebug/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
MTL
=
mktyplib.exe
MTL
=
mktyplib.exe
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ
=
/nologo /D
"_DEBUG"
/win32
MTL_PROJ
=
/nologo /D
"_DEBUG"
/win32
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlparse.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmlparse.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
LINK32
=
link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:0x20000000 /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmlparse.dll"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmlparse.dll"
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
odbccp32.lib /nologo /base
:
0x20000000 /subsystem:windows /dll /incremental:yes
\
odbccp32.lib /nologo /subsystem
:
windows /dll /incremental:yes
\
/pdb
:
"$(OUTDIR)/xmlparse.pdb" /debug /machine:I386 /out:"dbgbin/xmlparse.dll"
\
/pdb
:
"$(OUTDIR)/xmlparse.pdb" /debug /machine:I386 /out:"dbgbin/xmlparse.dll"
\
/implib
:
"$(OUTDIR)/xmlparse.lib"
/implib
:
"$(OUTDIR)/xmlparse.lib"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\hashtable.obj"
\
"$(INTDIR)\hashtable.obj"
\
"$(INTDIR)\xmlparse.obj"
\
"$(INTDIR)\xmlparse.obj"
\
".\xmltok\Debug\xmltok.lib"
".\xmltok\Debug\xmltok.lib"
".\dbgbin\xmlparse.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
".\dbgbin\xmlparse.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Release"
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "xmltok\Release"
# PROP BASE Output_Dir "xmltok\Release"
# PROP BASE Intermediate_Dir "xmltok\Release"
# PROP BASE Intermediate_Dir "xmltok\Release"
# PROP BASE Target_Dir "xmltok"
# PROP BASE Target_Dir "xmltok"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "xmltok\Release"
# PROP Output_Dir "xmltok\Release"
# PROP Intermediate_Dir "xmltok\Release"
# PROP Intermediate_Dir "xmltok\Release"
# PROP Target_Dir "xmltok"
# PROP Target_Dir "xmltok"
OUTDIR
=
.
\x
mltok
\R
elease
OUTDIR
=
.
\x
mltok
\R
elease
INTDIR
=
.
\x
mltok
\R
elease
INTDIR
=
.
\x
mltok
\R
elease
ALL
:
".
\b
in
\x
mltok.dll"
ALL
:
".
\b
in
\x
mltok.dll"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\d
llmain.obj"
-
@erase
"
$(INTDIR)
\d
llmain.obj"
-
@erase
"
$(INTDIR)
\x
mlrole.obj"
-
@erase
"
$(INTDIR)
\x
mlrole.obj"
-
@erase
"
$(INTDIR)
\x
mltok.obj"
-
@erase
"
$(INTDIR)
\x
mltok.obj"
-
@erase
"
$(OUTDIR)
\x
mltok.exp"
-
@erase
"
$(OUTDIR)
\x
mltok.exp"
-
@erase
"
$(OUTDIR)
\x
mltok.lib"
-
@erase
"
$(OUTDIR)
\x
mltok.lib"
-
@erase
".
\b
in
\x
mltok.dll"
-
@erase
".
\b
in
\x
mltok.dll"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
CPP_PROJ
=
/nologo /MT /W3 /GX /O2 /D
"NDEBUG"
/D
"WIN32"
/D
"_WINDOWS"
/D
\
CPP_PROJ
=
/nologo /MT /W3 /GX /O2 /D
"NDEBUG"
/D
"WIN32"
/D
"_WINDOWS"
/D
\
XMLTOKAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmltok.pch"
/YX /Fo
"
$(INTDIR)
/"
\
XMLTOKAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmltok.pch"
/YX /Fo
"
$(INTDIR)
/"
\
/c
/c
CPP_OBJS
=
.
\x
mltok
\R
elease/
CPP_OBJS
=
.
\x
mltok
\R
elease/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
MTL
=
mktyplib.exe
MTL
=
mktyplib.exe
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ
=
/nologo /D
"NDEBUG"
/win32
MTL_PROJ
=
/nologo /D
"NDEBUG"
/win32
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmltok.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmltok.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
LINK32
=
link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"bin/xmltok.dll"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"bin/xmltok.dll"
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
odbccp32.lib /nologo /entry
:
"DllMain" /subsystem:windows /dll /incremental:no
\
odbccp32.lib /nologo /entry
:
"DllMain" /subsystem:windows /dll /incremental:no
\
/pdb
:
"$(OUTDIR)/xmltok.pdb" /machine:I386 /out:"bin/xmltok.dll"
\
/pdb
:
"$(OUTDIR)/xmltok.pdb" /machine:I386 /out:"bin/xmltok.dll"
\
/implib
:
"$(OUTDIR)/xmltok.lib"
/implib
:
"$(OUTDIR)/xmltok.lib"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\dllmain.obj"
\
"$(INTDIR)\dllmain.obj"
\
"$(INTDIR)\xmlrole.obj"
\
"$(INTDIR)\xmlrole.obj"
\
"$(INTDIR)\xmltok.obj"
"$(INTDIR)\xmltok.obj"
".\bin\xmltok.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
".\bin\xmltok.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "xmltok\Debug"
# PROP BASE Output_Dir "xmltok\Debug"
# PROP BASE Intermediate_Dir "xmltok\Debug"
# PROP BASE Intermediate_Dir "xmltok\Debug"
# PROP BASE Target_Dir "xmltok"
# PROP BASE Target_Dir "xmltok"
# PROP Use_MFC 0
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "xmltok\Debug"
# PROP Output_Dir "xmltok\Debug"
# PROP Intermediate_Dir "xmltok\Debug"
# PROP Intermediate_Dir "xmltok\Debug"
# PROP Target_Dir "xmltok"
# PROP Target_Dir "xmltok"
OUTDIR
=
.
\x
mltok
\D
ebug
OUTDIR
=
.
\x
mltok
\D
ebug
INTDIR
=
.
\x
mltok
\D
ebug
INTDIR
=
.
\x
mltok
\D
ebug
ALL
:
".
\d
bgbin
\x
mltok.dll"
ALL
:
".
\d
bgbin
\x
mltok.dll"
CLEAN
:
CLEAN
:
-
@erase
"
$(INTDIR)
\d
llmain.obj"
-
@erase
"
$(INTDIR)
\d
llmain.obj"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.idb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(INTDIR)
\v
c40.pdb"
-
@erase
"
$(INTDIR)
\x
mlrole.obj"
-
@erase
"
$(INTDIR)
\x
mlrole.obj"
-
@erase
"
$(INTDIR)
\x
mltok.obj"
-
@erase
"
$(INTDIR)
\x
mltok.obj"
-
@erase
"
$(OUTDIR)
\x
mltok.exp"
-
@erase
"
$(OUTDIR)
\x
mltok.exp"
-
@erase
"
$(OUTDIR)
\x
mltok.lib"
-
@erase
"
$(OUTDIR)
\x
mltok.lib"
-
@erase
"
$(OUTDIR)
\x
mltok.pdb"
-
@erase
"
$(OUTDIR)
\x
mltok.pdb"
-
@erase
".
\d
bgbin
\x
mltok.dll"
-
@erase
".
\d
bgbin
\x
mltok.dll"
-
@erase
".
\d
bgbin
\x
mltok.ilk"
-
@erase
".
\d
bgbin
\x
mltok.ilk"
"$(OUTDIR)"
:
"$(OUTDIR)"
:
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
if
not
exist
"$(OUTDIR)/$(NULL)"
mkdir
"$(OUTDIR)"
CPP
=
cl.exe
CPP
=
cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
CPP_PROJ
=
/nologo /MTd /W3 /Gm /GX /Zi /Od /D
"_DEBUG"
/D
"WIN32"
/D
"_WINDOWS"
\
CPP_PROJ
=
/nologo /MTd /W3 /Gm /GX /Zi /Od /D
"_DEBUG"
/D
"WIN32"
/D
"_WINDOWS"
\
/D
XMLTOKAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmltok.pch"
/YX
\
/D
XMLTOKAPI
=
__declspec
(
dllexport
)
/Fp
"
$(INTDIR)
/xmltok.pch"
/YX
\
/Fo
"$(INTDIR)/"
/Fd
"$(INTDIR)/"
/c
/Fo
"$(INTDIR)/"
/Fd
"$(INTDIR)/"
/c
CPP_OBJS
=
.
\x
mltok
\D
ebug/
CPP_OBJS
=
.
\x
mltok
\D
ebug/
CPP_SBRS
=
.
\.
CPP_SBRS
=
.
\.
.c{$(CPP_OBJS)}.obj
:
.c{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_OBJS)}.obj
:
.cpp{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_OBJS)}.obj
:
.cxx{$(CPP_OBJS)}.obj
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.c{$(CPP_SBRS)}.sbr
:
.c{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cpp{$(CPP_SBRS)}.sbr
:
.cpp{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
.cxx{$(CPP_SBRS)}.sbr
:
.cxx{$(CPP_SBRS)}.sbr
:
$(CPP)
$(CPP_PROJ)
$<
$(CPP)
$(CPP_PROJ)
$<
MTL
=
mktyplib.exe
MTL
=
mktyplib.exe
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ
=
/nologo /D
"_DEBUG"
/win32
MTL_PROJ
=
/nologo /D
"_DEBUG"
/win32
RSC
=
rc.exe
RSC
=
rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32
=
bscmake.exe
BSC32
=
bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmltok.bsc"
BSC32_FLAGS
=
/nologo /o
"
$(OUTDIR)
/xmltok.bsc"
BSC32_SBRS
=
\
BSC32_SBRS
=
\
LINK32
=
link.exe
LINK32
=
link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmltok.dll"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmltok.dll"
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
LINK32_FLAGS
=
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib\
odbccp32.lib /nologo /subsystem
:
windows /dll /incremental:yes
\
odbccp32.lib /nologo /subsystem
:
windows /dll /incremental:yes
\
/pdb
:
"$(OUTDIR)/xmltok.pdb" /debug /machine:I386 /out:"dbgbin/xmltok.dll"
\
/pdb
:
"$(OUTDIR)/xmltok.pdb" /debug /machine:I386 /out:"dbgbin/xmltok.dll"
\
/implib
:
"$(OUTDIR)/xmltok.lib"
/implib
:
"$(OUTDIR)/xmltok.lib"
LINK32_OBJS
=
\
LINK32_OBJS
=
\
"$(INTDIR)\dllmain.obj"
\
"$(INTDIR)\dllmain.obj"
\
"$(INTDIR)\xmlrole.obj"
\
"$(INTDIR)\xmlrole.obj"
\
"$(INTDIR)\xmltok.obj"
"$(INTDIR)\xmltok.obj"
".\dbgbin\xmltok.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
".\dbgbin\xmltok.dll"
:
"$(OUTDIR)"
$(DEF_FILE)
$(LINK32_OBJS)
$(LINK32)
@<<
$(LINK32)
@<<
$(LINK32_FLAGS)
$(LINK32_OBJS)
$(LINK32_FLAGS)
$(LINK32_OBJS)
<<
<<
!ENDIF
!ENDIF
################################################################################
################################################################################
# Begin Target
# Begin Target
# Name "xmlwf - Win32 Release"
# Name "xmlwf - Win32 Release"
# Name "xmlwf - Win32 Debug"
# Name "xmlwf - Win32 Debug"
!IF
"$(CFG)"
==
"xmlwf - Win32 Release"
!IF
"$(CFG)"
==
"xmlwf - Win32 Release"
!ELSEIF
"$(CFG)"
==
"xmlwf - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmlwf - Win32 Debug"
!ENDIF
!ENDIF
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mlwf
\x
mlwf.c
SOURCE
=
.
\x
mlwf
\x
mlwf.c
DEP_CPP_XMLWF
=
\
DEP_CPP_XMLWF
=
\
".\xmlparse\xmlparse.h"
\
".\xmlparse\xmlparse.h"
\
".\xmlwf\codepage.h"
\
".\xmlwf\filemap.h"
\
".\xmlwf\filemap.h"
\
"$(INTDIR)\xmlwf.obj"
:
$(SOURCE)
$(DEP_CPP_XMLWF)
"$(INTDIR)"
"$(INTDIR)\xmlwf.obj"
:
$(SOURCE)
$(DEP_CPP_XMLWF)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
$(CPP)
$(CPP_PROJ)
$(SOURCE)
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mlwf
\w
in32filemap.c
SOURCE
=
.
\x
mlwf
\w
in32filemap.c
DEP_CPP_WIN32
=
\
DEP_CPP_WIN32
=
\
".\xmlwf\filemap.h"
\
".\xmlwf\filemap.h"
\
"$(INTDIR)\win32filemap.obj"
:
$(SOURCE)
$(DEP_CPP_WIN32)
"$(INTDIR)"
"$(INTDIR)\win32filemap.obj"
:
$(SOURCE)
$(DEP_CPP_WIN32)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
$(CPP)
$(CPP_PROJ)
$(SOURCE)
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mlwf
\u
nixfilemap.c
SOURCE
=
.
\x
mlwf
\u
nixfilemap.c
DEP_CPP_UNIXF
=
\
DEP_CPP_UNIXF
=
\
".\xmlwf\filemap.h"
\
".\xmlwf\filemap.h"
\
{$(INCLUDE)}
"\sys\stat.h"
\
{$(INCLUDE)}
"\sys\stat.h"
\
{$(INCLUDE)}
"\sys\TYPES.H"
\
{$(INCLUDE)}
"\sys\TYPES.H"
\
# PROP Exclude_From_Build 1
# PROP Exclude_From_Build 1
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mlwf
\r
eadfilemap.c
SOURCE
=
.
\x
mlwf
\r
eadfilemap.c
DEP_CPP_READF
=
\
DEP_CPP_READF
=
\
{$(INCLUDE)}
"\sys\stat.h"
\
{$(INCLUDE)}
"\sys\stat.h"
\
{$(INCLUDE)}
"\sys\TYPES.H"
\
{$(INCLUDE)}
"\sys\TYPES.H"
\
# PROP Exclude_From_Build 1
# PROP Exclude_From_Build 1
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Project Dependency
# Begin Project Dependency
# Project_Dep_Name "xmlparse"
# Project_Dep_Name "xmlparse"
!IF
"$(CFG)"
==
"xmlwf - Win32 Release"
!IF
"$(CFG)"
==
"xmlwf - Win32 Release"
"xmlparse - Win32 Release"
:
"xmlparse - Win32 Release"
:
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmlparse - Win32 Release"
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmlparse - Win32 Release"
!ELSEIF
"$(CFG)"
==
"xmlwf - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmlwf - Win32 Debug"
"xmlparse - Win32 Debug"
:
"xmlparse - Win32 Debug"
:
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmlparse - Win32 Debug"
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmlparse - Win32 Debug"
!ENDIF
# End Project Dependency
################################################################################
# Begin Source File
!ENDIF
SOURCE
=
.
\x
mlwf
\c
odepage.c
DEP_CPP_CODEP
=
\
".\xmlwf\codepage.h"
\
"$(INTDIR)\codepage.obj"
:
$(SOURCE)
$(DEP_CPP_CODEP)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
# End Project Dependency
# End Source File
# End Target
# End Target
################################################################################
################################################################################
# Begin Target
# Begin Target
# Name "gennmtab - Win32 Release"
# Name "gennmtab - Win32 Release"
# Name "gennmtab - Win32 Debug"
# Name "gennmtab - Win32 Debug"
!IF
"$(CFG)"
==
"gennmtab - Win32 Release"
!IF
"$(CFG)"
==
"gennmtab - Win32 Release"
!ELSEIF
"$(CFG)"
==
"gennmtab - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"gennmtab - Win32 Debug"
!ENDIF
!ENDIF
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\g
ennmtab
\g
ennmtab.c
SOURCE
=
.
\g
ennmtab
\g
ennmtab.c
"$(INTDIR)\gennmtab.obj"
:
$(SOURCE)
"$(INTDIR)"
"$(INTDIR)\gennmtab.obj"
:
$(SOURCE)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
$(CPP)
$(CPP_PROJ)
$(SOURCE)
# End Source File
# End Source File
# End Target
# End Target
################################################################################
################################################################################
# Begin Target
# Begin Target
# Name "xmlparse - Win32 Release"
# Name "xmlparse - Win32 Release"
# Name "xmlparse - Win32 Debug"
# Name "xmlparse - Win32 Debug"
!IF
"$(CFG)"
==
"xmlparse - Win32 Release"
!IF
"$(CFG)"
==
"xmlparse - Win32 Release"
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
!ENDIF
!ENDIF
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mlparse
\x
mlparse.c
SOURCE
=
.
\x
mlparse
\x
mlparse.c
DEP_CPP_XMLPA
=
\
!IF
"$(CFG)"
==
"xmlparse - Win32 Release"
DEP_CPP_XMLPA
=
\
".\xmlparse\hashtable.h"
\
".\xmlparse\hashtable.h"
\
".\xmlparse\xmlparse.h"
\
".\xmlparse\xmlparse.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmlrole.h"
\
".\xmltok\xmlrole.h"
\
".\xmltok\xmltok.h"
\
".\xmltok\xmltok.h"
\
NODEP_CPP_XMLPA
=
\
NODEP_CPP_XMLPA
=
\
".\xmltok\nspr.h"
\
".\xmltok\nspr.h"
\
"$(INTDIR)\xmlparse.obj"
:
$(SOURCE)
$(DEP_CPP_XMLPA)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
"$(INTDIR)\xmlparse.obj"
:
$(SOURCE)
$(DEP_CPP_XMLPA)
"$(INTDIR)"
DEP_CPP_XMLPA
=
\
".\xmlparse\hashtable.h"
\
".\xmlparse\xmlparse.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmlrole.h"
\
".\xmltok\xmltok.h"
\
$(CPP)
$(CPP_PROJ)
$(SOURCE)
NODEP_CPP_XMLPA
=
\
".\xmltok\nspr.h"
\
"$(INTDIR)\xmlparse.obj"
:
$(SOURCE)
$(DEP_CPP_XMLPA)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ENDIF
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mlparse
\h
ashtable.c
SOURCE
=
.
\x
mlparse
\h
ashtable.c
DEP_CPP_HASHT
=
\
!IF
"$(CFG)"
==
"xmlparse - Win32 Release"
DEP_CPP_HASHT
=
\
".\xmlparse\hashtable.h"
\
".\xmlparse\hashtable.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmldef.h"
\
NODEP_CPP_HASHT
=
\
NODEP_CPP_HASHT
=
\
".\xmltok\nspr.h"
\
".\xmltok\nspr.h"
\
"$(INTDIR)\hashtable.obj"
:
$(SOURCE)
$(DEP_CPP_HASHT)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
"$(INTDIR)\hashtable.obj"
:
$(SOURCE)
$(DEP_CPP_HASHT)
"$(INTDIR)"
DEP_CPP_HASHT
=
\
".\xmlparse\hashtable.h"
\
".\xmltok\xmldef.h"
\
$(CPP)
$(CPP_PROJ)
$(SOURCE)
NODEP_CPP_HASHT
=
\
".\xmltok\nspr.h"
\
"$(INTDIR)\hashtable.obj"
:
$(SOURCE)
$(DEP_CPP_HASHT)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ENDIF
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Project Dependency
# Begin Project Dependency
# Project_Dep_Name "xmltok"
# Project_Dep_Name "xmltok"
!IF
"$(CFG)"
==
"xmlparse - Win32 Release"
!IF
"$(CFG)"
==
"xmlparse - Win32 Release"
"xmltok - Win32 Release"
:
"xmltok - Win32 Release"
:
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmltok - Win32 Release"
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmltok - Win32 Release"
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmlparse - Win32 Debug"
"xmltok - Win32 Debug"
:
"xmltok - Win32 Debug"
:
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmltok - Win32 Debug"
$(MAKE)
/$(MAKEFLAGS)
/F
".\expat.mak"
CFG
=
"xmltok - Win32 Debug"
!ENDIF
!ENDIF
# End Project Dependency
# End Project Dependency
# End Target
# End Target
################################################################################
################################################################################
# Begin Target
# Begin Target
# Name "xmltok - Win32 Release"
# Name "xmltok - Win32 Release"
# Name "xmltok - Win32 Debug"
# Name "xmltok - Win32 Debug"
!IF
"$(CFG)"
==
"xmltok - Win32 Release"
!IF
"$(CFG)"
==
"xmltok - Win32 Release"
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Debug"
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Debug"
!ENDIF
!ENDIF
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mltok
\x
mlrole.c
SOURCE
=
.
\x
mltok
\x
mlrole.c
DEP_CPP_XMLRO
=
\
!IF
"$(CFG)"
==
"xmltok - Win32 Release"
DEP_CPP_XMLRO
=
\
".\xmltok\xmldef.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmlrole.h"
\
".\xmltok\xmlrole.h"
\
".\xmltok\xmltok.h"
\
".\xmltok\xmltok.h"
\
NODEP_CPP_XMLRO
=
\
NODEP_CPP_XMLRO
=
\
".\xmltok\nspr.h"
\
".\xmltok\nspr.h"
\
"$(INTDIR)\xmlrole.obj"
:
$(SOURCE)
$(DEP_CPP_XMLRO)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Debug"
"$(INTDIR)\xmlrole.obj"
:
$(SOURCE)
$(DEP_CPP_XMLRO)
"$(INTDIR)"
DEP_CPP_XMLRO
=
\
".\xmltok\xmldef.h"
\
".\xmltok\xmlrole.h"
\
".\xmltok\xmltok.h"
\
$(CPP)
$(CPP_PROJ)
$(SOURCE)
NODEP_CPP_XMLRO
=
\
".\xmltok\nspr.h"
\
"$(INTDIR)\xmlrole.obj"
:
$(SOURCE)
$(DEP_CPP_XMLRO)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ENDIF
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mltok
\x
mltok.c
SOURCE
=
.
\x
mltok
\x
mltok.c
DEP_CPP_XMLTO
=
\
!IF
"$(CFG)"
==
"xmltok - Win32 Release"
DEP_CPP_XMLTO
=
\
".\xmltok\asciitab.h"
\
".\xmltok\asciitab.h"
\
".\xmltok\iasciitab.h"
\
".\xmltok\iasciitab.h"
\
".\xmltok\latin1tab.h"
\
".\xmltok\latin1tab.h"
\
".\xmltok\nametab.h"
\
".\xmltok\nametab.h"
\
".\xmltok\utf8tab.h"
\
".\xmltok\utf8tab.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmltok.h"
\
".\xmltok\xmltok.h"
\
".\xmltok\xmltok_impl.c"
\
".\xmltok\xmltok_impl.c"
\
".\xmltok\xmltok_impl.h"
\
".\xmltok\xmltok_impl.h"
\
NODEP_CPP_XMLTO
=
\
NODEP_CPP_XMLTO
=
\
".\xmltok\nspr.h"
\
".\xmltok\nspr.h"
\
"$(INTDIR)\xmltok.obj"
:
$(SOURCE)
$(DEP_CPP_XMLTO)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Debug"
"$(INTDIR)\xmltok.obj"
:
$(SOURCE)
$(DEP_CPP_XMLTO)
"$(INTDIR)"
DEP_CPP_XMLTO
=
\
".\xmltok\asciitab.h"
\
".\xmltok\iasciitab.h"
\
".\xmltok\latin1tab.h"
\
".\xmltok\nametab.h"
\
".\xmltok\utf8tab.h"
\
".\xmltok\xmldef.h"
\
".\xmltok\xmltok.h"
\
".\xmltok\xmltok_impl.c"
\
".\xmltok\xmltok_impl.h"
\
$(CPP)
$(CPP_PROJ)
$(SOURCE)
NODEP_CPP_XMLTO
=
\
".\xmltok\nspr.h"
\
"$(INTDIR)\xmltok.obj"
:
$(SOURCE)
$(DEP_CPP_XMLTO)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ENDIF
# End Source File
# End Source File
################################################################################
################################################################################
# Begin Source File
# Begin Source File
SOURCE
=
.
\x
mltok
\d
llmain.c
SOURCE
=
.
\x
mltok
\d
llmain.c
!IF
"$(CFG)"
==
"xmltok - Win32 Release"
"$(INTDIR)\dllmain.obj"
:
$(SOURCE)
"$(INTDIR)"
"$(INTDIR)\dllmain.obj"
:
$(SOURCE)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
$(CPP)
$(CPP_PROJ)
$(SOURCE)
!ELSEIF
"$(CFG)"
==
"xmltok - Win32 Debug"
"$(INTDIR)\dllmain.obj"
:
$(SOURCE)
"$(INTDIR)"
$(CPP)
$(CPP_PROJ)
$(SOURCE)
# End Source File
# End Target
!ENDIF
# End Source File
# End Target
# End Project
# End Project
################################################################################
################################################################################
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/hashtable.c
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
c
s
ompliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
Software distributed under the License is distributed on an "AS IS"
...
@@ -12,21 +12,45 @@ under the License.
...
@@ -12,21 +12,45 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#include "xmldef.h"
#include "xmldef.h"
#ifdef XML_UNICODE_WCHAR_T
#ifndef XML_UNICODE
#define XML_UNICODE
#endif
#endif
#include "hashtable.h"
#include "hashtable.h"
#include <stdlib.h>
#include <string.h>
#define INIT_SIZE 64
#define INIT_SIZE 64
static
static
unsigned
long
hash
(
const
char
*
s
)
int
keyeq
(
KEY
s1
,
KEY
s2
)
{
for
(;
*
s1
==
*
s2
;
s1
++
,
s2
++
)
if
(
*
s1
==
0
)
return
1
;
return
0
;
}
static
unsigned
long
hash
(
KEY
s
)
{
{
unsigned
long
h
=
0
;
unsigned
long
h
=
0
;
while
(
*
s
)
while
(
*
s
)
...
@@ -34,7 +58,7 @@ unsigned long hash(const char *s)
...
@@ -34,7 +58,7 @@ unsigned long hash(const char *s)
return
h
;
return
h
;
}
}
NAMED
*
lookup
(
HASH_TABLE
*
table
,
const
char
*
name
,
size_t
createSize
)
NAMED
*
lookup
(
HASH_TABLE
*
table
,
KEY
name
,
size_t
createSize
)
{
{
size_t
i
;
size_t
i
;
if
(
table
->
size
==
0
)
{
if
(
table
->
size
==
0
)
{
...
@@ -52,7 +76,7 @@ NAMED *lookup(HASH_TABLE *table, const char *name, size_t createSize)
...
@@ -52,7 +76,7 @@ NAMED *lookup(HASH_TABLE *table, const char *name, size_t createSize)
for
(
i
=
h
&
(
table
->
size
-
1
);
for
(
i
=
h
&
(
table
->
size
-
1
);
table
->
v
[
i
];
table
->
v
[
i
];
i
==
0
?
i
=
table
->
size
-
1
:
--
i
)
{
i
==
0
?
i
=
table
->
size
-
1
:
--
i
)
{
if
(
strcmp
(
name
,
table
->
v
[
i
]
->
name
)
==
0
)
if
(
keyeq
(
name
,
table
->
v
[
i
]
->
name
)
)
return
table
->
v
[
i
];
return
table
->
v
[
i
];
}
}
if
(
!
createSize
)
if
(
!
createSize
)
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/hashtable.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,17 +12,41 @@ under the License.
...
@@ -12,17 +12,41 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#include <stddef.h>
#include <stddef.h>
#ifdef XML_UNICODE
#ifdef XML_UNICODE_WCHAR_T
typedef
const
wchar_t
*
KEY
;
#else
/* not XML_UNICODE_WCHAR_T */
typedef
const
unsigned
short
*
KEY
;
#endif
/* not XML_UNICODE_WCHAR_T */
#else
/* not XML_UNICODE */
typedef
const
char
*
KEY
;
#endif
/* not XML_UNICODE */
typedef
struct
{
typedef
struct
{
const
char
*
name
;
KEY
name
;
}
NAMED
;
}
NAMED
;
typedef
struct
{
typedef
struct
{
...
@@ -32,7 +56,7 @@ typedef struct {
...
@@ -32,7 +56,7 @@ typedef struct {
size_t
usedLim
;
size_t
usedLim
;
}
HASH_TABLE
;
}
HASH_TABLE
;
NAMED
*
lookup
(
HASH_TABLE
*
table
,
const
char
*
name
,
size_t
createSize
);
NAMED
*
lookup
(
HASH_TABLE
*
table
,
KEY
name
,
size_t
createSize
);
void
hashTableInit
(
HASH_TABLE
*
);
void
hashTableInit
(
HASH_TABLE
*
);
void
hashTableDestroy
(
HASH_TABLE
*
);
void
hashTableDestroy
(
HASH_TABLE
*
);
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/xmlparse.c
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,76 +12,150 @@ under the License.
...
@@ -12,76 +12,150 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#include "xmldef.h"
#include "xmldef.h"
#include "xmlparse.h"
#include "xmlparse.h"
#ifdef XML_UNICODE
#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
#define XmlConvert XmlUtf16Convert
#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
#define XmlEncode XmlUtf16Encode
#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1))
typedef
unsigned
short
ICHAR
;
#else
#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
#define XmlConvert XmlUtf8Convert
#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
#define XmlEncode XmlUtf8Encode
#define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
typedef
char
ICHAR
;
#endif
#ifndef XML_NS
#define XmlInitEncodingNS XmlInitEncoding
#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
#undef XmlGetInternalEncodingNS
#define XmlGetInternalEncodingNS XmlGetInternalEncoding
#define XmlParseXmlDeclNS XmlParseXmlDecl
#endif
#ifdef XML_UNICODE_WCHAR_T
#define XML_T(x) L ## x
#else
#define XML_T(x) x
#endif
/* Round up n to be a multiple of sz, where sz is a power of 2. */
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
#include "xmltok.h"
#include "xmltok.h"
#include "xmlrole.h"
#include "xmlrole.h"
#include "hashtable.h"
#include "hashtable.h"
#include <stdlib.h>
#define INIT_TAG_BUF_SIZE 32
/* must be a multiple of sizeof(XML_Char) */
#include <string.h>
#define INIT_TAG_BUF_SIZE 32
#define INIT_DATA_BUF_SIZE 1024
#define INIT_DATA_BUF_SIZE 1024
#define INIT_ATTS_SIZE 16
#define INIT_ATTS_SIZE 16
#define INIT_BLOCK_SIZE 1024
#define INIT_BLOCK_SIZE 1024
#define INIT_BUFFER_SIZE 1024
#define INIT_BUFFER_SIZE 1024
#define EXPAND_SPARE 24
typedef
struct
binding
{
struct
prefix
*
prefix
;
struct
binding
*
nextTagBinding
;
struct
binding
*
prevPrefixBinding
;
const
struct
attribute_id
*
attId
;
XML_Char
*
uri
;
int
uriLen
;
int
uriAlloc
;
}
BINDING
;
typedef
struct
prefix
{
const
XML_Char
*
name
;
BINDING
*
binding
;
}
PREFIX
;
typedef
struct
{
const
XML_Char
*
str
;
const
XML_Char
*
localPart
;
int
uriLen
;
}
TAG_NAME
;
typedef
struct
tag
{
typedef
struct
tag
{
struct
tag
*
parent
;
struct
tag
*
parent
;
const
char
*
rawName
;
const
char
*
rawName
;
int
rawNameLength
;
int
rawNameLength
;
const
char
*
name
;
TAG_NAME
name
;
char
*
buf
;
char
*
buf
;
char
*
bufEnd
;
char
*
bufEnd
;
BINDING
*
bindings
;
}
TAG
;
}
TAG
;
typedef
struct
{
typedef
struct
{
const
c
har
*
name
;
const
XML_C
har
*
name
;
const
c
har
*
textPtr
;
const
XML_C
har
*
textPtr
;
int
textLen
;
int
textLen
;
const
char
*
systemId
;
const
XML_Char
*
systemId
;
const
char
*
publicId
;
const
XML_Char
*
base
;
const
char
*
notation
;
const
XML_Char
*
publicId
;
const
XML_Char
*
notation
;
char
open
;
char
open
;
char
magic
;
}
ENTITY
;
}
ENTITY
;
typedef
struct
block
{
typedef
struct
block
{
struct
block
*
next
;
struct
block
*
next
;
int
size
;
int
size
;
c
har
s
[
1
];
XML_C
har
s
[
1
];
}
BLOCK
;
}
BLOCK
;
typedef
struct
{
typedef
struct
{
BLOCK
*
blocks
;
BLOCK
*
blocks
;
BLOCK
*
freeBlocks
;
BLOCK
*
freeBlocks
;
const
c
har
*
end
;
const
XML_C
har
*
end
;
c
har
*
ptr
;
XML_C
har
*
ptr
;
c
har
*
start
;
XML_C
har
*
start
;
}
STRING_POOL
;
}
STRING_POOL
;
/* The
byte before the name is a scratch byte
used to determine whether
/* The
XML_Char before the name is
used to determine whether
an attribute has been specified. */
an attribute has been specified. */
typedef
struct
{
typedef
struct
attribute_id
{
char
*
name
;
XML_Char
*
name
;
PREFIX
*
prefix
;
char
maybeTokenized
;
char
maybeTokenized
;
char
xmlns
;
}
ATTRIBUTE_ID
;
}
ATTRIBUTE_ID
;
typedef
struct
{
typedef
struct
{
const
ATTRIBUTE_ID
*
id
;
const
ATTRIBUTE_ID
*
id
;
char
isCdata
;
char
isCdata
;
const
c
har
*
value
;
const
XML_C
har
*
value
;
}
DEFAULT_ATTRIBUTE
;
}
DEFAULT_ATTRIBUTE
;
typedef
struct
{
typedef
struct
{
const
char
*
name
;
const
XML_Char
*
name
;
PREFIX
*
prefix
;
int
nDefaultAtts
;
int
nDefaultAtts
;
int
allocDefaultAtts
;
int
allocDefaultAtts
;
DEFAULT_ATTRIBUTE
*
defaultAtts
;
DEFAULT_ATTRIBUTE
*
defaultAtts
;
...
@@ -91,27 +165,54 @@ typedef struct {
...
@@ -91,27 +165,54 @@ typedef struct {
HASH_TABLE
generalEntities
;
HASH_TABLE
generalEntities
;
HASH_TABLE
elementTypes
;
HASH_TABLE
elementTypes
;
HASH_TABLE
attributeIds
;
HASH_TABLE
attributeIds
;
HASH_TABLE
prefixes
;
STRING_POOL
pool
;
STRING_POOL
pool
;
int
complete
;
int
complete
;
int
standalone
;
int
standalone
;
const
XML_Char
*
base
;
PREFIX
defaultPrefix
;
}
DTD
;
}
DTD
;
typedef
struct
open_internal_entity
{
const
char
*
internalEventPtr
;
const
char
*
internalEventEndPtr
;
struct
open_internal_entity
*
next
;
ENTITY
*
entity
;
}
OPEN_INTERNAL_ENTITY
;
typedef
enum
XML_Error
Processor
(
XML_Parser
parser
,
typedef
enum
XML_Error
Processor
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
start
,
const
char
*
end
,
const
char
*
end
,
const
char
**
endPtr
);
const
char
**
endPtr
);
static
Processor
prologProcessor
;
static
Processor
prologProcessor
;
static
Processor
prologInitProcessor
;
static
Processor
contentProcessor
;
static
Processor
contentProcessor
;
static
Processor
cdataSectionProcessor
;
static
Processor
epilogProcessor
;
static
Processor
epilogProcessor
;
static
Processor
errorProcessor
;
static
Processor
errorProcessor
;
static
Processor
externalEntityInitProcessor
;
static
Processor
externalEntityInitProcessor2
;
static
Processor
externalEntityInitProcessor3
;
static
Processor
externalEntityContentProcessor
;
static
enum
XML_Error
handleUnknownEncoding
(
XML_Parser
parser
,
const
XML_Char
*
encodingName
);
static
enum
XML_Error
processXmlDecl
(
XML_Parser
parser
,
int
isGeneralTextEntity
,
const
char
*
,
const
char
*
);
static
enum
XML_Error
initializeEncoding
(
XML_Parser
parser
);
static
enum
XML_Error
static
enum
XML_Error
doContent
(
XML_Parser
parser
,
int
startTagLevel
,
const
ENCODING
*
enc
,
doContent
(
XML_Parser
parser
,
int
startTagLevel
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
,
const
char
**
endPtr
);
const
char
*
start
,
const
char
*
end
,
const
char
**
endPtr
);
static
enum
XML_Error
storeAtts
(
XML_Parser
parser
,
const
ENCODING
*
,
const
char
*
tagName
,
const
char
*
s
);
static
enum
XML_Error
doCdataSection
(
XML_Parser
parser
,
const
ENCODING
*
,
const
char
**
startPtr
,
const
char
*
end
,
const
char
**
nextPtr
);
static
enum
XML_Error
storeAtts
(
XML_Parser
parser
,
const
ENCODING
*
,
const
char
*
s
,
TAG_NAME
*
tagNamePtr
,
BINDING
**
bindingsPtr
);
static
int
addBinding
(
XML_Parser
parser
,
PREFIX
*
prefix
,
const
ATTRIBUTE_ID
*
attId
,
const
XML_Char
*
uri
,
BINDING
**
bindingsPtr
);
static
int
static
int
defineAttribute
(
ELEMENT_TYPE
*
type
,
ATTRIBUTE_ID
*
,
int
isCdata
,
const
c
har
*
dfltValue
);
defineAttribute
(
ELEMENT_TYPE
*
type
,
ATTRIBUTE_ID
*
,
int
isCdata
,
const
XML_C
har
*
dfltValue
);
static
enum
XML_Error
static
enum
XML_Error
storeAttributeValue
(
XML_Parser
parser
,
const
ENCODING
*
,
int
isCdata
,
const
char
*
,
const
char
*
,
storeAttributeValue
(
XML_Parser
parser
,
const
ENCODING
*
,
int
isCdata
,
const
char
*
,
const
char
*
,
STRING_POOL
*
);
STRING_POOL
*
);
...
@@ -120,158 +221,376 @@ appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const cha
...
@@ -120,158 +221,376 @@ appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const cha
STRING_POOL
*
);
STRING_POOL
*
);
static
ATTRIBUTE_ID
*
static
ATTRIBUTE_ID
*
getAttributeId
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
);
getAttributeId
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
);
static
int
setElementTypePrefix
(
XML_Parser
parser
,
ELEMENT_TYPE
*
);
static
enum
XML_Error
static
enum
XML_Error
storeEntityValue
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
end
);
storeEntityValue
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
end
);
static
int
static
int
reportProcessingInstruction
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
);
reportProcessingInstruction
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
);
static
int
reportComment
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
);
static
void
reportDefault
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
);
static
const
XML_Char
*
getContext
(
XML_Parser
parser
);
static
int
setContext
(
XML_Parser
parser
,
const
XML_Char
*
context
);
static
void
normalizePublicId
(
XML_Char
*
s
);
static
int
dtdInit
(
DTD
*
);
static
int
dtdInit
(
DTD
*
);
static
void
dtdDestroy
(
DTD
*
);
static
void
dtdDestroy
(
DTD
*
);
static
int
dtdCopy
(
DTD
*
newDtd
,
const
DTD
*
oldDtd
);
static
void
poolInit
(
STRING_POOL
*
);
static
void
poolInit
(
STRING_POOL
*
);
static
void
poolClear
(
STRING_POOL
*
);
static
void
poolClear
(
STRING_POOL
*
);
static
void
poolDestroy
(
STRING_POOL
*
);
static
void
poolDestroy
(
STRING_POOL
*
);
static
c
har
*
poolAppend
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
static
XML_C
har
*
poolAppend
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
);
const
char
*
ptr
,
const
char
*
end
);
static
c
har
*
poolStoreString
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
static
XML_C
har
*
poolStoreString
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
);
const
char
*
ptr
,
const
char
*
end
);
static
int
poolGrow
(
STRING_POOL
*
pool
);
static
int
poolGrow
(
STRING_POOL
*
pool
);
static
const
XML_Char
*
poolCopyString
(
STRING_POOL
*
pool
,
const
XML_Char
*
s
);
static
const
XML_Char
*
poolCopyStringN
(
STRING_POOL
*
pool
,
const
XML_Char
*
s
,
int
n
);
#define poolStart(pool) ((pool)->start)
#define poolStart(pool) ((pool)->start)
#define poolEnd(pool) ((pool)->ptr)
#define poolEnd(pool) ((pool)->ptr)
#define poolLength(pool) ((pool)->ptr - (pool)->start)
#define poolLength(pool) ((pool)->ptr - (pool)->start)
#define poolChop(pool) ((void)--(pool->ptr))
#define poolChop(pool) ((void)--(pool->ptr))
#define poolLast
Byte
(pool) (((pool)->ptr)[-1])
#define poolLast
Char
(pool) (((pool)->ptr)[-1])
#define poolDiscard(pool) ((pool)->ptr = (pool)->start)
#define poolDiscard(pool) ((pool)->ptr = (pool)->start)
#define poolFinish(pool) ((pool)->start = (pool)->ptr)
#define poolFinish(pool) ((pool)->start = (pool)->ptr)
#define poolAppend
Byte
(pool, c) \
#define poolAppend
Char
(pool, c) \
(((pool)->ptr == (pool)->end && !poolGrow(pool)) \
(((pool)->ptr == (pool)->end && !poolGrow(pool)) \
? 0 \
? 0 \
: ((*((pool)->ptr)++ = c), 1))
: ((*((pool)->ptr)++ = c), 1))
typedef
struct
{
typedef
struct
{
char
*
buffer
;
/* The first member must be userData so that the XML_GetUserData macro works. */
void
*
m_userData
;
void
*
m_handlerArg
;
char
*
m_buffer
;
/* first character to be parsed */
/* first character to be parsed */
const
char
*
bufferPtr
;
const
char
*
m_
bufferPtr
;
/* past last character to be parsed */
/* past last character to be parsed */
char
*
bufferEnd
;
char
*
m_
bufferEnd
;
/* allocated end of buffer */
/* allocated end of buffer */
const
char
*
bufferLim
;
const
char
*
m_bufferLim
;
long
bufferEndByteIndex
;
long
m_parseEndByteIndex
;
char
*
dataBuf
;
const
char
*
m_parseEndPtr
;
char
*
dataBufEnd
;
XML_Char
*
m_dataBuf
;
void
*
userData
;
XML_Char
*
m_dataBufEnd
;
XML_StartElementHandler
startElementHandler
;
XML_StartElementHandler
m_startElementHandler
;
XML_EndElementHandler
endElementHandler
;
XML_EndElementHandler
m_endElementHandler
;
XML_CharacterDataHandler
characterDataHandler
;
XML_CharacterDataHandler
m_characterDataHandler
;
XML_ProcessingInstructionHandler
processingInstructionHandler
;
XML_ProcessingInstructionHandler
m_processingInstructionHandler
;
const
ENCODING
*
encoding
;
XML_CommentHandler
m_commentHandler
;
INIT_ENCODING
initEncoding
;
XML_StartCdataSectionHandler
m_startCdataSectionHandler
;
PROLOG_STATE
prologState
;
XML_EndCdataSectionHandler
m_endCdataSectionHandler
;
Processor
*
processor
;
XML_DefaultHandler
m_defaultHandler
;
enum
XML_Error
errorCode
;
XML_UnparsedEntityDeclHandler
m_unparsedEntityDeclHandler
;
const
char
*
errorPtr
;
XML_NotationDeclHandler
m_notationDeclHandler
;
int
tagLevel
;
XML_StartNamespaceDeclHandler
m_startNamespaceDeclHandler
;
ENTITY
*
declEntity
;
XML_EndNamespaceDeclHandler
m_endNamespaceDeclHandler
;
ELEMENT_TYPE
*
declElementType
;
XML_NotStandaloneHandler
m_notStandaloneHandler
;
ATTRIBUTE_ID
*
declAttributeId
;
XML_ExternalEntityRefHandler
m_externalEntityRefHandler
;
char
declAttributeIsCdata
;
void
*
m_externalEntityRefHandlerArg
;
DTD
dtd
;
XML_UnknownEncodingHandler
m_unknownEncodingHandler
;
TAG
*
tagStack
;
const
ENCODING
*
m_encoding
;
TAG
*
freeTagList
;
INIT_ENCODING
m_initEncoding
;
int
attsSize
;
const
XML_Char
*
m_protocolEncodingName
;
ATTRIBUTE
*
atts
;
int
m_ns
;
POSITION
position
;
void
*
m_unknownEncodingMem
;
long
errorByteIndex
;
void
*
m_unknownEncodingData
;
STRING_POOL
tempPool
;
void
*
m_unknownEncodingHandlerData
;
STRING_POOL
temp2Pool
;
void
(
*
m_unknownEncodingRelease
)(
void
*
);
char
*
groupConnector
;
PROLOG_STATE
m_prologState
;
unsigned
groupSize
;
Processor
*
m_processor
;
int
hadExternalDoctype
;
enum
XML_Error
m_errorCode
;
const
char
*
m_eventPtr
;
const
char
*
m_eventEndPtr
;
const
char
*
m_positionPtr
;
OPEN_INTERNAL_ENTITY
*
m_openInternalEntities
;
int
m_defaultExpandInternalEntities
;
int
m_tagLevel
;
ENTITY
*
m_declEntity
;
const
XML_Char
*
m_declNotationName
;
const
XML_Char
*
m_declNotationPublicId
;
ELEMENT_TYPE
*
m_declElementType
;
ATTRIBUTE_ID
*
m_declAttributeId
;
char
m_declAttributeIsCdata
;
DTD
m_dtd
;
TAG
*
m_tagStack
;
TAG
*
m_freeTagList
;
BINDING
*
m_inheritedBindings
;
BINDING
*
m_freeBindingList
;
int
m_attsSize
;
int
m_nSpecifiedAtts
;
ATTRIBUTE
*
m_atts
;
POSITION
m_position
;
STRING_POOL
m_tempPool
;
STRING_POOL
m_temp2Pool
;
char
*
m_groupConnector
;
unsigned
m_groupSize
;
int
m_hadExternalDoctype
;
XML_Char
m_namespaceSeparator
;
}
Parser
;
}
Parser
;
#define userData (((Parser *)parser)->userData)
#define userData (((Parser *)parser)->m_userData)
#define startElementHandler (((Parser *)parser)->startElementHandler)
#define handlerArg (((Parser *)parser)->m_handlerArg)
#define endElementHandler (((Parser *)parser)->endElementHandler)
#define startElementHandler (((Parser *)parser)->m_startElementHandler)
#define characterDataHandler (((Parser *)parser)->characterDataHandler)
#define endElementHandler (((Parser *)parser)->m_endElementHandler)
#define processingInstructionHandler (((Parser *)parser)->processingInstructionHandler)
#define characterDataHandler (((Parser *)parser)->m_characterDataHandler)
#define encoding (((Parser *)parser)->encoding)
#define processingInstructionHandler (((Parser *)parser)->m_processingInstructionHandler)
#define initEncoding (((Parser *)parser)->initEncoding)
#define commentHandler (((Parser *)parser)->m_commentHandler)
#define prologState (((Parser *)parser)->prologState)
#define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler)
#define processor (((Parser *)parser)->processor)
#define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler)
#define errorCode (((Parser *)parser)->errorCode)
#define defaultHandler (((Parser *)parser)->m_defaultHandler)
#define errorPtr (((Parser *)parser)->errorPtr)
#define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler)
#define errorByteIndex (((Parser *)parser)->errorByteIndex)
#define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler)
#define position (((Parser *)parser)->position)
#define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler)
#define tagLevel (((Parser *)parser)->tagLevel)
#define endNamespaceDeclHandler (((Parser *)parser)->m_endNamespaceDeclHandler)
#define buffer (((Parser *)parser)->buffer)
#define notStandaloneHandler (((Parser *)parser)->m_notStandaloneHandler)
#define bufferPtr (((Parser *)parser)->bufferPtr)
#define externalEntityRefHandler (((Parser *)parser)->m_externalEntityRefHandler)
#define bufferEnd (((Parser *)parser)->bufferEnd)
#define externalEntityRefHandlerArg (((Parser *)parser)->m_externalEntityRefHandlerArg)
#define bufferEndByteIndex (((Parser *)parser)->bufferEndByteIndex)
#define unknownEncodingHandler (((Parser *)parser)->m_unknownEncodingHandler)
#define bufferLim (((Parser *)parser)->bufferLim)
#define encoding (((Parser *)parser)->m_encoding)
#define dataBuf (((Parser *)parser)->dataBuf)
#define initEncoding (((Parser *)parser)->m_initEncoding)
#define dataBufEnd (((Parser *)parser)->dataBufEnd)
#define unknownEncodingMem (((Parser *)parser)->m_unknownEncodingMem)
#define dtd (((Parser *)parser)->dtd)
#define unknownEncodingData (((Parser *)parser)->m_unknownEncodingData)
#define declEntity (((Parser *)parser)->declEntity)
#define unknownEncodingHandlerData \
#define declElementType (((Parser *)parser)->declElementType)
(((Parser *)parser)->m_unknownEncodingHandlerData)
#define declAttributeId (((Parser *)parser)->declAttributeId)
#define unknownEncodingRelease (((Parser *)parser)->m_unknownEncodingRelease)
#define declAttributeIsCdata (((Parser *)parser)->declAttributeIsCdata)
#define protocolEncodingName (((Parser *)parser)->m_protocolEncodingName)
#define freeTagList (((Parser *)parser)->freeTagList)
#define ns (((Parser *)parser)->m_ns)
#define tagStack (((Parser *)parser)->tagStack)
#define prologState (((Parser *)parser)->m_prologState)
#define atts (((Parser *)parser)->atts)
#define processor (((Parser *)parser)->m_processor)
#define attsSize (((Parser *)parser)->attsSize)
#define errorCode (((Parser *)parser)->m_errorCode)
#define tempPool (((Parser *)parser)->tempPool)
#define eventPtr (((Parser *)parser)->m_eventPtr)
#define temp2Pool (((Parser *)parser)->temp2Pool)
#define eventEndPtr (((Parser *)parser)->m_eventEndPtr)
#define groupConnector (((Parser *)parser)->groupConnector)
#define positionPtr (((Parser *)parser)->m_positionPtr)
#define groupSize (((Parser *)parser)->groupSize)
#define position (((Parser *)parser)->m_position)
#define hadExternalDoctype (((Parser *)parser)->hadExternalDoctype)
#define openInternalEntities (((Parser *)parser)->m_openInternalEntities)
#define defaultExpandInternalEntities (((Parser *)parser)->m_defaultExpandInternalEntities)
XML_Parser
XML_ParserCreate
(
const
char
*
encodingName
)
#define tagLevel (((Parser *)parser)->m_tagLevel)
#define buffer (((Parser *)parser)->m_buffer)
#define bufferPtr (((Parser *)parser)->m_bufferPtr)
#define bufferEnd (((Parser *)parser)->m_bufferEnd)
#define parseEndByteIndex (((Parser *)parser)->m_parseEndByteIndex)
#define parseEndPtr (((Parser *)parser)->m_parseEndPtr)
#define bufferLim (((Parser *)parser)->m_bufferLim)
#define dataBuf (((Parser *)parser)->m_dataBuf)
#define dataBufEnd (((Parser *)parser)->m_dataBufEnd)
#define dtd (((Parser *)parser)->m_dtd)
#define declEntity (((Parser *)parser)->m_declEntity)
#define declNotationName (((Parser *)parser)->m_declNotationName)
#define declNotationPublicId (((Parser *)parser)->m_declNotationPublicId)
#define declElementType (((Parser *)parser)->m_declElementType)
#define declAttributeId (((Parser *)parser)->m_declAttributeId)
#define declAttributeIsCdata (((Parser *)parser)->m_declAttributeIsCdata)
#define freeTagList (((Parser *)parser)->m_freeTagList)
#define freeBindingList (((Parser *)parser)->m_freeBindingList)
#define inheritedBindings (((Parser *)parser)->m_inheritedBindings)
#define tagStack (((Parser *)parser)->m_tagStack)
#define atts (((Parser *)parser)->m_atts)
#define attsSize (((Parser *)parser)->m_attsSize)
#define nSpecifiedAtts (((Parser *)parser)->m_nSpecifiedAtts)
#define tempPool (((Parser *)parser)->m_tempPool)
#define temp2Pool (((Parser *)parser)->m_temp2Pool)
#define groupConnector (((Parser *)parser)->m_groupConnector)
#define groupSize (((Parser *)parser)->m_groupSize)
#define hadExternalDoctype (((Parser *)parser)->m_hadExternalDoctype)
#define namespaceSeparator (((Parser *)parser)->m_namespaceSeparator)
#ifdef _MSC_VER
#ifdef _DEBUG
Parser
*
asParser
(
XML_Parser
parser
)
{
return
parser
;
}
#endif
#endif
XML_Parser
XML_ParserCreate
(
const
XML_Char
*
encodingName
)
{
{
XML_Parser
parser
=
malloc
(
sizeof
(
Parser
));
XML_Parser
parser
=
malloc
(
sizeof
(
Parser
));
if
(
!
parser
)
if
(
!
parser
)
return
parser
;
return
parser
;
processor
=
prologProcessor
;
processor
=
prolog
Init
Processor
;
XmlPrologStateInit
(
&
prologState
);
XmlPrologStateInit
(
&
prologState
);
userData
=
0
;
userData
=
0
;
handlerArg
=
0
;
startElementHandler
=
0
;
startElementHandler
=
0
;
endElementHandler
=
0
;
endElementHandler
=
0
;
characterDataHandler
=
0
;
characterDataHandler
=
0
;
processingInstructionHandler
=
0
;
processingInstructionHandler
=
0
;
commentHandler
=
0
;
startCdataSectionHandler
=
0
;
endCdataSectionHandler
=
0
;
defaultHandler
=
0
;
unparsedEntityDeclHandler
=
0
;
notationDeclHandler
=
0
;
startNamespaceDeclHandler
=
0
;
endNamespaceDeclHandler
=
0
;
notStandaloneHandler
=
0
;
externalEntityRefHandler
=
0
;
externalEntityRefHandlerArg
=
parser
;
unknownEncodingHandler
=
0
;
buffer
=
0
;
buffer
=
0
;
bufferPtr
=
0
;
bufferPtr
=
0
;
bufferEnd
=
0
;
bufferEnd
=
0
;
bufferEndByteIndex
=
0
;
parseEndByteIndex
=
0
;
parseEndPtr
=
0
;
bufferLim
=
0
;
bufferLim
=
0
;
declElementType
=
0
;
declElementType
=
0
;
declAttributeId
=
0
;
declAttributeId
=
0
;
declEntity
=
0
;
declEntity
=
0
;
declNotationName
=
0
;
declNotationPublicId
=
0
;
memset
(
&
position
,
0
,
sizeof
(
POSITION
));
memset
(
&
position
,
0
,
sizeof
(
POSITION
));
errorCode
=
XML_ERROR_NONE
;
errorCode
=
XML_ERROR_NONE
;
errorByteIndex
=
0
;
eventPtr
=
0
;
errorPtr
=
0
;
eventEndPtr
=
0
;
positionPtr
=
0
;
openInternalEntities
=
0
;
tagLevel
=
0
;
tagLevel
=
0
;
tagStack
=
0
;
tagStack
=
0
;
freeTagList
=
0
;
freeTagList
=
0
;
freeBindingList
=
0
;
inheritedBindings
=
0
;
attsSize
=
INIT_ATTS_SIZE
;
attsSize
=
INIT_ATTS_SIZE
;
atts
=
malloc
(
attsSize
*
sizeof
(
ATTRIBUTE
));
atts
=
malloc
(
attsSize
*
sizeof
(
ATTRIBUTE
));
dataBuf
=
malloc
(
INIT_DATA_BUF_SIZE
);
nSpecifiedAtts
=
0
;
dataBuf
=
malloc
(
INIT_DATA_BUF_SIZE
*
sizeof
(
XML_Char
));
groupSize
=
0
;
groupSize
=
0
;
groupConnector
=
0
;
groupConnector
=
0
;
hadExternalDoctype
=
0
;
hadExternalDoctype
=
0
;
unknownEncodingMem
=
0
;
unknownEncodingRelease
=
0
;
unknownEncodingData
=
0
;
unknownEncodingHandlerData
=
0
;
namespaceSeparator
=
'!'
;
ns
=
0
;
poolInit
(
&
tempPool
);
poolInit
(
&
tempPool
);
poolInit
(
&
temp2Pool
);
poolInit
(
&
temp2Pool
);
if
(
!
dtdInit
(
&
dtd
)
||
!
atts
||
!
dataBuf
)
{
protocolEncodingName
=
encodingName
?
poolCopyString
(
&
tempPool
,
encodingName
)
:
0
;
if
(
!
dtdInit
(
&
dtd
)
||
!
atts
||
!
dataBuf
||
(
encodingName
&&
!
protocolEncodingName
))
{
XML_ParserFree
(
parser
);
XML_ParserFree
(
parser
);
return
0
;
return
0
;
}
}
dataBufEnd
=
dataBuf
+
INIT_DATA_BUF_SIZE
;
dataBufEnd
=
dataBuf
+
INIT_DATA_BUF_SIZE
;
if
(
!
XmlInitEncoding
(
&
initEncoding
,
&
encoding
,
encodingName
))
{
XmlInitEncoding
(
&
initEncoding
,
&
encoding
,
0
);
errorCode
=
XML_ERROR_UNKNOWN_ENCODING
;
return
parser
;
processor
=
errorProcessor
;
}
XML_Parser
XML_ParserCreateNS
(
const
XML_Char
*
encodingName
,
XML_Char
nsSep
)
{
static
const
XML_Char
implicitContext
[]
=
{
XML_T
(
'x'
),
XML_T
(
'm'
),
XML_T
(
'l'
),
XML_T
(
'='
),
XML_T
(
'h'
),
XML_T
(
't'
),
XML_T
(
't'
),
XML_T
(
'p'
),
XML_T
(
':'
),
XML_T
(
'/'
),
XML_T
(
'/'
),
XML_T
(
'w'
),
XML_T
(
'w'
),
XML_T
(
'w'
),
XML_T
(
'.'
),
XML_T
(
'w'
),
XML_T
(
'3'
),
XML_T
(
'.'
),
XML_T
(
'o'
),
XML_T
(
'r'
),
XML_T
(
'g'
),
XML_T
(
'/'
),
XML_T
(
'X'
),
XML_T
(
'M'
),
XML_T
(
'L'
),
XML_T
(
'/'
),
XML_T
(
'1'
),
XML_T
(
'9'
),
XML_T
(
'9'
),
XML_T
(
'8'
),
XML_T
(
'/'
),
XML_T
(
'n'
),
XML_T
(
'a'
),
XML_T
(
'm'
),
XML_T
(
'e'
),
XML_T
(
's'
),
XML_T
(
'p'
),
XML_T
(
'a'
),
XML_T
(
'c'
),
XML_T
(
'e'
),
XML_T
(
'\0'
)
};
XML_Parser
parser
=
XML_ParserCreate
(
encodingName
);
if
(
parser
)
{
XmlInitEncodingNS
(
&
initEncoding
,
&
encoding
,
0
);
ns
=
1
;
namespaceSeparator
=
nsSep
;
}
if
(
!
setContext
(
parser
,
implicitContext
))
{
XML_ParserFree
(
parser
);
return
0
;
}
return
parser
;
}
int
XML_SetEncoding
(
XML_Parser
parser
,
const
XML_Char
*
encodingName
)
{
if
(
!
encodingName
)
protocolEncodingName
=
0
;
else
{
protocolEncodingName
=
poolCopyString
(
&
tempPool
,
encodingName
);
if
(
!
protocolEncodingName
)
return
0
;
}
return
1
;
}
XML_Parser
XML_ExternalEntityParserCreate
(
XML_Parser
oldParser
,
const
XML_Char
*
context
,
const
XML_Char
*
encodingName
)
{
XML_Parser
parser
=
oldParser
;
DTD
*
oldDtd
=
&
dtd
;
XML_StartElementHandler
oldStartElementHandler
=
startElementHandler
;
XML_EndElementHandler
oldEndElementHandler
=
endElementHandler
;
XML_CharacterDataHandler
oldCharacterDataHandler
=
characterDataHandler
;
XML_ProcessingInstructionHandler
oldProcessingInstructionHandler
=
processingInstructionHandler
;
XML_CommentHandler
oldCommentHandler
=
commentHandler
;
XML_StartCdataSectionHandler
oldStartCdataSectionHandler
=
startCdataSectionHandler
;
XML_EndCdataSectionHandler
oldEndCdataSectionHandler
=
endCdataSectionHandler
;
XML_DefaultHandler
oldDefaultHandler
=
defaultHandler
;
XML_StartNamespaceDeclHandler
oldStartNamespaceDeclHandler
=
startNamespaceDeclHandler
;
XML_EndNamespaceDeclHandler
oldEndNamespaceDeclHandler
=
endNamespaceDeclHandler
;
XML_NotStandaloneHandler
oldNotStandaloneHandler
=
notStandaloneHandler
;
XML_ExternalEntityRefHandler
oldExternalEntityRefHandler
=
externalEntityRefHandler
;
XML_UnknownEncodingHandler
oldUnknownEncodingHandler
=
unknownEncodingHandler
;
void
*
oldUserData
=
userData
;
void
*
oldHandlerArg
=
handlerArg
;
int
oldDefaultExpandInternalEntities
=
defaultExpandInternalEntities
;
void
*
oldExternalEntityRefHandlerArg
=
externalEntityRefHandlerArg
;
parser
=
(
ns
?
XML_ParserCreateNS
(
encodingName
,
namespaceSeparator
)
:
XML_ParserCreate
(
encodingName
));
if
(
!
parser
)
return
0
;
startElementHandler
=
oldStartElementHandler
;
endElementHandler
=
oldEndElementHandler
;
characterDataHandler
=
oldCharacterDataHandler
;
processingInstructionHandler
=
oldProcessingInstructionHandler
;
commentHandler
=
oldCommentHandler
;
startCdataSectionHandler
=
oldStartCdataSectionHandler
;
endCdataSectionHandler
=
oldEndCdataSectionHandler
;
defaultHandler
=
oldDefaultHandler
;
startNamespaceDeclHandler
=
oldStartNamespaceDeclHandler
;
endNamespaceDeclHandler
=
oldEndNamespaceDeclHandler
;
notStandaloneHandler
=
oldNotStandaloneHandler
;
externalEntityRefHandler
=
oldExternalEntityRefHandler
;
unknownEncodingHandler
=
oldUnknownEncodingHandler
;
userData
=
oldUserData
;
if
(
oldUserData
==
oldHandlerArg
)
handlerArg
=
userData
;
else
handlerArg
=
parser
;
if
(
oldExternalEntityRefHandlerArg
!=
oldParser
)
externalEntityRefHandlerArg
=
oldExternalEntityRefHandlerArg
;
defaultExpandInternalEntities
=
oldDefaultExpandInternalEntities
;
if
(
!
dtdCopy
(
&
dtd
,
oldDtd
)
||
!
setContext
(
parser
,
context
))
{
XML_ParserFree
(
parser
);
return
0
;
}
}
processor
=
externalEntityInitProcessor
;
return
parser
;
return
parser
;
}
}
static
void
destroyBindings
(
BINDING
*
bindings
)
{
for
(;;)
{
BINDING
*
b
=
bindings
;
if
(
!
b
)
break
;
bindings
=
b
->
nextTagBinding
;
free
(
b
->
uri
);
free
(
b
);
}
}
void
XML_ParserFree
(
XML_Parser
parser
)
void
XML_ParserFree
(
XML_Parser
parser
)
{
{
for
(;;)
{
for
(;;)
{
...
@@ -285,8 +604,11 @@ void XML_ParserFree(XML_Parser parser)
...
@@ -285,8 +604,11 @@ void XML_ParserFree(XML_Parser parser)
p
=
tagStack
;
p
=
tagStack
;
tagStack
=
tagStack
->
parent
;
tagStack
=
tagStack
->
parent
;
free
(
p
->
buf
);
free
(
p
->
buf
);
destroyBindings
(
p
->
bindings
);
free
(
p
);
free
(
p
);
}
}
destroyBindings
(
freeBindingList
);
destroyBindings
(
inheritedBindings
);
poolDestroy
(
&
tempPool
);
poolDestroy
(
&
tempPool
);
poolDestroy
(
&
temp2Pool
);
poolDestroy
(
&
temp2Pool
);
dtdDestroy
(
&
dtd
);
dtdDestroy
(
&
dtd
);
...
@@ -294,14 +616,48 @@ void XML_ParserFree(XML_Parser parser)
...
@@ -294,14 +616,48 @@ void XML_ParserFree(XML_Parser parser)
free
(
groupConnector
);
free
(
groupConnector
);
free
(
buffer
);
free
(
buffer
);
free
(
dataBuf
);
free
(
dataBuf
);
free
(
unknownEncodingMem
);
if
(
unknownEncodingRelease
)
unknownEncodingRelease
(
unknownEncodingData
);
free
(
parser
);
free
(
parser
);
}
}
void
XML_UseParserAsHandlerArg
(
XML_Parser
parser
)
{
handlerArg
=
parser
;
}
void
XML_SetUserData
(
XML_Parser
parser
,
void
*
p
)
void
XML_SetUserData
(
XML_Parser
parser
,
void
*
p
)
{
{
if
(
handlerArg
==
userData
)
handlerArg
=
userData
=
p
;
else
userData
=
p
;
userData
=
p
;
}
}
int
XML_SetBase
(
XML_Parser
parser
,
const
XML_Char
*
p
)
{
if
(
p
)
{
p
=
poolCopyString
(
&
dtd
.
pool
,
p
);
if
(
!
p
)
return
0
;
dtd
.
base
=
p
;
}
else
dtd
.
base
=
0
;
return
1
;
}
const
XML_Char
*
XML_GetBase
(
XML_Parser
parser
)
{
return
dtd
.
base
;
}
int
XML_GetSpecifiedAttributeCount
(
XML_Parser
parser
)
{
return
nSpecifiedAtts
;
}
void
XML_SetElementHandler
(
XML_Parser
parser
,
void
XML_SetElementHandler
(
XML_Parser
parser
,
XML_StartElementHandler
start
,
XML_StartElementHandler
start
,
XML_EndElementHandler
end
)
XML_EndElementHandler
end
)
...
@@ -322,44 +678,120 @@ void XML_SetProcessingInstructionHandler(XML_Parser parser,
...
@@ -322,44 +678,120 @@ void XML_SetProcessingInstructionHandler(XML_Parser parser,
processingInstructionHandler
=
handler
;
processingInstructionHandler
=
handler
;
}
}
void
XML_SetCommentHandler
(
XML_Parser
parser
,
XML_CommentHandler
handler
)
{
commentHandler
=
handler
;
}
void
XML_SetCdataSectionHandler
(
XML_Parser
parser
,
XML_StartCdataSectionHandler
start
,
XML_EndCdataSectionHandler
end
)
{
startCdataSectionHandler
=
start
;
endCdataSectionHandler
=
end
;
}
void
XML_SetDefaultHandler
(
XML_Parser
parser
,
XML_DefaultHandler
handler
)
{
defaultHandler
=
handler
;
defaultExpandInternalEntities
=
0
;
}
void
XML_SetDefaultHandlerExpand
(
XML_Parser
parser
,
XML_DefaultHandler
handler
)
{
defaultHandler
=
handler
;
defaultExpandInternalEntities
=
1
;
}
void
XML_SetUnparsedEntityDeclHandler
(
XML_Parser
parser
,
XML_UnparsedEntityDeclHandler
handler
)
{
unparsedEntityDeclHandler
=
handler
;
}
void
XML_SetNotationDeclHandler
(
XML_Parser
parser
,
XML_NotationDeclHandler
handler
)
{
notationDeclHandler
=
handler
;
}
void
XML_SetNamespaceDeclHandler
(
XML_Parser
parser
,
XML_StartNamespaceDeclHandler
start
,
XML_EndNamespaceDeclHandler
end
)
{
startNamespaceDeclHandler
=
start
;
endNamespaceDeclHandler
=
end
;
}
void
XML_SetNotStandaloneHandler
(
XML_Parser
parser
,
XML_NotStandaloneHandler
handler
)
{
notStandaloneHandler
=
handler
;
}
void
XML_SetExternalEntityRefHandler
(
XML_Parser
parser
,
XML_ExternalEntityRefHandler
handler
)
{
externalEntityRefHandler
=
handler
;
}
void
XML_SetExternalEntityRefHandlerArg
(
XML_Parser
parser
,
void
*
arg
)
{
if
(
arg
)
externalEntityRefHandlerArg
=
arg
;
else
externalEntityRefHandlerArg
=
parser
;
}
void
XML_SetUnknownEncodingHandler
(
XML_Parser
parser
,
XML_UnknownEncodingHandler
handler
,
void
*
data
)
{
unknownEncodingHandler
=
handler
;
unknownEncodingHandlerData
=
data
;
}
int
XML_Parse
(
XML_Parser
parser
,
const
char
*
s
,
int
len
,
int
isFinal
)
int
XML_Parse
(
XML_Parser
parser
,
const
char
*
s
,
int
len
,
int
isFinal
)
{
{
bufferEndByteIndex
+=
len
;
if
(
len
==
0
)
{
if
(
len
==
0
)
{
if
(
!
isFinal
)
if
(
!
isFinal
)
return
1
;
return
1
;
errorCode
=
processor
(
parser
,
bufferPtr
,
bufferEnd
,
0
);
positionPtr
=
bufferPtr
;
return
errorCode
==
XML_ERROR_NONE
;
errorCode
=
processor
(
parser
,
bufferPtr
,
parseEndPtr
=
bufferEnd
,
0
);
if
(
errorCode
==
XML_ERROR_NONE
)
return
1
;
eventEndPtr
=
eventPtr
;
return
0
;
}
}
else
if
(
bufferPtr
==
bufferEnd
)
{
else
if
(
bufferPtr
==
bufferEnd
)
{
const
char
*
end
;
const
char
*
end
;
int
nLeftOver
;
int
nLeftOver
;
parseEndByteIndex
+=
len
;
positionPtr
=
s
;
if
(
isFinal
)
{
if
(
isFinal
)
{
errorCode
=
processor
(
parser
,
s
,
s
+
len
,
0
);
errorCode
=
processor
(
parser
,
s
,
parseEndPtr
=
s
+
len
,
0
);
if
(
errorCode
==
XML_ERROR_NONE
)
if
(
errorCode
==
XML_ERROR_NONE
)
return
1
;
return
1
;
if
(
errorPtr
)
{
eventEndPtr
=
eventPtr
;
errorByteIndex
=
bufferEndByteIndex
-
(
s
+
len
-
errorPtr
);
XmlUpdatePosition
(
encoding
,
s
,
errorPtr
,
&
position
);
}
return
0
;
return
0
;
}
}
errorCode
=
processor
(
parser
,
s
,
s
+
len
,
&
end
);
errorCode
=
processor
(
parser
,
s
,
parseEndPtr
=
s
+
len
,
&
end
);
if
(
errorCode
!=
XML_ERROR_NONE
)
{
if
(
errorCode
!=
XML_ERROR_NONE
)
{
if
(
errorPtr
)
{
eventEndPtr
=
eventPtr
;
errorByteIndex
=
bufferEndByteIndex
-
(
s
+
len
-
errorPtr
);
XmlUpdatePosition
(
encoding
,
s
,
errorPtr
,
&
position
);
}
return
0
;
return
0
;
}
}
XmlUpdatePosition
(
encoding
,
s
,
end
,
&
position
);
XmlUpdatePosition
(
encoding
,
positionPtr
,
end
,
&
position
);
nLeftOver
=
s
+
len
-
end
;
nLeftOver
=
s
+
len
-
end
;
if
(
nLeftOver
)
{
if
(
nLeftOver
)
{
if
(
buffer
==
0
||
nLeftOver
>
bufferLim
-
buffer
)
{
if
(
buffer
==
0
||
nLeftOver
>
bufferLim
-
buffer
)
{
/* FIXME avoid integer overflow */
/* FIXME avoid integer overflow */
buffer
=
realloc
(
buffer
,
len
*
2
);
buffer
=
buffer
==
0
?
malloc
(
len
*
2
)
:
realloc
(
buffer
,
len
*
2
);
if
(
!
buffer
)
{
if
(
!
buffer
)
{
errorCode
=
XML_ERROR_NO_MEMORY
;
errorCode
=
XML_ERROR_NO_MEMORY
;
eventPtr
=
eventEndPtr
=
0
;
return
0
;
return
0
;
}
}
bufferLim
=
buffer
+
len
*
2
;
bufferLim
=
buffer
+
len
*
2
;
...
@@ -379,19 +811,18 @@ int XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
...
@@ -379,19 +811,18 @@ int XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
int
XML_ParseBuffer
(
XML_Parser
parser
,
int
len
,
int
isFinal
)
int
XML_ParseBuffer
(
XML_Parser
parser
,
int
len
,
int
isFinal
)
{
{
const
char
*
start
=
bufferPtr
;
const
char
*
start
=
bufferPtr
;
positionPtr
=
start
;
bufferEnd
+=
len
;
bufferEnd
+=
len
;
errorCode
=
processor
(
parser
,
bufferPtr
,
bufferEnd
,
parseEndByteIndex
+=
len
;
errorCode
=
processor
(
parser
,
start
,
parseEndPtr
=
bufferEnd
,
isFinal
?
(
const
char
**
)
0
:
&
bufferPtr
);
isFinal
?
(
const
char
**
)
0
:
&
bufferPtr
);
if
(
errorCode
==
XML_ERROR_NONE
)
{
if
(
errorCode
==
XML_ERROR_NONE
)
{
if
(
!
isFinal
)
if
(
!
isFinal
)
XmlUpdatePosition
(
encoding
,
start
,
bufferPtr
,
&
position
);
XmlUpdatePosition
(
encoding
,
positionPtr
,
bufferPtr
,
&
position
);
return
1
;
return
1
;
}
}
else
{
else
{
if
(
errorPtr
)
{
eventEndPtr
=
eventPtr
;
errorByteIndex
=
bufferEndByteIndex
-
(
bufferEnd
-
errorPtr
);
XmlUpdatePosition
(
encoding
,
start
,
errorPtr
,
&
position
);
}
return
0
;
return
0
;
}
}
}
}
...
@@ -431,49 +862,82 @@ void *XML_GetBuffer(XML_Parser parser, int len)
...
@@ -431,49 +862,82 @@ void *XML_GetBuffer(XML_Parser parser, int len)
return
bufferEnd
;
return
bufferEnd
;
}
}
int
XML_GetErrorCode
(
XML_Parser
parser
)
enum
XML_Error
XML_GetErrorCode
(
XML_Parser
parser
)
{
{
return
errorCode
;
return
errorCode
;
}
}
int
XML_GetErrorLineNumber
(
XML_Parser
parser
)
long
XML_GetCurrentByteIndex
(
XML_Parser
parser
)
{
if
(
eventPtr
)
return
parseEndByteIndex
-
(
parseEndPtr
-
eventPtr
);
return
-
1
;
}
int
XML_GetCurrentByteCount
(
XML_Parser
parser
)
{
if
(
eventEndPtr
&&
eventPtr
)
return
eventEndPtr
-
eventPtr
;
return
0
;
}
int
XML_GetCurrentLineNumber
(
XML_Parser
parser
)
{
{
if
(
eventPtr
)
{
XmlUpdatePosition
(
encoding
,
positionPtr
,
eventPtr
,
&
position
);
positionPtr
=
eventPtr
;
}
return
position
.
lineNumber
+
1
;
return
position
.
lineNumber
+
1
;
}
}
int
XML_Get
Error
ColumnNumber
(
XML_Parser
parser
)
int
XML_Get
Current
ColumnNumber
(
XML_Parser
parser
)
{
{
if
(
eventPtr
)
{
XmlUpdatePosition
(
encoding
,
positionPtr
,
eventPtr
,
&
position
);
positionPtr
=
eventPtr
;
}
return
position
.
columnNumber
;
return
position
.
columnNumber
;
}
}
long
XML_GetErrorByteIndex
(
XML_Parser
parser
)
void
XML_DefaultCurrent
(
XML_Parser
parser
)
{
{
return
errorByteIndex
;
if
(
defaultHandler
)
{
if
(
openInternalEntities
)
reportDefault
(
parser
,
ns
?
XmlGetInternalEncodingNS
()
:
XmlGetInternalEncoding
(),
openInternalEntities
->
internalEventPtr
,
openInternalEntities
->
internalEventEndPtr
);
else
reportDefault
(
parser
,
encoding
,
eventPtr
,
eventEndPtr
);
}
}
}
const
c
har
*
XML_ErrorString
(
int
code
)
const
XML_LC
har
*
XML_ErrorString
(
int
code
)
{
{
static
const
c
har
*
message
[]
=
{
static
const
XML_LC
har
*
message
[]
=
{
0
,
0
,
"out of memory"
,
XML_T
(
"out of memory"
),
"syntax error"
,
XML_T
(
"syntax error"
),
"no element found"
,
XML_T
(
"no element found"
),
"not well-formed"
,
XML_T
(
"not well-formed"
),
"unclosed token"
,
XML_T
(
"unclosed token"
),
"unclosed token"
,
XML_T
(
"unclosed token"
),
"mismatched tag"
,
XML_T
(
"mismatched tag"
),
"duplicate attribute"
,
XML_T
(
"duplicate attribute"
),
"junk after document element"
,
XML_T
(
"junk after document element"
),
"parameter entity reference not allowed within declaration in internal subset"
,
XML_T
(
"illegal parameter entity reference"
),
"undefined entity"
,
XML_T
(
"undefined entity"
),
"recursive entity reference"
,
XML_T
(
"recursive entity reference"
),
"asynchronous entity"
,
XML_T
(
"asynchronous entity"
),
"reference to invalid character number"
,
XML_T
(
"reference to invalid character number"
),
"reference to binary entity"
,
XML_T
(
"reference to binary entity"
),
"reference to external entity in attribute"
,
XML_T
(
"reference to external entity in attribute"
),
"xml processing instruction not at start of external entity"
,
XML_T
(
"xml processing instruction not at start of external entity"
),
"unknown encoding"
,
XML_T
(
"unknown encoding"
),
"encoding specified in XML declaration is incorrect"
XML_T
(
"encoding specified in XML declaration is incorrect"
),
XML_T
(
"unclosed CDATA section"
),
XML_T
(
"error in processing external entity reference"
),
XML_T
(
"document is not standalone"
)
};
};
if
(
code
>
0
&&
code
<
sizeof
(
message
)
/
sizeof
(
message
[
0
]))
if
(
code
>
0
&&
code
<
sizeof
(
message
)
/
sizeof
(
message
[
0
]))
return
message
[
code
];
return
message
[
code
];
...
@@ -489,6 +953,96 @@ enum XML_Error contentProcessor(XML_Parser parser,
...
@@ -489,6 +953,96 @@ enum XML_Error contentProcessor(XML_Parser parser,
return
doContent
(
parser
,
0
,
encoding
,
start
,
end
,
endPtr
);
return
doContent
(
parser
,
0
,
encoding
,
start
,
end
,
endPtr
);
}
}
static
enum
XML_Error
externalEntityInitProcessor
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
end
,
const
char
**
endPtr
)
{
enum
XML_Error
result
=
initializeEncoding
(
parser
);
if
(
result
!=
XML_ERROR_NONE
)
return
result
;
processor
=
externalEntityInitProcessor2
;
return
externalEntityInitProcessor2
(
parser
,
start
,
end
,
endPtr
);
}
static
enum
XML_Error
externalEntityInitProcessor2
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
end
,
const
char
**
endPtr
)
{
const
char
*
next
;
int
tok
=
XmlContentTok
(
encoding
,
start
,
end
,
&
next
);
switch
(
tok
)
{
case
XML_TOK_BOM
:
start
=
next
;
break
;
case
XML_TOK_PARTIAL
:
if
(
endPtr
)
{
*
endPtr
=
start
;
return
XML_ERROR_NONE
;
}
eventPtr
=
start
;
return
XML_ERROR_UNCLOSED_TOKEN
;
case
XML_TOK_PARTIAL_CHAR
:
if
(
endPtr
)
{
*
endPtr
=
start
;
return
XML_ERROR_NONE
;
}
eventPtr
=
start
;
return
XML_ERROR_PARTIAL_CHAR
;
}
processor
=
externalEntityInitProcessor3
;
return
externalEntityInitProcessor3
(
parser
,
start
,
end
,
endPtr
);
}
static
enum
XML_Error
externalEntityInitProcessor3
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
end
,
const
char
**
endPtr
)
{
const
char
*
next
;
int
tok
=
XmlContentTok
(
encoding
,
start
,
end
,
&
next
);
switch
(
tok
)
{
case
XML_TOK_XML_DECL
:
{
enum
XML_Error
result
=
processXmlDecl
(
parser
,
1
,
start
,
next
);
if
(
result
!=
XML_ERROR_NONE
)
return
result
;
start
=
next
;
}
break
;
case
XML_TOK_PARTIAL
:
if
(
endPtr
)
{
*
endPtr
=
start
;
return
XML_ERROR_NONE
;
}
eventPtr
=
start
;
return
XML_ERROR_UNCLOSED_TOKEN
;
case
XML_TOK_PARTIAL_CHAR
:
if
(
endPtr
)
{
*
endPtr
=
start
;
return
XML_ERROR_NONE
;
}
eventPtr
=
start
;
return
XML_ERROR_PARTIAL_CHAR
;
}
processor
=
externalEntityContentProcessor
;
tagLevel
=
1
;
return
doContent
(
parser
,
1
,
encoding
,
start
,
end
,
endPtr
);
}
static
enum
XML_Error
externalEntityContentProcessor
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
end
,
const
char
**
endPtr
)
{
return
doContent
(
parser
,
1
,
encoding
,
start
,
end
,
endPtr
);
}
static
enum
XML_Error
static
enum
XML_Error
doContent
(
XML_Parser
parser
,
doContent
(
XML_Parser
parser
,
int
startTagLevel
,
int
startTagLevel
,
...
@@ -497,95 +1051,146 @@ doContent(XML_Parser parser,
...
@@ -497,95 +1051,146 @@ doContent(XML_Parser parser,
const
char
*
end
,
const
char
*
end
,
const
char
**
nextPtr
)
const
char
**
nextPtr
)
{
{
const
ENCODING
*
utf8
=
XmlGetInternalEncoding
(
XML_UTF8_ENCODING
);
const
ENCODING
*
internalEnc
=
ns
?
XmlGetInternalEncodingNS
()
:
XmlGetInternalEncoding
();
const
char
**
eventPP
;
const
char
**
eventEndPP
;
if
(
enc
==
encoding
)
{
eventPP
=
&
eventPtr
;
eventEndPP
=
&
eventEndPtr
;
}
else
{
eventPP
=
&
(
openInternalEntities
->
internalEventPtr
);
eventEndPP
=
&
(
openInternalEntities
->
internalEventEndPtr
);
}
*
eventPP
=
s
;
for
(;;)
{
for
(;;)
{
const
char
*
next
;
const
char
*
next
=
s
;
/* XmlContentTok doesn't always set the last arg */
int
tok
=
XmlContentTok
(
enc
,
s
,
end
,
&
next
);
int
tok
=
XmlContentTok
(
enc
,
s
,
end
,
&
next
);
*
eventEndPP
=
next
;
switch
(
tok
)
{
switch
(
tok
)
{
case
XML_TOK_TRAILING_CR
:
case
XML_TOK_TRAILING_CR
:
if
(
nextPtr
)
{
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
}
*
eventEndPP
=
end
;
if
(
characterDataHandler
)
{
XML_Char
c
=
0xA
;
characterDataHandler
(
handlerArg
,
&
c
,
1
);
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
end
);
if
(
startTagLevel
==
0
)
return
XML_ERROR_NO_ELEMENTS
;
if
(
tagLevel
!=
startTagLevel
)
return
XML_ERROR_ASYNC_ENTITY
;
return
XML_ERROR_NONE
;
case
XML_TOK_NONE
:
case
XML_TOK_NONE
:
if
(
nextPtr
)
{
if
(
nextPtr
)
{
*
nextPtr
=
s
;
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
if
(
startTagLevel
>
0
)
{
if
(
startTagLevel
>
0
)
{
if
(
tagLevel
!=
startTagLevel
)
{
if
(
tagLevel
!=
startTagLevel
)
errorPtr
=
s
;
return
XML_ERROR_ASYNC_ENTITY
;
return
XML_ERROR_ASYNC_ENTITY
;
}
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
errorPtr
=
s
;
return
XML_ERROR_NO_ELEMENTS
;
return
XML_ERROR_NO_ELEMENTS
;
case
XML_TOK_INVALID
:
case
XML_TOK_INVALID
:
errorPtr
=
next
;
*
eventPP
=
next
;
return
XML_ERROR_INVALID_TOKEN
;
return
XML_ERROR_INVALID_TOKEN
;
case
XML_TOK_PARTIAL
:
case
XML_TOK_PARTIAL
:
if
(
nextPtr
)
{
if
(
nextPtr
)
{
*
nextPtr
=
s
;
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
errorPtr
=
s
;
return
XML_ERROR_UNCLOSED_TOKEN
;
return
XML_ERROR_UNCLOSED_TOKEN
;
case
XML_TOK_PARTIAL_CHAR
:
case
XML_TOK_PARTIAL_CHAR
:
if
(
nextPtr
)
{
if
(
nextPtr
)
{
*
nextPtr
=
s
;
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
errorPtr
=
s
;
return
XML_ERROR_PARTIAL_CHAR
;
return
XML_ERROR_PARTIAL_CHAR
;
case
XML_TOK_ENTITY_REF
:
case
XML_TOK_ENTITY_REF
:
{
{
const
char
*
name
=
poolStoreString
(
&
dtd
.
pool
,
enc
,
const
XML_Char
*
name
;
ENTITY
*
entity
;
XML_Char
ch
=
XmlPredefinedEntityName
(
enc
,
s
+
enc
->
minBytesPerChar
,
next
-
enc
->
minBytesPerChar
);
if
(
ch
)
{
if
(
characterDataHandler
)
characterDataHandler
(
handlerArg
,
&
ch
,
1
);
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
}
name
=
poolStoreString
(
&
dtd
.
pool
,
enc
,
s
+
enc
->
minBytesPerChar
,
s
+
enc
->
minBytesPerChar
,
next
-
enc
->
minBytesPerChar
);
next
-
enc
->
minBytesPerChar
);
ENTITY
*
entity
;
if
(
!
name
)
if
(
!
name
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
entity
=
(
ENTITY
*
)
lookup
(
&
dtd
.
generalEntities
,
name
,
0
);
entity
=
(
ENTITY
*
)
lookup
(
&
dtd
.
generalEntities
,
name
,
0
);
poolDiscard
(
&
dtd
.
pool
);
poolDiscard
(
&
dtd
.
pool
);
if
(
!
entity
)
{
if
(
!
entity
)
{
if
(
dtd
.
complete
||
dtd
.
standalone
)
{
if
(
dtd
.
complete
||
dtd
.
standalone
)
errorPtr
=
s
;
return
XML_ERROR_UNDEFINED_ENTITY
;
return
XML_ERROR_UNDEFINED_ENTITY
;
}
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
break
;
}
}
if
(
entity
->
magic
)
{
if
(
entity
->
open
)
if
(
characterDataHandler
)
characterDataHandler
(
userData
,
entity
->
textPtr
,
entity
->
textLen
);
break
;
}
if
(
entity
->
open
)
{
errorPtr
=
s
;
return
XML_ERROR_RECURSIVE_ENTITY_REF
;
return
XML_ERROR_RECURSIVE_ENTITY_REF
;
}
if
(
entity
->
notation
)
if
(
entity
->
notation
)
{
errorPtr
=
s
;
return
XML_ERROR_BINARY_ENTITY_REF
;
return
XML_ERROR_BINARY_ENTITY_REF
;
}
if
(
entity
)
{
if
(
entity
)
{
if
(
entity
->
textPtr
)
{
if
(
entity
->
textPtr
)
{
enum
XML_Error
result
;
enum
XML_Error
result
;
OPEN_INTERNAL_ENTITY
openEntity
;
if
(
defaultHandler
&&
!
defaultExpandInternalEntities
)
{
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
}
entity
->
open
=
1
;
entity
->
open
=
1
;
openEntity
.
next
=
openInternalEntities
;
openInternalEntities
=
&
openEntity
;
openEntity
.
entity
=
entity
;
openEntity
.
internalEventPtr
=
0
;
openEntity
.
internalEventEndPtr
=
0
;
result
=
doContent
(
parser
,
result
=
doContent
(
parser
,
tagLevel
,
tagLevel
,
utf8
,
internalEnc
,
entity
->
textPtr
,
(
char
*
)
entity
->
textPtr
,
entity
->
textPtr
+
entity
->
textLen
,
(
char
*
)(
entity
->
textPtr
+
entity
->
textLen
)
,
0
);
0
);
entity
->
open
=
0
;
entity
->
open
=
0
;
if
(
result
)
{
openInternalEntities
=
openEntity
.
next
;
errorPtr
=
s
;
if
(
result
)
return
result
;
return
result
;
}
}
else
if
(
externalEntityRefHandler
)
{
const
XML_Char
*
context
;
entity
->
open
=
1
;
context
=
getContext
(
parser
);
entity
->
open
=
0
;
if
(
!
context
)
return
XML_ERROR_NO_MEMORY
;
if
(
!
externalEntityRefHandler
(
externalEntityRefHandlerArg
,
context
,
dtd
.
base
,
entity
->
systemId
,
entity
->
publicId
))
return
XML_ERROR_EXTERNAL_ENTITY_HANDLING
;
poolDiscard
(
&
tempPool
);
}
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
}
}
break
;
break
;
}
}
case
XML_TOK_START_TAG_WITH_ATTS
:
case
XML_TOK_START_TAG_WITH_ATTS
:
if
(
!
startElementHandler
)
{
if
(
!
startElementHandler
)
{
enum
XML_Error
result
=
storeAtts
(
parser
,
enc
,
0
,
s
);
enum
XML_Error
result
=
storeAtts
(
parser
,
enc
,
s
,
0
,
0
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
}
}
...
@@ -606,13 +1211,18 @@ doContent(XML_Parser parser,
...
@@ -606,13 +1211,18 @@ doContent(XML_Parser parser,
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
tag
->
bufEnd
=
tag
->
buf
+
INIT_TAG_BUF_SIZE
;
tag
->
bufEnd
=
tag
->
buf
+
INIT_TAG_BUF_SIZE
;
}
}
tag
->
bindings
=
0
;
tag
->
parent
=
tagStack
;
tag
->
parent
=
tagStack
;
tagStack
=
tag
;
tagStack
=
tag
;
tag
->
name
.
localPart
=
0
;
tag
->
rawName
=
s
+
enc
->
minBytesPerChar
;
tag
->
rawName
=
s
+
enc
->
minBytesPerChar
;
tag
->
rawNameLength
=
XmlNameLength
(
enc
,
tag
->
rawName
);
tag
->
rawNameLength
=
XmlNameLength
(
enc
,
tag
->
rawName
);
if
(
nextPtr
)
{
if
(
nextPtr
)
{
if
(
tag
->
rawNameLength
>
tag
->
bufEnd
-
tag
->
buf
)
{
/* Need to guarantee that:
tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */
if
(
tag
->
rawNameLength
+
(
int
)(
sizeof
(
XML_Char
)
-
1
)
+
(
int
)
sizeof
(
XML_Char
)
>
tag
->
bufEnd
-
tag
->
buf
)
{
int
bufSize
=
tag
->
rawNameLength
*
4
;
int
bufSize
=
tag
->
rawNameLength
*
4
;
bufSize
=
ROUND_UP
(
bufSize
,
sizeof
(
XML_Char
));
tag
->
buf
=
realloc
(
tag
->
buf
,
bufSize
);
tag
->
buf
=
realloc
(
tag
->
buf
,
bufSize
);
if
(
!
tag
->
buf
)
if
(
!
tag
->
buf
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
...
@@ -624,18 +1234,19 @@ doContent(XML_Parser parser,
...
@@ -624,18 +1234,19 @@ doContent(XML_Parser parser,
++
tagLevel
;
++
tagLevel
;
if
(
startElementHandler
)
{
if
(
startElementHandler
)
{
enum
XML_Error
result
;
enum
XML_Error
result
;
char
*
toPtr
;
XML_Char
*
toPtr
;
const
char
*
rawNameEnd
=
tag
->
rawName
+
tag
->
rawNameLength
;
for
(;;)
{
for
(;;)
{
const
char
*
rawNameEnd
=
tag
->
rawName
+
tag
->
rawNameLength
;
const
char
*
fromPtr
=
tag
->
rawName
;
const
char
*
fromPtr
=
tag
->
rawName
;
int
bufSize
;
int
bufSize
;
toPtr
=
tag
->
buf
;
if
(
nextPtr
)
if
(
nextPtr
)
toPtr
+=
tag
->
rawNameLength
;
toPtr
=
(
XML_Char
*
)(
tag
->
buf
+
ROUND_UP
(
tag
->
rawNameLength
,
sizeof
(
XML_Char
)));
tag
->
name
=
toPtr
;
else
XmlConvert
(
enc
,
XML_UTF8_ENCODING
,
toPtr
=
(
XML_Char
*
)
tag
->
buf
;
tag
->
name
.
str
=
toPtr
;
XmlConvert
(
enc
,
&
fromPtr
,
rawNameEnd
,
&
fromPtr
,
rawNameEnd
,
&
toPtr
,
tag
->
bufEnd
-
1
);
(
ICHAR
**
)
&
toPtr
,
(
ICHAR
*
)
tag
->
bufEnd
-
1
);
if
(
fromPtr
==
rawNameEnd
)
if
(
fromPtr
==
rawNameEnd
)
break
;
break
;
bufSize
=
(
tag
->
bufEnd
-
tag
->
buf
)
<<
1
;
bufSize
=
(
tag
->
bufEnd
-
tag
->
buf
)
<<
1
;
...
@@ -643,21 +1254,26 @@ doContent(XML_Parser parser,
...
@@ -643,21 +1254,26 @@ doContent(XML_Parser parser,
if
(
!
tag
->
buf
)
if
(
!
tag
->
buf
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
tag
->
bufEnd
=
tag
->
buf
+
bufSize
;
tag
->
bufEnd
=
tag
->
buf
+
bufSize
;
if
(
nextPtr
)
tag
->
rawName
=
tag
->
buf
;
}
}
*
toPtr
=
0
;
*
toPtr
=
XML_T
(
'\0'
)
;
result
=
storeAtts
(
parser
,
enc
,
tag
->
name
,
s
);
result
=
storeAtts
(
parser
,
enc
,
s
,
&
(
tag
->
name
),
&
(
tag
->
bindings
)
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
startElementHandler
(
userData
,
tag
->
name
,
(
const
c
har
**
)
atts
);
startElementHandler
(
handlerArg
,
tag
->
name
.
str
,
(
const
XML_C
har
**
)
atts
);
poolClear
(
&
tempPool
);
poolClear
(
&
tempPool
);
}
}
else
else
{
tag
->
name
=
0
;
tag
->
name
.
str
=
0
;
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
}
break
;
break
;
}
}
case
XML_TOK_EMPTY_ELEMENT_WITH_ATTS
:
case
XML_TOK_EMPTY_ELEMENT_WITH_ATTS
:
if
(
!
startElementHandler
)
{
if
(
!
startElementHandler
)
{
enum
XML_Error
result
=
storeAtts
(
parser
,
enc
,
0
,
s
);
enum
XML_Error
result
=
storeAtts
(
parser
,
enc
,
s
,
0
,
0
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
}
}
...
@@ -665,30 +1281,44 @@ doContent(XML_Parser parser,
...
@@ -665,30 +1281,44 @@ doContent(XML_Parser parser,
case
XML_TOK_EMPTY_ELEMENT_NO_ATTS
:
case
XML_TOK_EMPTY_ELEMENT_NO_ATTS
:
if
(
startElementHandler
||
endElementHandler
)
{
if
(
startElementHandler
||
endElementHandler
)
{
const
char
*
rawName
=
s
+
enc
->
minBytesPerChar
;
const
char
*
rawName
=
s
+
enc
->
minBytesPerChar
;
const
char
*
name
=
poolStoreString
(
&
tempPool
,
enc
,
rawName
,
enum
XML_Error
result
;
rawName
BINDING
*
bindings
=
0
;
+
XmlNameLength
(
enc
,
rawName
));
TAG_NAME
name
;
if
(
!
name
)
name
.
str
=
poolStoreString
(
&
tempPool
,
enc
,
rawName
,
rawName
+
XmlNameLength
(
enc
,
rawName
));
if
(
!
name
.
str
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
poolFinish
(
&
tempPool
);
poolFinish
(
&
tempPool
);
if
(
startElementHandler
)
{
result
=
storeAtts
(
parser
,
enc
,
s
,
&
name
,
&
bindings
);
enum
XML_Error
result
=
storeAtts
(
parser
,
enc
,
name
,
s
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
startElementHandler
(
userData
,
name
,
(
const
char
**
)
atts
);
poolFinish
(
&
tempPool
);
if
(
startElementHandler
)
startElementHandler
(
handlerArg
,
name
.
str
,
(
const
XML_Char
**
)
atts
);
if
(
endElementHandler
)
{
if
(
startElementHandler
)
*
eventPP
=
*
eventEndPP
;
endElementHandler
(
handlerArg
,
name
.
str
);
}
}
if
(
endElementHandler
)
endElementHandler
(
userData
,
name
);
poolClear
(
&
tempPool
);
poolClear
(
&
tempPool
);
}
while
(
bindings
)
{
BINDING
*
b
=
bindings
;
if
(
endNamespaceDeclHandler
)
endNamespaceDeclHandler
(
handlerArg
,
b
->
prefix
->
name
);
bindings
=
bindings
->
nextTagBinding
;
b
->
nextTagBinding
=
freeBindingList
;
freeBindingList
=
b
;
b
->
prefix
->
binding
=
b
->
prevPrefixBinding
;
}
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
if
(
tagLevel
==
0
)
if
(
tagLevel
==
0
)
return
epilogProcessor
(
parser
,
next
,
end
,
nextPtr
);
return
epilogProcessor
(
parser
,
next
,
end
,
nextPtr
);
break
;
break
;
case
XML_TOK_END_TAG
:
case
XML_TOK_END_TAG
:
if
(
tagLevel
==
startTagLevel
)
{
if
(
tagLevel
==
startTagLevel
)
errorPtr
=
s
;
return
XML_ERROR_ASYNC_ENTITY
;
return
XML_ERROR_ASYNC_ENTITY
;
}
else
{
else
{
int
len
;
int
len
;
const
char
*
rawName
;
const
char
*
rawName
;
...
@@ -700,21 +1330,29 @@ doContent(XML_Parser parser,
...
@@ -700,21 +1330,29 @@ doContent(XML_Parser parser,
len
=
XmlNameLength
(
enc
,
rawName
);
len
=
XmlNameLength
(
enc
,
rawName
);
if
(
len
!=
tag
->
rawNameLength
if
(
len
!=
tag
->
rawNameLength
||
memcmp
(
tag
->
rawName
,
rawName
,
len
)
!=
0
)
{
||
memcmp
(
tag
->
rawName
,
rawName
,
len
)
!=
0
)
{
errorPtr
=
rawName
;
*
eventPP
=
rawName
;
return
XML_ERROR_TAG_MISMATCH
;
return
XML_ERROR_TAG_MISMATCH
;
}
}
--
tagLevel
;
--
tagLevel
;
if
(
endElementHandler
)
{
if
(
endElementHandler
&&
tag
->
name
.
str
)
{
if
(
tag
->
name
)
if
(
tag
->
name
.
localPart
)
{
endElementHandler
(
userData
,
tag
->
name
);
XML_Char
*
to
=
(
XML_Char
*
)
tag
->
name
.
str
+
tag
->
name
.
uriLen
;
else
{
const
XML_Char
*
from
=
tag
->
name
.
localPart
;
const
char
*
name
=
poolStoreString
(
&
tempPool
,
enc
,
rawName
,
while
((
*
to
++
=
*
from
++
)
!=
0
)
rawName
+
len
);
;
if
(
!
name
)
}
return
XML_ERROR_NO_MEMORY
;
endElementHandler
(
handlerArg
,
tag
->
name
.
str
);
endElementHandler
(
userData
,
name
);
}
poolClear
(
&
tempPool
);
else
if
(
defaultHandler
)
}
reportDefault
(
parser
,
enc
,
s
,
next
);
while
(
tag
->
bindings
)
{
BINDING
*
b
=
tag
->
bindings
;
if
(
endNamespaceDeclHandler
)
endNamespaceDeclHandler
(
handlerArg
,
b
->
prefix
->
name
);
tag
->
bindings
=
tag
->
bindings
->
nextTagBinding
;
b
->
nextTagBinding
=
freeBindingList
;
freeBindingList
=
b
;
b
->
prefix
->
binding
=
b
->
prevPrefixBinding
;
}
}
if
(
tagLevel
==
0
)
if
(
tagLevel
==
0
)
return
epilogProcessor
(
parser
,
next
,
end
,
nextPtr
);
return
epilogProcessor
(
parser
,
next
,
end
,
nextPtr
);
...
@@ -723,82 +1361,163 @@ doContent(XML_Parser parser,
...
@@ -723,82 +1361,163 @@ doContent(XML_Parser parser,
case
XML_TOK_CHAR_REF
:
case
XML_TOK_CHAR_REF
:
{
{
int
n
=
XmlCharRefNumber
(
enc
,
s
);
int
n
=
XmlCharRefNumber
(
enc
,
s
);
if
(
n
<
0
)
{
if
(
n
<
0
)
errorPtr
=
s
;
return
XML_ERROR_BAD_CHAR_REF
;
return
XML_ERROR_BAD_CHAR_REF
;
}
if
(
characterDataHandler
)
{
if
(
characterDataHandler
)
{
char
buf
[
XML_MAX_BYTES_PER_CHAR
];
XML_Char
buf
[
XML_ENCODE_MAX
];
characterDataHandler
(
userData
,
buf
,
XmlEncode
(
utf8
,
n
,
buf
));
characterDataHandler
(
handlerArg
,
buf
,
XmlEncode
(
n
,
(
ICHAR
*
)
buf
));
}
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
}
}
break
;
break
;
case
XML_TOK_XML_DECL
:
case
XML_TOK_XML_DECL
:
errorPtr
=
s
;
return
XML_ERROR_MISPLACED_XML_PI
;
return
XML_ERROR_MISPLACED_XML_PI
;
case
XML_TOK_DATA_NEWLINE
:
case
XML_TOK_DATA_NEWLINE
:
if
(
characterDataHandler
)
{
if
(
characterDataHandler
)
{
char
c
=
'\n'
;
XML_Char
c
=
0xA
;
characterDataHandler
(
userData
,
&
c
,
1
);
characterDataHandler
(
handlerArg
,
&
c
,
1
);
}
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
break
;
case
XML_TOK_CDATA_SECTION
:
case
XML_TOK_CDATA_SECT_OPEN
:
if
(
characterDataHandler
)
{
{
const
char
*
lim
=
next
-
enc
->
minBytesPerChar
*
3
;
enum
XML_Error
result
;
s
+=
enc
->
minBytesPerChar
*
9
;
if
(
startCdataSectionHandler
)
do
{
startCdataSectionHandler
(
handlerArg
);
char
*
dataPtr
=
dataBuf
;
#if 0
XmlConvert
(
enc
,
XML_UTF8_ENCODING
,
&
s
,
lim
,
&
dataPtr
,
dataBufEnd
);
/* Suppose you doing a transformation on a document that involves
characterDataHandler
(
userData
,
dataBuf
,
dataPtr
-
dataBuf
);
changing only the character data. You set up a defaultHandler
}
while
(
s
!=
lim
);
and a characterDataHandler. The defaultHandler simply copies
characters through. The characterDataHandler does the transformation
and writes the characters out escaping them as necessary. This case
will fail to work if we leave out the following two lines (because &
and < inside CDATA sections will be incorrectly escaped).
However, now we have a start/endCdataSectionHandler, so it seems
easier to let the user deal with this. */
else if (characterDataHandler)
characterDataHandler(handlerArg, dataBuf, 0);
#endif
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
result
=
doCdataSection
(
parser
,
enc
,
&
next
,
end
,
nextPtr
);
if
(
!
next
)
{
processor
=
cdataSectionProcessor
;
return
result
;
}
}
}
break
;
break
;
case
XML_TOK_DATA_CHARS
:
case
XML_TOK_TRAILING_RSQB
:
if
(
nextPtr
)
{
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
}
if
(
characterDataHandler
)
{
if
(
characterDataHandler
)
{
do
{
if
(
MUST_CONVERT
(
enc
,
s
))
{
char
*
dataPtr
=
dataBuf
;
ICHAR
*
dataPtr
=
(
ICHAR
*
)
dataBuf
;
XmlConvert
(
enc
,
XML_UTF8_ENCODING
,
&
s
,
next
,
&
dataPtr
,
dataBufEnd
);
XmlConvert
(
enc
,
&
s
,
end
,
&
dataPtr
,
(
ICHAR
*
)
dataBufEnd
);
characterDataHandler
(
userData
,
dataBuf
,
dataPtr
-
dataBuf
);
characterDataHandler
(
handlerArg
,
dataBuf
,
dataPtr
-
(
ICHAR
*
)
dataBuf
);
}
while
(
s
!=
next
);
}
}
break
;
else
characterDataHandler
(
handlerArg
,
(
XML_Char
*
)
s
,
(
XML_Char
*
)
end
-
(
XML_Char
*
)
s
);
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
end
);
if
(
startTagLevel
==
0
)
{
*
eventPP
=
end
;
return
XML_ERROR_NO_ELEMENTS
;
}
if
(
tagLevel
!=
startTagLevel
)
{
*
eventPP
=
end
;
return
XML_ERROR_ASYNC_ENTITY
;
}
return
XML_ERROR_NONE
;
case
XML_TOK_DATA_CHARS
:
if
(
characterDataHandler
)
{
if
(
MUST_CONVERT
(
enc
,
s
))
{
for
(;;)
{
ICHAR
*
dataPtr
=
(
ICHAR
*
)
dataBuf
;
XmlConvert
(
enc
,
&
s
,
next
,
&
dataPtr
,
(
ICHAR
*
)
dataBufEnd
);
*
eventEndPP
=
s
;
characterDataHandler
(
handlerArg
,
dataBuf
,
dataPtr
-
(
ICHAR
*
)
dataBuf
);
if
(
s
==
next
)
break
;
*
eventPP
=
s
;
}
}
else
characterDataHandler
(
handlerArg
,
(
XML_Char
*
)
s
,
(
XML_Char
*
)
next
-
(
XML_Char
*
)
s
);
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
case
XML_TOK_PI
:
case
XML_TOK_PI
:
if
(
!
reportProcessingInstruction
(
parser
,
enc
,
s
,
next
))
if
(
!
reportProcessingInstruction
(
parser
,
enc
,
s
,
next
))
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
break
;
break
;
case
XML_TOK_COMMENT
:
if
(
!
reportComment
(
parser
,
enc
,
s
,
next
))
return
XML_ERROR_NO_MEMORY
;
break
;
default:
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
}
}
s
=
next
;
*
eventPP
=
s
=
next
;
}
}
/* not reached */
/* not reached */
}
}
/* If tagName is non-null, build a real list of attributes,
/* If tagName
Ptr
is non-null, build a real list of attributes,
otherwise just check the attributes for well-formedness. */
otherwise just check the attributes for well-formedness. */
static
enum
XML_Error
storeAtts
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
static
enum
XML_Error
storeAtts
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
tagName
,
const
char
*
s
)
const
char
*
s
,
TAG_NAME
*
tagNamePtr
,
BINDING
**
bindingsPtr
)
{
{
ELEMENT_TYPE
*
elementType
=
0
;
ELEMENT_TYPE
*
elementType
=
0
;
int
nDefaultAtts
=
0
;
int
nDefaultAtts
=
0
;
const
char
**
appAtts
=
(
const
char
**
)
atts
;
const
XML_Char
**
appAtts
;
int
attIndex
=
0
;
int
i
;
int
i
;
int
n
;
int
n
;
int
nPrefixes
=
0
;
if
(
tagName
)
{
BINDING
*
binding
;
elementType
=
(
ELEMENT_TYPE
*
)
lookup
(
&
dtd
.
elementTypes
,
tagName
,
0
);
const
XML_Char
*
localPart
;
if
(
elementType
)
if
(
tagNamePtr
)
{
elementType
=
(
ELEMENT_TYPE
*
)
lookup
(
&
dtd
.
elementTypes
,
tagNamePtr
->
str
,
0
);
if
(
!
elementType
)
{
tagNamePtr
->
str
=
poolCopyString
(
&
dtd
.
pool
,
tagNamePtr
->
str
);
if
(
!
tagNamePtr
->
str
)
return
XML_ERROR_NO_MEMORY
;
elementType
=
(
ELEMENT_TYPE
*
)
lookup
(
&
dtd
.
elementTypes
,
tagNamePtr
->
str
,
sizeof
(
ELEMENT_TYPE
));
if
(
!
elementType
)
return
XML_ERROR_NO_MEMORY
;
if
(
ns
&&
!
setElementTypePrefix
(
parser
,
elementType
))
return
XML_ERROR_NO_MEMORY
;
}
nDefaultAtts
=
elementType
->
nDefaultAtts
;
nDefaultAtts
=
elementType
->
nDefaultAtts
;
}
}
n
=
XmlGetAttributes
(
enc
,
s
,
attsSize
,
atts
);
n
=
XmlGetAttributes
(
enc
,
s
,
attsSize
,
atts
);
if
(
n
+
nDefaultAtts
>
attsSize
)
{
if
(
n
+
nDefaultAtts
>
attsSize
)
{
attsSize
=
2
*
n
;
int
oldAttsSize
=
attsSize
;
attsSize
=
n
+
nDefaultAtts
+
INIT_ATTS_SIZE
;
atts
=
realloc
((
void
*
)
atts
,
attsSize
*
sizeof
(
ATTRIBUTE
));
atts
=
realloc
((
void
*
)
atts
,
attsSize
*
sizeof
(
ATTRIBUTE
));
if
(
!
atts
)
if
(
!
atts
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
if
(
n
>
a
ttsSize
)
if
(
n
>
oldA
ttsSize
)
XmlGetAttributes
(
enc
,
s
,
n
,
atts
);
XmlGetAttributes
(
enc
,
s
,
n
,
atts
);
}
}
appAtts
=
(
const
XML_Char
**
)
atts
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
ATTRIBUTE_ID
*
attId
=
getAttributeId
(
parser
,
enc
,
atts
[
i
].
name
,
ATTRIBUTE_ID
*
attId
=
getAttributeId
(
parser
,
enc
,
atts
[
i
].
name
,
atts
[
i
].
name
atts
[
i
].
name
...
@@ -806,11 +1525,12 @@ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc,
...
@@ -806,11 +1525,12 @@ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc,
if
(
!
attId
)
if
(
!
attId
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
if
((
attId
->
name
)[
-
1
])
{
if
((
attId
->
name
)[
-
1
])
{
errorPtr
=
atts
[
i
].
name
;
if
(
enc
==
encoding
)
eventPtr
=
atts
[
i
].
name
;
return
XML_ERROR_DUPLICATE_ATTRIBUTE
;
return
XML_ERROR_DUPLICATE_ATTRIBUTE
;
}
}
(
attId
->
name
)[
-
1
]
=
1
;
(
attId
->
name
)[
-
1
]
=
1
;
appAtts
[
i
<<
1
]
=
attId
->
name
;
appAtts
[
attIndex
++
]
=
attId
->
name
;
if
(
!
atts
[
i
].
normalized
)
{
if
(
!
atts
[
i
].
normalized
)
{
enum
XML_Error
result
;
enum
XML_Error
result
;
int
isCdata
=
1
;
int
isCdata
=
1
;
...
@@ -830,109 +1550,480 @@ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc,
...
@@ -830,109 +1550,480 @@ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc,
&
tempPool
);
&
tempPool
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
if
(
tagName
)
{
if
(
tagName
Ptr
)
{
appAtts
[
(
i
<<
1
)
+
1
]
=
poolStart
(
&
tempPool
);
appAtts
[
attIndex
]
=
poolStart
(
&
tempPool
);
poolFinish
(
&
tempPool
);
poolFinish
(
&
tempPool
);
}
}
else
else
poolDiscard
(
&
tempPool
);
poolDiscard
(
&
tempPool
);
}
}
else
if
(
tagName
)
{
else
if
(
tagName
Ptr
)
{
appAtts
[
(
i
<<
1
)
+
1
]
=
poolStoreString
(
&
tempPool
,
enc
,
atts
[
i
].
valuePtr
,
atts
[
i
].
valueEnd
);
appAtts
[
attIndex
]
=
poolStoreString
(
&
tempPool
,
enc
,
atts
[
i
].
valuePtr
,
atts
[
i
].
valueEnd
);
if
(
appAtts
[
(
i
<<
1
)
+
1
]
==
0
)
if
(
appAtts
[
attIndex
]
==
0
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
poolFinish
(
&
tempPool
);
poolFinish
(
&
tempPool
);
}
}
if
(
attId
->
prefix
&&
tagNamePtr
)
{
if
(
attId
->
xmlns
)
{
if
(
!
addBinding
(
parser
,
attId
->
prefix
,
attId
,
appAtts
[
attIndex
],
bindingsPtr
))
return
XML_ERROR_NO_MEMORY
;
--
attIndex
;
}
else
{
attIndex
++
;
nPrefixes
++
;
(
attId
->
name
)[
-
1
]
=
2
;
}
}
}
if
(
tagName
)
{
else
attIndex
++
;
}
nSpecifiedAtts
=
attIndex
;
if
(
tagNamePtr
)
{
int
j
;
int
j
;
for
(
j
=
0
;
j
<
nDefaultAtts
;
j
++
)
{
for
(
j
=
0
;
j
<
nDefaultAtts
;
j
++
)
{
const
DEFAULT_ATTRIBUTE
*
da
=
elementType
->
defaultAtts
+
j
;
const
DEFAULT_ATTRIBUTE
*
da
=
elementType
->
defaultAtts
+
j
;
if
(
!
(
da
->
id
->
name
)[
-
1
]
&&
da
->
value
)
{
if
(
!
(
da
->
id
->
name
)[
-
1
]
&&
da
->
value
)
{
if
(
da
->
id
->
prefix
)
{
if
(
da
->
id
->
xmlns
)
{
if
(
!
addBinding
(
parser
,
da
->
id
->
prefix
,
da
->
id
,
da
->
value
,
bindingsPtr
))
return
XML_ERROR_NO_MEMORY
;
}
else
{
(
da
->
id
->
name
)[
-
1
]
=
2
;
nPrefixes
++
;
appAtts
[
attIndex
++
]
=
da
->
id
->
name
;
appAtts
[
attIndex
++
]
=
da
->
value
;
}
}
else
{
(
da
->
id
->
name
)[
-
1
]
=
1
;
(
da
->
id
->
name
)[
-
1
]
=
1
;
appAtts
[
i
<<
1
]
=
da
->
id
->
name
;
appAtts
[
attIndex
++
]
=
da
->
id
->
name
;
appAtts
[(
i
<<
1
)
+
1
]
=
da
->
value
;
appAtts
[
attIndex
++
]
=
da
->
value
;
i
++
;
}
}
}
appAtts
[
attIndex
]
=
0
;
}
i
=
0
;
if
(
nPrefixes
)
{
for
(;
i
<
attIndex
;
i
+=
2
)
{
if
(
appAtts
[
i
][
-
1
]
==
2
)
{
ATTRIBUTE_ID
*
id
;
((
XML_Char
*
)(
appAtts
[
i
]))[
-
1
]
=
0
;
id
=
(
ATTRIBUTE_ID
*
)
lookup
(
&
dtd
.
attributeIds
,
appAtts
[
i
],
0
);
if
(
id
->
prefix
->
binding
)
{
int
j
;
const
BINDING
*
b
=
id
->
prefix
->
binding
;
const
XML_Char
*
s
=
appAtts
[
i
];
for
(
j
=
0
;
j
<
b
->
uriLen
;
j
++
)
{
if
(
!
poolAppendChar
(
&
tempPool
,
b
->
uri
[
j
]))
return
XML_ERROR_NO_MEMORY
;
}
while
(
*
s
++
!=
':'
)
;
do
{
if
(
!
poolAppendChar
(
&
tempPool
,
*
s
))
return
XML_ERROR_NO_MEMORY
;
}
while
(
*
s
++
);
appAtts
[
i
]
=
poolStart
(
&
tempPool
);
poolFinish
(
&
tempPool
);
}
if
(
!--
nPrefixes
)
break
;
}
else
((
XML_Char
*
)(
appAtts
[
i
]))[
-
1
]
=
0
;
}
}
}
for
(;
i
<
attIndex
;
i
+=
2
)
((
XML_Char
*
)(
appAtts
[
i
]))[
-
1
]
=
0
;
if
(
!
tagNamePtr
)
return
XML_ERROR_NONE
;
for
(
binding
=
*
bindingsPtr
;
binding
;
binding
=
binding
->
nextTagBinding
)
binding
->
attId
->
name
[
-
1
]
=
0
;
if
(
elementType
->
prefix
)
{
binding
=
elementType
->
prefix
->
binding
;
if
(
!
binding
)
return
XML_ERROR_NONE
;
localPart
=
tagNamePtr
->
str
;
while
(
*
localPart
++
!=
XML_T
(
':'
))
;
}
}
appAtts
[
i
<<
1
]
=
0
;
else
if
(
dtd
.
defaultPrefix
.
binding
)
{
binding
=
dtd
.
defaultPrefix
.
binding
;
localPart
=
tagNamePtr
->
str
;
}
else
return
XML_ERROR_NONE
;
tagNamePtr
->
localPart
=
localPart
;
tagNamePtr
->
uriLen
=
binding
->
uriLen
;
i
=
binding
->
uriLen
;
do
{
if
(
i
==
binding
->
uriAlloc
)
{
binding
->
uri
=
realloc
(
binding
->
uri
,
binding
->
uriAlloc
*=
2
);
if
(
!
binding
->
uri
)
return
XML_ERROR_NO_MEMORY
;
}
}
while
(
i
--
>
0
)
binding
->
uri
[
i
++
]
=
*
localPart
;
((
char
*
)
appAtts
[
i
<<
1
])[
-
1
]
=
0
;
}
while
(
*
localPart
++
);
tagNamePtr
->
str
=
binding
->
uri
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
static
enum
XML_Error
static
prologProcessor
(
XML_Parser
parser
,
int
addBinding
(
XML_Parser
parser
,
PREFIX
*
prefix
,
const
ATTRIBUTE_ID
*
attId
,
const
XML_Char
*
uri
,
BINDING
**
bindingsPtr
)
const
char
*
s
,
{
BINDING
*
b
;
int
len
;
for
(
len
=
0
;
uri
[
len
];
len
++
)
;
if
(
namespaceSeparator
)
len
++
;
if
(
freeBindingList
)
{
b
=
freeBindingList
;
if
(
len
>
b
->
uriAlloc
)
{
b
->
uri
=
realloc
(
b
->
uri
,
len
+
EXPAND_SPARE
);
if
(
!
b
->
uri
)
return
0
;
b
->
uriAlloc
=
len
+
EXPAND_SPARE
;
}
freeBindingList
=
b
->
nextTagBinding
;
}
else
{
b
=
malloc
(
sizeof
(
BINDING
));
if
(
!
b
)
return
0
;
b
->
uri
=
malloc
(
sizeof
(
XML_Char
)
*
len
+
EXPAND_SPARE
);
if
(
!
b
->
uri
)
{
free
(
b
);
return
0
;
}
b
->
uriAlloc
=
len
;
}
b
->
uriLen
=
len
;
memcpy
(
b
->
uri
,
uri
,
len
*
sizeof
(
XML_Char
));
if
(
namespaceSeparator
)
b
->
uri
[
len
-
1
]
=
namespaceSeparator
;
b
->
prefix
=
prefix
;
b
->
attId
=
attId
;
b
->
prevPrefixBinding
=
prefix
->
binding
;
if
(
*
uri
==
XML_T
(
'\0'
)
&&
prefix
==
&
dtd
.
defaultPrefix
)
prefix
->
binding
=
0
;
else
prefix
->
binding
=
b
;
b
->
nextTagBinding
=
*
bindingsPtr
;
*
bindingsPtr
=
b
;
if
(
startNamespaceDeclHandler
)
startNamespaceDeclHandler
(
handlerArg
,
prefix
->
name
,
prefix
->
binding
?
uri
:
0
);
return
1
;
}
/* The idea here is to avoid using stack for each CDATA section when
the whole file is parsed with one call. */
static
enum
XML_Error
cdataSectionProcessor
(
XML_Parser
parser
,
const
char
*
start
,
const
char
*
end
,
const
char
**
endPtr
)
{
enum
XML_Error
result
=
doCdataSection
(
parser
,
encoding
,
&
start
,
end
,
endPtr
);
if
(
start
)
{
processor
=
contentProcessor
;
return
contentProcessor
(
parser
,
start
,
end
,
endPtr
);
}
return
result
;
}
/* startPtr gets set to non-null is the section is closed, and to null if
the section is not yet closed. */
static
enum
XML_Error
doCdataSection
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
**
startPtr
,
const
char
*
end
,
const
char
*
end
,
const
char
**
nextPtr
)
const
char
**
nextPtr
)
{
{
const
char
*
s
=
*
startPtr
;
const
char
**
eventPP
;
const
char
**
eventEndPP
;
if
(
enc
==
encoding
)
{
eventPP
=
&
eventPtr
;
*
eventPP
=
s
;
eventEndPP
=
&
eventEndPtr
;
}
else
{
eventPP
=
&
(
openInternalEntities
->
internalEventPtr
);
eventEndPP
=
&
(
openInternalEntities
->
internalEventEndPtr
);
}
*
eventPP
=
s
;
*
startPtr
=
0
;
for
(;;)
{
for
(;;)
{
const
char
*
next
;
const
char
*
next
;
int
tok
=
XmlPrologTok
(
encoding
,
s
,
end
,
&
next
);
int
tok
=
XmlCdataSectionTok
(
enc
,
s
,
end
,
&
next
);
if
(
tok
<=
0
)
{
*
eventEndPP
=
next
;
if
(
nextPtr
!=
0
&&
tok
!=
XML_TOK_INVALID
)
{
switch
(
tok
)
{
*
nextPtr
=
s
;
case
XML_TOK_CDATA_SECT_CLOSE
:
if
(
endCdataSectionHandler
)
endCdataSectionHandler
(
handlerArg
);
#if 0
/* see comment under XML_TOK_CDATA_SECT_OPEN */
else if (characterDataHandler)
characterDataHandler(handlerArg, dataBuf, 0);
#endif
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
*
startPtr
=
next
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
case
XML_TOK_DATA_NEWLINE
:
if
(
characterDataHandler
)
{
XML_Char
c
=
0xA
;
characterDataHandler
(
handlerArg
,
&
c
,
1
);
}
}
switch
(
tok
)
{
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
case
XML_TOK_DATA_CHARS
:
if
(
characterDataHandler
)
{
if
(
MUST_CONVERT
(
enc
,
s
))
{
for
(;;)
{
ICHAR
*
dataPtr
=
(
ICHAR
*
)
dataBuf
;
XmlConvert
(
enc
,
&
s
,
next
,
&
dataPtr
,
(
ICHAR
*
)
dataBufEnd
);
*
eventEndPP
=
next
;
characterDataHandler
(
handlerArg
,
dataBuf
,
dataPtr
-
(
ICHAR
*
)
dataBuf
);
if
(
s
==
next
)
break
;
*
eventPP
=
s
;
}
}
else
characterDataHandler
(
handlerArg
,
(
XML_Char
*
)
s
,
(
XML_Char
*
)
next
-
(
XML_Char
*
)
s
);
}
else
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
s
,
next
);
break
;
case
XML_TOK_INVALID
:
case
XML_TOK_INVALID
:
errorPtr
=
next
;
*
eventPP
=
next
;
return
XML_ERROR_INVALID_TOKEN
;
return
XML_ERROR_INVALID_TOKEN
;
case
XML_TOK_NONE
:
return
XML_ERROR_NO_ELEMENTS
;
case
XML_TOK_PARTIAL
:
return
XML_ERROR_UNCLOSED_TOKEN
;
case
XML_TOK_PARTIAL_CHAR
:
case
XML_TOK_PARTIAL_CHAR
:
if
(
nextPtr
)
{
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
}
return
XML_ERROR_PARTIAL_CHAR
;
return
XML_ERROR_PARTIAL_CHAR
;
case
XML_TOK_TRAILING_CR
:
case
XML_TOK_PARTIAL
:
errorPtr
=
s
+
encoding
->
minBytesPerChar
;
case
XML_TOK_NONE
:
return
XML_ERROR_NO_ELEMENTS
;
if
(
nextPtr
)
{
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
}
return
XML_ERROR_UNCLOSED_CDATA_SECTION
;
default:
default:
abort
();
abort
();
}
}
*
eventPP
=
s
=
next
;
}
}
switch
(
XmlTokenRole
(
&
prologState
,
tok
,
s
,
next
,
encoding
))
{
/* not reached */
case
XML_ROLE_XML_DECL
:
}
{
static
enum
XML_Error
initializeEncoding
(
XML_Parser
parser
)
{
const
char
*
s
;
#ifdef XML_UNICODE
char
encodingBuf
[
128
];
if
(
!
protocolEncodingName
)
s
=
0
;
else
{
int
i
;
for
(
i
=
0
;
protocolEncodingName
[
i
];
i
++
)
{
if
(
i
==
sizeof
(
encodingBuf
)
-
1
||
protocolEncodingName
[
i
]
>=
0x80
||
protocolEncodingName
[
i
]
<
0
)
{
encodingBuf
[
0
]
=
'\0'
;
break
;
}
encodingBuf
[
i
]
=
(
char
)
protocolEncodingName
[
i
];
}
encodingBuf
[
i
]
=
'\0'
;
s
=
encodingBuf
;
}
#else
s
=
protocolEncodingName
;
#endif
if
((
ns
?
XmlInitEncodingNS
:
XmlInitEncoding
)(
&
initEncoding
,
&
encoding
,
s
))
return
XML_ERROR_NONE
;
return
handleUnknownEncoding
(
parser
,
protocolEncodingName
);
}
static
enum
XML_Error
processXmlDecl
(
XML_Parser
parser
,
int
isGeneralTextEntity
,
const
char
*
s
,
const
char
*
next
)
{
const
char
*
encodingName
=
0
;
const
char
*
encodingName
=
0
;
const
ENCODING
*
newEncoding
=
0
;
const
ENCODING
*
newEncoding
=
0
;
const
char
*
version
;
const
char
*
version
;
int
standalone
=
-
1
;
int
standalone
=
-
1
;
if
(
!
XmlParseXmlDecl
(
0
,
if
(
!
(
ns
?
XmlParseXmlDeclNS
:
XmlParseXmlDecl
)(
isGeneralTextEntity
,
encoding
,
encoding
,
s
,
s
,
next
,
next
,
&
error
Ptr
,
&
event
Ptr
,
&
version
,
&
version
,
&
encodingName
,
&
encodingName
,
&
newEncoding
,
&
newEncoding
,
&
standalone
))
&
standalone
))
return
XML_ERROR_SYNTAX
;
return
XML_ERROR_SYNTAX
;
if
(
!
isGeneralTextEntity
&&
standalone
==
1
)
dtd
.
standalone
=
1
;
if
(
defaultHandler
)
reportDefault
(
parser
,
encoding
,
s
,
next
);
if
(
!
protocolEncodingName
)
{
if
(
newEncoding
)
{
if
(
newEncoding
)
{
if
(
newEncoding
->
minBytesPerChar
!=
encoding
->
minBytesPerChar
)
{
if
(
newEncoding
->
minBytesPerChar
!=
encoding
->
minBytesPerChar
)
{
error
Ptr
=
encodingName
;
event
Ptr
=
encodingName
;
return
XML_ERROR_INCORRECT_ENCODING
;
return
XML_ERROR_INCORRECT_ENCODING
;
}
}
encoding
=
newEncoding
;
encoding
=
newEncoding
;
}
}
else
if
(
encodingName
)
{
else
if
(
encodingName
)
{
errorPtr
=
encodingName
;
enum
XML_Error
result
;
const
XML_Char
*
s
=
poolStoreString
(
&
tempPool
,
encoding
,
encodingName
,
encodingName
+
XmlNameLength
(
encoding
,
encodingName
));
if
(
!
s
)
return
XML_ERROR_NO_MEMORY
;
result
=
handleUnknownEncoding
(
parser
,
s
);
poolDiscard
(
&
tempPool
);
if
(
result
==
XML_ERROR_UNKNOWN_ENCODING
)
eventPtr
=
encodingName
;
return
result
;
}
}
return
XML_ERROR_NONE
;
}
static
enum
XML_Error
handleUnknownEncoding
(
XML_Parser
parser
,
const
XML_Char
*
encodingName
)
{
if
(
unknownEncodingHandler
)
{
XML_Encoding
info
;
int
i
;
for
(
i
=
0
;
i
<
256
;
i
++
)
info
.
map
[
i
]
=
-
1
;
info
.
convert
=
0
;
info
.
data
=
0
;
info
.
release
=
0
;
if
(
unknownEncodingHandler
(
unknownEncodingHandlerData
,
encodingName
,
&
info
))
{
ENCODING
*
enc
;
unknownEncodingMem
=
malloc
(
XmlSizeOfUnknownEncoding
());
if
(
!
unknownEncodingMem
)
{
if
(
info
.
release
)
info
.
release
(
info
.
data
);
return
XML_ERROR_NO_MEMORY
;
}
enc
=
(
ns
?
XmlInitUnknownEncodingNS
:
XmlInitUnknownEncoding
)(
unknownEncodingMem
,
info
.
map
,
info
.
convert
,
info
.
data
);
if
(
enc
)
{
unknownEncodingData
=
info
.
data
;
unknownEncodingRelease
=
info
.
release
;
encoding
=
enc
;
return
XML_ERROR_NONE
;
}
}
if
(
info
.
release
)
info
.
release
(
info
.
data
);
}
return
XML_ERROR_UNKNOWN_ENCODING
;
return
XML_ERROR_UNKNOWN_ENCODING
;
}
static
enum
XML_Error
prologInitProcessor
(
XML_Parser
parser
,
const
char
*
s
,
const
char
*
end
,
const
char
**
nextPtr
)
{
enum
XML_Error
result
=
initializeEncoding
(
parser
);
if
(
result
!=
XML_ERROR_NONE
)
return
result
;
processor
=
prologProcessor
;
return
prologProcessor
(
parser
,
s
,
end
,
nextPtr
);
}
static
enum
XML_Error
prologProcessor
(
XML_Parser
parser
,
const
char
*
s
,
const
char
*
end
,
const
char
**
nextPtr
)
{
for
(;;)
{
const
char
*
next
;
int
tok
=
XmlPrologTok
(
encoding
,
s
,
end
,
&
next
);
if
(
tok
<=
0
)
{
if
(
nextPtr
!=
0
&&
tok
!=
XML_TOK_INVALID
)
{
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
}
}
if
(
standalone
==
1
)
switch
(
tok
)
{
dtd
.
standalone
=
1
;
case
XML_TOK_INVALID
:
break
;
eventPtr
=
next
;
return
XML_ERROR_INVALID_TOKEN
;
case
XML_TOK_NONE
:
return
XML_ERROR_NO_ELEMENTS
;
case
XML_TOK_PARTIAL
:
return
XML_ERROR_UNCLOSED_TOKEN
;
case
XML_TOK_PARTIAL_CHAR
:
return
XML_ERROR_PARTIAL_CHAR
;
case
XML_TOK_TRAILING_CR
:
eventPtr
=
s
+
encoding
->
minBytesPerChar
;
return
XML_ERROR_NO_ELEMENTS
;
default:
abort
();
}
}
switch
(
XmlTokenRole
(
&
prologState
,
tok
,
s
,
next
,
encoding
))
{
case
XML_ROLE_XML_DECL
:
{
enum
XML_Error
result
=
processXmlDecl
(
parser
,
0
,
s
,
next
);
if
(
result
!=
XML_ERROR_NONE
)
return
result
;
}
}
break
;
case
XML_ROLE_DOCTYPE_SYSTEM_ID
:
case
XML_ROLE_DOCTYPE_SYSTEM_ID
:
if
(
!
dtd
.
standalone
&&
notStandaloneHandler
&&
!
notStandaloneHandler
(
handlerArg
))
return
XML_ERROR_NOT_STANDALONE
;
hadExternalDoctype
=
1
;
hadExternalDoctype
=
1
;
break
;
break
;
case
XML_ROLE_DOCTYPE_PUBLIC_ID
:
case
XML_ROLE_DOCTYPE_PUBLIC_ID
:
case
XML_ROLE_ENTITY_PUBLIC_ID
:
case
XML_ROLE_ENTITY_PUBLIC_ID
:
case
XML_ROLE_NOTATION_PUBLIC_ID
:
if
(
!
XmlIsPublicId
(
encoding
,
s
,
next
,
&
eventPtr
))
if
(
!
XmlIsPublicId
(
encoding
,
s
,
next
,
&
errorPtr
))
return
XML_ERROR_SYNTAX
;
return
XML_ERROR_SYNTAX
;
if
(
declEntity
)
{
XML_Char
*
tem
=
poolStoreString
(
&
dtd
.
pool
,
encoding
,
s
+
encoding
->
minBytesPerChar
,
next
-
encoding
->
minBytesPerChar
);
if
(
!
tem
)
return
XML_ERROR_NO_MEMORY
;
normalizePublicId
(
tem
);
declEntity
->
publicId
=
tem
;
poolFinish
(
&
dtd
.
pool
);
}
break
;
break
;
case
XML_ROLE_INSTANCE_START
:
case
XML_ROLE_INSTANCE_START
:
processor
=
contentProcessor
;
processor
=
contentProcessor
;
...
@@ -941,7 +2032,7 @@ prologProcessor(XML_Parser parser,
...
@@ -941,7 +2032,7 @@ prologProcessor(XML_Parser parser,
return
contentProcessor
(
parser
,
s
,
end
,
nextPtr
);
return
contentProcessor
(
parser
,
s
,
end
,
nextPtr
);
case
XML_ROLE_ATTLIST_ELEMENT_NAME
:
case
XML_ROLE_ATTLIST_ELEMENT_NAME
:
{
{
const
c
har
*
name
=
poolStoreString
(
&
dtd
.
pool
,
encoding
,
s
,
next
);
const
XML_C
har
*
name
=
poolStoreString
(
&
dtd
.
pool
,
encoding
,
s
,
next
);
if
(
!
name
)
if
(
!
name
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
declElementType
=
(
ELEMENT_TYPE
*
)
lookup
(
&
dtd
.
elementTypes
,
name
,
sizeof
(
ELEMENT_TYPE
));
declElementType
=
(
ELEMENT_TYPE
*
)
lookup
(
&
dtd
.
elementTypes
,
name
,
sizeof
(
ELEMENT_TYPE
));
...
@@ -949,8 +2040,11 @@ prologProcessor(XML_Parser parser,
...
@@ -949,8 +2040,11 @@ prologProcessor(XML_Parser parser,
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
if
(
declElementType
->
name
!=
name
)
if
(
declElementType
->
name
!=
name
)
poolDiscard
(
&
dtd
.
pool
);
poolDiscard
(
&
dtd
.
pool
);
else
else
{
poolFinish
(
&
dtd
.
pool
);
poolFinish
(
&
dtd
.
pool
);
if
(
!
setElementTypePrefix
(
parser
,
declElementType
))
return
XML_ERROR_NO_MEMORY
;
}
break
;
break
;
}
}
case
XML_ROLE_ATTRIBUTE_NAME
:
case
XML_ROLE_ATTRIBUTE_NAME
:
...
@@ -971,7 +2065,7 @@ prologProcessor(XML_Parser parser,
...
@@ -971,7 +2065,7 @@ prologProcessor(XML_Parser parser,
case
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE
:
case
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE
:
case
XML_ROLE_FIXED_ATTRIBUTE_VALUE
:
case
XML_ROLE_FIXED_ATTRIBUTE_VALUE
:
{
{
const
c
har
*
attVal
;
const
XML_C
har
*
attVal
;
enum
XML_Error
result
enum
XML_Error
result
=
storeAttributeValue
(
parser
,
encoding
,
declAttributeIsCdata
,
=
storeAttributeValue
(
parser
,
encoding
,
declAttributeIsCdata
,
s
+
encoding
->
minBytesPerChar
,
s
+
encoding
->
minBytesPerChar
,
...
@@ -1000,6 +2094,7 @@ prologProcessor(XML_Parser parser,
...
@@ -1000,6 +2094,7 @@ prologProcessor(XML_Parser parser,
next
-
encoding
->
minBytesPerChar
);
next
-
encoding
->
minBytesPerChar
);
if
(
!
declEntity
->
systemId
)
if
(
!
declEntity
->
systemId
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
declEntity
->
base
=
dtd
.
base
;
poolFinish
(
&
dtd
.
pool
);
poolFinish
(
&
dtd
.
pool
);
}
}
break
;
break
;
...
@@ -1009,11 +2104,26 @@ prologProcessor(XML_Parser parser,
...
@@ -1009,11 +2104,26 @@ prologProcessor(XML_Parser parser,
if
(
!
declEntity
->
notation
)
if
(
!
declEntity
->
notation
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
poolFinish
(
&
dtd
.
pool
);
poolFinish
(
&
dtd
.
pool
);
if
(
unparsedEntityDeclHandler
)
{
eventPtr
=
eventEndPtr
=
s
;
unparsedEntityDeclHandler
(
handlerArg
,
declEntity
->
name
,
declEntity
->
base
,
declEntity
->
systemId
,
declEntity
->
publicId
,
declEntity
->
notation
);
}
}
}
break
;
break
;
case
XML_ROLE_GENERAL_ENTITY_NAME
:
case
XML_ROLE_GENERAL_ENTITY_NAME
:
{
{
const
char
*
name
=
poolStoreString
(
&
dtd
.
pool
,
encoding
,
s
,
next
);
const
XML_Char
*
name
;
if
(
XmlPredefinedEntityName
(
encoding
,
s
,
next
))
{
declEntity
=
0
;
break
;
}
name
=
poolStoreString
(
&
dtd
.
pool
,
encoding
,
s
,
next
);
if
(
!
name
)
if
(
!
name
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
if
(
dtd
.
complete
)
{
if
(
dtd
.
complete
)
{
...
@@ -1036,8 +2146,61 @@ prologProcessor(XML_Parser parser,
...
@@ -1036,8 +2146,61 @@ prologProcessor(XML_Parser parser,
case
XML_ROLE_PARAM_ENTITY_NAME
:
case
XML_ROLE_PARAM_ENTITY_NAME
:
declEntity
=
0
;
declEntity
=
0
;
break
;
break
;
case
XML_ROLE_NOTATION_NAME
:
declNotationPublicId
=
0
;
declNotationName
=
0
;
if
(
notationDeclHandler
)
{
declNotationName
=
poolStoreString
(
&
tempPool
,
encoding
,
s
,
next
);
if
(
!
declNotationName
)
return
XML_ERROR_NO_MEMORY
;
poolFinish
(
&
tempPool
);
}
break
;
case
XML_ROLE_NOTATION_PUBLIC_ID
:
if
(
!
XmlIsPublicId
(
encoding
,
s
,
next
,
&
eventPtr
))
return
XML_ERROR_SYNTAX
;
if
(
declNotationName
)
{
XML_Char
*
tem
=
poolStoreString
(
&
tempPool
,
encoding
,
s
+
encoding
->
minBytesPerChar
,
next
-
encoding
->
minBytesPerChar
);
if
(
!
tem
)
return
XML_ERROR_NO_MEMORY
;
normalizePublicId
(
tem
);
declNotationPublicId
=
tem
;
poolFinish
(
&
tempPool
);
}
break
;
case
XML_ROLE_NOTATION_SYSTEM_ID
:
if
(
declNotationName
&&
notationDeclHandler
)
{
const
XML_Char
*
systemId
=
poolStoreString
(
&
tempPool
,
encoding
,
s
+
encoding
->
minBytesPerChar
,
next
-
encoding
->
minBytesPerChar
);
if
(
!
systemId
)
return
XML_ERROR_NO_MEMORY
;
eventPtr
=
eventEndPtr
=
s
;
notationDeclHandler
(
handlerArg
,
declNotationName
,
dtd
.
base
,
systemId
,
declNotationPublicId
);
}
poolClear
(
&
tempPool
);
break
;
case
XML_ROLE_NOTATION_NO_SYSTEM_ID
:
if
(
declNotationPublicId
&&
notationDeclHandler
)
{
eventPtr
=
eventEndPtr
=
s
;
notationDeclHandler
(
handlerArg
,
declNotationName
,
dtd
.
base
,
0
,
declNotationPublicId
);
}
poolClear
(
&
tempPool
);
break
;
case
XML_ROLE_ERROR
:
case
XML_ROLE_ERROR
:
e
rror
Ptr
=
s
;
e
vent
Ptr
=
s
;
switch
(
tok
)
{
switch
(
tok
)
{
case
XML_TOK_PARAM_ENTITY_REF
:
case
XML_TOK_PARAM_ENTITY_REF
:
return
XML_ERROR_PARAM_ENTITY_REF
;
return
XML_ERROR_PARAM_ENTITY_REF
;
...
@@ -1059,29 +2222,54 @@ prologProcessor(XML_Parser parser,
...
@@ -1059,29 +2222,54 @@ prologProcessor(XML_Parser parser,
break
;
break
;
case
XML_ROLE_GROUP_SEQUENCE
:
case
XML_ROLE_GROUP_SEQUENCE
:
if
(
groupConnector
[
prologState
.
level
]
==
'|'
)
{
if
(
groupConnector
[
prologState
.
level
]
==
'|'
)
{
e
rror
Ptr
=
s
;
e
vent
Ptr
=
s
;
return
XML_ERROR_SYNTAX
;
return
XML_ERROR_SYNTAX
;
}
}
groupConnector
[
prologState
.
level
]
=
','
;
groupConnector
[
prologState
.
level
]
=
','
;
break
;
break
;
case
XML_ROLE_GROUP_CHOICE
:
case
XML_ROLE_GROUP_CHOICE
:
if
(
groupConnector
[
prologState
.
level
]
==
','
)
{
if
(
groupConnector
[
prologState
.
level
]
==
','
)
{
e
rror
Ptr
=
s
;
e
vent
Ptr
=
s
;
return
XML_ERROR_SYNTAX
;
return
XML_ERROR_SYNTAX
;
}
}
groupConnector
[
prologState
.
level
]
=
'|'
;
groupConnector
[
prologState
.
level
]
=
'|'
;
break
;
break
;
case
XML_ROLE_PARAM_ENTITY_REF
:
case
XML_ROLE_PARAM_ENTITY_REF
:
if
(
!
dtd
.
standalone
&&
notStandaloneHandler
&&
!
notStandaloneHandler
(
handlerArg
))
return
XML_ERROR_NOT_STANDALONE
;
dtd
.
complete
=
0
;
dtd
.
complete
=
0
;
break
;
break
;
case
XML_ROLE_NONE
:
case
XML_ROLE_NONE
:
switch
(
tok
)
{
switch
(
tok
)
{
case
XML_TOK_PI
:
case
XML_TOK_PI
:
eventPtr
=
s
;
eventEndPtr
=
next
;
if
(
!
reportProcessingInstruction
(
parser
,
encoding
,
s
,
next
))
if
(
!
reportProcessingInstruction
(
parser
,
encoding
,
s
,
next
))
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
break
;
break
;
case
XML_TOK_COMMENT
:
eventPtr
=
s
;
eventEndPtr
=
next
;
if
(
!
reportComment
(
parser
,
encoding
,
s
,
next
))
return
XML_ERROR_NO_MEMORY
;
break
;
}
break
;
}
}
if
(
defaultHandler
)
{
switch
(
tok
)
{
case
XML_TOK_PI
:
case
XML_TOK_COMMENT
:
case
XML_TOK_BOM
:
case
XML_TOK_XML_DECL
:
break
;
break
;
default:
eventPtr
=
s
;
eventEndPtr
=
next
;
reportDefault
(
parser
,
encoding
,
s
,
next
);
}
}
}
s
=
next
;
s
=
next
;
}
}
...
@@ -1095,44 +2283,53 @@ enum XML_Error epilogProcessor(XML_Parser parser,
...
@@ -1095,44 +2283,53 @@ enum XML_Error epilogProcessor(XML_Parser parser,
const
char
**
nextPtr
)
const
char
**
nextPtr
)
{
{
processor
=
epilogProcessor
;
processor
=
epilogProcessor
;
eventPtr
=
s
;
for
(;;)
{
for
(;;)
{
const
char
*
next
;
const
char
*
next
;
int
tok
=
XmlPrologTok
(
encoding
,
s
,
end
,
&
next
);
int
tok
=
XmlPrologTok
(
encoding
,
s
,
end
,
&
next
);
eventEndPtr
=
next
;
switch
(
tok
)
{
switch
(
tok
)
{
case
XML_TOK_TRAILING_CR
:
case
XML_TOK_TRAILING_CR
:
if
(
defaultHandler
)
{
eventEndPtr
=
end
;
reportDefault
(
parser
,
encoding
,
s
,
end
);
}
/* fall through */
case
XML_TOK_NONE
:
case
XML_TOK_NONE
:
if
(
nextPtr
)
if
(
nextPtr
)
*
nextPtr
=
end
;
*
nextPtr
=
end
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
case
XML_TOK_PROLOG_S
:
case
XML_TOK_PROLOG_S
:
case
XML_TOK_COMMENT
:
if
(
defaultHandler
)
reportDefault
(
parser
,
encoding
,
s
,
next
);
break
;
break
;
case
XML_TOK_PI
:
case
XML_TOK_PI
:
if
(
!
reportProcessingInstruction
(
parser
,
encoding
,
s
,
next
))
if
(
!
reportProcessingInstruction
(
parser
,
encoding
,
s
,
next
))
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
break
;
break
;
case
XML_TOK_COMMENT
:
if
(
!
reportComment
(
parser
,
encoding
,
s
,
next
))
return
XML_ERROR_NO_MEMORY
;
break
;
case
XML_TOK_INVALID
:
case
XML_TOK_INVALID
:
e
rror
Ptr
=
next
;
e
vent
Ptr
=
next
;
return
XML_ERROR_INVALID_TOKEN
;
return
XML_ERROR_INVALID_TOKEN
;
case
XML_TOK_PARTIAL
:
case
XML_TOK_PARTIAL
:
if
(
nextPtr
)
{
if
(
nextPtr
)
{
*
nextPtr
=
s
;
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
errorPtr
=
s
;
return
XML_ERROR_UNCLOSED_TOKEN
;
return
XML_ERROR_UNCLOSED_TOKEN
;
case
XML_TOK_PARTIAL_CHAR
:
case
XML_TOK_PARTIAL_CHAR
:
if
(
nextPtr
)
{
if
(
nextPtr
)
{
*
nextPtr
=
s
;
*
nextPtr
=
s
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
errorPtr
=
s
;
return
XML_ERROR_PARTIAL_CHAR
;
return
XML_ERROR_PARTIAL_CHAR
;
default:
default:
errorPtr
=
s
;
return
XML_ERROR_JUNK_AFTER_DOC_ELEMENT
;
return
XML_ERROR_JUNK_AFTER_DOC_ELEMENT
;
}
}
s
=
next
;
eventPtr
=
s
=
next
;
}
}
}
}
...
@@ -1153,9 +2350,9 @@ storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
...
@@ -1153,9 +2350,9 @@ storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
enum
XML_Error
result
=
appendAttributeValue
(
parser
,
enc
,
isCdata
,
ptr
,
end
,
pool
);
enum
XML_Error
result
=
appendAttributeValue
(
parser
,
enc
,
isCdata
,
ptr
,
end
,
pool
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
if
(
!
isCdata
&&
poolLength
(
pool
)
&&
poolLast
Byte
(
pool
)
==
' '
)
if
(
!
isCdata
&&
poolLength
(
pool
)
&&
poolLast
Char
(
pool
)
==
0x20
)
poolChop
(
pool
);
poolChop
(
pool
);
if
(
!
poolAppend
Byte
(
pool
,
0
))
if
(
!
poolAppend
Char
(
pool
,
XML_T
(
'\0'
)
))
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
}
}
...
@@ -1165,7 +2362,7 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
...
@@ -1165,7 +2362,7 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
const
char
*
ptr
,
const
char
*
end
,
const
char
*
ptr
,
const
char
*
end
,
STRING_POOL
*
pool
)
STRING_POOL
*
pool
)
{
{
const
ENCODING
*
utf8
=
XmlGetInternalEncoding
(
XML_UTF8_ENCODING
);
const
ENCODING
*
internalEnc
=
ns
?
XmlGetInternalEncodingNS
()
:
XmlGetInternalEncoding
(
);
for
(;;)
{
for
(;;)
{
const
char
*
next
;
const
char
*
next
;
int
tok
=
XmlAttributeValueTok
(
enc
,
ptr
,
end
,
&
next
);
int
tok
=
XmlAttributeValueTok
(
enc
,
ptr
,
end
,
&
next
);
...
@@ -1173,31 +2370,35 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
...
@@ -1173,31 +2370,35 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
case
XML_TOK_NONE
:
case
XML_TOK_NONE
:
return
XML_ERROR_NONE
;
return
XML_ERROR_NONE
;
case
XML_TOK_INVALID
:
case
XML_TOK_INVALID
:
errorPtr
=
next
;
if
(
enc
==
encoding
)
eventPtr
=
next
;
return
XML_ERROR_INVALID_TOKEN
;
return
XML_ERROR_INVALID_TOKEN
;
case
XML_TOK_PARTIAL
:
case
XML_TOK_PARTIAL
:
errorPtr
=
ptr
;
if
(
enc
==
encoding
)
eventPtr
=
ptr
;
return
XML_ERROR_INVALID_TOKEN
;
return
XML_ERROR_INVALID_TOKEN
;
case
XML_TOK_CHAR_REF
:
case
XML_TOK_CHAR_REF
:
{
{
char
buf
[
XML_MAX_BYTES_PER_CHAR
];
XML_Char
buf
[
XML_ENCODE_MAX
];
int
i
;
int
i
;
int
n
=
XmlCharRefNumber
(
enc
,
ptr
);
int
n
=
XmlCharRefNumber
(
enc
,
ptr
);
if
(
n
<
0
)
{
if
(
n
<
0
)
{
errorPtr
=
ptr
;
if
(
enc
==
encoding
)
eventPtr
=
ptr
;
return
XML_ERROR_BAD_CHAR_REF
;
return
XML_ERROR_BAD_CHAR_REF
;
}
}
if
(
!
isCdata
if
(
!
isCdata
&&
n
==
' '
&&
n
==
0x20
/* space */
&&
(
poolLength
(
pool
)
==
0
||
poolLast
Byte
(
pool
)
==
' '
))
&&
(
poolLength
(
pool
)
==
0
||
poolLast
Char
(
pool
)
==
0x20
))
break
;
break
;
n
=
XmlEncode
(
utf8
,
n
,
buf
);
n
=
XmlEncode
(
n
,
(
ICHAR
*
)
buf
);
if
(
!
n
)
{
if
(
!
n
)
{
errorPtr
=
ptr
;
if
(
enc
==
encoding
)
eventPtr
=
ptr
;
return
XML_ERROR_BAD_CHAR_REF
;
return
XML_ERROR_BAD_CHAR_REF
;
}
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
(
!
poolAppend
Byte
(
pool
,
buf
[
i
]))
if
(
!
poolAppend
Char
(
pool
,
buf
[
i
]))
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
}
}
}
}
...
@@ -1212,57 +2413,62 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
...
@@ -1212,57 +2413,62 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
/* fall through */
/* fall through */
case
XML_TOK_ATTRIBUTE_VALUE_S
:
case
XML_TOK_ATTRIBUTE_VALUE_S
:
case
XML_TOK_DATA_NEWLINE
:
case
XML_TOK_DATA_NEWLINE
:
if
(
!
isCdata
&&
(
poolLength
(
pool
)
==
0
||
poolLast
Byte
(
pool
)
==
' '
))
if
(
!
isCdata
&&
(
poolLength
(
pool
)
==
0
||
poolLast
Char
(
pool
)
==
0x20
))
break
;
break
;
if
(
!
poolAppend
Byte
(
pool
,
' '
))
if
(
!
poolAppend
Char
(
pool
,
0x20
))
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
break
;
break
;
case
XML_TOK_ENTITY_REF
:
case
XML_TOK_ENTITY_REF
:
{
{
const
char
*
name
=
poolStoreString
(
&
temp2Pool
,
enc
,
const
XML_Char
*
name
;
ENTITY
*
entity
;
XML_Char
ch
=
XmlPredefinedEntityName
(
enc
,
ptr
+
enc
->
minBytesPerChar
,
next
-
enc
->
minBytesPerChar
);
if
(
ch
)
{
if
(
!
poolAppendChar
(
pool
,
ch
))
return
XML_ERROR_NO_MEMORY
;
break
;
}
name
=
poolStoreString
(
&
temp2Pool
,
enc
,
ptr
+
enc
->
minBytesPerChar
,
ptr
+
enc
->
minBytesPerChar
,
next
-
enc
->
minBytesPerChar
);
next
-
enc
->
minBytesPerChar
);
ENTITY
*
entity
;
if
(
!
name
)
if
(
!
name
)
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
entity
=
(
ENTITY
*
)
lookup
(
&
dtd
.
generalEntities
,
name
,
0
);
entity
=
(
ENTITY
*
)
lookup
(
&
dtd
.
generalEntities
,
name
,
0
);
poolDiscard
(
&
temp2Pool
);
poolDiscard
(
&
temp2Pool
);
if
(
!
entity
)
{
if
(
!
entity
)
{
if
(
dtd
.
complete
)
{
if
(
dtd
.
complete
)
{
errorPtr
=
ptr
;
if
(
enc
==
encoding
)
eventPtr
=
ptr
;
return
XML_ERROR_UNDEFINED_ENTITY
;
return
XML_ERROR_UNDEFINED_ENTITY
;
}
}
}
}
else
if
(
entity
->
open
)
{
else
if
(
entity
->
open
)
{
errorPtr
=
ptr
;
if
(
enc
==
encoding
)
eventPtr
=
ptr
;
return
XML_ERROR_RECURSIVE_ENTITY_REF
;
return
XML_ERROR_RECURSIVE_ENTITY_REF
;
}
}
else
if
(
entity
->
notation
)
{
else
if
(
entity
->
notation
)
{
errorPtr
=
ptr
;
if
(
enc
==
encoding
)
eventPtr
=
ptr
;
return
XML_ERROR_BINARY_ENTITY_REF
;
return
XML_ERROR_BINARY_ENTITY_REF
;
}
}
else
if
(
entity
->
magic
)
{
int
i
;
for
(
i
=
0
;
i
<
entity
->
textLen
;
i
++
)
if
(
!
poolAppendByte
(
pool
,
entity
->
textPtr
[
i
]))
return
XML_ERROR_NO_MEMORY
;
}
else
if
(
!
entity
->
textPtr
)
{
else
if
(
!
entity
->
textPtr
)
{
errorPtr
=
ptr
;
if
(
enc
==
encoding
)
eventPtr
=
ptr
;
return
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
;
return
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
;
}
}
else
{
else
{
enum
XML_Error
result
;
enum
XML_Error
result
;
const
c
har
*
textEnd
=
entity
->
textPtr
+
entity
->
textLen
;
const
XML_C
har
*
textEnd
=
entity
->
textPtr
+
entity
->
textLen
;
entity
->
open
=
1
;
entity
->
open
=
1
;
result
=
appendAttributeValue
(
parser
,
utf8
,
isCdata
,
entity
->
textPtr
,
textEnd
,
pool
);
result
=
appendAttributeValue
(
parser
,
internalEnc
,
isCdata
,
(
char
*
)
entity
->
textPtr
,
(
char
*
)
textEnd
,
pool
);
entity
->
open
=
0
;
entity
->
open
=
0
;
if
(
result
)
{
if
(
result
)
errorPtr
=
ptr
;
return
result
;
return
result
;
}
}
}
}
}
break
;
break
;
default:
default:
abort
();
abort
();
...
@@ -1277,7 +2483,7 @@ enum XML_Error storeEntityValue(XML_Parser parser,
...
@@ -1277,7 +2483,7 @@ enum XML_Error storeEntityValue(XML_Parser parser,
const
char
*
entityTextPtr
,
const
char
*
entityTextPtr
,
const
char
*
entityTextEnd
)
const
char
*
entityTextEnd
)
{
{
const
ENCODING
*
utf8
=
XmlGetInternalEncoding
(
XML_UTF8_ENCODING
);
const
ENCODING
*
internalEnc
=
ns
?
XmlGetInternalEncodingNS
()
:
XmlGetInternalEncoding
(
);
STRING_POOL
*
pool
=
&
(
dtd
.
pool
);
STRING_POOL
*
pool
=
&
(
dtd
.
pool
);
entityTextPtr
+=
encoding
->
minBytesPerChar
;
entityTextPtr
+=
encoding
->
minBytesPerChar
;
entityTextEnd
-=
encoding
->
minBytesPerChar
;
entityTextEnd
-=
encoding
->
minBytesPerChar
;
...
@@ -1286,7 +2492,7 @@ enum XML_Error storeEntityValue(XML_Parser parser,
...
@@ -1286,7 +2492,7 @@ enum XML_Error storeEntityValue(XML_Parser parser,
int
tok
=
XmlEntityValueTok
(
encoding
,
entityTextPtr
,
entityTextEnd
,
&
next
);
int
tok
=
XmlEntityValueTok
(
encoding
,
entityTextPtr
,
entityTextEnd
,
&
next
);
switch
(
tok
)
{
switch
(
tok
)
{
case
XML_TOK_PARAM_ENTITY_REF
:
case
XML_TOK_PARAM_ENTITY_REF
:
e
rror
Ptr
=
entityTextPtr
;
e
vent
Ptr
=
entityTextPtr
;
return
XML_ERROR_SYNTAX
;
return
XML_ERROR_SYNTAX
;
case
XML_TOK_NONE
:
case
XML_TOK_NONE
:
if
(
declEntity
)
{
if
(
declEntity
)
{
...
@@ -1308,20 +2514,20 @@ enum XML_Error storeEntityValue(XML_Parser parser,
...
@@ -1308,20 +2514,20 @@ enum XML_Error storeEntityValue(XML_Parser parser,
case
XML_TOK_DATA_NEWLINE
:
case
XML_TOK_DATA_NEWLINE
:
if
(
pool
->
end
==
pool
->
ptr
&&
!
poolGrow
(
pool
))
if
(
pool
->
end
==
pool
->
ptr
&&
!
poolGrow
(
pool
))
return
XML_ERROR_NO_MEMORY
;
return
XML_ERROR_NO_MEMORY
;
*
(
pool
->
ptr
)
++
=
'\n'
;
*
(
pool
->
ptr
)
++
=
0xA
;
break
;
break
;
case
XML_TOK_CHAR_REF
:
case
XML_TOK_CHAR_REF
:
{
{
char
buf
[
XML_MAX_BYTES_PER_CHAR
];
XML_Char
buf
[
XML_ENCODE_MAX
];
int
i
;
int
i
;
int
n
=
XmlCharRefNumber
(
encoding
,
entityTextPtr
);
int
n
=
XmlCharRefNumber
(
encoding
,
entityTextPtr
);
if
(
n
<
0
)
{
if
(
n
<
0
)
{
e
rror
Ptr
=
entityTextPtr
;
e
vent
Ptr
=
entityTextPtr
;
return
XML_ERROR_BAD_CHAR_REF
;
return
XML_ERROR_BAD_CHAR_REF
;
}
}
n
=
XmlEncode
(
utf8
,
n
,
buf
);
n
=
XmlEncode
(
n
,
(
ICHAR
*
)
buf
);
if
(
!
n
)
{
if
(
!
n
)
{
e
rror
Ptr
=
entityTextPtr
;
e
vent
Ptr
=
entityTextPtr
;
return
XML_ERROR_BAD_CHAR_REF
;
return
XML_ERROR_BAD_CHAR_REF
;
}
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
...
@@ -1332,10 +2538,10 @@ enum XML_Error storeEntityValue(XML_Parser parser,
...
@@ -1332,10 +2538,10 @@ enum XML_Error storeEntityValue(XML_Parser parser,
}
}
break
;
break
;
case
XML_TOK_PARTIAL
:
case
XML_TOK_PARTIAL
:
e
rror
Ptr
=
entityTextPtr
;
e
vent
Ptr
=
entityTextPtr
;
return
XML_ERROR_INVALID_TOKEN
;
return
XML_ERROR_INVALID_TOKEN
;
case
XML_TOK_INVALID
:
case
XML_TOK_INVALID
:
e
rror
Ptr
=
next
;
e
vent
Ptr
=
next
;
return
XML_ERROR_INVALID_TOKEN
;
return
XML_ERROR_INVALID_TOKEN
;
default:
default:
abort
();
abort
();
...
@@ -1346,36 +2552,42 @@ enum XML_Error storeEntityValue(XML_Parser parser,
...
@@ -1346,36 +2552,42 @@ enum XML_Error storeEntityValue(XML_Parser parser,
}
}
static
void
static
void
normalizeLines
(
c
har
*
s
)
normalizeLines
(
XML_C
har
*
s
)
{
{
c
har
*
p
;
XML_C
har
*
p
;
s
=
strchr
(
s
,
'\r'
);
for
(;;
s
++
)
{
if
(
!
s
)
if
(
*
s
==
XML_T
(
'\0'
)
)
return
;
return
;
if
(
*
s
==
0xD
)
break
;
}
p
=
s
;
p
=
s
;
while
(
*
s
)
{
do
{
if
(
*
s
==
'\r'
)
{
if
(
*
s
==
0xD
)
{
*
p
++
=
'\n'
;
*
p
++
=
0xA
;
if
(
*++
s
==
'\n'
)
if
(
*++
s
==
0xA
)
s
++
;
s
++
;
}
}
else
else
*
p
++
=
*
s
++
;
*
p
++
=
*
s
++
;
}
}
while
(
*
s
);
*
p
=
'\0'
;
*
p
=
XML_T
(
'\0'
)
;
}
}
static
int
static
int
reportProcessingInstruction
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
)
reportProcessingInstruction
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
)
{
{
const
c
har
*
target
;
const
XML_C
har
*
target
;
c
har
*
data
;
XML_C
har
*
data
;
const
char
*
tem
;
const
char
*
tem
;
if
(
!
processingInstructionHandler
)
if
(
!
processingInstructionHandler
)
{
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
start
,
end
);
return
1
;
return
1
;
target
=
start
+
enc
->
minBytesPerChar
*
2
;
}
tem
=
target
+
XmlNameLength
(
enc
,
target
);
start
+=
enc
->
minBytesPerChar
*
2
;
target
=
poolStoreString
(
&
tempPool
,
enc
,
target
,
tem
);
tem
=
start
+
XmlNameLength
(
enc
,
start
);
target
=
poolStoreString
(
&
tempPool
,
enc
,
start
,
tem
);
if
(
!
target
)
if
(
!
target
)
return
0
;
return
0
;
poolFinish
(
&
tempPool
);
poolFinish
(
&
tempPool
);
...
@@ -1385,22 +2597,73 @@ reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *
...
@@ -1385,22 +2597,73 @@ reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *
if
(
!
data
)
if
(
!
data
)
return
0
;
return
0
;
normalizeLines
(
data
);
normalizeLines
(
data
);
processingInstructionHandler
(
userData
,
target
,
data
);
processingInstructionHandler
(
handlerArg
,
target
,
data
);
poolClear
(
&
tempPool
);
poolClear
(
&
tempPool
);
return
1
;
return
1
;
}
}
static
int
static
int
defineAttribute
(
ELEMENT_TYPE
*
type
,
ATTRIBUTE_ID
*
attId
,
int
isCdata
,
const
char
*
value
)
reportComment
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
)
{
XML_Char
*
data
;
if
(
!
commentHandler
)
{
if
(
defaultHandler
)
reportDefault
(
parser
,
enc
,
start
,
end
);
return
1
;
}
data
=
poolStoreString
(
&
tempPool
,
enc
,
start
+
enc
->
minBytesPerChar
*
4
,
end
-
enc
->
minBytesPerChar
*
3
);
if
(
!
data
)
return
0
;
normalizeLines
(
data
);
commentHandler
(
handlerArg
,
data
);
poolClear
(
&
tempPool
);
return
1
;
}
static
void
reportDefault
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
s
,
const
char
*
end
)
{
if
(
MUST_CONVERT
(
enc
,
s
))
{
const
char
**
eventPP
;
const
char
**
eventEndPP
;
if
(
enc
==
encoding
)
{
eventPP
=
&
eventPtr
;
eventEndPP
=
&
eventEndPtr
;
}
else
{
eventPP
=
&
(
openInternalEntities
->
internalEventPtr
);
eventEndPP
=
&
(
openInternalEntities
->
internalEventEndPtr
);
}
do
{
ICHAR
*
dataPtr
=
(
ICHAR
*
)
dataBuf
;
XmlConvert
(
enc
,
&
s
,
end
,
&
dataPtr
,
(
ICHAR
*
)
dataBufEnd
);
*
eventEndPP
=
s
;
defaultHandler
(
handlerArg
,
dataBuf
,
dataPtr
-
(
ICHAR
*
)
dataBuf
);
*
eventPP
=
s
;
}
while
(
s
!=
end
);
}
else
defaultHandler
(
handlerArg
,
(
XML_Char
*
)
s
,
(
XML_Char
*
)
end
-
(
XML_Char
*
)
s
);
}
static
int
defineAttribute
(
ELEMENT_TYPE
*
type
,
ATTRIBUTE_ID
*
attId
,
int
isCdata
,
const
XML_Char
*
value
)
{
{
DEFAULT_ATTRIBUTE
*
att
;
DEFAULT_ATTRIBUTE
*
att
;
if
(
type
->
nDefaultAtts
==
type
->
allocDefaultAtts
)
{
if
(
type
->
nDefaultAtts
==
type
->
allocDefaultAtts
)
{
if
(
type
->
allocDefaultAtts
==
0
)
if
(
type
->
allocDefaultAtts
==
0
)
{
type
->
allocDefaultAtts
=
8
;
type
->
allocDefaultAtts
=
8
;
else
type
->
defaultAtts
=
malloc
(
type
->
allocDefaultAtts
*
sizeof
(
DEFAULT_ATTRIBUTE
));
}
else
{
type
->
allocDefaultAtts
*=
2
;
type
->
allocDefaultAtts
*=
2
;
type
->
defaultAtts
=
realloc
(
type
->
defaultAtts
,
type
->
defaultAtts
=
realloc
(
type
->
defaultAtts
,
type
->
allocDefaultAtts
*
sizeof
(
DEFAULT_ATTRIBUTE
));
type
->
allocDefaultAtts
*
sizeof
(
DEFAULT_ATTRIBUTE
));
}
if
(
!
type
->
defaultAtts
)
if
(
!
type
->
defaultAtts
)
return
0
;
return
0
;
}
}
...
@@ -1414,12 +2677,39 @@ defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata, const char
...
@@ -1414,12 +2677,39 @@ defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata, const char
return
1
;
return
1
;
}
}
static
int
setElementTypePrefix
(
XML_Parser
parser
,
ELEMENT_TYPE
*
elementType
)
{
const
XML_Char
*
name
;
for
(
name
=
elementType
->
name
;
*
name
;
name
++
)
{
if
(
*
name
==
XML_T
(
':'
))
{
PREFIX
*
prefix
;
const
XML_Char
*
s
;
for
(
s
=
elementType
->
name
;
s
!=
name
;
s
++
)
{
if
(
!
poolAppendChar
(
&
dtd
.
pool
,
*
s
))
return
0
;
}
if
(
!
poolAppendChar
(
&
dtd
.
pool
,
XML_T
(
'\0'
)))
return
0
;
prefix
=
(
PREFIX
*
)
lookup
(
&
dtd
.
prefixes
,
poolStart
(
&
dtd
.
pool
),
sizeof
(
PREFIX
));
if
(
!
prefix
)
return
0
;
if
(
prefix
->
name
==
poolStart
(
&
dtd
.
pool
))
poolFinish
(
&
dtd
.
pool
);
else
poolDiscard
(
&
dtd
.
pool
);
elementType
->
prefix
=
prefix
;
}
}
return
1
;
}
static
ATTRIBUTE_ID
*
static
ATTRIBUTE_ID
*
getAttributeId
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
)
getAttributeId
(
XML_Parser
parser
,
const
ENCODING
*
enc
,
const
char
*
start
,
const
char
*
end
)
{
{
ATTRIBUTE_ID
*
id
;
ATTRIBUTE_ID
*
id
;
const
c
har
*
name
;
const
XML_C
har
*
name
;
if
(
!
poolAppend
Byte
(
&
dtd
.
pool
,
0
))
if
(
!
poolAppend
Char
(
&
dtd
.
pool
,
XML_T
(
'\0'
)
))
return
0
;
return
0
;
name
=
poolStoreString
(
&
dtd
.
pool
,
enc
,
start
,
end
);
name
=
poolStoreString
(
&
dtd
.
pool
,
enc
,
start
,
end
);
if
(
!
name
)
if
(
!
name
)
...
@@ -1430,30 +2720,205 @@ getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const
...
@@ -1430,30 +2720,205 @@ getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const
return
0
;
return
0
;
if
(
id
->
name
!=
name
)
if
(
id
->
name
!=
name
)
poolDiscard
(
&
dtd
.
pool
);
poolDiscard
(
&
dtd
.
pool
);
else
{
poolFinish
(
&
dtd
.
pool
);
if
(
!
ns
)
;
else
if
(
name
[
0
]
==
'x'
&&
name
[
1
]
==
'm'
&&
name
[
2
]
==
'l'
&&
name
[
3
]
==
'n'
&&
name
[
4
]
==
's'
&&
(
name
[
5
]
==
XML_T
(
'\0'
)
||
name
[
5
]
==
XML_T
(
':'
)))
{
if
(
name
[
5
]
==
'\0'
)
id
->
prefix
=
&
dtd
.
defaultPrefix
;
else
else
id
->
prefix
=
(
PREFIX
*
)
lookup
(
&
dtd
.
prefixes
,
name
+
6
,
sizeof
(
PREFIX
));
id
->
xmlns
=
1
;
}
else
{
int
i
;
for
(
i
=
0
;
name
[
i
];
i
++
)
{
if
(
name
[
i
]
==
XML_T
(
':'
))
{
int
j
;
for
(
j
=
0
;
j
<
i
;
j
++
)
{
if
(
!
poolAppendChar
(
&
dtd
.
pool
,
name
[
j
]))
return
0
;
}
if
(
!
poolAppendChar
(
&
dtd
.
pool
,
XML_T
(
'\0'
)))
return
0
;
id
->
prefix
=
(
PREFIX
*
)
lookup
(
&
dtd
.
prefixes
,
poolStart
(
&
dtd
.
pool
),
sizeof
(
PREFIX
));
if
(
id
->
prefix
->
name
==
poolStart
(
&
dtd
.
pool
))
poolFinish
(
&
dtd
.
pool
);
poolFinish
(
&
dtd
.
pool
);
else
poolDiscard
(
&
dtd
.
pool
);
break
;
}
}
}
}
return
id
;
return
id
;
}
}
static
int
dtdInit
(
DTD
*
p
)
#define CONTEXT_SEP XML_T('\f')
static
const
XML_Char
*
getContext
(
XML_Parser
parser
)
{
{
static
const
char
*
names
[]
=
{
"lt"
,
"amp"
,
"gt"
,
"quot"
,
"apos"
};
HASH_TABLE_ITER
iter
;
static
const
char
chars
[]
=
{
'<'
,
'&'
,
'>'
,
'"'
,
'\''
};
int
needSep
=
0
;
if
(
dtd
.
defaultPrefix
.
binding
)
{
int
i
;
int
i
;
int
len
;
if
(
!
poolAppendChar
(
&
tempPool
,
XML_T
(
'='
)))
return
0
;
len
=
dtd
.
defaultPrefix
.
binding
->
uriLen
;
if
(
namespaceSeparator
!=
XML_T
(
'\0'
))
len
--
;
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
!
poolAppendChar
(
&
tempPool
,
dtd
.
defaultPrefix
.
binding
->
uri
[
i
]))
return
0
;
needSep
=
1
;
}
poolInit
(
&
(
p
->
pool
));
hashTableIterInit
(
&
iter
,
&
(
dtd
.
prefixes
));
hashTableInit
(
&
(
p
->
generalEntities
));
for
(;;)
{
for
(
i
=
0
;
i
<
5
;
i
++
)
{
int
i
;
ENTITY
*
entity
=
(
ENTITY
*
)
lookup
(
&
(
p
->
generalEntities
),
names
[
i
],
sizeof
(
ENTITY
));
int
len
;
if
(
!
entity
)
const
XML_Char
*
s
;
PREFIX
*
prefix
=
(
PREFIX
*
)
hashTableIterNext
(
&
iter
);
if
(
!
prefix
)
break
;
if
(
!
prefix
->
binding
)
continue
;
if
(
needSep
&&
!
poolAppendChar
(
&
tempPool
,
CONTEXT_SEP
))
return
0
;
for
(
s
=
prefix
->
name
;
*
s
;
s
++
)
if
(
!
poolAppendChar
(
&
tempPool
,
*
s
))
return
0
;
if
(
!
poolAppendChar
(
&
tempPool
,
XML_T
(
'='
)))
return
0
;
len
=
prefix
->
binding
->
uriLen
;
if
(
namespaceSeparator
!=
XML_T
(
'\0'
))
len
--
;
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
!
poolAppendChar
(
&
tempPool
,
prefix
->
binding
->
uri
[
i
]))
return
0
;
needSep
=
1
;
}
hashTableIterInit
(
&
iter
,
&
(
dtd
.
generalEntities
));
for
(;;)
{
const
XML_Char
*
s
;
ENTITY
*
e
=
(
ENTITY
*
)
hashTableIterNext
(
&
iter
);
if
(
!
e
)
break
;
if
(
!
e
->
open
)
continue
;
if
(
needSep
&&
!
poolAppendChar
(
&
tempPool
,
CONTEXT_SEP
))
return
0
;
for
(
s
=
e
->
name
;
*
s
;
s
++
)
if
(
!
poolAppendChar
(
&
tempPool
,
*
s
))
return
0
;
needSep
=
1
;
}
if
(
!
poolAppendChar
(
&
tempPool
,
XML_T
(
'\0'
)))
return
0
;
return
tempPool
.
start
;
}
static
int
setContext
(
XML_Parser
parser
,
const
XML_Char
*
context
)
{
const
XML_Char
*
s
=
context
;
while
(
*
context
!=
XML_T
(
'\0'
))
{
if
(
*
s
==
CONTEXT_SEP
||
*
s
==
XML_T
(
'\0'
))
{
ENTITY
*
e
;
if
(
!
poolAppendChar
(
&
tempPool
,
XML_T
(
'\0'
)))
return
0
;
e
=
(
ENTITY
*
)
lookup
(
&
dtd
.
generalEntities
,
poolStart
(
&
tempPool
),
0
);
if
(
e
)
e
->
open
=
1
;
if
(
*
s
!=
XML_T
(
'\0'
))
s
++
;
context
=
s
;
poolDiscard
(
&
tempPool
);
}
else
if
(
*
s
==
'='
)
{
PREFIX
*
prefix
;
if
(
poolLength
(
&
tempPool
)
==
0
)
prefix
=
&
dtd
.
defaultPrefix
;
else
{
if
(
!
poolAppendChar
(
&
tempPool
,
XML_T
(
'\0'
)))
return
0
;
prefix
=
(
PREFIX
*
)
lookup
(
&
dtd
.
prefixes
,
poolStart
(
&
tempPool
),
sizeof
(
PREFIX
));
if
(
!
prefix
)
return
0
;
if
(
prefix
->
name
==
poolStart
(
&
tempPool
))
poolFinish
(
&
tempPool
);
else
poolDiscard
(
&
tempPool
);
}
for
(
context
=
s
+
1
;
*
context
!=
CONTEXT_SEP
&&
*
context
!=
XML_T
(
'\0'
);
context
++
)
if
(
!
poolAppendChar
(
&
tempPool
,
*
context
))
return
0
;
if
(
!
poolAppendChar
(
&
tempPool
,
XML_T
(
'\0'
)))
return
0
;
if
(
!
addBinding
(
parser
,
prefix
,
0
,
poolStart
(
&
tempPool
),
&
inheritedBindings
))
return
0
;
poolDiscard
(
&
tempPool
);
if
(
*
context
!=
XML_T
(
'\0'
))
++
context
;
s
=
context
;
}
else
{
if
(
!
poolAppendChar
(
&
tempPool
,
*
s
))
return
0
;
return
0
;
entity
->
textPtr
=
chars
+
i
;
s
++
;
entity
->
textLen
=
1
;
}
entity
->
magic
=
1
;
}
return
1
;
}
static
void
normalizePublicId
(
XML_Char
*
publicId
)
{
XML_Char
*
p
=
publicId
;
XML_Char
*
s
;
for
(
s
=
publicId
;
*
s
;
s
++
)
{
switch
(
*
s
)
{
case
0x20
:
case
0xD
:
case
0xA
:
if
(
p
!=
publicId
&&
p
[
-
1
]
!=
0x20
)
*
p
++
=
0x20
;
break
;
default:
*
p
++
=
*
s
;
}
}
}
if
(
p
!=
publicId
&&
p
[
-
1
]
==
0x20
)
--
p
;
*
p
=
XML_T
(
'\0'
);
}
static
int
dtdInit
(
DTD
*
p
)
{
poolInit
(
&
(
p
->
pool
));
hashTableInit
(
&
(
p
->
generalEntities
));
hashTableInit
(
&
(
p
->
elementTypes
));
hashTableInit
(
&
(
p
->
elementTypes
));
hashTableInit
(
&
(
p
->
attributeIds
));
hashTableInit
(
&
(
p
->
attributeIds
));
hashTableInit
(
&
(
p
->
prefixes
));
p
->
complete
=
1
;
p
->
complete
=
1
;
p
->
standalone
=
0
;
p
->
base
=
0
;
p
->
defaultPrefix
.
name
=
0
;
p
->
defaultPrefix
.
binding
=
0
;
return
1
;
return
1
;
}
}
...
@@ -1465,14 +2930,164 @@ static void dtdDestroy(DTD *p)
...
@@ -1465,14 +2930,164 @@ static void dtdDestroy(DTD *p)
ELEMENT_TYPE
*
e
=
(
ELEMENT_TYPE
*
)
hashTableIterNext
(
&
iter
);
ELEMENT_TYPE
*
e
=
(
ELEMENT_TYPE
*
)
hashTableIterNext
(
&
iter
);
if
(
!
e
)
if
(
!
e
)
break
;
break
;
if
(
e
->
allocDefaultAtts
!=
0
)
free
(
e
->
defaultAtts
);
free
(
e
->
defaultAtts
);
}
}
hashTableDestroy
(
&
(
p
->
generalEntities
));
hashTableDestroy
(
&
(
p
->
generalEntities
));
hashTableDestroy
(
&
(
p
->
elementTypes
));
hashTableDestroy
(
&
(
p
->
elementTypes
));
hashTableDestroy
(
&
(
p
->
attributeIds
));
hashTableDestroy
(
&
(
p
->
attributeIds
));
hashTableDestroy
(
&
(
p
->
prefixes
));
poolDestroy
(
&
(
p
->
pool
));
poolDestroy
(
&
(
p
->
pool
));
}
}
/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise.
The new DTD has already been initialized. */
static
int
dtdCopy
(
DTD
*
newDtd
,
const
DTD
*
oldDtd
)
{
HASH_TABLE_ITER
iter
;
if
(
oldDtd
->
base
)
{
const
XML_Char
*
tem
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldDtd
->
base
);
if
(
!
tem
)
return
0
;
newDtd
->
base
=
tem
;
}
/* Copy the prefix table. */
hashTableIterInit
(
&
iter
,
&
(
oldDtd
->
prefixes
));
for
(;;)
{
const
XML_Char
*
name
;
const
PREFIX
*
oldP
=
(
PREFIX
*
)
hashTableIterNext
(
&
iter
);
if
(
!
oldP
)
break
;
name
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldP
->
name
);
if
(
!
name
)
return
0
;
if
(
!
lookup
(
&
(
newDtd
->
prefixes
),
name
,
sizeof
(
PREFIX
)))
return
0
;
}
hashTableIterInit
(
&
iter
,
&
(
oldDtd
->
attributeIds
));
/* Copy the attribute id table. */
for
(;;)
{
ATTRIBUTE_ID
*
newA
;
const
XML_Char
*
name
;
const
ATTRIBUTE_ID
*
oldA
=
(
ATTRIBUTE_ID
*
)
hashTableIterNext
(
&
iter
);
if
(
!
oldA
)
break
;
/* Remember to allocate the scratch byte before the name. */
if
(
!
poolAppendChar
(
&
(
newDtd
->
pool
),
XML_T
(
'\0'
)))
return
0
;
name
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldA
->
name
);
if
(
!
name
)
return
0
;
++
name
;
newA
=
(
ATTRIBUTE_ID
*
)
lookup
(
&
(
newDtd
->
attributeIds
),
name
,
sizeof
(
ATTRIBUTE_ID
));
if
(
!
newA
)
return
0
;
newA
->
maybeTokenized
=
oldA
->
maybeTokenized
;
if
(
oldA
->
prefix
)
{
newA
->
xmlns
=
oldA
->
xmlns
;
if
(
oldA
->
prefix
==
&
oldDtd
->
defaultPrefix
)
newA
->
prefix
=
&
newDtd
->
defaultPrefix
;
else
newA
->
prefix
=
(
PREFIX
*
)
lookup
(
&
(
newDtd
->
prefixes
),
oldA
->
prefix
->
name
,
0
);
}
}
/* Copy the element type table. */
hashTableIterInit
(
&
iter
,
&
(
oldDtd
->
elementTypes
));
for
(;;)
{
int
i
;
ELEMENT_TYPE
*
newE
;
const
XML_Char
*
name
;
const
ELEMENT_TYPE
*
oldE
=
(
ELEMENT_TYPE
*
)
hashTableIterNext
(
&
iter
);
if
(
!
oldE
)
break
;
name
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldE
->
name
);
if
(
!
name
)
return
0
;
newE
=
(
ELEMENT_TYPE
*
)
lookup
(
&
(
newDtd
->
elementTypes
),
name
,
sizeof
(
ELEMENT_TYPE
));
if
(
!
newE
)
return
0
;
if
(
oldE
->
nDefaultAtts
)
{
newE
->
defaultAtts
=
(
DEFAULT_ATTRIBUTE
*
)
malloc
(
oldE
->
nDefaultAtts
*
sizeof
(
DEFAULT_ATTRIBUTE
));
if
(
!
newE
->
defaultAtts
)
return
0
;
}
newE
->
allocDefaultAtts
=
newE
->
nDefaultAtts
=
oldE
->
nDefaultAtts
;
if
(
oldE
->
prefix
)
newE
->
prefix
=
(
PREFIX
*
)
lookup
(
&
(
newDtd
->
prefixes
),
oldE
->
prefix
->
name
,
0
);
for
(
i
=
0
;
i
<
newE
->
nDefaultAtts
;
i
++
)
{
newE
->
defaultAtts
[
i
].
id
=
(
ATTRIBUTE_ID
*
)
lookup
(
&
(
newDtd
->
attributeIds
),
oldE
->
defaultAtts
[
i
].
id
->
name
,
0
);
newE
->
defaultAtts
[
i
].
isCdata
=
oldE
->
defaultAtts
[
i
].
isCdata
;
if
(
oldE
->
defaultAtts
[
i
].
value
)
{
newE
->
defaultAtts
[
i
].
value
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldE
->
defaultAtts
[
i
].
value
);
if
(
!
newE
->
defaultAtts
[
i
].
value
)
return
0
;
}
else
newE
->
defaultAtts
[
i
].
value
=
0
;
}
}
/* Copy the entity table. */
hashTableIterInit
(
&
iter
,
&
(
oldDtd
->
generalEntities
));
for
(;;)
{
ENTITY
*
newE
;
const
XML_Char
*
name
;
const
ENTITY
*
oldE
=
(
ENTITY
*
)
hashTableIterNext
(
&
iter
);
if
(
!
oldE
)
break
;
name
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldE
->
name
);
if
(
!
name
)
return
0
;
newE
=
(
ENTITY
*
)
lookup
(
&
(
newDtd
->
generalEntities
),
name
,
sizeof
(
ENTITY
));
if
(
!
newE
)
return
0
;
if
(
oldE
->
systemId
)
{
const
XML_Char
*
tem
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldE
->
systemId
);
if
(
!
tem
)
return
0
;
newE
->
systemId
=
tem
;
if
(
oldE
->
base
)
{
if
(
oldE
->
base
==
oldDtd
->
base
)
newE
->
base
=
newDtd
->
base
;
tem
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldE
->
base
);
if
(
!
tem
)
return
0
;
newE
->
base
=
tem
;
}
}
else
{
const
XML_Char
*
tem
=
poolCopyStringN
(
&
(
newDtd
->
pool
),
oldE
->
textPtr
,
oldE
->
textLen
);
if
(
!
tem
)
return
0
;
newE
->
textPtr
=
tem
;
newE
->
textLen
=
oldE
->
textLen
;
}
if
(
oldE
->
notation
)
{
const
XML_Char
*
tem
=
poolCopyString
(
&
(
newDtd
->
pool
),
oldE
->
notation
);
if
(
!
tem
)
return
0
;
newE
->
notation
=
tem
;
}
}
newDtd
->
complete
=
oldDtd
->
complete
;
newDtd
->
standalone
=
oldDtd
->
standalone
;
return
1
;
}
static
static
void
poolInit
(
STRING_POOL
*
pool
)
void
poolInit
(
STRING_POOL
*
pool
)
{
{
...
@@ -1526,13 +3141,13 @@ void poolDestroy(STRING_POOL *pool)
...
@@ -1526,13 +3141,13 @@ void poolDestroy(STRING_POOL *pool)
}
}
static
static
c
har
*
poolAppend
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
XML_C
har
*
poolAppend
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
)
const
char
*
ptr
,
const
char
*
end
)
{
{
if
(
!
pool
->
ptr
&&
!
poolGrow
(
pool
))
if
(
!
pool
->
ptr
&&
!
poolGrow
(
pool
))
return
0
;
return
0
;
for
(;;)
{
for
(;;)
{
XmlConvert
(
enc
,
XML_UTF8_ENCODING
,
&
ptr
,
end
,
&
(
pool
->
ptr
),
pool
->
end
);
XmlConvert
(
enc
,
&
ptr
,
end
,
(
ICHAR
**
)
&
(
pool
->
ptr
),
(
ICHAR
*
)
pool
->
end
);
if
(
ptr
==
end
)
if
(
ptr
==
end
)
break
;
break
;
if
(
!
poolGrow
(
pool
))
if
(
!
poolGrow
(
pool
))
...
@@ -1541,9 +3156,33 @@ char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
...
@@ -1541,9 +3156,33 @@ char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
return
pool
->
start
;
return
pool
->
start
;
}
}
static
const
XML_Char
*
poolCopyString
(
STRING_POOL
*
pool
,
const
XML_Char
*
s
)
{
do
{
if
(
!
poolAppendChar
(
pool
,
*
s
))
return
0
;
}
while
(
*
s
++
);
s
=
pool
->
start
;
poolFinish
(
pool
);
return
s
;
}
static
const
XML_Char
*
poolCopyStringN
(
STRING_POOL
*
pool
,
const
XML_Char
*
s
,
int
n
)
{
if
(
!
pool
->
ptr
&&
!
poolGrow
(
pool
))
return
0
;
for
(;
n
>
0
;
--
n
,
s
++
)
{
if
(
!
poolAppendChar
(
pool
,
*
s
))
return
0
;
}
s
=
pool
->
start
;
poolFinish
(
pool
);
return
s
;
}
static
static
c
har
*
poolStoreString
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
XML_C
har
*
poolStoreString
(
STRING_POOL
*
pool
,
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
)
const
char
*
ptr
,
const
char
*
end
)
{
{
if
(
!
poolAppend
(
pool
,
enc
,
ptr
,
end
))
if
(
!
poolAppend
(
pool
,
enc
,
ptr
,
end
))
...
@@ -1572,7 +3211,7 @@ int poolGrow(STRING_POOL *pool)
...
@@ -1572,7 +3211,7 @@ int poolGrow(STRING_POOL *pool)
pool
->
freeBlocks
->
next
=
pool
->
blocks
;
pool
->
freeBlocks
->
next
=
pool
->
blocks
;
pool
->
blocks
=
pool
->
freeBlocks
;
pool
->
blocks
=
pool
->
freeBlocks
;
pool
->
freeBlocks
=
tem
;
pool
->
freeBlocks
=
tem
;
memcpy
(
pool
->
blocks
->
s
,
pool
->
start
,
pool
->
end
-
pool
->
start
);
memcpy
(
pool
->
blocks
->
s
,
pool
->
start
,
(
pool
->
end
-
pool
->
start
)
*
sizeof
(
XML_Char
)
);
pool
->
ptr
=
pool
->
blocks
->
s
+
(
pool
->
ptr
-
pool
->
start
);
pool
->
ptr
=
pool
->
blocks
->
s
+
(
pool
->
ptr
-
pool
->
start
);
pool
->
start
=
pool
->
blocks
->
s
;
pool
->
start
=
pool
->
blocks
->
s
;
pool
->
end
=
pool
->
start
+
pool
->
blocks
->
size
;
pool
->
end
=
pool
->
start
+
pool
->
blocks
->
size
;
...
@@ -1581,7 +3220,7 @@ int poolGrow(STRING_POOL *pool)
...
@@ -1581,7 +3220,7 @@ int poolGrow(STRING_POOL *pool)
}
}
if
(
pool
->
blocks
&&
pool
->
start
==
pool
->
blocks
->
s
)
{
if
(
pool
->
blocks
&&
pool
->
start
==
pool
->
blocks
->
s
)
{
int
blockSize
=
(
pool
->
end
-
pool
->
start
)
*
2
;
int
blockSize
=
(
pool
->
end
-
pool
->
start
)
*
2
;
pool
->
blocks
=
realloc
(
pool
->
blocks
,
offsetof
(
BLOCK
,
s
)
+
blockSize
);
pool
->
blocks
=
realloc
(
pool
->
blocks
,
offsetof
(
BLOCK
,
s
)
+
blockSize
*
sizeof
(
XML_Char
)
);
if
(
!
pool
->
blocks
)
if
(
!
pool
->
blocks
)
return
0
;
return
0
;
pool
->
blocks
->
size
=
blockSize
;
pool
->
blocks
->
size
=
blockSize
;
...
@@ -1596,13 +3235,13 @@ int poolGrow(STRING_POOL *pool)
...
@@ -1596,13 +3235,13 @@ int poolGrow(STRING_POOL *pool)
blockSize
=
INIT_BLOCK_SIZE
;
blockSize
=
INIT_BLOCK_SIZE
;
else
else
blockSize
*=
2
;
blockSize
*=
2
;
tem
=
malloc
(
offsetof
(
BLOCK
,
s
)
+
blockSize
);
tem
=
malloc
(
offsetof
(
BLOCK
,
s
)
+
blockSize
*
sizeof
(
XML_Char
)
);
if
(
!
tem
)
if
(
!
tem
)
return
0
;
return
0
;
tem
->
size
=
blockSize
;
tem
->
size
=
blockSize
;
tem
->
next
=
pool
->
blocks
;
tem
->
next
=
pool
->
blocks
;
pool
->
blocks
=
tem
;
pool
->
blocks
=
tem
;
memcpy
(
tem
->
s
,
pool
->
start
,
pool
->
ptr
-
pool
->
start
);
memcpy
(
tem
->
s
,
pool
->
start
,
(
pool
->
ptr
-
pool
->
start
)
*
sizeof
(
XML_Char
)
);
pool
->
ptr
=
tem
->
s
+
(
pool
->
ptr
-
pool
->
start
);
pool
->
ptr
=
tem
->
s
+
(
pool
->
ptr
-
pool
->
start
);
pool
->
start
=
tem
->
s
;
pool
->
start
=
tem
->
s
;
pool
->
end
=
tem
->
s
+
blockSize
;
pool
->
end
=
tem
->
s
+
blockSize
;
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmlparse/xmlparse.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#ifndef XmlParse_INCLUDED
#ifndef XmlParse_INCLUDED
...
@@ -31,32 +41,237 @@ extern "C" {
...
@@ -31,32 +41,237 @@ extern "C" {
typedef
void
*
XML_Parser
;
typedef
void
*
XML_Parser
;
/* Constructs a new parser; encoding should be the name of the charset from
#ifdef XML_UNICODE_WCHAR_T
the Content-Type header if the Content-Type is text/xml, or null otherwise. */
XML_Parser
XMLPARSEAPI
/* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
XML_ParserCreate
(
const
char
*
encoding
);
uses Unicode. */
/* Information is UTF-16 encoded as wchar_ts */
#ifndef XML_UNICODE
#define XML_UNICODE
#endif
#include <stddef.h>
typedef
wchar_t
XML_Char
;
typedef
wchar_t
XML_LChar
;
#else
/* not XML_UNICODE_WCHAR_T */
#ifdef XML_UNICODE
/* Information is UTF-16 encoded as unsigned shorts */
typedef
unsigned
short
XML_Char
;
typedef
char
XML_LChar
;
#else
/* not XML_UNICODE */
/* Information is UTF-8 encoded. */
/* Information is UTF-8 encoded. */
typedef
char
XML_Char
;
typedef
char
XML_LChar
;
#endif
/* not XML_UNICODE */
#endif
/* not XML_UNICODE_WCHAR_T */
/* atts is array of name/value pairs, terminated by NULL;
/* Constructs a new parser; encoding is the encoding specified by the external
names and values are '\0' terminated. */
protocol or null if there is none specified. */
XML_Parser
XMLPARSEAPI
XML_ParserCreate
(
const
XML_Char
*
encoding
);
/* Constructs a new parser and namespace processor. Element type names
and attribute names that belong to a namespace will be expanded;
unprefixed attribute names are never expanded; unprefixed element type
names are expanded only if there is a default namespace. The expanded
name is the concatenation of the namespace URI, the namespace separator character,
and the local part of the name. If the namespace separator is '\0' then
the namespace URI and the local part will be concatenated without any
separator. When a namespace is not declared, the name and prefix will be
passed through without expansion. */
XML_Parser
XMLPARSEAPI
XML_ParserCreateNS
(
const
XML_Char
*
encoding
,
XML_Char
namespaceSeparator
);
/* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated. */
typedef
void
(
*
XML_StartElementHandler
)(
void
*
userData
,
typedef
void
(
*
XML_StartElementHandler
)(
void
*
userData
,
const
c
har
*
name
,
const
XML_C
har
*
name
,
const
c
har
**
atts
);
const
XML_C
har
**
atts
);
typedef
void
(
*
XML_EndElementHandler
)(
void
*
userData
,
typedef
void
(
*
XML_EndElementHandler
)(
void
*
userData
,
const
c
har
*
name
);
const
XML_C
har
*
name
);
/* s is not 0 terminated. */
typedef
void
(
*
XML_CharacterDataHandler
)(
void
*
userData
,
typedef
void
(
*
XML_CharacterDataHandler
)(
void
*
userData
,
const
c
har
*
s
,
const
XML_C
har
*
s
,
int
len
);
int
len
);
/* target and data are
'\0'
terminated */
/* target and data are
0
terminated */
typedef
void
(
*
XML_ProcessingInstructionHandler
)(
void
*
userData
,
typedef
void
(
*
XML_ProcessingInstructionHandler
)(
void
*
userData
,
const
char
*
target
,
const
XML_Char
*
target
,
const
char
*
data
);
const
XML_Char
*
data
);
/* data is 0 terminated */
typedef
void
(
*
XML_CommentHandler
)(
void
*
userData
,
const
XML_Char
*
data
);
typedef
void
(
*
XML_StartCdataSectionHandler
)(
void
*
userData
);
typedef
void
(
*
XML_EndCdataSectionHandler
)(
void
*
userData
);
/* This is called for any characters in the XML document for
which there is no applicable handler. This includes both
characters that are part of markup which is of a kind that is
not reported (comments, markup declarations), or characters
that are part of a construct which could be reported but
for which no handler has been supplied. The characters are passed
exactly as they were in the XML document except that
they will be encoded in UTF-8. Line boundaries are not normalized.
Note that a byte order mark character is not passed to the default handler.
There are no guarantees about how characters are divided between calls
to the default handler: for example, a comment might be split between
multiple calls. */
typedef
void
(
*
XML_DefaultHandler
)(
void
*
userData
,
const
XML_Char
*
s
,
int
len
);
/* This is called for a declaration of an unparsed (NDATA)
entity. The base argument is whatever was set by XML_SetBase.
The entityName, systemId and notationName arguments will never be null.
The other arguments may be. */
typedef
void
(
*
XML_UnparsedEntityDeclHandler
)(
void
*
userData
,
const
XML_Char
*
entityName
,
const
XML_Char
*
base
,
const
XML_Char
*
systemId
,
const
XML_Char
*
publicId
,
const
XML_Char
*
notationName
);
/* This is called for a declaration of notation.
The base argument is whatever was set by XML_SetBase.
The notationName will never be null. The other arguments can be. */
typedef
void
(
*
XML_NotationDeclHandler
)(
void
*
userData
,
const
XML_Char
*
notationName
,
const
XML_Char
*
base
,
const
XML_Char
*
systemId
,
const
XML_Char
*
publicId
);
/* When namespace processing is enabled, these are called once for
each namespace declaration. The call to the start and end element
handlers occur between the calls to the start and end namespace
declaration handlers. For an xmlns attribute, prefix will be null.
For an xmlns="" attribute, uri will be null. */
typedef
void
(
*
XML_StartNamespaceDeclHandler
)(
void
*
userData
,
const
XML_Char
*
prefix
,
const
XML_Char
*
uri
);
typedef
void
(
*
XML_EndNamespaceDeclHandler
)(
void
*
userData
,
const
XML_Char
*
prefix
);
/* This is called if the document is not standalone (it has an
external subset or a reference to a parameter entity, but does not
have standalone="yes"). If this handler returns 0, then processing
will not continue, and the parser will return a
XML_ERROR_NOT_STANDALONE error. */
typedef
int
(
*
XML_NotStandaloneHandler
)(
void
*
userData
);
/* This is called for a reference to an external parsed general entity.
The referenced entity is not automatically parsed.
The application can parse it immediately or later using
XML_ExternalEntityParserCreate.
The parser argument is the parser parsing the entity containing the reference;
it can be passed as the parser argument to XML_ExternalEntityParserCreate.
The systemId argument is the system identifier as specified in the entity declaration;
it will not be null.
The base argument is the system identifier that should be used as the base for
resolving systemId if systemId was relative; this is set by XML_SetBase;
it may be null.
The publicId argument is the public identifier as specified in the entity declaration,
or null if none was specified; the whitespace in the public identifier
will have been normalized as required by the XML spec.
The context argument specifies the parsing context in the format
expected by the context argument to
XML_ExternalEntityParserCreate; context is valid only until the handler
returns, so if the referenced entity is to be parsed later, it must be copied.
The handler should return 0 if processing should not continue because of
a fatal error in the handling of the external entity.
In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING
error.
Note that unlike other handlers the first argument is the parser, not userData. */
typedef
int
(
*
XML_ExternalEntityRefHandler
)(
XML_Parser
parser
,
const
XML_Char
*
context
,
const
XML_Char
*
base
,
const
XML_Char
*
systemId
,
const
XML_Char
*
publicId
);
/* This structure is filled in by the XML_UnknownEncodingHandler
to provide information to the parser about encodings that are unknown
to the parser.
The map[b] member gives information about byte sequences
whose first byte is b.
If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c.
If map[b] is -1, then the byte sequence is malformed.
If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
sequence that encodes a single Unicode scalar value.
The data member will be passed as the first argument to the convert function.
The convert function is used to convert multibyte sequences;
s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
The convert function must return the Unicode scalar value
represented by this byte sequence or -1 if the byte sequence is malformed.
The convert function may be null if the encoding is a single-byte encoding,
that is if map[b] >= -1 for all bytes b.
When the parser is finished with the encoding, then if release is not null,
it will call release passing it the data member;
once release has been called, the convert function will not be called again.
Expat places certain restrictions on the encodings that are supported
using this mechanism.
1. Every ASCII character that can appear in a well-formed XML document,
other than the characters
$@\^`{}~
must be represented by a single byte, and that byte must be the
same byte that represents that character in ASCII.
2. No character may require more than 4 bytes to encode.
3. All characters encoded must have Unicode scalar values <= 0xFFFF,
(ie characters that would be encoded by surrogates in UTF-16
are not allowed). Note that this restriction doesn't apply to
the built-in support for UTF-8 and UTF-16.
4. No Unicode character may be encoded by more than one distinct sequence
of bytes. */
typedef
struct
{
int
map
[
256
];
void
*
data
;
int
(
*
convert
)(
void
*
data
,
const
char
*
s
);
void
(
*
release
)(
void
*
data
);
}
XML_Encoding
;
/* This is called for an encoding that is unknown to the parser.
The encodingHandlerData argument is that which was passed as the
second argument to XML_SetUnknownEncodingHandler.
The name argument gives the name of the encoding as specified in
the encoding declaration.
If the callback can provide information about the encoding,
it must fill in the XML_Encoding structure, and return 1.
Otherwise it must return 0.
If info does not describe a suitable encoding,
then the parser will return an XML_UNKNOWN_ENCODING error. */
typedef
int
(
*
XML_UnknownEncodingHandler
)(
void
*
encodingHandlerData
,
const
XML_Char
*
name
,
XML_Encoding
*
info
);
void
XMLPARSEAPI
void
XMLPARSEAPI
XML_SetElementHandler
(
XML_Parser
parser
,
XML_SetElementHandler
(
XML_Parser
parser
,
...
@@ -70,11 +285,106 @@ XML_SetCharacterDataHandler(XML_Parser parser,
...
@@ -70,11 +285,106 @@ XML_SetCharacterDataHandler(XML_Parser parser,
void
XMLPARSEAPI
void
XMLPARSEAPI
XML_SetProcessingInstructionHandler
(
XML_Parser
parser
,
XML_SetProcessingInstructionHandler
(
XML_Parser
parser
,
XML_ProcessingInstructionHandler
handler
);
XML_ProcessingInstructionHandler
handler
);
void
XMLPARSEAPI
XML_SetCommentHandler
(
XML_Parser
parser
,
XML_CommentHandler
handler
);
void
XMLPARSEAPI
XML_SetCdataSectionHandler
(
XML_Parser
parser
,
XML_StartCdataSectionHandler
start
,
XML_EndCdataSectionHandler
end
);
/* This sets the default handler and also inhibits expansion of internal entities.
The entity reference will be passed to the default handler. */
void
XMLPARSEAPI
XML_SetDefaultHandler
(
XML_Parser
parser
,
XML_DefaultHandler
handler
);
/* This sets the default handler but does not inhibit expansion of internal entities.
The entity reference will not be passed to the default handler. */
void
XMLPARSEAPI
XML_SetDefaultHandlerExpand
(
XML_Parser
parser
,
XML_DefaultHandler
handler
);
void
XMLPARSEAPI
XML_SetUnparsedEntityDeclHandler
(
XML_Parser
parser
,
XML_UnparsedEntityDeclHandler
handler
);
void
XMLPARSEAPI
XML_SetNotationDeclHandler
(
XML_Parser
parser
,
XML_NotationDeclHandler
handler
);
void
XMLPARSEAPI
XML_SetNamespaceDeclHandler
(
XML_Parser
parser
,
XML_StartNamespaceDeclHandler
start
,
XML_EndNamespaceDeclHandler
end
);
void
XMLPARSEAPI
XML_SetNotStandaloneHandler
(
XML_Parser
parser
,
XML_NotStandaloneHandler
handler
);
void
XMLPARSEAPI
XML_SetExternalEntityRefHandler
(
XML_Parser
parser
,
XML_ExternalEntityRefHandler
handler
);
/* If a non-null value for arg is specified here, then it will be passed
as the first argument to the external entity ref handler instead
of the parser object. */
void
XMLPARSEAPI
XML_SetExternalEntityRefHandlerArg
(
XML_Parser
,
void
*
arg
);
void
XMLPARSEAPI
XML_SetUnknownEncodingHandler
(
XML_Parser
parser
,
XML_UnknownEncodingHandler
handler
,
void
*
encodingHandlerData
);
/* This can be called within a handler for a start element, end element,
processing instruction or character data. It causes the corresponding
markup to be passed to the default handler. */
void
XMLPARSEAPI
XML_DefaultCurrent
(
XML_Parser
parser
);
/* This value is passed as the userData argument to callbacks. */
/* This value is passed as the userData argument to callbacks. */
void
XMLPARSEAPI
void
XMLPARSEAPI
XML_SetUserData
(
XML_Parser
parser
,
void
*
userData
);
XML_SetUserData
(
XML_Parser
parser
,
void
*
userData
);
/* Returns the last value set by XML_SetUserData or null. */
#define XML_GetUserData(parser) (*(void **)(parser))
/* This is equivalent to supplying an encoding argument
to XML_CreateParser. It must not be called after XML_Parse
or XML_ParseBuffer. */
int
XMLPARSEAPI
XML_SetEncoding
(
XML_Parser
parser
,
const
XML_Char
*
encoding
);
/* If this function is called, then the parser will be passed
as the first argument to callbacks instead of userData.
The userData will still be accessible using XML_GetUserData. */
void
XMLPARSEAPI
XML_UseParserAsHandlerArg
(
XML_Parser
parser
);
/* Sets the base to be used for resolving relative URIs in system identifiers in
declarations. Resolving relative identifiers is left to the application:
this value will be passed through as the base argument to the
XML_ExternalEntityRefHandler, XML_NotationDeclHandler
and XML_UnparsedEntityDeclHandler. The base argument will be copied.
Returns zero if out of memory, non-zero otherwise. */
int
XMLPARSEAPI
XML_SetBase
(
XML_Parser
parser
,
const
XML_Char
*
base
);
const
XML_Char
XMLPARSEAPI
*
XML_GetBase
(
XML_Parser
parser
);
/* Returns the number of the attributes passed in last call to the
XML_StartElementHandler that were specified in the start-tag rather
than defaulted. */
int
XMLPARSEAPI
XML_GetSpecifiedAttributeCount
(
XML_Parser
parser
);
/* Parses some input. Returns 0 if a fatal error is detected.
/* Parses some input. Returns 0 if a fatal error is detected.
The last call to XML_Parse must have isFinal true;
The last call to XML_Parse must have isFinal true;
len may be zero for this call (or any other). */
len may be zero for this call (or any other). */
...
@@ -87,8 +397,23 @@ XML_GetBuffer(XML_Parser parser, int len);
...
@@ -87,8 +397,23 @@ XML_GetBuffer(XML_Parser parser, int len);
int
XMLPARSEAPI
int
XMLPARSEAPI
XML_ParseBuffer
(
XML_Parser
parser
,
int
len
,
int
isFinal
);
XML_ParseBuffer
(
XML_Parser
parser
,
int
len
,
int
isFinal
);
/* If XML_Parser or XML_ParseEnd have returned 0, then XML_GetError*
/* Creates an XML_Parser object that can parse an external general entity;
returns information about the error. */
context is a '\0'-terminated string specifying the parse context;
encoding is a '\0'-terminated string giving the name of the externally specified encoding,
or null if there is no externally specified encoding.
The context string consists of a sequence of tokens separated by formfeeds (\f);
a token consisting of a name specifies that the general entity of the name
is open; a token of the form prefix=uri specifies the namespace for a particular
prefix; a token of the form =uri specifies the default namespace.
This can be called at any point after the first call to an ExternalEntityRefHandler
so longer as the parser has not yet been freed.
The new parser is completely independent and may safely be used in a separate thread.
The handlers and userData are initialized from the parser argument.
Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
XML_Parser
XMLPARSEAPI
XML_ExternalEntityParserCreate
(
XML_Parser
parser
,
const
XML_Char
*
context
,
const
XML_Char
*
encoding
);
enum
XML_Error
{
enum
XML_Error
{
XML_ERROR_NONE
,
XML_ERROR_NONE
,
...
@@ -110,19 +435,45 @@ enum XML_Error {
...
@@ -110,19 +435,45 @@ enum XML_Error {
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
,
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
,
XML_ERROR_MISPLACED_XML_PI
,
XML_ERROR_MISPLACED_XML_PI
,
XML_ERROR_UNKNOWN_ENCODING
,
XML_ERROR_UNKNOWN_ENCODING
,
XML_ERROR_INCORRECT_ENCODING
XML_ERROR_INCORRECT_ENCODING
,
XML_ERROR_UNCLOSED_CDATA_SECTION
,
XML_ERROR_EXTERNAL_ENTITY_HANDLING
,
XML_ERROR_NOT_STANDALONE
};
};
int
XMLPARSEAPI
XML_GetErrorCode
(
XML_Parser
parser
);
/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
int
XMLPARSEAPI
XML_GetErrorLineNumber
(
XML_Parser
parser
);
returns information about the error. */
int
XMLPARSEAPI
XML_GetErrorColumnNumber
(
XML_Parser
parser
);
long
XMLPARSEAPI
XML_GetErrorByteIndex
(
XML_Parser
parser
);
enum
XML_Error
XMLPARSEAPI
XML_GetErrorCode
(
XML_Parser
parser
);
/* These functions return information about the current parse location.
They may be called when XML_Parse or XML_ParseBuffer return 0;
in this case the location is the location of the character at which
the error was detected.
They may also be called from any other callback called to report
some parse event; in this the location is the location of the first
of the sequence of characters that generated the event. */
int
XMLPARSEAPI
XML_GetCurrentLineNumber
(
XML_Parser
parser
);
int
XMLPARSEAPI
XML_GetCurrentColumnNumber
(
XML_Parser
parser
);
long
XMLPARSEAPI
XML_GetCurrentByteIndex
(
XML_Parser
parser
);
/* Return the number of bytes in the current event.
Returns 0 if the event is in an internal entity. */
int
XMLPARSEAPI
XML_GetCurrentByteCount
(
XML_Parser
parser
);
/* For backwards compatibility with previous versions. */
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
/* Frees memory used by the parser. */
void
XMLPARSEAPI
void
XMLPARSEAPI
XML_ParserFree
(
XML_Parser
parser
);
XML_ParserFree
(
XML_Parser
parser
);
const
char
XMLPARSEAPI
*
/* Returns a string describing the error. */
XML_ErrorString
(
int
code
);
const
XML_LChar
XMLPARSEAPI
*
XML_ErrorString
(
int
code
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/asciitab.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
/* 0x00 */
BT_NONXML
,
BT_NONXML
,
BT_NONXML
,
BT_NONXML
,
/* 0x00 */
BT_NONXML
,
BT_NONXML
,
BT_NONXML
,
BT_NONXML
,
...
@@ -32,7 +42,7 @@ Contributor(s):
...
@@ -32,7 +42,7 @@ Contributor(s):
/* 0x2C */
BT_COMMA
,
BT_MINUS
,
BT_NAME
,
BT_SOL
,
/* 0x2C */
BT_COMMA
,
BT_MINUS
,
BT_NAME
,
BT_SOL
,
/* 0x30 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x30 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x34 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x34 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x38 */
BT_DIGIT
,
BT_DIGIT
,
BT_
NMSTRT
,
BT_SEMI
,
/* 0x38 */
BT_DIGIT
,
BT_DIGIT
,
BT_
COLON
,
BT_SEMI
,
/* 0x3C */
BT_LT
,
BT_EQUALS
,
BT_GT
,
BT_QUEST
,
/* 0x3C */
BT_LT
,
BT_EQUALS
,
BT_GT
,
BT_QUEST
,
/* 0x40 */
BT_OTHER
,
BT_HEX
,
BT_HEX
,
BT_HEX
,
/* 0x40 */
BT_OTHER
,
BT_HEX
,
BT_HEX
,
BT_HEX
,
/* 0x44 */
BT_HEX
,
BT_HEX
,
BT_HEX
,
BT_NMSTRT
,
/* 0x44 */
BT_HEX
,
BT_HEX
,
BT_HEX
,
BT_NMSTRT
,
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/dllmain.c
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,12 +12,25 @@ under the License.
...
@@ -12,12 +12,25 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#define STRICT 1
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <windows.h>
BOOL
WINAPI
DllMain
(
HANDLE
hInst
,
ULONG
ul_reason_for_call
,
LPVOID
lpReserved
)
BOOL
WINAPI
DllMain
(
HANDLE
hInst
,
ULONG
ul_reason_for_call
,
LPVOID
lpReserved
)
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/iasciitab.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
...
@@ -33,7 +43,7 @@ Contributor(s):
...
@@ -33,7 +43,7 @@ Contributor(s):
/* 0x2C */
BT_COMMA
,
BT_MINUS
,
BT_NAME
,
BT_SOL
,
/* 0x2C */
BT_COMMA
,
BT_MINUS
,
BT_NAME
,
BT_SOL
,
/* 0x30 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x30 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x34 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x34 */
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
BT_DIGIT
,
/* 0x38 */
BT_DIGIT
,
BT_DIGIT
,
BT_
NMSTRT
,
BT_SEMI
,
/* 0x38 */
BT_DIGIT
,
BT_DIGIT
,
BT_
COLON
,
BT_SEMI
,
/* 0x3C */
BT_LT
,
BT_EQUALS
,
BT_GT
,
BT_QUEST
,
/* 0x3C */
BT_LT
,
BT_EQUALS
,
BT_GT
,
BT_QUEST
,
/* 0x40 */
BT_OTHER
,
BT_HEX
,
BT_HEX
,
BT_HEX
,
/* 0x40 */
BT_OTHER
,
BT_HEX
,
BT_HEX
,
BT_HEX
,
/* 0x44 */
BT_HEX
,
BT_HEX
,
BT_HEX
,
BT_NMSTRT
,
/* 0x44 */
BT_HEX
,
BT_HEX
,
BT_HEX
,
BT_NMSTRT
,
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/latin1tab.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
/* 0x80 */
BT_OTHER
,
BT_OTHER
,
BT_OTHER
,
BT_OTHER
,
/* 0x80 */
BT_OTHER
,
BT_OTHER
,
BT_OTHER
,
BT_OTHER
,
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/utf8tab.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmldef.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,19 +12,50 @@ under the License.
...
@@ -12,19 +12,50 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#include <string.h>
#ifdef XML_WINLIB
#define WIN32_LEAN_AND_MEAN
#define STRICT
#include <windows.h>
#define malloc(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define calloc(x, y) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x)*(y))
#define free(x) HeapFree(GetProcessHeap(), 0, (x))
#define realloc(x, y) HeapReAlloc(GetProcessHeap(), 0, x, y)
#define abort()
/* as nothing */
#else
/* not XML_WINLIB */
#include <stdlib.h>
#endif
/* not XML_WINLIB */
/* This file can be used for any definitions needed in
/* This file can be used for any definitions needed in
particular environments. */
particular environments. */
#ifdef MOZILLA
#ifdef MOZILLA
#include "nspr.h"
#include "nspr.h"
#define malloc(x) PR_Calloc(1,(x))
#define malloc(x) PR_Malloc(x)
#define realloc(x, y) PR_Realloc((x), (y))
#define calloc(x, y) PR_Calloc((x),(y))
#define calloc(x, y) PR_Calloc((x),(y))
#define free(x) PR_Free(x)
#define free(x) PR_Free(x)
#define int int32
#define int int32
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmlrole.c
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#include "xmldef.h"
#include "xmldef.h"
...
@@ -149,6 +159,7 @@ int doctype0(PROLOG_STATE *state,
...
@@ -149,6 +159,7 @@ int doctype0(PROLOG_STATE *state,
case
XML_TOK_PROLOG_S
:
case
XML_TOK_PROLOG_S
:
return
XML_ROLE_NONE
;
return
XML_ROLE_NONE
;
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
doctype1
;
state
->
handler
=
doctype1
;
return
XML_ROLE_DOCTYPE_NAME
;
return
XML_ROLE_DOCTYPE_NAME
;
}
}
...
@@ -594,7 +605,7 @@ int notation4(PROLOG_STATE *state,
...
@@ -594,7 +605,7 @@ int notation4(PROLOG_STATE *state,
return
XML_ROLE_NOTATION_SYSTEM_ID
;
return
XML_ROLE_NOTATION_SYSTEM_ID
;
case
XML_TOK_DECL_CLOSE
:
case
XML_TOK_DECL_CLOSE
:
state
->
handler
=
internalSubset
;
state
->
handler
=
internalSubset
;
return
XML_ROLE_NO
NE
;
return
XML_ROLE_NO
TATION_NO_SYSTEM_ID
;
}
}
return
syntaxError
(
state
);
return
syntaxError
(
state
);
}
}
...
@@ -610,6 +621,7 @@ int attlist0(PROLOG_STATE *state,
...
@@ -610,6 +621,7 @@ int attlist0(PROLOG_STATE *state,
case
XML_TOK_PROLOG_S
:
case
XML_TOK_PROLOG_S
:
return
XML_ROLE_NONE
;
return
XML_ROLE_NONE
;
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
attlist1
;
state
->
handler
=
attlist1
;
return
XML_ROLE_ATTLIST_ELEMENT_NAME
;
return
XML_ROLE_ATTLIST_ELEMENT_NAME
;
}
}
...
@@ -630,6 +642,7 @@ int attlist1(PROLOG_STATE *state,
...
@@ -630,6 +642,7 @@ int attlist1(PROLOG_STATE *state,
state
->
handler
=
internalSubset
;
state
->
handler
=
internalSubset
;
return
XML_ROLE_NONE
;
return
XML_ROLE_NONE
;
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
attlist2
;
state
->
handler
=
attlist2
;
return
XML_ROLE_ATTRIBUTE_NAME
;
return
XML_ROLE_ATTRIBUTE_NAME
;
}
}
...
@@ -689,6 +702,7 @@ int attlist3(PROLOG_STATE *state,
...
@@ -689,6 +702,7 @@ int attlist3(PROLOG_STATE *state,
return
XML_ROLE_NONE
;
return
XML_ROLE_NONE
;
case
XML_TOK_NMTOKEN
:
case
XML_TOK_NMTOKEN
:
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
attlist4
;
state
->
handler
=
attlist4
;
return
XML_ROLE_ATTRIBUTE_ENUM_VALUE
;
return
XML_ROLE_ATTRIBUTE_ENUM_VALUE
;
}
}
...
@@ -836,6 +850,7 @@ int element0(PROLOG_STATE *state,
...
@@ -836,6 +850,7 @@ int element0(PROLOG_STATE *state,
case
XML_TOK_PROLOG_S
:
case
XML_TOK_PROLOG_S
:
return
XML_ROLE_NONE
;
return
XML_ROLE_NONE
;
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
element1
;
state
->
handler
=
element1
;
return
XML_ROLE_ELEMENT_NAME
;
return
XML_ROLE_ELEMENT_NAME
;
}
}
...
@@ -893,6 +908,7 @@ int element2(PROLOG_STATE *state,
...
@@ -893,6 +908,7 @@ int element2(PROLOG_STATE *state,
state
->
handler
=
element6
;
state
->
handler
=
element6
;
return
XML_ROLE_GROUP_OPEN
;
return
XML_ROLE_GROUP_OPEN
;
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
element7
;
state
->
handler
=
element7
;
return
XML_ROLE_CONTENT_ELEMENT
;
return
XML_ROLE_CONTENT_ELEMENT
;
case
XML_TOK_NAME_QUESTION
:
case
XML_TOK_NAME_QUESTION
:
...
@@ -940,6 +956,7 @@ int element4(PROLOG_STATE *state,
...
@@ -940,6 +956,7 @@ int element4(PROLOG_STATE *state,
case
XML_TOK_PROLOG_S
:
case
XML_TOK_PROLOG_S
:
return
XML_ROLE_NONE
;
return
XML_ROLE_NONE
;
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
element5
;
state
->
handler
=
element5
;
return
XML_ROLE_CONTENT_ELEMENT
;
return
XML_ROLE_CONTENT_ELEMENT
;
}
}
...
@@ -980,6 +997,7 @@ int element6(PROLOG_STATE *state,
...
@@ -980,6 +997,7 @@ int element6(PROLOG_STATE *state,
state
->
level
+=
1
;
state
->
level
+=
1
;
return
XML_ROLE_GROUP_OPEN
;
return
XML_ROLE_GROUP_OPEN
;
case
XML_TOK_NAME
:
case
XML_TOK_NAME
:
case
XML_TOK_PREFIXED_NAME
:
state
->
handler
=
element7
;
state
->
handler
=
element7
;
return
XML_ROLE_CONTENT_ELEMENT
;
return
XML_ROLE_CONTENT_ELEMENT
;
case
XML_TOK_NAME_QUESTION
:
case
XML_TOK_NAME_QUESTION
:
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmlrole.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#ifndef XmlRole_INCLUDED
#ifndef XmlRole_INCLUDED
...
@@ -44,6 +54,7 @@ enum {
...
@@ -44,6 +54,7 @@ enum {
XML_ROLE_ENTITY_NOTATION_NAME
,
XML_ROLE_ENTITY_NOTATION_NAME
,
XML_ROLE_NOTATION_NAME
,
XML_ROLE_NOTATION_NAME
,
XML_ROLE_NOTATION_SYSTEM_ID
,
XML_ROLE_NOTATION_SYSTEM_ID
,
XML_ROLE_NOTATION_NO_SYSTEM_ID
,
XML_ROLE_NOTATION_PUBLIC_ID
,
XML_ROLE_NOTATION_PUBLIC_ID
,
XML_ROLE_ATTRIBUTE_NAME
,
XML_ROLE_ATTRIBUTE_NAME
,
XML_ROLE_ATTRIBUTE_TYPE_CDATA
,
XML_ROLE_ATTRIBUTE_TYPE_CDATA
,
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok.c
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#include "xmldef.h"
#include "xmldef.h"
...
@@ -23,7 +33,7 @@ Contributor(s):
...
@@ -23,7 +33,7 @@ Contributor(s):
#include "nametab.h"
#include "nametab.h"
#define VTABLE1 \
#define VTABLE1 \
{ PREFIX(prologTok), PREFIX(contentTok) }, \
{ PREFIX(prologTok), PREFIX(contentTok)
, PREFIX(cdataSectionTok)
}, \
{ PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
{ PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
PREFIX(sameName), \
PREFIX(sameName), \
PREFIX(nameMatchesAscii), \
PREFIX(nameMatchesAscii), \
...
@@ -31,14 +41,11 @@ Contributor(s):
...
@@ -31,14 +41,11 @@ Contributor(s):
PREFIX(skipS), \
PREFIX(skipS), \
PREFIX(getAtts), \
PREFIX(getAtts), \
PREFIX(charRefNumber), \
PREFIX(charRefNumber), \
PREFIX(predefinedEntityName), \
PREFIX(updatePosition), \
PREFIX(updatePosition), \
PREFIX(isPublicId)
PREFIX(isPublicId)
#define VTABLE2 \
#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
PREFIX(encode), \
{ PREFIX(toUtf8) }
#define VTABLE VTABLE1, VTABLE2
#define UCS2_GET_NAMING(pages, hi, lo) \
#define UCS2_GET_NAMING(pages, hi, lo) \
(namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
(namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
...
@@ -81,29 +88,173 @@ We need 8 bits to index into pages, 3 bits to add to that index and
...
@@ -81,29 +88,173 @@ We need 8 bits to index into pages, 3 bits to add to that index and
#define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0)
#define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0)
static
int
isNever
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
0
;
}
static
int
utf8_isName2
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
UTF8_GET_NAMING2
(
namePages
,
(
const
unsigned
char
*
)
p
);
}
static
int
utf8_isName3
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
UTF8_GET_NAMING3
(
namePages
,
(
const
unsigned
char
*
)
p
);
}
#define utf8_isName4 isNever
static
int
utf8_isNmstrt2
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
UTF8_GET_NAMING2
(
nmstrtPages
,
(
const
unsigned
char
*
)
p
);
}
static
int
utf8_isNmstrt3
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
UTF8_GET_NAMING3
(
nmstrtPages
,
(
const
unsigned
char
*
)
p
);
}
#define utf8_isNmstrt4 isNever
#define utf8_isInvalid2 isNever
static
int
utf8_isInvalid3
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
UTF8_INVALID3
((
const
unsigned
char
*
)
p
);
}
static
int
utf8_isInvalid4
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
UTF8_INVALID4
((
const
unsigned
char
*
)
p
);
}
struct
normal_encoding
{
struct
normal_encoding
{
ENCODING
enc
;
ENCODING
enc
;
unsigned
char
type
[
256
];
unsigned
char
type
[
256
];
#ifdef XML_MIN_SIZE
int
(
*
byteType
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isNameMin
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isNmstrtMin
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
byteToAscii
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
charMatches
)(
const
ENCODING
*
,
const
char
*
,
int
);
#endif
/* XML_MIN_SIZE */
int
(
*
isName2
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isName3
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isName4
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isNmstrt2
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isNmstrt3
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isNmstrt4
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isInvalid2
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isInvalid3
)(
const
ENCODING
*
,
const
char
*
);
int
(
*
isInvalid4
)(
const
ENCODING
*
,
const
char
*
);
};
};
#ifdef XML_MIN_SIZE
#define STANDARD_VTABLE(E) \
E ## byteType, \
E ## isNameMin, \
E ## isNmstrtMin, \
E ## byteToAscii, \
E ## charMatches,
#else
#define STANDARD_VTABLE(E)
/* as nothing */
#endif
#define NORMAL_VTABLE(E) \
E ## isName2, \
E ## isName3, \
E ## isName4, \
E ## isNmstrt2, \
E ## isNmstrt3, \
E ## isNmstrt4, \
E ## isInvalid2, \
E ## isInvalid3, \
E ## isInvalid4
static
int
checkCharRefNumber
(
int
);
static
int
checkCharRefNumber
(
int
);
#include "xmltok_impl.h"
#include "xmltok_impl.h"
#ifdef XML_MIN_SIZE
#define sb_isNameMin isNever
#define sb_isNmstrtMin isNever
#endif
#ifdef XML_MIN_SIZE
#define MINBPC(enc) ((enc)->minBytesPerChar)
#else
/* minimum bytes per character */
/* minimum bytes per character */
#define MINBPC 1
#define MINBPC(enc) 1
#define BYTE_TYPE(enc, p) \
#endif
#define SB_BYTE_TYPE(enc, p) \
(((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
(((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
#ifdef XML_MIN_SIZE
static
int
sb_byteType
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
SB_BYTE_TYPE
(
enc
,
p
);
}
#define BYTE_TYPE(enc, p) \
(((const struct normal_encoding *)(enc))->byteType(enc, p))
#else
#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p)
#endif
#ifdef XML_MIN_SIZE
#define BYTE_TO_ASCII(enc, p) \
(((const struct normal_encoding *)(enc))->byteToAscii(enc, p))
static
int
sb_byteToAscii
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
*
p
;
}
#else
#define BYTE_TO_ASCII(enc, p) (*p)
#define BYTE_TO_ASCII(enc, p) (*p)
#define IS_NAME_CHAR(enc, p, n) UTF8_GET_NAMING(namePages, p, n)
#endif
#define IS_NMSTRT_CHAR(enc, p, n) UTF8_GET_NAMING(nmstrtPages, p, n)
#define IS_NAME_CHAR(enc, p, n) \
(((const struct normal_encoding *)(enc))->isName ## n(enc, p))
#define IS_NMSTRT_CHAR(enc, p, n) \
(((const struct normal_encoding *)(enc))->isNmstrt ## n(enc, p))
#define IS_INVALID_CHAR(enc, p, n) \
#define IS_INVALID_CHAR(enc, p, n) \
((n) == 3 \
(((const struct normal_encoding *)(enc))->isInvalid ## n(enc, p))
? UTF8_INVALID3((const unsigned char *)(p)) \
: ((n) == 4 ? UTF8_INVALID4((const unsigned char *)(p)) : 0))
#ifdef XML_MIN_SIZE
#define IS_NAME_CHAR_MINBPC(enc, p) \
(((const struct normal_encoding *)(enc))->isNameMin(enc, p))
#define IS_NMSTRT_CHAR_MINBPC(enc, p) \
(((const struct normal_encoding *)(enc))->isNmstrtMin(enc, p))
#else
#define IS_NAME_CHAR_MINBPC(enc, p) (0)
#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0)
#endif
#ifdef XML_MIN_SIZE
#define CHAR_MATCHES(enc, p, c) \
(((const struct normal_encoding *)(enc))->charMatches(enc, p, c))
static
int
sb_charMatches
(
const
ENCODING
*
enc
,
const
char
*
p
,
int
c
)
{
return
*
p
==
c
;
}
#else
/* c is an ASCII character */
/* c is an ASCII character */
#define CHAR_MATCHES(enc, p, c) (*(p) == c)
#define CHAR_MATCHES(enc, p, c) (*(p) == c)
#endif
#define PREFIX(ident) normal_ ## ident
#define PREFIX(ident) normal_ ## ident
#include "xmltok_impl.c"
#include "xmltok_impl.c"
...
@@ -113,51 +264,18 @@ static int checkCharRefNumber(int);
...
@@ -113,51 +264,18 @@ static int checkCharRefNumber(int);
#undef BYTE_TO_ASCII
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NAME_CHAR
#undef IS_NAME_CHAR_MINBPC
#undef IS_NMSTRT_CHAR
#undef IS_NMSTRT_CHAR
#undef IS_NMSTRT_CHAR_MINBPC
#undef IS_INVALID_CHAR
#undef IS_INVALID_CHAR
enum
{
enum
{
/* UTF8_cvalN is value of masked first byte of N byte sequence */
/* cvalN is value of masked first byte of N byte sequence */
UTF8_cval1
=
0x00
,
cval1
=
0x00
,
UTF8_cval2
=
0xc0
,
cval2
=
0xc0
,
UTF8_cval3
=
0xe0
,
cval3
=
0xe0
,
UTF8_cval4
=
0xf0
cval4
=
0xf0
,
/* minN is minimum legal resulting value for N byte sequence */
min2
=
0x80
,
min3
=
0x800
,
min4
=
0x10000
};
};
static
int
utf8_encode
(
const
ENCODING
*
enc
,
int
c
,
char
*
buf
)
{
if
(
c
<
0
)
return
0
;
if
(
c
<
min2
)
{
buf
[
0
]
=
(
c
|
cval1
);
return
1
;
}
if
(
c
<
min3
)
{
buf
[
0
]
=
((
c
>>
6
)
|
cval2
);
buf
[
1
]
=
((
c
&
0x3f
)
|
0x80
);
return
2
;
}
if
(
c
<
min4
)
{
buf
[
0
]
=
((
c
>>
12
)
|
cval3
);
buf
[
1
]
=
(((
c
>>
6
)
&
0x3f
)
|
0x80
);
buf
[
2
]
=
((
c
&
0x3f
)
|
0x80
);
return
3
;
}
if
(
c
<
0x110000
)
{
buf
[
0
]
=
((
c
>>
18
)
|
cval4
);
buf
[
1
]
=
(((
c
>>
12
)
&
0x3f
)
|
0x80
);
buf
[
2
]
=
(((
c
>>
6
)
&
0x3f
)
|
0x80
);
buf
[
3
]
=
((
c
&
0x3f
)
|
0x80
);
return
4
;
}
return
0
;
}
static
static
void
utf8_toUtf8
(
const
ENCODING
*
enc
,
void
utf8_toUtf8
(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
*
fromLim
,
const
char
**
fromP
,
const
char
*
fromLim
,
...
@@ -177,33 +295,90 @@ void utf8_toUtf8(const ENCODING *enc,
...
@@ -177,33 +295,90 @@ void utf8_toUtf8(const ENCODING *enc,
*
toP
=
to
;
*
toP
=
to
;
}
}
static
void
utf8_toUtf16
(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
*
fromLim
,
unsigned
short
**
toP
,
const
unsigned
short
*
toLim
)
{
unsigned
short
*
to
=
*
toP
;
const
char
*
from
=
*
fromP
;
while
(
from
!=
fromLim
&&
to
!=
toLim
)
{
switch
(((
struct
normal_encoding
*
)
enc
)
->
type
[(
unsigned
char
)
*
from
])
{
case
BT_LEAD2
:
*
to
++
=
((
from
[
0
]
&
0x1f
)
<<
6
)
|
(
from
[
1
]
&
0x3f
);
from
+=
2
;
break
;
case
BT_LEAD3
:
*
to
++
=
((
from
[
0
]
&
0xf
)
<<
12
)
|
((
from
[
1
]
&
0x3f
)
<<
6
)
|
(
from
[
2
]
&
0x3f
);
from
+=
3
;
break
;
case
BT_LEAD4
:
{
unsigned
long
n
;
if
(
to
+
1
==
toLim
)
break
;
n
=
((
from
[
0
]
&
0x7
)
<<
18
)
|
((
from
[
1
]
&
0x3f
)
<<
12
)
|
((
from
[
2
]
&
0x3f
)
<<
6
)
|
(
from
[
3
]
&
0x3f
);
n
-=
0x10000
;
to
[
0
]
=
(
unsigned
short
)((
n
>>
10
)
|
0xD800
);
to
[
1
]
=
(
unsigned
short
)((
n
&
0x3FF
)
|
0xDC00
);
to
+=
2
;
from
+=
4
;
}
break
;
default:
*
to
++
=
*
from
++
;
break
;
}
}
*
fromP
=
from
;
*
toP
=
to
;
}
#ifdef XML_NS
static
const
struct
normal_encoding
utf8_encoding_ns
=
{
{
VTABLE1
,
utf8_toUtf8
,
utf8_toUtf16
,
1
,
1
,
0
},
{
#include "asciitab.h"
#include "utf8tab.h"
},
STANDARD_VTABLE
(
sb_
)
NORMAL_VTABLE
(
utf8_
)
};
#endif
static
const
struct
normal_encoding
utf8_encoding
=
{
static
const
struct
normal_encoding
utf8_encoding
=
{
{
VTABLE1
,
utf8_
encode
,
{
utf8_toUtf8
},
1
},
{
VTABLE1
,
utf8_
toUtf8
,
utf8_toUtf16
,
1
,
1
,
0
},
{
{
#define BT_COLON BT_NMSTRT
#include "asciitab.h"
#include "asciitab.h"
#undef BT_COLON
#include "utf8tab.h"
#include "utf8tab.h"
}
},
STANDARD_VTABLE
(
sb_
)
NORMAL_VTABLE
(
utf8_
)
};
};
static
const
struct
normal_encoding
internal_utf8_encoding
=
{
#ifdef XML_NS
{
VTABLE1
,
utf8_encode
,
{
utf8_toUtf8
},
1
},
static
const
struct
normal_encoding
internal_utf8_encoding_ns
=
{
{
VTABLE1
,
utf8_toUtf8
,
utf8_toUtf16
,
1
,
1
,
0
},
{
{
#include "iasciitab.h"
#include "iasciitab.h"
#include "utf8tab.h"
#include "utf8tab.h"
}
},
STANDARD_VTABLE
(
sb_
)
NORMAL_VTABLE
(
utf8_
)
};
};
static
#endif
int
latin1_encode
(
const
ENCODING
*
enc
,
int
c
,
char
*
buf
)
{
static
const
struct
normal_encoding
internal_utf8_encoding
=
{
if
(
c
<
0
)
{
VTABLE1
,
utf8_toUtf8
,
utf8_toUtf16
,
1
,
1
,
0
},
return
0
;
{
if
(
c
<=
0xFF
)
{
#define BT_COLON BT_NMSTRT
buf
[
0
]
=
(
char
)
c
;
#include "iasciitab.h"
return
1
;
#undef BT_COLON
}
#include "utf8tab.h"
return
0
;
},
}
STANDARD_VTABLE
(
sb_
)
NORMAL_VTABLE
(
utf8_
)
};
static
static
void
latin1_toUtf8
(
const
ENCODING
*
enc
,
void
latin1_toUtf8
(
const
ENCODING
*
enc
,
...
@@ -218,7 +393,7 @@ void latin1_toUtf8(const ENCODING *enc,
...
@@ -218,7 +393,7 @@ void latin1_toUtf8(const ENCODING *enc,
if
(
c
&
0x80
)
{
if
(
c
&
0x80
)
{
if
(
toLim
-
*
toP
<
2
)
if
(
toLim
-
*
toP
<
2
)
break
;
break
;
*
(
*
toP
)
++
=
((
c
>>
6
)
|
cval2
);
*
(
*
toP
)
++
=
((
c
>>
6
)
|
UTF8_
cval2
);
*
(
*
toP
)
++
=
((
c
&
0x3f
)
|
0x80
);
*
(
*
toP
)
++
=
((
c
&
0x3f
)
|
0x80
);
(
*
fromP
)
++
;
(
*
fromP
)
++
;
}
}
...
@@ -230,17 +405,71 @@ void latin1_toUtf8(const ENCODING *enc,
...
@@ -230,17 +405,71 @@ void latin1_toUtf8(const ENCODING *enc,
}
}
}
}
static
void
latin1_toUtf16
(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
*
fromLim
,
unsigned
short
**
toP
,
const
unsigned
short
*
toLim
)
{
while
(
*
fromP
!=
fromLim
&&
*
toP
!=
toLim
)
*
(
*
toP
)
++
=
(
unsigned
char
)
*
(
*
fromP
)
++
;
}
#ifdef XML_NS
static
const
struct
normal_encoding
latin1_encoding_ns
=
{
{
VTABLE1
,
latin1_toUtf8
,
latin1_toUtf16
,
1
,
0
,
0
},
{
#include "asciitab.h"
#include "latin1tab.h"
},
STANDARD_VTABLE
(
sb_
)
};
#endif
static
const
struct
normal_encoding
latin1_encoding
=
{
static
const
struct
normal_encoding
latin1_encoding
=
{
{
VTABLE1
,
latin1_
encode
,
{
latin1_toUtf8
},
1
},
{
VTABLE1
,
latin1_
toUtf8
,
latin1_toUtf16
,
1
,
0
,
0
},
{
{
#define BT_COLON BT_NMSTRT
#include "asciitab.h"
#include "asciitab.h"
#undef BT_COLON
#include "latin1tab.h"
#include "latin1tab.h"
}
},
STANDARD_VTABLE
(
sb_
)
};
static
void
ascii_toUtf8
(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
*
fromLim
,
char
**
toP
,
const
char
*
toLim
)
{
while
(
*
fromP
!=
fromLim
&&
*
toP
!=
toLim
)
*
(
*
toP
)
++
=
*
(
*
fromP
)
++
;
}
#ifdef XML_NS
static
const
struct
normal_encoding
ascii_encoding_ns
=
{
{
VTABLE1
,
ascii_toUtf8
,
latin1_toUtf16
,
1
,
1
,
0
},
{
#include "asciitab.h"
/* BT_NONXML == 0 */
},
STANDARD_VTABLE
(
sb_
)
};
};
#
define latin1tab (latin1_encoding.type)
#
endif
#undef PREFIX
static
const
struct
normal_encoding
ascii_encoding
=
{
{
VTABLE1
,
ascii_toUtf8
,
latin1_toUtf16
,
1
,
1
,
0
},
{
#define BT_COLON BT_NMSTRT
#include "asciitab.h"
#undef BT_COLON
/* BT_NONXML == 0 */
},
STANDARD_VTABLE
(
sb_
)
};
static
int
unicode_byte_type
(
char
hi
,
char
lo
)
static
int
unicode_byte_type
(
char
hi
,
char
lo
)
{
{
...
@@ -260,28 +489,9 @@ static int unicode_byte_type(char hi, char lo)
...
@@ -260,28 +489,9 @@ static int unicode_byte_type(char hi, char lo)
return
BT_NONASCII
;
return
BT_NONASCII
;
}
}
#define DEFINE_UTF16_ENCODE \
#define DEFINE_UTF16_TO_UTF8(E) \
static \
int PREFIX(encode)(const ENCODING *enc, int charNum, char *buf) \
{ \
if (charNum < 0) \
return 0; \
if (charNum < 0x10000) { \
SET2(buf, charNum); \
return 2; \
} \
if (charNum < 0x110000) { \
charNum -= 0x10000; \
SET2(buf, (charNum >> 10) + 0xD800); \
SET2(buf + 2, (charNum & 0x3FF) + 0xDC00); \
return 4; \
} \
return 0; \
}
#define DEFINE_UTF16_TO_UTF8 \
static \
static \
void
PREFIX(toUtf8)
(const ENCODING *enc, \
void
E ## toUtf8
(const ENCODING *enc, \
const char **fromP, const char *fromLim, \
const char **fromP, const char *fromLim, \
char **toP, const char *toLim) \
char **toP, const char *toLim) \
{ \
{ \
...
@@ -308,7 +518,7 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
...
@@ -308,7 +518,7 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
*fromP = from; \
*fromP = from; \
return; \
return; \
} \
} \
*(*toP)++ = ((lo >> 6) | (hi << 2) | cval2); \
*(*toP)++ = ((lo >> 6) | (hi << 2) |
UTF8_
cval2); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
break; \
break; \
default: \
default: \
...
@@ -317,7 +527,7 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
...
@@ -317,7 +527,7 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
return; \
return; \
} \
} \
/* 16 bits divided 4, 6, 6 amongst 3 bytes */
\
/* 16 bits divided 4, 6, 6 amongst 3 bytes */
\
*(*toP)++ = ((hi >> 4) | cval3); \
*(*toP)++ = ((hi >> 4) |
UTF8_
cval3); \
*(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \
*(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
break; \
break; \
...
@@ -327,7 +537,7 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
...
@@ -327,7 +537,7 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
return; \
return; \
} \
} \
plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
*(*toP)++ = ((plane >> 2) | cval4); \
*(*toP)++ = ((plane >> 2) |
UTF8_
cval4); \
*(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \
*(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \
from += 2; \
from += 2; \
lo2 = GET_LO(from); \
lo2 = GET_LO(from); \
...
@@ -342,196 +552,354 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
...
@@ -342,196 +552,354 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
*fromP = from; \
*fromP = from; \
}
}
#define PREFIX(ident) little2_ ## ident
#define DEFINE_UTF16_TO_UTF16(E) \
#define MINBPC 2
static \
#define BYTE_TYPE(enc, p) \
void E ## toUtf16(const ENCODING *enc, \
((p)[1] == 0 ? latin1tab[(unsigned char)*(p)] : unicode_byte_type((p)[1], (p)[0]))
const char **fromP, const char *fromLim, \
#define BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1)
unsigned short **toP, const unsigned short *toLim) \
#define CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c)
{ \
#define IS_NAME_CHAR(enc, p, n) \
/* Avoid copying first half only of surrogate */
\
UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
if (fromLim - *fromP > ((toLim - *toP) << 1) \
#define IS_NMSTRT_CHAR(enc, p, n) \
&& (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \
UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
fromLim -= 2; \
for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \
#include "xmltok_impl.c"
*(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
}
#define SET2(ptr, ch) \
#define SET2(ptr, ch) \
(((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))
(((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))
#define GET_LO(ptr) ((unsigned char)(ptr)[0])
#define GET_LO(ptr) ((unsigned char)(ptr)[0])
#define GET_HI(ptr) ((unsigned char)(ptr)[1])
#define GET_HI(ptr) ((unsigned char)(ptr)[1])
DEFINE_UTF16_
ENCODE
DEFINE_UTF16_
TO_UTF8
(
little2_
)
DEFINE_UTF16_TO_UTF
8
DEFINE_UTF16_TO_UTF
16
(
little2_
)
#undef SET2
#undef SET2
#undef GET_LO
#undef GET_LO
#undef GET_HI
#undef GET_HI
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NMSTRT_CHAR
#undef IS_INVALID_CHAR
static
const
struct
encoding
little2_encoding
=
{
VTABLE
,
2
};
#undef PREFIX
#define PREFIX(ident) big2_ ## ident
#define MINBPC 2
/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
#define BYTE_TYPE(enc, p) \
((p)[0] == 0 ? latin1tab[(unsigned char)(p)[1]] : unicode_byte_type((p)[0], (p)[1]))
#define BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1)
#define CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c)
#define IS_NAME_CHAR(enc, p, n) \
UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
#define IS_NMSTRT_CHAR(enc, p, n) \
UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
#include "xmltok_impl.c"
#define SET2(ptr, ch) \
#define SET2(ptr, ch) \
(((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))
(((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))
#define GET_LO(ptr) ((unsigned char)(ptr)[1])
#define GET_LO(ptr) ((unsigned char)(ptr)[1])
#define GET_HI(ptr) ((unsigned char)(ptr)[0])
#define GET_HI(ptr) ((unsigned char)(ptr)[0])
DEFINE_UTF16_
ENCODE
DEFINE_UTF16_
TO_UTF8
(
big2_
)
DEFINE_UTF16_TO_UTF
8
DEFINE_UTF16_TO_UTF
16
(
big2_
)
#undef SET2
#undef SET2
#undef GET_LO
#undef GET_LO
#undef GET_HI
#undef GET_HI
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NMSTRT_CHAR
#undef IS_INVALID_CHAR
static
const
struct
encoding
big2_encoding
=
{
VTABLE
,
2
};
#define LITTLE2_BYTE_TYPE(enc, p) \
((p)[1] == 0 \
? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
: unicode_byte_type((p)[1], (p)[0]))
#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1)
#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c)
#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \
UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
#
undef PREFIX
#
ifdef XML_MIN_SIZE
static
static
int
streqci
(
const
char
*
s1
,
const
char
*
s2
)
int
little2_byteType
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
{
for
(;;)
{
return
LITTLE2_BYTE_TYPE
(
enc
,
p
);
char
c1
=
*
s1
++
;
char
c2
=
*
s2
++
;
if
(
'a'
<=
c1
&&
c1
<=
'z'
)
c1
+=
'A'
-
'a'
;
if
(
'a'
<=
c2
&&
c2
<=
'z'
)
c2
+=
'A'
-
'a'
;
if
(
c1
!=
c2
)
return
0
;
if
(
!
c1
)
break
;
}
return
1
;
}
}
static
static
int
initScan
(
const
ENCODING
*
enc
,
int
state
,
const
char
*
ptr
,
const
char
*
end
,
int
little2_byteToAscii
(
const
ENCODING
*
enc
,
const
char
*
p
)
const
char
**
nextTokPtr
)
{
{
const
ENCODING
**
encPtr
;
return
LITTLE2_BYTE_TO_ASCII
(
enc
,
p
);
if
(
ptr
==
end
)
return
XML_TOK_NONE
;
encPtr
=
((
const
INIT_ENCODING
*
)
enc
)
->
encPtr
;
if
(
ptr
+
1
==
end
)
{
switch
((
unsigned
char
)
*
ptr
)
{
case
0xFE
:
case
0xFF
:
case
0x00
:
case
0x3C
:
return
XML_TOK_PARTIAL
;
}
}
else
{
switch
(((
unsigned
char
)
ptr
[
0
]
<<
8
)
|
(
unsigned
char
)
ptr
[
1
])
{
case
0x003C
:
*
encPtr
=
&
big2_encoding
;
return
XmlTok
(
*
encPtr
,
state
,
ptr
,
end
,
nextTokPtr
);
case
0xFEFF
:
*
nextTokPtr
=
ptr
+
2
;
*
encPtr
=
&
big2_encoding
;
return
XML_TOK_BOM
;
case
0x3C00
:
*
encPtr
=
&
little2_encoding
;
return
XmlTok
(
*
encPtr
,
state
,
ptr
,
end
,
nextTokPtr
);
case
0xFFFE
:
*
nextTokPtr
=
ptr
+
2
;
*
encPtr
=
&
little2_encoding
;
return
XML_TOK_BOM
;
}
}
*
encPtr
=
&
utf8_encoding
.
enc
;
return
XmlTok
(
*
encPtr
,
state
,
ptr
,
end
,
nextTokPtr
);
}
}
static
static
int
initScanProlog
(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
int
little2_charMatches
(
const
ENCODING
*
enc
,
const
char
*
p
,
int
c
)
const
char
**
nextTokPtr
)
{
{
return
initScan
(
enc
,
XML_PROLOG_STATE
,
ptr
,
end
,
nextTokPtr
);
return
LITTLE2_CHAR_MATCHES
(
enc
,
p
,
c
);
}
}
static
static
int
initScanContent
(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
int
little2_isNameMin
(
const
ENCODING
*
enc
,
const
char
*
p
)
const
char
**
nextTokPtr
)
{
{
return
initScan
(
enc
,
XML_CONTENT_STATE
,
ptr
,
end
,
nextTokPtr
);
return
LITTLE2_IS_NAME_CHAR_MINBPC
(
enc
,
p
);
}
}
static
static
void
initUpdatePosition
(
const
ENCODING
*
enc
,
const
char
*
ptr
,
int
little2_isNmstrtMin
(
const
ENCODING
*
enc
,
const
char
*
p
)
const
char
*
end
,
POSITION
*
pos
)
{
{
normal_updatePosition
(
&
utf8_encoding
.
enc
,
ptr
,
end
,
pos
);
return
LITTLE2_IS_NMSTRT_CHAR_MINBPC
(
enc
,
p
);
}
}
const
ENCODING
*
XmlGetInternalEncoding
(
int
e
)
#undef VTABLE
{
#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16
switch
(
e
)
{
case
XML_UTF8_ENCODING
:
return
&
internal_utf8_encoding
.
enc
;
}
return
0
;
}
int
XmlInitEncoding
(
INIT_ENCODING
*
p
,
const
ENCODING
**
encPtr
,
const
char
*
name
)
#else
/* not XML_MIN_SIZE */
#undef PREFIX
#define PREFIX(ident) little2_ ## ident
#define MINBPC(enc) 2
/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p)
#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p)
#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c)
#define IS_NAME_CHAR(enc, p, n) 0
#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)
#define IS_NMSTRT_CHAR(enc, p, n) (0)
#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)
#include "xmltok_impl.c"
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NAME_CHAR_MINBPC
#undef IS_NMSTRT_CHAR
#undef IS_NMSTRT_CHAR_MINBPC
#undef IS_INVALID_CHAR
#endif
/* not XML_MIN_SIZE */
#ifdef XML_NS
static
const
struct
normal_encoding
little2_encoding_ns
=
{
{
VTABLE
,
2
,
0
,
#if XML_BYTE_ORDER == 12
1
#else
0
#endif
},
{
#include "asciitab.h"
#include "latin1tab.h"
},
STANDARD_VTABLE
(
little2_
)
};
#endif
static
const
struct
normal_encoding
little2_encoding
=
{
{
VTABLE
,
2
,
0
,
#if XML_BYTE_ORDER == 12
1
#else
0
#endif
},
{
#define BT_COLON BT_NMSTRT
#include "asciitab.h"
#undef BT_COLON
#include "latin1tab.h"
},
STANDARD_VTABLE
(
little2_
)
};
#if XML_BYTE_ORDER != 21
#ifdef XML_NS
static
const
struct
normal_encoding
internal_little2_encoding_ns
=
{
{
VTABLE
,
2
,
0
,
1
},
{
#include "iasciitab.h"
#include "latin1tab.h"
},
STANDARD_VTABLE
(
little2_
)
};
#endif
static
const
struct
normal_encoding
internal_little2_encoding
=
{
{
VTABLE
,
2
,
0
,
1
},
{
#define BT_COLON BT_NMSTRT
#include "iasciitab.h"
#undef BT_COLON
#include "latin1tab.h"
},
STANDARD_VTABLE
(
little2_
)
};
#endif
#define BIG2_BYTE_TYPE(enc, p) \
((p)[0] == 0 \
? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
: unicode_byte_type((p)[0], (p)[1]))
#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1)
#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c)
#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \
UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
#ifdef XML_MIN_SIZE
static
int
big2_byteType
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
{
if
(
name
)
{
return
BIG2_BYTE_TYPE
(
enc
,
p
);
if
(
streqci
(
name
,
"ISO-8859-1"
))
{
}
*
encPtr
=
&
latin1_encoding
.
enc
;
return
1
;
static
}
int
big2_byteToAscii
(
const
ENCODING
*
enc
,
const
char
*
p
)
if
(
streqci
(
name
,
"UTF-8"
))
{
{
*
encPtr
=
&
utf8_encoding
.
enc
;
return
BIG2_BYTE_TO_ASCII
(
enc
,
p
);
return
1
;
}
}
if
(
!
streqci
(
name
,
"UTF-16"
))
static
int
big2_charMatches
(
const
ENCODING
*
enc
,
const
char
*
p
,
int
c
)
{
return
BIG2_CHAR_MATCHES
(
enc
,
p
,
c
);
}
static
int
big2_isNameMin
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
BIG2_IS_NAME_CHAR_MINBPC
(
enc
,
p
);
}
static
int
big2_isNmstrtMin
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
return
BIG2_IS_NMSTRT_CHAR_MINBPC
(
enc
,
p
);
}
#undef VTABLE
#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16
#else
/* not XML_MIN_SIZE */
#undef PREFIX
#define PREFIX(ident) big2_ ## ident
#define MINBPC(enc) 2
/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p)
#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p)
#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c)
#define IS_NAME_CHAR(enc, p, n) 0
#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p)
#define IS_NMSTRT_CHAR(enc, p, n) (0)
#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)
#include "xmltok_impl.c"
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NAME_CHAR_MINBPC
#undef IS_NMSTRT_CHAR
#undef IS_NMSTRT_CHAR_MINBPC
#undef IS_INVALID_CHAR
#endif
/* not XML_MIN_SIZE */
#ifdef XML_NS
static
const
struct
normal_encoding
big2_encoding_ns
=
{
{
VTABLE
,
2
,
0
,
#if XML_BYTE_ORDER == 21
1
#else
0
#endif
},
{
#include "asciitab.h"
#include "latin1tab.h"
},
STANDARD_VTABLE
(
big2_
)
};
#endif
static
const
struct
normal_encoding
big2_encoding
=
{
{
VTABLE
,
2
,
0
,
#if XML_BYTE_ORDER == 21
1
#else
0
#endif
},
{
#define BT_COLON BT_NMSTRT
#include "asciitab.h"
#undef BT_COLON
#include "latin1tab.h"
},
STANDARD_VTABLE
(
big2_
)
};
#if XML_BYTE_ORDER != 12
#ifdef XML_NS
static
const
struct
normal_encoding
internal_big2_encoding_ns
=
{
{
VTABLE
,
2
,
0
,
1
},
{
#include "iasciitab.h"
#include "latin1tab.h"
},
STANDARD_VTABLE
(
big2_
)
};
#endif
static
const
struct
normal_encoding
internal_big2_encoding
=
{
{
VTABLE
,
2
,
0
,
1
},
{
#define BT_COLON BT_NMSTRT
#include "iasciitab.h"
#undef BT_COLON
#include "latin1tab.h"
},
STANDARD_VTABLE
(
big2_
)
};
#endif
#undef PREFIX
static
int
streqci
(
const
char
*
s1
,
const
char
*
s2
)
{
for
(;;)
{
char
c1
=
*
s1
++
;
char
c2
=
*
s2
++
;
if
(
'a'
<=
c1
&&
c1
<=
'z'
)
c1
+=
'A'
-
'a'
;
if
(
'a'
<=
c2
&&
c2
<=
'z'
)
c2
+=
'A'
-
'a'
;
if
(
c1
!=
c2
)
return
0
;
return
0
;
if
(
!
c1
)
break
;
}
}
p
->
initEnc
.
scanners
[
XML_PROLOG_STATE
]
=
initScanProlog
;
p
->
initEnc
.
scanners
[
XML_CONTENT_STATE
]
=
initScanContent
;
p
->
initEnc
.
updatePosition
=
initUpdatePosition
;
p
->
initEnc
.
minBytesPerChar
=
1
;
p
->
encPtr
=
encPtr
;
*
encPtr
=
&
(
p
->
initEnc
);
return
1
;
return
1
;
}
}
static
void
initUpdatePosition
(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
POSITION
*
pos
)
{
normal_updatePosition
(
&
utf8_encoding
.
enc
,
ptr
,
end
,
pos
);
}
static
static
int
toAscii
(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
)
int
toAscii
(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
)
{
{
char
buf
[
1
];
char
buf
[
1
];
char
*
p
=
buf
;
char
*
p
=
buf
;
Xml
Convert
(
enc
,
XML_UTF8_ENCODING
,
&
ptr
,
end
,
&
p
,
p
+
1
);
Xml
Utf8Convert
(
enc
,
&
ptr
,
end
,
&
p
,
p
+
1
);
if
(
p
==
buf
)
if
(
p
==
buf
)
return
-
1
;
return
-
1
;
else
else
...
@@ -542,10 +910,10 @@ static
...
@@ -542,10 +910,10 @@ static
int
isSpace
(
int
c
)
int
isSpace
(
int
c
)
{
{
switch
(
c
)
{
switch
(
c
)
{
case
' '
:
case
0x20
:
case
'\r'
:
case
0xD
:
case
'\n'
:
case
0xA
:
case
'\t'
:
case
0x9
:
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -635,34 +1003,10 @@ int parsePseudoAttribute(const ENCODING *enc,
...
@@ -635,34 +1003,10 @@ int parsePseudoAttribute(const ENCODING *enc,
}
}
static
static
const
ENCODING
*
findEncoding
(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
)
int
doParseXmlDecl
(
const
ENCODING
*
(
*
encodingFinder
)(
const
ENCODING
*
,
{
const
char
*
,
#define ENCODING_MAX 128
const
char
*
),
char
buf
[
ENCODING_MAX
];
int
isGeneralTextEntity
,
char
*
p
=
buf
;
int
i
;
XmlConvert
(
enc
,
XML_UTF8_ENCODING
,
&
ptr
,
end
,
&
p
,
p
+
ENCODING_MAX
-
1
);
if
(
ptr
!=
end
)
return
0
;
*
p
=
0
;
for
(
i
=
0
;
buf
[
i
];
i
++
)
{
if
(
'a'
<=
buf
[
i
]
&&
buf
[
i
]
<=
'z'
)
buf
[
i
]
+=
'A'
-
'a'
;
}
if
(
streqci
(
buf
,
"UTF-8"
))
return
&
utf8_encoding
.
enc
;
if
(
streqci
(
buf
,
"ISO-8859-1"
))
return
&
latin1_encoding
.
enc
;
if
(
streqci
(
buf
,
"UTF-16"
))
{
static
const
unsigned
short
n
=
1
;
if
(
enc
->
minBytesPerChar
==
2
)
return
enc
;
return
&
big2_encoding
;
}
return
0
;
}
int
XmlParseXmlDecl
(
int
isGeneralTextEntity
,
const
ENCODING
*
enc
,
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
ptr
,
const
char
*
end
,
const
char
*
end
,
...
@@ -693,9 +1037,15 @@ int XmlParseXmlDecl(int isGeneralTextEntity,
...
@@ -693,9 +1037,15 @@ int XmlParseXmlDecl(int isGeneralTextEntity,
*
badPtr
=
ptr
;
*
badPtr
=
ptr
;
return
0
;
return
0
;
}
}
if
(
!
name
)
if
(
!
name
)
{
if
(
isGeneralTextEntity
)
{
/* a TextDecl must have an EncodingDecl */
*
badPtr
=
ptr
;
return
0
;
}
return
1
;
return
1
;
}
}
}
if
(
XmlNameMatchesAscii
(
enc
,
name
,
"encoding"
))
{
if
(
XmlNameMatchesAscii
(
enc
,
name
,
"encoding"
))
{
int
c
=
toAscii
(
enc
,
val
,
end
);
int
c
=
toAscii
(
enc
,
val
,
end
);
if
(
!
(
'a'
<=
c
&&
c
<=
'z'
)
&&
!
(
'A'
<=
c
&&
c
<=
'Z'
))
{
if
(
!
(
'a'
<=
c
&&
c
<=
'z'
)
&&
!
(
'A'
<=
c
&&
c
<=
'Z'
))
{
...
@@ -705,7 +1055,7 @@ int XmlParseXmlDecl(int isGeneralTextEntity,
...
@@ -705,7 +1055,7 @@ int XmlParseXmlDecl(int isGeneralTextEntity,
if
(
encodingName
)
if
(
encodingName
)
*
encodingName
=
val
;
*
encodingName
=
val
;
if
(
encoding
)
if
(
encoding
)
*
encoding
=
findEncoding
(
enc
,
val
,
ptr
-
enc
->
minBytesPerChar
);
*
encoding
=
encodingFinder
(
enc
,
val
,
ptr
-
enc
->
minBytesPerChar
);
if
(
!
parsePseudoAttribute
(
enc
,
ptr
,
end
,
&
name
,
&
val
,
&
ptr
))
{
if
(
!
parsePseudoAttribute
(
enc
,
ptr
,
end
,
&
name
,
&
val
,
&
ptr
))
{
*
badPtr
=
ptr
;
*
badPtr
=
ptr
;
return
0
;
return
0
;
...
@@ -757,3 +1107,421 @@ int checkCharRefNumber(int result)
...
@@ -757,3 +1107,421 @@ int checkCharRefNumber(int result)
return
result
;
return
result
;
}
}
int
XmlUtf8Encode
(
int
c
,
char
*
buf
)
{
enum
{
/* minN is minimum legal resulting value for N byte sequence */
min2
=
0x80
,
min3
=
0x800
,
min4
=
0x10000
};
if
(
c
<
0
)
return
0
;
if
(
c
<
min2
)
{
buf
[
0
]
=
(
c
|
UTF8_cval1
);
return
1
;
}
if
(
c
<
min3
)
{
buf
[
0
]
=
((
c
>>
6
)
|
UTF8_cval2
);
buf
[
1
]
=
((
c
&
0x3f
)
|
0x80
);
return
2
;
}
if
(
c
<
min4
)
{
buf
[
0
]
=
((
c
>>
12
)
|
UTF8_cval3
);
buf
[
1
]
=
(((
c
>>
6
)
&
0x3f
)
|
0x80
);
buf
[
2
]
=
((
c
&
0x3f
)
|
0x80
);
return
3
;
}
if
(
c
<
0x110000
)
{
buf
[
0
]
=
((
c
>>
18
)
|
UTF8_cval4
);
buf
[
1
]
=
(((
c
>>
12
)
&
0x3f
)
|
0x80
);
buf
[
2
]
=
(((
c
>>
6
)
&
0x3f
)
|
0x80
);
buf
[
3
]
=
((
c
&
0x3f
)
|
0x80
);
return
4
;
}
return
0
;
}
int
XmlUtf16Encode
(
int
charNum
,
unsigned
short
*
buf
)
{
if
(
charNum
<
0
)
return
0
;
if
(
charNum
<
0x10000
)
{
buf
[
0
]
=
charNum
;
return
1
;
}
if
(
charNum
<
0x110000
)
{
charNum
-=
0x10000
;
buf
[
0
]
=
(
charNum
>>
10
)
+
0xD800
;
buf
[
1
]
=
(
charNum
&
0x3FF
)
+
0xDC00
;
return
2
;
}
return
0
;
}
struct
unknown_encoding
{
struct
normal_encoding
normal
;
int
(
*
convert
)(
void
*
userData
,
const
char
*
p
);
void
*
userData
;
unsigned
short
utf16
[
256
];
char
utf8
[
256
][
4
];
};
int
XmlSizeOfUnknownEncoding
()
{
return
sizeof
(
struct
unknown_encoding
);
}
static
int
unknown_isName
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
int
c
=
((
const
struct
unknown_encoding
*
)
enc
)
->
convert
(((
const
struct
unknown_encoding
*
)
enc
)
->
userData
,
p
);
if
(
c
&
~
0xFFFF
)
return
0
;
return
UCS2_GET_NAMING
(
namePages
,
c
>>
8
,
c
&
0xFF
);
}
static
int
unknown_isNmstrt
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
int
c
=
((
const
struct
unknown_encoding
*
)
enc
)
->
convert
(((
const
struct
unknown_encoding
*
)
enc
)
->
userData
,
p
);
if
(
c
&
~
0xFFFF
)
return
0
;
return
UCS2_GET_NAMING
(
nmstrtPages
,
c
>>
8
,
c
&
0xFF
);
}
static
int
unknown_isInvalid
(
const
ENCODING
*
enc
,
const
char
*
p
)
{
int
c
=
((
const
struct
unknown_encoding
*
)
enc
)
->
convert
(((
const
struct
unknown_encoding
*
)
enc
)
->
userData
,
p
);
return
(
c
&
~
0xFFFF
)
||
checkCharRefNumber
(
c
)
<
0
;
}
static
void
unknown_toUtf8
(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
*
fromLim
,
char
**
toP
,
const
char
*
toLim
)
{
char
buf
[
XML_UTF8_ENCODE_MAX
];
for
(;;)
{
const
char
*
utf8
;
int
n
;
if
(
*
fromP
==
fromLim
)
break
;
utf8
=
((
const
struct
unknown_encoding
*
)
enc
)
->
utf8
[(
unsigned
char
)
**
fromP
];
n
=
*
utf8
++
;
if
(
n
==
0
)
{
int
c
=
((
const
struct
unknown_encoding
*
)
enc
)
->
convert
(((
const
struct
unknown_encoding
*
)
enc
)
->
userData
,
*
fromP
);
n
=
XmlUtf8Encode
(
c
,
buf
);
if
(
n
>
toLim
-
*
toP
)
break
;
utf8
=
buf
;
*
fromP
+=
((
const
struct
normal_encoding
*
)
enc
)
->
type
[(
unsigned
char
)
**
fromP
]
-
(
BT_LEAD2
-
2
);
}
else
{
if
(
n
>
toLim
-
*
toP
)
break
;
(
*
fromP
)
++
;
}
do
{
*
(
*
toP
)
++
=
*
utf8
++
;
}
while
(
--
n
!=
0
);
}
}
static
void
unknown_toUtf16
(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
*
fromLim
,
unsigned
short
**
toP
,
const
unsigned
short
*
toLim
)
{
while
(
*
fromP
!=
fromLim
&&
*
toP
!=
toLim
)
{
unsigned
short
c
=
((
const
struct
unknown_encoding
*
)
enc
)
->
utf16
[(
unsigned
char
)
**
fromP
];
if
(
c
==
0
)
{
c
=
(
unsigned
short
)((
const
struct
unknown_encoding
*
)
enc
)
->
convert
(((
const
struct
unknown_encoding
*
)
enc
)
->
userData
,
*
fromP
);
*
fromP
+=
((
const
struct
normal_encoding
*
)
enc
)
->
type
[(
unsigned
char
)
**
fromP
]
-
(
BT_LEAD2
-
2
);
}
else
(
*
fromP
)
++
;
*
(
*
toP
)
++
=
c
;
}
}
ENCODING
*
XmlInitUnknownEncoding
(
void
*
mem
,
int
*
table
,
int
(
*
convert
)(
void
*
userData
,
const
char
*
p
),
void
*
userData
)
{
int
i
;
struct
unknown_encoding
*
e
=
mem
;
for
(
i
=
0
;
i
<
sizeof
(
struct
normal_encoding
);
i
++
)
((
char
*
)
mem
)[
i
]
=
((
char
*
)
&
latin1_encoding
)[
i
];
for
(
i
=
0
;
i
<
128
;
i
++
)
if
(
latin1_encoding
.
type
[
i
]
!=
BT_OTHER
&&
latin1_encoding
.
type
[
i
]
!=
BT_NONXML
&&
table
[
i
]
!=
i
)
return
0
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
int
c
=
table
[
i
];
if
(
c
==
-
1
)
{
e
->
normal
.
type
[
i
]
=
BT_MALFORM
;
/* This shouldn't really get used. */
e
->
utf16
[
i
]
=
0xFFFF
;
e
->
utf8
[
i
][
0
]
=
1
;
e
->
utf8
[
i
][
1
]
=
0
;
}
else
if
(
c
<
0
)
{
if
(
c
<
-
4
)
return
0
;
e
->
normal
.
type
[
i
]
=
BT_LEAD2
-
(
c
+
2
);
e
->
utf8
[
i
][
0
]
=
0
;
e
->
utf16
[
i
]
=
0
;
}
else
if
(
c
<
0x80
)
{
if
(
latin1_encoding
.
type
[
c
]
!=
BT_OTHER
&&
latin1_encoding
.
type
[
c
]
!=
BT_NONXML
&&
c
!=
i
)
return
0
;
e
->
normal
.
type
[
i
]
=
latin1_encoding
.
type
[
c
];
e
->
utf8
[
i
][
0
]
=
1
;
e
->
utf8
[
i
][
1
]
=
(
char
)
c
;
e
->
utf16
[
i
]
=
c
==
0
?
0xFFFF
:
c
;
}
else
if
(
checkCharRefNumber
(
c
)
<
0
)
{
e
->
normal
.
type
[
i
]
=
BT_NONXML
;
/* This shouldn't really get used. */
e
->
utf16
[
i
]
=
0xFFFF
;
e
->
utf8
[
i
][
0
]
=
1
;
e
->
utf8
[
i
][
1
]
=
0
;
}
else
{
if
(
c
>
0xFFFF
)
return
0
;
if
(
UCS2_GET_NAMING
(
nmstrtPages
,
c
>>
8
,
c
&
0xff
))
e
->
normal
.
type
[
i
]
=
BT_NMSTRT
;
else
if
(
UCS2_GET_NAMING
(
namePages
,
c
>>
8
,
c
&
0xff
))
e
->
normal
.
type
[
i
]
=
BT_NAME
;
else
e
->
normal
.
type
[
i
]
=
BT_OTHER
;
e
->
utf8
[
i
][
0
]
=
(
char
)
XmlUtf8Encode
(
c
,
e
->
utf8
[
i
]
+
1
);
e
->
utf16
[
i
]
=
c
;
}
}
e
->
userData
=
userData
;
e
->
convert
=
convert
;
if
(
convert
)
{
e
->
normal
.
isName2
=
unknown_isName
;
e
->
normal
.
isName3
=
unknown_isName
;
e
->
normal
.
isName4
=
unknown_isName
;
e
->
normal
.
isNmstrt2
=
unknown_isNmstrt
;
e
->
normal
.
isNmstrt3
=
unknown_isNmstrt
;
e
->
normal
.
isNmstrt4
=
unknown_isNmstrt
;
e
->
normal
.
isInvalid2
=
unknown_isInvalid
;
e
->
normal
.
isInvalid3
=
unknown_isInvalid
;
e
->
normal
.
isInvalid4
=
unknown_isInvalid
;
}
e
->
normal
.
enc
.
utf8Convert
=
unknown_toUtf8
;
e
->
normal
.
enc
.
utf16Convert
=
unknown_toUtf16
;
return
&
(
e
->
normal
.
enc
);
}
/* If this enumeration is changed, getEncodingIndex and encodings
must also be changed. */
enum
{
UNKNOWN_ENC
=
-
1
,
ISO_8859_1_ENC
=
0
,
US_ASCII_ENC
,
UTF_8_ENC
,
UTF_16_ENC
,
UTF_16BE_ENC
,
UTF_16LE_ENC
,
/* must match encodingNames up to here */
NO_ENC
};
static
int
getEncodingIndex
(
const
char
*
name
)
{
static
const
char
*
encodingNames
[]
=
{
"ISO-8859-1"
,
"US-ASCII"
,
"UTF-8"
,
"UTF-16"
,
"UTF-16BE"
"UTF-16LE"
,
};
int
i
;
if
(
name
==
0
)
return
NO_ENC
;
for
(
i
=
0
;
i
<
sizeof
(
encodingNames
)
/
sizeof
(
encodingNames
[
0
]);
i
++
)
if
(
streqci
(
name
,
encodingNames
[
i
]))
return
i
;
return
UNKNOWN_ENC
;
}
/* For binary compatibility, we store the index of the encoding specified
at initialization in the isUtf16 member. */
#define INIT_ENC_INDEX(enc) ((enc)->initEnc.isUtf16)
/* This is what detects the encoding.
encodingTable maps from encoding indices to encodings;
INIT_ENC_INDEX(enc) is the index of the external (protocol) specified encoding;
state is XML_CONTENT_STATE if we're parsing an external text entity,
and XML_PROLOG_STATE otherwise.
*/
static
int
initScan
(
const
ENCODING
**
encodingTable
,
const
INIT_ENCODING
*
enc
,
int
state
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
nextTokPtr
)
{
const
ENCODING
**
encPtr
;
if
(
ptr
==
end
)
return
XML_TOK_NONE
;
encPtr
=
enc
->
encPtr
;
if
(
ptr
+
1
==
end
)
{
/* only a single byte available for auto-detection */
/* a well-formed document entity must have more than one byte */
if
(
state
!=
XML_CONTENT_STATE
)
return
XML_TOK_PARTIAL
;
/* so we're parsing an external text entity... */
/* if UTF-16 was externally specified, then we need at least 2 bytes */
switch
(
INIT_ENC_INDEX
(
enc
))
{
case
UTF_16_ENC
:
case
UTF_16LE_ENC
:
case
UTF_16BE_ENC
:
return
XML_TOK_PARTIAL
;
}
switch
((
unsigned
char
)
*
ptr
)
{
case
0xFE
:
case
0xFF
:
case
0xEF
:
/* possibly first byte of UTF-8 BOM */
if
(
INIT_ENC_INDEX
(
enc
)
==
ISO_8859_1_ENC
&&
state
==
XML_CONTENT_STATE
)
break
;
/* fall through */
case
0x00
:
case
0x3C
:
return
XML_TOK_PARTIAL
;
}
}
else
{
switch
(((
unsigned
char
)
ptr
[
0
]
<<
8
)
|
(
unsigned
char
)
ptr
[
1
])
{
case
0xFEFF
:
if
(
INIT_ENC_INDEX
(
enc
)
==
ISO_8859_1_ENC
&&
state
==
XML_CONTENT_STATE
)
break
;
*
nextTokPtr
=
ptr
+
2
;
*
encPtr
=
encodingTable
[
UTF_16BE_ENC
];
return
XML_TOK_BOM
;
/* 00 3C is handled in the default case */
case
0x3C00
:
if
((
INIT_ENC_INDEX
(
enc
)
==
UTF_16BE_ENC
||
INIT_ENC_INDEX
(
enc
)
==
UTF_16_ENC
)
&&
state
==
XML_CONTENT_STATE
)
break
;
*
encPtr
=
encodingTable
[
UTF_16LE_ENC
];
return
XmlTok
(
*
encPtr
,
state
,
ptr
,
end
,
nextTokPtr
);
case
0xFFFE
:
if
(
INIT_ENC_INDEX
(
enc
)
==
ISO_8859_1_ENC
&&
state
==
XML_CONTENT_STATE
)
break
;
*
nextTokPtr
=
ptr
+
2
;
*
encPtr
=
encodingTable
[
UTF_16LE_ENC
];
return
XML_TOK_BOM
;
case
0xEFBB
:
/* Maybe a UTF-8 BOM (EF BB BF) */
/* If there's an explicitly specified (external) encoding
of ISO-8859-1 or some flavour of UTF-16
and this is an external text entity,
don't look for the BOM,
because it might be a legal data. */
if
(
state
==
XML_CONTENT_STATE
)
{
int
e
=
INIT_ENC_INDEX
(
enc
);
if
(
e
==
ISO_8859_1_ENC
||
e
==
UTF_16BE_ENC
||
e
==
UTF_16LE_ENC
||
e
==
UTF_16_ENC
)
break
;
}
if
(
ptr
+
2
==
end
)
return
XML_TOK_PARTIAL
;
if
((
unsigned
char
)
ptr
[
2
]
==
0xBF
)
{
*
encPtr
=
encodingTable
[
UTF_8_ENC
];
return
XML_TOK_BOM
;
}
break
;
default:
if
(
ptr
[
0
]
==
'\0'
)
{
/* 0 isn't a legal data character. Furthermore a document entity can only
start with ASCII characters. So the only way this can fail to be big-endian
UTF-16 if it it's an external parsed general entity that's labelled as
UTF-16LE. */
if
(
state
==
XML_CONTENT_STATE
&&
INIT_ENC_INDEX
(
enc
)
==
UTF_16LE_ENC
)
break
;
*
encPtr
=
encodingTable
[
UTF_16BE_ENC
];
return
XmlTok
(
*
encPtr
,
state
,
ptr
,
end
,
nextTokPtr
);
}
else
if
(
ptr
[
1
]
==
'\0'
)
{
/* We could recover here in the case:
- parsing an external entity
- second byte is 0
- no externally specified encoding
- no encoding declaration
by assuming UTF-16LE. But we don't, because this would mean when
presented just with a single byte, we couldn't reliably determine
whether we needed further bytes. */
if
(
state
==
XML_CONTENT_STATE
)
break
;
*
encPtr
=
encodingTable
[
UTF_16LE_ENC
];
return
XmlTok
(
*
encPtr
,
state
,
ptr
,
end
,
nextTokPtr
);
}
break
;
}
}
*
encPtr
=
encodingTable
[
INIT_ENC_INDEX
(
enc
)];
return
XmlTok
(
*
encPtr
,
state
,
ptr
,
end
,
nextTokPtr
);
}
#define NS(x) x
#define ns(x) x
#include "xmltok_ns.c"
#undef NS
#undef ns
#ifdef XML_NS
#define NS(x) x ## NS
#define ns(x) x ## _ns
#include "xmltok_ns.c"
#undef NS
#undef ns
ENCODING
*
XmlInitUnknownEncodingNS
(
void
*
mem
,
int
*
table
,
int
(
*
convert
)(
void
*
userData
,
const
char
*
p
),
void
*
userData
)
{
ENCODING
*
enc
=
XmlInitUnknownEncoding
(
mem
,
table
,
convert
,
userData
);
if
(
enc
)
((
struct
normal_encoding
*
)
enc
)
->
type
[
':'
]
=
BT_COLON
;
return
enc
;
}
#endif
/* XML_NS */
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#ifndef XmlTok_INCLUDED
#ifndef XmlTok_INCLUDED
...
@@ -29,6 +39,9 @@ extern "C" {
...
@@ -29,6 +39,9 @@ extern "C" {
#define XMLTOKAPI
/* as nothing */
#define XMLTOKAPI
/* as nothing */
#endif
#endif
/* The following token may be returned by XmlContentTok */
#define XML_TOK_TRAILING_RSQB -5
/* ] or ]] at the end of the scan; might be start of
illegal ]]> sequence */
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
#define XML_TOK_NONE -4
/* The string to be scanned is empty */
#define XML_TOK_NONE -4
/* The string to be scanned is empty */
#define XML_TOK_TRAILING_CR -3
/* A CR at the end of the scan;
#define XML_TOK_TRAILING_CR -3
/* A CR at the end of the scan;
...
@@ -38,7 +51,7 @@ extern "C" {
...
@@ -38,7 +51,7 @@ extern "C" {
#define XML_TOK_INVALID 0
#define XML_TOK_INVALID 0
/* The following tokens are returned by XmlContentTok; some are also
/* The following tokens are returned by XmlContentTok; some are also
returned by XmlAttributeValueTok
and XmlEntity
Tok */
returned by XmlAttributeValueTok
, XmlEntityTok, XmlCdataSection
Tok */
#define XML_TOK_START_TAG_WITH_ATTS 1
#define XML_TOK_START_TAG_WITH_ATTS 1
#define XML_TOK_START_TAG_NO_ATTS 2
#define XML_TOK_START_TAG_NO_ATTS 2
...
@@ -47,7 +60,7 @@ extern "C" {
...
@@ -47,7 +60,7 @@ extern "C" {
#define XML_TOK_END_TAG 5
#define XML_TOK_END_TAG 5
#define XML_TOK_DATA_CHARS 6
#define XML_TOK_DATA_CHARS 6
#define XML_TOK_DATA_NEWLINE 7
#define XML_TOK_DATA_NEWLINE 7
#define XML_TOK_CDATA_SECT
IO
N 8
#define XML_TOK_CDATA_SECT
_OPE
N 8
#define XML_TOK_ENTITY_REF 9
#define XML_TOK_ENTITY_REF 9
#define XML_TOK_CHAR_REF 10
/* numeric character reference */
#define XML_TOK_CHAR_REF 10
/* numeric character reference */
...
@@ -85,25 +98,29 @@ extern "C" {
...
@@ -85,25 +98,29 @@ extern "C" {
#define XML_TOK_CLOSE_PAREN_PLUS 37
/* )+ */
#define XML_TOK_CLOSE_PAREN_PLUS 37
/* )+ */
#define XML_TOK_COMMA 38
#define XML_TOK_COMMA 38
/* The following tokens
is returned only by XmlAttributeValueTok */
/* The following token
is returned only by XmlAttributeValueTok */
#define XML_TOK_ATTRIBUTE_VALUE_S 39
#define XML_TOK_ATTRIBUTE_VALUE_S 39
#define XML_N_STATES 2
/* The following token is returned only by XmlCdataSectionTok */
#define XML_TOK_CDATA_SECT_CLOSE 40
/* With namespace processing this is returned by XmlPrologTok
for a name with a colon. */
#define XML_TOK_PREFIXED_NAME 41
#define XML_N_STATES 3
#define XML_PROLOG_STATE 0
#define XML_PROLOG_STATE 0
#define XML_CONTENT_STATE 1
#define XML_CONTENT_STATE 1
#define XML_CDATA_SECTION_STATE 2
#define XML_N_LITERAL_TYPES 2
#define XML_N_LITERAL_TYPES 2
#define XML_ATTRIBUTE_VALUE_LITERAL 0
#define XML_ATTRIBUTE_VALUE_LITERAL 0
#define XML_ENTITY_VALUE_LITERAL 1
#define XML_ENTITY_VALUE_LITERAL 1
#define XML_N_INTERNAL_ENCODINGS 1
/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
#define XML_UTF8_ENCODING 0
#define XML_UTF8_ENCODE_MAX 4
#if 0
/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
#define XML_UTF16_ENCODING 1
#define XML_UTF16_ENCODE_MAX 2
#define XML_UCS4_ENCODING 2
#endif
#define XML_MAX_BYTES_PER_CHAR 4
typedef
struct
position
{
typedef
struct
position
{
/* first line and first column are 0 not 1 */
/* first line and first column are 0 not 1 */
...
@@ -139,21 +156,26 @@ struct encoding {
...
@@ -139,21 +156,26 @@ struct encoding {
int
(
*
getAtts
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
int
(
*
getAtts
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
int
attsMax
,
ATTRIBUTE
*
atts
);
int
attsMax
,
ATTRIBUTE
*
atts
);
int
(
*
charRefNumber
)(
const
ENCODING
*
enc
,
const
char
*
ptr
);
int
(
*
charRefNumber
)(
const
ENCODING
*
enc
,
const
char
*
ptr
);
int
(
*
predefinedEntityName
)(
const
ENCODING
*
,
const
char
*
,
const
char
*
);
void
(
*
updatePosition
)(
const
ENCODING
*
,
void
(
*
updatePosition
)(
const
ENCODING
*
,
const
char
*
ptr
,
const
char
*
ptr
,
const
char
*
end
,
const
char
*
end
,
POSITION
*
);
POSITION
*
);
int
(
*
isPublicId
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
int
(
*
isPublicId
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
badPtr
);
const
char
**
badPtr
);
int
(
*
encode
)(
const
ENCODING
*
enc
,
void
(
*
utf8Convert
)(
const
ENCODING
*
enc
,
int
charNum
,
char
*
buf
);
void
(
*
convert
[
XML_N_INTERNAL_ENCODINGS
])(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
**
fromP
,
const
char
*
fromLim
,
const
char
*
fromLim
,
char
**
toP
,
char
**
toP
,
const
char
*
toLim
);
const
char
*
toLim
);
void
(
*
utf16Convert
)(
const
ENCODING
*
enc
,
const
char
**
fromP
,
const
char
*
fromLim
,
unsigned
short
**
toP
,
const
unsigned
short
*
toLim
);
int
minBytesPerChar
;
int
minBytesPerChar
;
char
isUtf8
;
char
isUtf16
;
};
};
/*
/*
...
@@ -186,6 +208,9 @@ literals, comments and processing instructions.
...
@@ -186,6 +208,9 @@ literals, comments and processing instructions.
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
/* This is used for performing a 2nd-level tokenization on
/* This is used for performing a 2nd-level tokenization on
the content of a literal that has already been returned by XmlTok. */
the content of a literal that has already been returned by XmlTok. */
...
@@ -215,17 +240,20 @@ the content of a literal that has already been returned by XmlTok. */
...
@@ -215,17 +240,20 @@ the content of a literal that has already been returned by XmlTok. */
#define XmlCharRefNumber(enc, ptr) \
#define XmlCharRefNumber(enc, ptr) \
(((enc)->charRefNumber)(enc, ptr))
(((enc)->charRefNumber)(enc, ptr))
#define XmlPredefinedEntityName(enc, ptr, end) \
(((enc)->predefinedEntityName)(enc, ptr, end))
#define XmlUpdatePosition(enc, ptr, end, pos) \
#define XmlUpdatePosition(enc, ptr, end, pos) \
(((enc)->updatePosition)(enc, ptr, end, pos))
(((enc)->updatePosition)(enc, ptr, end, pos))
#define XmlIsPublicId(enc, ptr, end, badPtr) \
#define XmlIsPublicId(enc, ptr, end, badPtr) \
(((enc)->isPublicId)(enc, ptr, end, badPtr))
(((enc)->isPublicId)(enc, ptr, end, badPtr))
#define Xml
Encode(enc, ch, buf
) \
#define Xml
Utf8Convert(enc, fromP, fromLim, toP, toLim
) \
(((enc)->
encode)(enc, ch, buf
))
(((enc)->
utf8Convert)(enc, fromP, fromLim, toP, toLim
))
#define Xml
Convert(enc, targetE
nc, fromP, fromLim, toP, toLim) \
#define Xml
Utf16Convert(e
nc, fromP, fromLim, toP, toLim) \
(((enc)->
convert[targetEnc]
)(enc, fromP, fromLim, toP, toLim))
(((enc)->
utf16Convert
)(enc, fromP, fromLim, toP, toLim))
typedef
struct
{
typedef
struct
{
ENCODING
initEnc
;
ENCODING
initEnc
;
...
@@ -243,8 +271,35 @@ int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
...
@@ -243,8 +271,35 @@ int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
int
*
standalonePtr
);
int
*
standalonePtr
);
int
XMLTOKAPI
XmlInitEncoding
(
INIT_ENCODING
*
,
const
ENCODING
**
,
const
char
*
name
);
int
XMLTOKAPI
XmlInitEncoding
(
INIT_ENCODING
*
,
const
ENCODING
**
,
const
char
*
name
);
const
ENCODING
XMLTOKAPI
*
XmlGetInternalEncoding
(
int
);
const
ENCODING
XMLTOKAPI
*
XmlGetUtf8InternalEncoding
();
const
ENCODING
XMLTOKAPI
*
XmlGetUtf16InternalEncoding
();
int
XMLTOKAPI
XmlUtf8Encode
(
int
charNumber
,
char
*
buf
);
int
XMLTOKAPI
XmlUtf16Encode
(
int
charNumber
,
unsigned
short
*
buf
);
int
XMLTOKAPI
XmlSizeOfUnknownEncoding
();
ENCODING
XMLTOKAPI
*
XmlInitUnknownEncoding
(
void
*
mem
,
int
*
table
,
int
(
*
conv
)(
void
*
userData
,
const
char
*
p
),
void
*
userData
);
int
XMLTOKAPI
XmlParseXmlDeclNS
(
int
isGeneralTextEntity
,
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
badPtr
,
const
char
**
versionPtr
,
const
char
**
encodingNamePtr
,
const
ENCODING
**
namedEncodingPtr
,
int
*
standalonePtr
);
int
XMLTOKAPI
XmlInitEncodingNS
(
INIT_ENCODING
*
,
const
ENCODING
**
,
const
char
*
name
);
const
ENCODING
XMLTOKAPI
*
XmlGetUtf8InternalEncodingNS
();
const
ENCODING
XMLTOKAPI
*
XmlGetUtf16InternalEncodingNS
();
ENCODING
XMLTOKAPI
*
XmlInitUnknownEncodingNS
(
void
*
mem
,
int
*
table
,
int
(
*
conv
)(
void
*
userData
,
const
char
*
p
),
void
*
userData
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_impl.c
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
#ifndef IS_INVALID_CHAR
#ifndef IS_INVALID_CHAR
...
@@ -56,7 +66,7 @@ Contributor(s):
...
@@ -56,7 +66,7 @@ Contributor(s):
#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \
#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \
case BT_NONASCII: \
case BT_NONASCII: \
if (!IS_NAME_CHAR
(enc, ptr, MINBPC
)) { \
if (!IS_NAME_CHAR
_MINBPC(enc, ptr
)) { \
*nextTokPtr = ptr; \
*nextTokPtr = ptr; \
return XML_TOK_INVALID; \
return XML_TOK_INVALID; \
} \
} \
...
@@ -65,7 +75,7 @@ Contributor(s):
...
@@ -65,7 +75,7 @@ Contributor(s):
case BT_DIGIT: \
case BT_DIGIT: \
case BT_NAME: \
case BT_NAME: \
case BT_MINUS: \
case BT_MINUS: \
ptr += MINBPC; \
ptr += MINBPC
(enc)
; \
break; \
break; \
CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \
CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \
CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \
CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \
...
@@ -84,13 +94,13 @@ Contributor(s):
...
@@ -84,13 +94,13 @@ Contributor(s):
#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \
#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \
case BT_NONASCII: \
case BT_NONASCII: \
if (!IS_NMSTRT_CHAR
(enc, ptr, MINBPC
)) { \
if (!IS_NMSTRT_CHAR
_MINBPC(enc, ptr
)) { \
*nextTokPtr = ptr; \
*nextTokPtr = ptr; \
return XML_TOK_INVALID; \
return XML_TOK_INVALID; \
} \
} \
case BT_NMSTRT: \
case BT_NMSTRT: \
case BT_HEX: \
case BT_HEX: \
ptr += MINBPC; \
ptr += MINBPC
(enc)
; \
break; \
break; \
CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \
CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \
CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \
CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \
...
@@ -111,26 +121,26 @@ int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -111,26 +121,26 @@ int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
while
(
ptr
!=
end
)
{
while
(
ptr
!=
end
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
INVALID_CASES
(
ptr
,
nextTokPtr
)
INVALID_CASES
(
ptr
,
nextTokPtr
)
case
BT_MINUS
:
case
BT_MINUS
:
if
((
ptr
+=
MINBPC
)
==
end
)
if
((
ptr
+=
MINBPC
(
enc
)
)
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'-'
))
{
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'-'
))
{
if
((
ptr
+=
MINBPC
)
==
end
)
if
((
ptr
+=
MINBPC
(
enc
)
)
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_COMMENT
;
return
XML_TOK_COMMENT
;
}
}
/* fall through */
break
;
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
}
}
...
@@ -148,13 +158,13 @@ int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -148,13 +158,13 @@ int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_MINUS
:
case
BT_MINUS
:
return
PREFIX
(
scanComment
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanComment
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_LSQB
:
case
BT_LSQB
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_COND_SECT_OPEN
;
return
XML_TOK_COND_SECT_OPEN
;
case
BT_NMSTRT
:
case
BT_NMSTRT
:
case
BT_HEX
:
case
BT_HEX
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -163,10 +173,10 @@ int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -163,10 +173,10 @@ int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
while
(
ptr
!=
end
)
{
while
(
ptr
!=
end
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_PERCNT
:
case
BT_PERCNT
:
if
(
ptr
+
MINBPC
==
end
)
if
(
ptr
+
MINBPC
(
enc
)
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
/* don't allow <!ENTITY% foo "whatever"> */
/* don't allow <!ENTITY% foo "whatever"> */
switch
(
BYTE_TYPE
(
enc
,
ptr
+
MINBPC
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
+
MINBPC
(
enc
)
))
{
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_PERCNT
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_PERCNT
:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
...
@@ -177,7 +187,7 @@ int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -177,7 +187,7 @@ int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
return
XML_TOK_DECL_OPEN
;
return
XML_TOK_DECL_OPEN
;
case
BT_NMSTRT
:
case
BT_NMSTRT
:
case
BT_HEX
:
case
BT_HEX
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -192,7 +202,7 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -192,7 +202,7 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
{
{
int
upper
=
0
;
int
upper
=
0
;
*
tokPtr
=
XML_TOK_PI
;
*
tokPtr
=
XML_TOK_PI
;
if
(
end
-
ptr
!=
MINBPC
*
3
)
if
(
end
-
ptr
!=
MINBPC
(
enc
)
*
3
)
return
1
;
return
1
;
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
case
'x'
:
case
'x'
:
...
@@ -203,7 +213,7 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -203,7 +213,7 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
default:
default:
return
1
;
return
1
;
}
}
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
case
'm'
:
case
'm'
:
break
;
break
;
...
@@ -213,7 +223,7 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -213,7 +223,7 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
default:
default:
return
1
;
return
1
;
}
}
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
case
'l'
:
case
'l'
:
break
;
break
;
...
@@ -253,21 +263,21 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -253,21 +263,21 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
while
(
ptr
!=
end
)
{
while
(
ptr
!=
end
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
INVALID_CASES
(
ptr
,
nextTokPtr
)
INVALID_CASES
(
ptr
,
nextTokPtr
)
case
BT_QUEST
:
case
BT_QUEST
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
tok
;
return
tok
;
}
}
break
;
break
;
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
}
}
...
@@ -277,11 +287,11 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -277,11 +287,11 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
tok
;
return
tok
;
}
}
/* fall through */
/* fall through */
...
@@ -293,38 +303,99 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -293,38 +303,99 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
}
}
/* ptr points to character following "<![" */
static
static
int
PREFIX
(
scanCdataSection
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
int
PREFIX
(
scanCdataSection
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
nextTokPtr
)
const
char
**
nextTokPtr
)
{
{
int
i
;
int
i
;
/* CDATA[
]]>
*/
/* CDATA[ */
if
(
end
-
ptr
<
9
*
MINBPC
)
if
(
end
-
ptr
<
6
*
MINBPC
(
enc
)
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
for
(
i
=
0
;
i
<
6
;
i
++
,
ptr
+=
MINBPC
)
{
for
(
i
=
0
;
i
<
6
;
i
++
,
ptr
+=
MINBPC
(
enc
)
)
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
"CDATA["
[
i
]))
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
"CDATA["
[
i
]))
{
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
}
}
end
-=
2
*
MINBPC
;
*
nextTokPtr
=
ptr
;
while
(
ptr
!=
end
)
{
return
XML_TOK_CDATA_SECT_OPEN
;
}
static
int
PREFIX
(
cdataSectionTok
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
nextTokPtr
)
{
if
(
ptr
==
end
)
return
XML_TOK_NONE
;
if
(
MINBPC
(
enc
)
>
1
)
{
size_t
n
=
end
-
ptr
;
if
(
n
&
(
MINBPC
(
enc
)
-
1
))
{
n
&=
~
(
MINBPC
(
enc
)
-
1
);
if
(
n
==
0
)
return
XML_TOK_PARTIAL
;
end
=
ptr
+
n
;
}
}
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
INVALID_CASES
(
ptr
,
nextTokPtr
)
case
BT_RSQB
:
case
BT_RSQB
:
if
(
CHAR_MATCHES
(
enc
,
ptr
+
MINBPC
,
']'
)
ptr
+=
MINBPC
(
enc
);
&&
CHAR_MATCHES
(
enc
,
ptr
+
2
*
MINBPC
,
'>'
))
{
if
(
ptr
==
end
)
*
nextTokPtr
=
ptr
+
3
*
MINBPC
;
return
XML_TOK_PARTIAL
;
return
XML_TOK_CDATA_SECTION
;
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
']'
))
break
;
ptr
+=
MINBPC
(
enc
);
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
ptr
-=
MINBPC
(
enc
);
break
;
}
}
/* fall through */
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
);
return
XML_TOK_CDATA_SECT_CLOSE
;
case
BT_CR
:
ptr
+=
MINBPC
(
enc
);
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
if
(
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
ptr
+=
MINBPC
(
enc
);
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_NEWLINE
;
case
BT_LF
:
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
);
return
XML_TOK_DATA_NEWLINE
;
INVALID_CASES
(
ptr
,
nextTokPtr
)
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
);
break
;
}
}
while
(
ptr
!=
end
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
*nextTokPtr = ptr; \
return XML_TOK_DATA_CHARS; \
} \
ptr += n; \
break;
LEAD_CASE
(
2
)
LEAD_CASE
(
3
)
LEAD_CASE
(
4
)
#undef LEAD_CASE
case
BT_NONXML
:
case
BT_MALFORM
:
case
BT_TRAIL
:
case
BT_CR
:
case
BT_LF
:
case
BT_RSQB
:
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
default:
ptr
+=
MINBPC
(
enc
);
break
;
}
}
return
XML_TOK_PARTIAL
;
}
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
}
}
/* ptr points to character following "</" */
/* ptr points to character following "</" */
...
@@ -345,12 +416,12 @@ int PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -345,12 +416,12 @@ int PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
for
(
ptr
+=
MINBPC
;
ptr
!=
end
;
ptr
+=
MINBPC
)
{
for
(
ptr
+=
MINBPC
(
enc
);
ptr
!=
end
;
ptr
+=
MINBPC
(
enc
)
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
break
;
break
;
case
BT_GT
:
case
BT_GT
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_END_TAG
;
return
XML_TOK_END_TAG
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -358,8 +429,14 @@ int PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -358,8 +429,14 @@ int PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
}
}
}
}
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
#ifdef XML_NS
case
BT_COLON
:
/* no need to check qname syntax here, since end-tag must match exactly */
ptr
+=
MINBPC
(
enc
);
break
;
#endif
case
BT_GT
:
case
BT_GT
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_END_TAG
;
return
XML_TOK_END_TAG
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -384,13 +461,13 @@ int PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end
...
@@ -384,13 +461,13 @@ int PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
for
(
ptr
+=
MINBPC
;
ptr
!=
end
;
ptr
+=
MINBPC
)
{
for
(
ptr
+=
MINBPC
(
enc
);
ptr
!=
end
;
ptr
+=
MINBPC
(
enc
)
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_DIGIT
:
case
BT_DIGIT
:
case
BT_HEX
:
case
BT_HEX
:
break
;
break
;
case
BT_SEMI
:
case
BT_SEMI
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_CHAR_REF
;
return
XML_TOK_CHAR_REF
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -409,7 +486,7 @@ int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -409,7 +486,7 @@ int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
{
{
if
(
ptr
!=
end
)
{
if
(
ptr
!=
end
)
{
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'x'
))
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'x'
))
return
PREFIX
(
scanHexCharRef
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanHexCharRef
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_DIGIT
:
case
BT_DIGIT
:
break
;
break
;
...
@@ -417,12 +494,12 @@ int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -417,12 +494,12 @@ int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
for
(
ptr
+=
MINBPC
;
ptr
!=
end
;
ptr
+=
MINBPC
)
{
for
(
ptr
+=
MINBPC
(
enc
);
ptr
!=
end
;
ptr
+=
MINBPC
(
enc
)
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_DIGIT
:
case
BT_DIGIT
:
break
;
break
;
case
BT_SEMI
:
case
BT_SEMI
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_CHAR_REF
;
return
XML_TOK_CHAR_REF
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -442,9 +519,9 @@ int PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -442,9 +519,9 @@ int PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NMSTRT_CASES
(
en
d
,
ptr
,
end
,
nextTokPtr
)
CHECK_NMSTRT_CASES
(
en
c
,
ptr
,
end
,
nextTokPtr
)
case
BT_NUM
:
case
BT_NUM
:
return
PREFIX
(
scanCharRef
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanCharRef
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
...
@@ -453,7 +530,7 @@ int PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -453,7 +530,7 @@ int PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
case
BT_SEMI
:
case
BT_SEMI
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_ENTITY_REF
;
return
XML_TOK_ENTITY_REF
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -469,14 +546,35 @@ static
...
@@ -469,14 +546,35 @@ static
int
PREFIX
(
scanAtts
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
int
PREFIX
(
scanAtts
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
nextTokPtr
)
const
char
**
nextTokPtr
)
{
{
#ifdef XML_NS
int
hadColon
=
0
;
#endif
while
(
ptr
!=
end
)
{
while
(
ptr
!=
end
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
#ifdef XML_NS
case
BT_COLON
:
if
(
hadColon
)
{
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
}
hadColon
=
1
;
ptr
+=
MINBPC
(
enc
);
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NMSTRT_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
default:
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
}
break
;
#endif
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
for
(;;)
{
for
(;;)
{
int
t
;
int
t
;
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
t
=
BYTE_TYPE
(
enc
,
ptr
);
t
=
BYTE_TYPE
(
enc
,
ptr
);
...
@@ -496,9 +594,12 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -496,9 +594,12 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
case
BT_EQUALS
:
case
BT_EQUALS
:
{
{
int
open
;
int
open
;
#ifdef XML_NS
hadColon
=
0
;
#endif
for
(;;)
{
for
(;;)
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
open
=
BYTE_TYPE
(
enc
,
ptr
);
open
=
BYTE_TYPE
(
enc
,
ptr
);
...
@@ -514,7 +615,7 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -514,7 +615,7 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
}
}
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
/* in attribute value */
/* in attribute value */
for
(;;)
{
for
(;;)
{
int
t
;
int
t
;
...
@@ -527,7 +628,7 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -527,7 +628,7 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
INVALID_CASES
(
ptr
,
nextTokPtr
)
INVALID_CASES
(
ptr
,
nextTokPtr
)
case
BT_AMP
:
case
BT_AMP
:
{
{
int
tok
=
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
,
end
,
&
ptr
);
int
tok
=
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
&
ptr
);
if
(
tok
<=
0
)
{
if
(
tok
<=
0
)
{
if
(
tok
==
XML_TOK_INVALID
)
if
(
tok
==
XML_TOK_INVALID
)
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -539,13 +640,29 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -539,13 +640,29 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
}
}
ptr
+=
MINBPC
(
enc
);
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
break
;
case
BT_SOL
:
goto
sol
;
case
BT_GT
:
goto
gt
;
default:
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
}
/* ptr points to closing quote */
/* ptr points to closing quote */
for
(;;)
{
for
(;;)
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
...
@@ -553,17 +670,19 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -553,17 +670,19 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
continue
;
continue
;
case
BT_GT
:
case
BT_GT
:
*
nextTokPtr
=
ptr
+
MINBPC
;
gt:
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
);
return
XML_TOK_START_TAG_WITH_ATTS
;
return
XML_TOK_START_TAG_WITH_ATTS
;
case
BT_SOL
:
case
BT_SOL
:
ptr
+=
MINBPC
;
sol:
ptr
+=
MINBPC
(
enc
);
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_EMPTY_ELEMENT_WITH_ATTS
;
return
XML_TOK_EMPTY_ELEMENT_WITH_ATTS
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -587,36 +706,60 @@ static
...
@@ -587,36 +706,60 @@ static
int
PREFIX
(
scanLt
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
int
PREFIX
(
scanLt
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
nextTokPtr
)
const
char
**
nextTokPtr
)
{
{
#ifdef XML_NS
int
hadColon
;
#endif
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NMSTRT_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
CHECK_NMSTRT_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
case
BT_EXCL
:
case
BT_EXCL
:
if
((
ptr
+=
MINBPC
)
==
end
)
if
((
ptr
+=
MINBPC
(
enc
)
)
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_MINUS
:
case
BT_MINUS
:
return
PREFIX
(
scanComment
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanComment
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_LSQB
:
case
BT_LSQB
:
return
PREFIX
(
scanCdataSection
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanCdataSection
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
case
BT_QUEST
:
case
BT_QUEST
:
return
PREFIX
(
scanPi
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanPi
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_SOL
:
case
BT_SOL
:
return
PREFIX
(
scanEndTag
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanEndTag
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
#ifdef XML_NS
hadColon
=
0
;
#endif
/* we have a start-tag */
/* we have a start-tag */
while
(
ptr
!=
end
)
{
while
(
ptr
!=
end
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
#ifdef XML_NS
case
BT_COLON
:
if
(
hadColon
)
{
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
}
hadColon
=
1
;
ptr
+=
MINBPC
(
enc
);
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NMSTRT_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
default:
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
}
break
;
#endif
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
{
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
while
(
ptr
!=
end
)
{
while
(
ptr
!=
end
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NMSTRT_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
CHECK_NMSTRT_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
...
@@ -625,7 +768,7 @@ int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -625,7 +768,7 @@ int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
case
BT_SOL
:
case
BT_SOL
:
goto
sol
;
goto
sol
;
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
continue
;
continue
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -637,18 +780,18 @@ int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -637,18 +780,18 @@ int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
}
}
case
BT_GT
:
case
BT_GT
:
gt:
gt:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_START_TAG_NO_ATTS
;
return
XML_TOK_START_TAG_NO_ATTS
;
case
BT_SOL
:
case
BT_SOL
:
sol:
sol:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_EMPTY_ELEMENT_NO_ATTS
;
return
XML_TOK_EMPTY_ELEMENT_NO_ATTS
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -664,51 +807,49 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -664,51 +807,49 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
{
{
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_NONE
;
return
XML_TOK_NONE
;
#if MINBPC > 1
if
(
MINBPC
(
enc
)
>
1
)
{
{
size_t
n
=
end
-
ptr
;
size_t
n
=
end
-
ptr
;
if
(
n
&
(
MINBPC
-
1
))
{
if
(
n
&
(
MINBPC
(
enc
)
-
1
))
{
n
&=
~
(
MINBPC
-
1
);
n
&=
~
(
MINBPC
(
enc
)
-
1
);
if
(
n
==
0
)
if
(
n
==
0
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
end
=
ptr
+
n
;
end
=
ptr
+
n
;
}
}
}
}
#endif
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_LT
:
case
BT_LT
:
return
PREFIX
(
scanLt
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanLt
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_AMP
:
case
BT_AMP
:
return
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_CR
:
case
BT_CR
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_TRAILING_CR
;
return
XML_TOK_TRAILING_CR
;
if
(
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
if
(
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_NEWLINE
;
return
XML_TOK_DATA_NEWLINE
;
case
BT_LF
:
case
BT_LF
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_DATA_NEWLINE
;
return
XML_TOK_DATA_NEWLINE
;
case
BT_RSQB
:
case
BT_RSQB
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_
PARTIAL
;
return
XML_TOK_
TRAILING_RSQB
;
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
']'
))
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
']'
))
break
;
break
;
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_
PARTIAL
;
return
XML_TOK_
TRAILING_RSQB
;
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
,
'>'
))
{
ptr
-=
MINBPC
;
ptr
-=
MINBPC
(
enc
)
;
break
;
break
;
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
INVALID_CASES
(
ptr
,
nextTokPtr
)
INVALID_CASES
(
ptr
,
nextTokPtr
)
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
while
(
ptr
!=
end
)
{
while
(
ptr
!=
end
)
{
...
@@ -724,17 +865,17 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -724,17 +865,17 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
LEAD_CASE
(
2
)
LEAD_CASE
(
3
)
LEAD_CASE
(
4
)
LEAD_CASE
(
2
)
LEAD_CASE
(
3
)
LEAD_CASE
(
4
)
#undef LEAD_CASE
#undef LEAD_CASE
case
BT_RSQB
:
case
BT_RSQB
:
if
(
ptr
+
MINBPC
!=
end
)
{
if
(
ptr
+
MINBPC
(
enc
)
!=
end
)
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
+
MINBPC
,
']'
))
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
+
MINBPC
(
enc
)
,
']'
))
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
if
(
ptr
+
2
*
MINBPC
!=
end
)
{
if
(
ptr
+
2
*
MINBPC
(
enc
)
!=
end
)
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
+
2
*
MINBPC
,
'>'
))
{
if
(
!
CHAR_MATCHES
(
enc
,
ptr
+
2
*
MINBPC
(
enc
)
,
'>'
))
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
*
nextTokPtr
=
ptr
+
2
*
MINBPC
;
*
nextTokPtr
=
ptr
+
2
*
MINBPC
(
enc
)
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
}
}
...
@@ -749,7 +890,7 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -749,7 +890,7 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
}
}
...
@@ -766,7 +907,7 @@ int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -766,7 +907,7 @@ int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NMSTRT_CASES
(
en
d
,
ptr
,
end
,
nextTokPtr
)
CHECK_NMSTRT_CASES
(
en
c
,
ptr
,
end
,
nextTokPtr
)
case
BT_S
:
case
BT_LF
:
case
BT_CR
:
case
BT_PERCNT
:
case
BT_S
:
case
BT_LF
:
case
BT_CR
:
case
BT_PERCNT
:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_PERCENT
;
return
XML_TOK_PERCENT
;
...
@@ -778,7 +919,7 @@ int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -778,7 +919,7 @@ int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
case
BT_SEMI
:
case
BT_SEMI
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_PARAM_ENTITY_REF
;
return
XML_TOK_PARAM_ENTITY_REF
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -795,7 +936,7 @@ int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -795,7 +936,7 @@ int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NMSTRT_CASES
(
en
d
,
ptr
,
end
,
nextTokPtr
)
CHECK_NMSTRT_CASES
(
en
c
,
ptr
,
end
,
nextTokPtr
)
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
...
@@ -826,7 +967,7 @@ int PREFIX(scanLit)(int open, const ENCODING *enc,
...
@@ -826,7 +967,7 @@ int PREFIX(scanLit)(int open, const ENCODING *enc,
INVALID_CASES
(
ptr
,
nextTokPtr
)
INVALID_CASES
(
ptr
,
nextTokPtr
)
case
BT_QUOT
:
case
BT_QUOT
:
case
BT_APOS
:
case
BT_APOS
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
t
!=
open
)
if
(
t
!=
open
)
break
;
break
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
...
@@ -840,7 +981,7 @@ int PREFIX(scanLit)(int open, const ENCODING *enc,
...
@@ -840,7 +981,7 @@ int PREFIX(scanLit)(int open, const ENCODING *enc,
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
}
}
...
@@ -854,51 +995,49 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -854,51 +995,49 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
int
tok
;
int
tok
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_NONE
;
return
XML_TOK_NONE
;
#if MINBPC > 1
if
(
MINBPC
(
enc
)
>
1
)
{
{
size_t
n
=
end
-
ptr
;
size_t
n
=
end
-
ptr
;
if
(
n
&
(
MINBPC
-
1
))
{
if
(
n
&
(
MINBPC
(
enc
)
-
1
))
{
n
&=
~
(
MINBPC
-
1
);
n
&=
~
(
MINBPC
(
enc
)
-
1
);
if
(
n
==
0
)
if
(
n
==
0
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
end
=
ptr
+
n
;
end
=
ptr
+
n
;
}
}
}
}
#endif
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_QUOT
:
case
BT_QUOT
:
return
PREFIX
(
scanLit
)(
BT_QUOT
,
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanLit
)(
BT_QUOT
,
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_APOS
:
case
BT_APOS
:
return
PREFIX
(
scanLit
)(
BT_APOS
,
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanLit
)(
BT_APOS
,
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_LT
:
case
BT_LT
:
{
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_EXCL
:
case
BT_EXCL
:
return
PREFIX
(
scanDecl
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanDecl
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_QUEST
:
case
BT_QUEST
:
return
PREFIX
(
scanPi
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanPi
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_NMSTRT
:
case
BT_NMSTRT
:
case
BT_HEX
:
case
BT_HEX
:
case
BT_NONASCII
:
case
BT_NONASCII
:
case
BT_LEAD2
:
case
BT_LEAD2
:
case
BT_LEAD3
:
case
BT_LEAD3
:
case
BT_LEAD4
:
case
BT_LEAD4
:
*
nextTokPtr
=
ptr
-
MINBPC
;
*
nextTokPtr
=
ptr
-
MINBPC
(
enc
)
;
return
XML_TOK_INSTANCE_START
;
return
XML_TOK_INSTANCE_START
;
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
case
BT_CR
:
case
BT_CR
:
if
(
ptr
+
MINBPC
==
end
)
if
(
ptr
+
MINBPC
(
enc
)
==
end
)
return
XML_TOK_TRAILING_CR
;
return
XML_TOK_TRAILING_CR
;
/* fall through */
/* fall through */
case
BT_S
:
case
BT_LF
:
case
BT_S
:
case
BT_LF
:
for
(;;)
{
for
(;;)
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
break
;
break
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
...
@@ -906,7 +1045,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -906,7 +1045,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
break
;
break
;
case
BT_CR
:
case
BT_CR
:
/* don't split CR/LF pair */
/* don't split CR/LF pair */
if
(
ptr
+
MINBPC
!=
end
)
if
(
ptr
+
MINBPC
(
enc
)
!=
end
)
break
;
break
;
/* fall through */
/* fall through */
default:
default:
...
@@ -917,43 +1056,43 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -917,43 +1056,43 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_PROLOG_S
;
return
XML_TOK_PROLOG_S
;
case
BT_PERCNT
:
case
BT_PERCNT
:
return
PREFIX
(
scanPercent
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanPercent
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
case
BT_COMMA
:
case
BT_COMMA
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_COMMA
;
return
XML_TOK_COMMA
;
case
BT_LSQB
:
case
BT_LSQB
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_OPEN_BRACKET
;
return
XML_TOK_OPEN_BRACKET
;
case
BT_RSQB
:
case
BT_RSQB
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
CHAR_MATCHES
(
enc
,
ptr
,
']'
))
{
if
(
CHAR_MATCHES
(
enc
,
ptr
,
']'
))
{
if
(
ptr
+
MINBPC
==
end
)
if
(
ptr
+
MINBPC
(
enc
)
==
end
)
return
XML_TOK_PARTIAL
;
return
XML_TOK_PARTIAL
;
if
(
CHAR_MATCHES
(
enc
,
ptr
+
MINBPC
,
'>'
))
{
if
(
CHAR_MATCHES
(
enc
,
ptr
+
MINBPC
(
enc
)
,
'>'
))
{
*
nextTokPtr
=
ptr
+
2
*
MINBPC
;
*
nextTokPtr
=
ptr
+
2
*
MINBPC
(
enc
)
;
return
XML_TOK_COND_SECT_CLOSE
;
return
XML_TOK_COND_SECT_CLOSE
;
}
}
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_CLOSE_BRACKET
;
return
XML_TOK_CLOSE_BRACKET
;
case
BT_LPAR
:
case
BT_LPAR
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_OPEN_PAREN
;
return
XML_TOK_OPEN_PAREN
;
case
BT_RPAR
:
case
BT_RPAR
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_
INVALID
;
return
XML_TOK_
PARTIAL
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_AST
:
case
BT_AST
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_CLOSE_PAREN_ASTERISK
;
return
XML_TOK_CLOSE_PAREN_ASTERISK
;
case
BT_QUEST
:
case
BT_QUEST
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_CLOSE_PAREN_QUESTION
;
return
XML_TOK_CLOSE_PAREN_QUESTION
;
case
BT_PLUS
:
case
BT_PLUS
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_CLOSE_PAREN_PLUS
;
return
XML_TOK_CLOSE_PAREN_PLUS
;
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_GT
:
case
BT_COMMA
:
case
BT_VERBAR
:
case
BT_GT
:
case
BT_COMMA
:
case
BT_VERBAR
:
...
@@ -964,13 +1103,13 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -964,13 +1103,13 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
case
BT_VERBAR
:
case
BT_VERBAR
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_OR
;
return
XML_TOK_OR
;
case
BT_GT
:
case
BT_GT
:
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_DECL_CLOSE
;
return
XML_TOK_DECL_CLOSE
;
case
BT_NUM
:
case
BT_NUM
:
return
PREFIX
(
scanPoundName
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanPoundName
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
#define LEAD_CASE(n) \
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
case BT_LEAD ## n: \
if (end - ptr < n) \
if (end - ptr < n) \
...
@@ -992,22 +1131,25 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -992,22 +1131,25 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
case
BT_NMSTRT
:
case
BT_NMSTRT
:
case
BT_HEX
:
case
BT_HEX
:
tok
=
XML_TOK_NAME
;
tok
=
XML_TOK_NAME
;
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
case
BT_DIGIT
:
case
BT_DIGIT
:
case
BT_NAME
:
case
BT_NAME
:
case
BT_MINUS
:
case
BT_MINUS
:
#ifdef XML_NS
case
BT_COLON
:
#endif
tok
=
XML_TOK_NMTOKEN
;
tok
=
XML_TOK_NMTOKEN
;
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
case
BT_NONASCII
:
case
BT_NONASCII
:
if
(
IS_NMSTRT_CHAR
(
enc
,
ptr
,
MINBPC
))
{
if
(
IS_NMSTRT_CHAR
_MINBPC
(
enc
,
ptr
))
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
tok
=
XML_TOK_NAME
;
tok
=
XML_TOK_NAME
;
break
;
break
;
}
}
if
(
IS_NAME_CHAR
(
enc
,
ptr
,
MINBPC
))
{
if
(
IS_NAME_CHAR
_MINBPC
(
enc
,
ptr
))
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
tok
=
XML_TOK_NMTOKEN
;
tok
=
XML_TOK_NMTOKEN
;
break
;
break
;
}
}
...
@@ -1024,26 +1166,47 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -1024,26 +1166,47 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
case
BT_S
:
case
BT_CR
:
case
BT_LF
:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
tok
;
return
tok
;
#ifdef XML_NS
case
BT_COLON
:
ptr
+=
MINBPC
(
enc
);
switch
(
tok
)
{
case
XML_TOK_NAME
:
if
(
ptr
==
end
)
return
XML_TOK_PARTIAL
;
tok
=
XML_TOK_PREFIXED_NAME
;
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
CHECK_NAME_CASES
(
enc
,
ptr
,
end
,
nextTokPtr
)
default:
tok
=
XML_TOK_NMTOKEN
;
break
;
}
break
;
case
XML_TOK_PREFIXED_NAME
:
tok
=
XML_TOK_NMTOKEN
;
break
;
}
break
;
#endif
case
BT_PLUS
:
case
BT_PLUS
:
if
(
tok
!=
XML_TOK_NAME
)
{
if
(
tok
==
XML_TOK_NMTOKEN
)
{
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_NAME_PLUS
;
return
XML_TOK_NAME_PLUS
;
case
BT_AST
:
case
BT_AST
:
if
(
tok
!=
XML_TOK_NAME
)
{
if
(
tok
==
XML_TOK_NMTOKEN
)
{
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_NAME_ASTERISK
;
return
XML_TOK_NAME_ASTERISK
;
case
BT_QUEST
:
case
BT_QUEST
:
if
(
tok
!=
XML_TOK_NAME
)
{
if
(
tok
==
XML_TOK_NMTOKEN
)
{
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
}
}
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_NAME_QUESTION
;
return
XML_TOK_NAME_QUESTION
;
default:
default:
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
...
@@ -1069,7 +1232,7 @@ int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *
...
@@ -1069,7 +1232,7 @@ int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *
#undef LEAD_CASE
#undef LEAD_CASE
case
BT_AMP
:
case
BT_AMP
:
if
(
ptr
==
start
)
if
(
ptr
==
start
)
return
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
case
BT_LT
:
case
BT_LT
:
...
@@ -1078,18 +1241,18 @@ int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *
...
@@ -1078,18 +1241,18 @@ int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *
return
XML_TOK_INVALID
;
return
XML_TOK_INVALID
;
case
BT_LF
:
case
BT_LF
:
if
(
ptr
==
start
)
{
if
(
ptr
==
start
)
{
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_DATA_NEWLINE
;
return
XML_TOK_DATA_NEWLINE
;
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
case
BT_CR
:
case
BT_CR
:
if
(
ptr
==
start
)
{
if
(
ptr
==
start
)
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_TRAILING_CR
;
return
XML_TOK_TRAILING_CR
;
if
(
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
if
(
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_NEWLINE
;
return
XML_TOK_DATA_NEWLINE
;
}
}
...
@@ -1097,13 +1260,13 @@ int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *
...
@@ -1097,13 +1260,13 @@ int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
case
BT_S
:
case
BT_S
:
if
(
ptr
==
start
)
{
if
(
ptr
==
start
)
{
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_ATTRIBUTE_VALUE_S
;
return
XML_TOK_ATTRIBUTE_VALUE_S
;
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
}
}
...
@@ -1127,35 +1290,35 @@ int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end
...
@@ -1127,35 +1290,35 @@ int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end
#undef LEAD_CASE
#undef LEAD_CASE
case
BT_AMP
:
case
BT_AMP
:
if
(
ptr
==
start
)
if
(
ptr
==
start
)
return
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanRef
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
case
BT_PERCNT
:
case
BT_PERCNT
:
if
(
ptr
==
start
)
if
(
ptr
==
start
)
return
PREFIX
(
scanPercent
)(
enc
,
ptr
+
MINBPC
,
end
,
nextTokPtr
);
return
PREFIX
(
scanPercent
)(
enc
,
ptr
+
MINBPC
(
enc
)
,
end
,
nextTokPtr
);
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
case
BT_LF
:
case
BT_LF
:
if
(
ptr
==
start
)
{
if
(
ptr
==
start
)
{
*
nextTokPtr
=
ptr
+
MINBPC
;
*
nextTokPtr
=
ptr
+
MINBPC
(
enc
)
;
return
XML_TOK_DATA_NEWLINE
;
return
XML_TOK_DATA_NEWLINE
;
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
case
BT_CR
:
case
BT_CR
:
if
(
ptr
==
start
)
{
if
(
ptr
==
start
)
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
==
end
)
if
(
ptr
==
end
)
return
XML_TOK_TRAILING_CR
;
return
XML_TOK_TRAILING_CR
;
if
(
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
if
(
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_NEWLINE
;
return
XML_TOK_DATA_NEWLINE
;
}
}
*
nextTokPtr
=
ptr
;
*
nextTokPtr
=
ptr
;
return
XML_TOK_DATA_CHARS
;
return
XML_TOK_DATA_CHARS
;
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
}
}
...
@@ -1167,9 +1330,9 @@ static
...
@@ -1167,9 +1330,9 @@ static
int
PREFIX
(
isPublicId
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
int
PREFIX
(
isPublicId
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
badPtr
)
const
char
**
badPtr
)
{
{
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
end
-=
MINBPC
;
end
-=
MINBPC
(
enc
)
;
for
(;
ptr
!=
end
;
ptr
+=
MINBPC
)
{
for
(;
ptr
!=
end
;
ptr
+=
MINBPC
(
enc
)
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
case
BT_DIGIT
:
case
BT_DIGIT
:
case
BT_HEX
:
case
BT_HEX
:
...
@@ -1189,6 +1352,9 @@ int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
...
@@ -1189,6 +1352,9 @@ int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
case
BT_AST
:
case
BT_AST
:
case
BT_PERCNT
:
case
BT_PERCNT
:
case
BT_NUM
:
case
BT_NUM
:
#ifdef XML_NS
case
BT_COLON
:
#endif
break
;
break
;
case
BT_S
:
case
BT_S
:
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'\t'
))
{
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'\t'
))
{
...
@@ -1227,7 +1393,7 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
...
@@ -1227,7 +1393,7 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
int
nAtts
=
0
;
int
nAtts
=
0
;
int
open
;
int
open
;
for
(
ptr
+=
MINBPC
;;
ptr
+=
MINBPC
)
{
for
(
ptr
+=
MINBPC
(
enc
);;
ptr
+=
MINBPC
(
enc
)
)
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr
))
{
#define START_NAME \
#define START_NAME \
if (state == other) { \
if (state == other) { \
...
@@ -1238,7 +1404,7 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
...
@@ -1238,7 +1404,7 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
state = inName; \
state = inName; \
}
}
#define LEAD_CASE(n) \
#define LEAD_CASE(n) \
case BT_LEAD ## n: START_NAME ptr += (n - MINBPC); break;
case BT_LEAD ## n: START_NAME ptr += (n - MINBPC
(enc)
); break;
LEAD_CASE
(
2
)
LEAD_CASE
(
3
)
LEAD_CASE
(
4
)
LEAD_CASE
(
2
)
LEAD_CASE
(
3
)
LEAD_CASE
(
4
)
#undef LEAD_CASE
#undef LEAD_CASE
case
BT_NONASCII
:
case
BT_NONASCII
:
...
@@ -1249,38 +1415,46 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
...
@@ -1249,38 +1415,46 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
#undef START_NAME
#undef START_NAME
case
BT_QUOT
:
case
BT_QUOT
:
if
(
state
!=
inValue
)
{
if
(
state
!=
inValue
)
{
atts
[
nAtts
].
valuePtr
=
ptr
+
MINBPC
;
if
(
nAtts
<
attsMax
)
atts
[
nAtts
].
valuePtr
=
ptr
+
MINBPC
(
enc
);
state
=
inValue
;
state
=
inValue
;
open
=
BT_QUOT
;
open
=
BT_QUOT
;
}
}
else
if
(
open
==
BT_QUOT
)
{
else
if
(
open
==
BT_QUOT
)
{
state
=
other
;
state
=
other
;
atts
[
nAtts
++
].
valueEnd
=
ptr
;
if
(
nAtts
<
attsMax
)
atts
[
nAtts
].
valueEnd
=
ptr
;
nAtts
++
;
}
}
break
;
break
;
case
BT_APOS
:
case
BT_APOS
:
if
(
state
!=
inValue
)
{
if
(
state
!=
inValue
)
{
atts
[
nAtts
].
valuePtr
=
ptr
+
MINBPC
;
if
(
nAtts
<
attsMax
)
atts
[
nAtts
].
valuePtr
=
ptr
+
MINBPC
(
enc
);
state
=
inValue
;
state
=
inValue
;
open
=
BT_APOS
;
open
=
BT_APOS
;
}
}
else
if
(
open
==
BT_APOS
)
{
else
if
(
open
==
BT_APOS
)
{
state
=
other
;
state
=
other
;
atts
[
nAtts
++
].
valueEnd
=
ptr
;
if
(
nAtts
<
attsMax
)
atts
[
nAtts
].
valueEnd
=
ptr
;
nAtts
++
;
}
}
break
;
break
;
case
BT_AMP
:
case
BT_AMP
:
if
(
nAtts
<
attsMax
)
atts
[
nAtts
].
normalized
=
0
;
atts
[
nAtts
].
normalized
=
0
;
break
;
break
;
case
BT_S
:
case
BT_S
:
if
(
state
==
inName
)
if
(
state
==
inName
)
state
=
other
;
state
=
other
;
else
if
(
state
==
inValue
else
if
(
state
==
inValue
&&
nAtts
<
attsMax
&&
atts
[
nAtts
].
normalized
&&
atts
[
nAtts
].
normalized
&&
(
ptr
==
atts
[
nAtts
].
valuePtr
&&
(
ptr
==
atts
[
nAtts
].
valuePtr
||
BYTE_TO_ASCII
(
enc
,
ptr
)
!=
' '
||
BYTE_TO_ASCII
(
enc
,
ptr
)
!=
' '
||
BYTE_TO_ASCII
(
enc
,
ptr
+
MINBPC
)
==
' '
||
BYTE_TO_ASCII
(
enc
,
ptr
+
MINBPC
(
enc
)
)
==
' '
||
BYTE_TYPE
(
enc
,
ptr
+
MINBPC
)
==
open
))
||
BYTE_TYPE
(
enc
,
ptr
+
MINBPC
(
enc
)
)
==
open
))
atts
[
nAtts
].
normalized
=
0
;
atts
[
nAtts
].
normalized
=
0
;
break
;
break
;
case
BT_CR
:
case
BT_LF
:
case
BT_CR
:
case
BT_LF
:
...
@@ -1288,7 +1462,7 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
...
@@ -1288,7 +1462,7 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
Apart from that we could just change state on the quote. */
Apart from that we could just change state on the quote. */
if
(
state
==
inName
)
if
(
state
==
inName
)
state
=
other
;
state
=
other
;
else
if
(
state
==
inValue
)
else
if
(
state
==
inValue
&&
nAtts
<
attsMax
)
atts
[
nAtts
].
normalized
=
0
;
atts
[
nAtts
].
normalized
=
0
;
break
;
break
;
case
BT_GT
:
case
BT_GT
:
...
@@ -1308,9 +1482,9 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
...
@@ -1308,9 +1482,9 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
{
{
int
result
=
0
;
int
result
=
0
;
/* skip &# */
/* skip &# */
ptr
+=
2
*
MINBPC
;
ptr
+=
2
*
MINBPC
(
enc
)
;
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'x'
))
{
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'x'
))
{
for
(
ptr
+=
MINBPC
;
!
CHAR_MATCHES
(
enc
,
ptr
,
';'
);
ptr
+=
MINBPC
)
{
for
(
ptr
+=
MINBPC
(
enc
);
!
CHAR_MATCHES
(
enc
,
ptr
,
';'
);
ptr
+=
MINBPC
(
enc
)
)
{
int
c
=
BYTE_TO_ASCII
(
enc
,
ptr
);
int
c
=
BYTE_TO_ASCII
(
enc
,
ptr
);
switch
(
c
)
{
switch
(
c
)
{
case
'0'
:
case
'1'
:
case
'2'
:
case
'3'
:
case
'4'
:
case
'0'
:
case
'1'
:
case
'2'
:
case
'3'
:
case
'4'
:
...
@@ -1332,7 +1506,7 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
...
@@ -1332,7 +1506,7 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
}
}
}
}
else
{
else
{
for
(;
!
CHAR_MATCHES
(
enc
,
ptr
,
';'
);
ptr
+=
MINBPC
)
{
for
(;
!
CHAR_MATCHES
(
enc
,
ptr
,
';'
);
ptr
+=
MINBPC
(
enc
)
)
{
int
c
=
BYTE_TO_ASCII
(
enc
,
ptr
);
int
c
=
BYTE_TO_ASCII
(
enc
,
ptr
);
result
*=
10
;
result
*=
10
;
result
+=
(
c
-
'0'
);
result
+=
(
c
-
'0'
);
...
@@ -1343,6 +1517,59 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
...
@@ -1343,6 +1517,59 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
return
checkCharRefNumber
(
result
);
return
checkCharRefNumber
(
result
);
}
}
static
int
PREFIX
(
predefinedEntityName
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
)
{
switch
((
end
-
ptr
)
/
MINBPC
(
enc
))
{
case
2
:
if
(
CHAR_MATCHES
(
enc
,
ptr
+
MINBPC
(
enc
),
't'
))
{
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
case
'l'
:
return
'<'
;
case
'g'
:
return
'>'
;
}
}
break
;
case
3
:
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'a'
))
{
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'm'
))
{
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'p'
))
return
'&'
;
}
}
break
;
case
4
:
switch
(
BYTE_TO_ASCII
(
enc
,
ptr
))
{
case
'q'
:
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'u'
))
{
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'o'
))
{
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
't'
))
return
'"'
;
}
}
break
;
case
'a'
:
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'p'
))
{
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
'o'
))
{
ptr
+=
MINBPC
(
enc
);
if
(
CHAR_MATCHES
(
enc
,
ptr
,
's'
))
return
'\''
;
}
}
break
;
}
}
return
0
;
}
static
static
int
PREFIX
(
sameName
)(
const
ENCODING
*
enc
,
const
char
*
ptr1
,
const
char
*
ptr2
)
int
PREFIX
(
sameName
)(
const
ENCODING
*
enc
,
const
char
*
ptr1
,
const
char
*
ptr2
)
{
{
...
@@ -1360,36 +1587,40 @@ int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
...
@@ -1360,36 +1587,40 @@ int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
break
;
break
;
case
BT_NONASCII
:
case
BT_NONASCII
:
case
BT_NMSTRT
:
case
BT_NMSTRT
:
#ifdef XML_NS
case
BT_COLON
:
#endif
case
BT_HEX
:
case
BT_HEX
:
case
BT_DIGIT
:
case
BT_DIGIT
:
case
BT_NAME
:
case
BT_NAME
:
case
BT_MINUS
:
case
BT_MINUS
:
if
(
*
ptr2
++
!=
*
ptr1
++
)
if
(
*
ptr2
++
!=
*
ptr1
++
)
return
0
;
return
0
;
#if MINBPC > 1
if
(
MINBPC
(
enc
)
>
1
)
{
if
(
*
ptr2
++
!=
*
ptr1
++
)
if
(
*
ptr2
++
!=
*
ptr1
++
)
return
0
;
return
0
;
#if MINBPC > 2
if
(
MINBPC
(
enc
)
>
2
)
{
if
(
*
ptr2
++
!=
*
ptr1
++
)
if
(
*
ptr2
++
!=
*
ptr1
++
)
return
0
;
return
0
;
#if MINBPC > 3
if
(
MINBPC
(
enc
)
>
3
)
{
if
(
*
ptr2
++
!=
*
ptr1
++
)
if
(
*
ptr2
++
!=
*
ptr1
++
)
return
0
;
return
0
;
#endif
}
#endif
}
#endif
}
break
;
break
;
default:
default:
#if MINBPC == 1
if
(
MINBPC
(
enc
)
==
1
&&
*
ptr1
==
*
ptr2
)
if
(
*
ptr1
==
*
ptr2
)
return
1
;
return
1
;
#endif
switch
(
BYTE_TYPE
(
enc
,
ptr2
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr2
))
{
case
BT_LEAD2
:
case
BT_LEAD2
:
case
BT_LEAD3
:
case
BT_LEAD3
:
case
BT_LEAD4
:
case
BT_LEAD4
:
case
BT_NONASCII
:
case
BT_NONASCII
:
case
BT_NMSTRT
:
case
BT_NMSTRT
:
#ifdef XML_NS
case
BT_COLON
:
#endif
case
BT_HEX
:
case
BT_HEX
:
case
BT_DIGIT
:
case
BT_DIGIT
:
case
BT_NAME
:
case
BT_NAME
:
...
@@ -1406,8 +1637,8 @@ int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
...
@@ -1406,8 +1637,8 @@ int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
static
static
int
PREFIX
(
nameMatchesAscii
)(
const
ENCODING
*
enc
,
const
char
*
ptr1
,
const
char
*
ptr2
)
int
PREFIX
(
nameMatchesAscii
)(
const
ENCODING
*
enc
,
const
char
*
ptr1
,
const
char
*
ptr2
)
{
{
for
(;
*
ptr2
;
ptr1
+=
MINBPC
,
ptr2
++
)
{
for
(;
*
ptr2
;
ptr1
+=
MINBPC
(
enc
)
,
ptr2
++
)
{
if
(
!
CHAR_MATCHES
(
en
d
,
ptr1
,
*
ptr2
))
if
(
!
CHAR_MATCHES
(
en
c
,
ptr1
,
*
ptr2
))
return
0
;
return
0
;
}
}
switch
(
BYTE_TYPE
(
enc
,
ptr1
))
{
switch
(
BYTE_TYPE
(
enc
,
ptr1
))
{
...
@@ -1416,6 +1647,9 @@ int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, const char *
...
@@ -1416,6 +1647,9 @@ int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, const char *
case
BT_LEAD4
:
case
BT_LEAD4
:
case
BT_NONASCII
:
case
BT_NONASCII
:
case
BT_NMSTRT
:
case
BT_NMSTRT
:
#ifdef XML_NS
case
BT_COLON
:
#endif
case
BT_HEX
:
case
BT_HEX
:
case
BT_DIGIT
:
case
BT_DIGIT
:
case
BT_NAME
:
case
BT_NAME
:
...
@@ -1438,11 +1672,14 @@ int PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
...
@@ -1438,11 +1672,14 @@ int PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
#undef LEAD_CASE
#undef LEAD_CASE
case
BT_NONASCII
:
case
BT_NONASCII
:
case
BT_NMSTRT
:
case
BT_NMSTRT
:
#ifdef XML_NS
case
BT_COLON
:
#endif
case
BT_HEX
:
case
BT_HEX
:
case
BT_DIGIT
:
case
BT_DIGIT
:
case
BT_NAME
:
case
BT_NAME
:
case
BT_MINUS
:
case
BT_MINUS
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
default:
default:
return
ptr
-
start
;
return
ptr
-
start
;
...
@@ -1458,7 +1695,7 @@ const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr)
...
@@ -1458,7 +1695,7 @@ const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr)
case
BT_LF
:
case
BT_LF
:
case
BT_CR
:
case
BT_CR
:
case
BT_S
:
case
BT_S
:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
default:
default:
return
ptr
;
return
ptr
;
...
@@ -1483,17 +1720,17 @@ void PREFIX(updatePosition)(const ENCODING *enc,
...
@@ -1483,17 +1720,17 @@ void PREFIX(updatePosition)(const ENCODING *enc,
case
BT_LF
:
case
BT_LF
:
pos
->
columnNumber
=
(
unsigned
)
-
1
;
pos
->
columnNumber
=
(
unsigned
)
-
1
;
pos
->
lineNumber
++
;
pos
->
lineNumber
++
;
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
case
BT_CR
:
case
BT_CR
:
pos
->
lineNumber
++
;
pos
->
lineNumber
++
;
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
if
(
ptr
!=
end
&&
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
if
(
ptr
!=
end
&&
BYTE_TYPE
(
enc
,
ptr
)
==
BT_LF
)
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
pos
->
columnNumber
=
(
unsigned
)
-
1
;
pos
->
columnNumber
=
(
unsigned
)
-
1
;
break
;
break
;
default:
default:
ptr
+=
MINBPC
;
ptr
+=
MINBPC
(
enc
)
;
break
;
break
;
}
}
pos
->
columnNumber
++
;
pos
->
columnNumber
++
;
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_impl.h
View file @
c1aa3d82
/*
/*
The contents of this file are subject to the Mozilla Public License
The contents of this file are subject to the Mozilla Public License
Version 1.
0
(the "License"); you may not use this file except in
Version 1.
1
(the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
http://www.mozilla.org/MPL/
...
@@ -12,10 +12,20 @@ under the License.
...
@@ -12,10 +12,20 @@ under the License.
The Original Code is expat.
The Original Code is expat.
The Initial Developer of the Original Code is James Clark.
The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
Portions created by James Clark are Copyright (C) 1998
, 1999
James Clark. All Rights Reserved.
James Clark. All Rights Reserved.
Contributor(s):
Contributor(s):
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License (the "GPL"), in which case the
provisions of the GPL are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of
the GPL and not to allow others to use your version of this file under
the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the
GPL. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the GPL.
*/
*/
enum
{
enum
{
...
@@ -42,6 +52,7 @@ enum {
...
@@ -42,6 +52,7 @@ enum {
BT_LSQB
,
BT_LSQB
,
BT_S
,
BT_S
,
BT_NMSTRT
,
BT_NMSTRT
,
BT_COLON
,
BT_HEX
,
BT_HEX
,
BT_DIGIT
,
BT_DIGIT
,
BT_NAME
,
BT_NAME
,
...
...
lib/python/Shared/DC/xml/pyexpat/expat/xmltok/xmltok_ns.c
0 → 100755
View file @
c1aa3d82
const
ENCODING
*
NS
(
XmlGetUtf8InternalEncoding
)()
{
return
&
ns
(
internal_utf8_encoding
).
enc
;
}
const
ENCODING
*
NS
(
XmlGetUtf16InternalEncoding
)()
{
#if XML_BYTE_ORDER == 12
return
&
ns
(
internal_little2_encoding
).
enc
;
#elif XML_BYTE_ORDER == 21
return
&
ns
(
internal_big2_encoding
).
enc
;
#else
const
short
n
=
1
;
return
*
(
const
char
*
)
&
n
?
&
ns
(
internal_little2_encoding
).
enc
:
&
ns
(
internal_big2_encoding
).
enc
;
#endif
}
static
const
ENCODING
*
NS
(
encodings
)[]
=
{
&
ns
(
latin1_encoding
).
enc
,
&
ns
(
ascii_encoding
).
enc
,
&
ns
(
utf8_encoding
).
enc
,
&
ns
(
big2_encoding
).
enc
,
&
ns
(
big2_encoding
).
enc
,
&
ns
(
little2_encoding
).
enc
,
&
ns
(
utf8_encoding
).
enc
/* NO_ENC */
};
static
int
NS
(
initScanProlog
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
nextTokPtr
)
{
return
initScan
(
NS
(
encodings
),
(
const
INIT_ENCODING
*
)
enc
,
XML_PROLOG_STATE
,
ptr
,
end
,
nextTokPtr
);
}
static
int
NS
(
initScanContent
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
nextTokPtr
)
{
return
initScan
(
NS
(
encodings
),
(
const
INIT_ENCODING
*
)
enc
,
XML_CONTENT_STATE
,
ptr
,
end
,
nextTokPtr
);
}
int
NS
(
XmlInitEncoding
)(
INIT_ENCODING
*
p
,
const
ENCODING
**
encPtr
,
const
char
*
name
)
{
int
i
=
getEncodingIndex
(
name
);
if
(
i
==
UNKNOWN_ENC
)
return
0
;
INIT_ENC_INDEX
(
p
)
=
(
char
)
i
;
p
->
initEnc
.
scanners
[
XML_PROLOG_STATE
]
=
NS
(
initScanProlog
);
p
->
initEnc
.
scanners
[
XML_CONTENT_STATE
]
=
NS
(
initScanContent
);
p
->
initEnc
.
updatePosition
=
initUpdatePosition
;
p
->
encPtr
=
encPtr
;
*
encPtr
=
&
(
p
->
initEnc
);
return
1
;
}
static
const
ENCODING
*
NS
(
findEncoding
)(
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
)
{
#define ENCODING_MAX 128
char
buf
[
ENCODING_MAX
];
char
*
p
=
buf
;
int
i
;
XmlUtf8Convert
(
enc
,
&
ptr
,
end
,
&
p
,
p
+
ENCODING_MAX
-
1
);
if
(
ptr
!=
end
)
return
0
;
*
p
=
0
;
if
(
streqci
(
buf
,
"UTF-16"
)
&&
enc
->
minBytesPerChar
==
2
)
return
enc
;
i
=
getEncodingIndex
(
buf
);
if
(
i
==
UNKNOWN_ENC
)
return
0
;
return
NS
(
encodings
)[
i
];
}
int
NS
(
XmlParseXmlDecl
)(
int
isGeneralTextEntity
,
const
ENCODING
*
enc
,
const
char
*
ptr
,
const
char
*
end
,
const
char
**
badPtr
,
const
char
**
versionPtr
,
const
char
**
encodingName
,
const
ENCODING
**
encoding
,
int
*
standalone
)
{
return
doParseXmlDecl
(
NS
(
findEncoding
),
isGeneralTextEntity
,
enc
,
ptr
,
end
,
badPtr
,
versionPtr
,
encodingName
,
encoding
,
standalone
);
}
lib/python/Shared/DC/xml/pyexpat/pyexpat.c
View file @
c1aa3d82
...
@@ -33,11 +33,6 @@ PERFORMANCE OF THIS SOFTWARE.
...
@@ -33,11 +33,6 @@ PERFORMANCE OF THIS SOFTWARE.
#include "xmlparse.h"
#include "xmlparse.h"
#include <setjmp.h>
#include <setjmp.h>
/*
** The version number should match the one in _checkversion
*/
#define VERSION "1.3"
static
PyObject
*
ErrorObject
;
static
PyObject
*
ErrorObject
;
/* ----------------------------------------------------- */
/* ----------------------------------------------------- */
...
@@ -51,6 +46,16 @@ typedef struct {
...
@@ -51,6 +46,16 @@ typedef struct {
PyObject
*
EndElementHandler
;
PyObject
*
EndElementHandler
;
PyObject
*
CharacterDataHandler
;
PyObject
*
CharacterDataHandler
;
PyObject
*
ProcessingInstructionHandler
;
PyObject
*
ProcessingInstructionHandler
;
PyObject
*
CommentHandler
;
PyObject
*
StartCdataSectionHandler
;
PyObject
*
EndCdataSectionHandler
;
PyObject
*
DefaultHandler
;
PyObject
*
UnparsedEntityDeclHandler
;
PyObject
*
NotationDeclHandler
;
PyObject
*
StartNamespaceDeclHandler
;
PyObject
*
EndNamespaceDeclHandler
;
PyObject
*
NotStandaloneHandler
;
int
attrdict
;
int
jmpbuf_valid
;
int
jmpbuf_valid
;
jmp_buf
jmpbuf
;
jmp_buf
jmpbuf
;
}
xmlparseobject
;
}
xmlparseobject
;
...
@@ -59,126 +64,333 @@ staticforward PyTypeObject Xmlparsetype;
...
@@ -59,126 +64,333 @@ staticforward PyTypeObject Xmlparsetype;
/* Callback routines */
/* Callback routines */
static
void
static
void
my_StartElementHandler
(
userdata
,
name
,
atts
)
my_StartElementHandler
(
void
*
userdata
,
const
char
*
name
,
const
char
**
atts
)
{
void
*
userdata
;
char
*
name
;
char
**
atts
;
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
args
;
PyObject
*
rv
;
PyObject
*
rv
;
PyObject
*
attrs_obj
;
PyObject
*
attrs_obj
;
int
attrs_len
;
int
attrs_len
;
c
har
**
attrs_p
;
c
onst
char
**
attrs_p
,
**
attrs_k
;
if
(
self
->
StartElementHandler
if
(
self
->
StartElementHandler
!=
Py_None
)
{
&&
self
->
StartElementHandler
!=
Py_None
)
{
if
(
self
->
attrdict
)
{
if
(
(
attrs_obj
=
PyDict_New
())
==
NULL
)
goto
err
;
for
(
attrs_len
=
0
,
attrs_p
=
atts
;
*
attrs_p
;
attrs_p
++
,
attrs_len
++
)
{
if
(
attrs_len
%
2
)
{
rv
=
PyString_FromString
(
*
attrs_p
);
if
(
!
rv
)
{
Py_DECREF
(
attrs_obj
);
goto
err
;
}
if
(
PyDict_SetItemString
(
attrs_obj
,
(
char
*
)
*
attrs_k
,
rv
)
<
0
)
{
Py_DECREF
(
attrs_obj
);
goto
err
;
}
Py_DECREF
(
rv
);
}
else
attrs_k
=
attrs_p
;
}
}
else
{
for
(
attrs_len
=
0
,
attrs_p
=
atts
;
for
(
attrs_len
=
0
,
attrs_p
=
atts
;
*
attrs_p
;
*
attrs_p
;
attrs_p
++
,
attrs_len
++
);
attrs_p
++
,
attrs_len
++
);
if
(
(
attrs_obj
=
PyList_New
(
attrs_len
))
==
NULL
)
if
(
(
attrs_obj
=
PyList_New
(
attrs_len
))
==
NULL
)
return
;
goto
err
;
for
(
attrs_len
=
0
,
attrs_p
=
atts
;
*
attrs_p
;
for
(
attrs_len
=
0
,
attrs_p
=
atts
;
*
attrs_p
;
attrs_p
++
,
attrs_len
++
)
{
attrs_p
++
,
attrs_len
++
)
{
PyList_SetItem
(
attrs_obj
,
attrs_len
,
rv
=
PyString_FromString
(
*
attrs_p
);
PyString_FromString
(
*
attrs_p
));
if
(
!
rv
)
{
Py_DECREF
(
attrs_obj
);
goto
err
;
}
PyList_SET_ITEM
(
attrs_obj
,
attrs_len
,
rv
);
}
}
}
args
=
Py_BuildValue
(
"(sO)"
,
name
,
attrs_obj
);
args
=
Py_BuildValue
(
"(sO)"
,
name
,
attrs_obj
);
Py_
X
DECREF
(
attrs_obj
);
Py_DECREF
(
attrs_obj
);
if
(
!
args
)
return
;
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
StartElementHandler
,
args
);
rv
=
PyEval_CallObject
(
self
->
StartElementHandler
,
args
);
Py_XDECREF
(
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
{
if
(
rv
==
NULL
)
goto
err
;
if
(
self
->
jmpbuf_valid
)
Py_DECREF
(
rv
);
longjmp
(
self
->
jmpbuf
,
1
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in StartElementHandler()
\n
"
);
PySys_WriteStderr
(
"Exception in StartElementHandler()
\n
"
);
PyErr_Clear
();
PyErr_Clear
();
}
Py_XDECREF
(
rv
);
}
}
}
static
void
static
void
my_EndElementHandler
(
userdata
,
name
)
my_EndElementHandler
(
void
*
userdata
,
const
char
*
name
)
{
void
*
userdata
;
char
*
name
;
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
args
;
PyObject
*
rv
;
PyObject
*
rv
;
if
(
self
->
EndElementHandler
if
(
self
->
EndElementHandler
!=
Py_None
)
{
&&
self
->
EndElementHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"(s)"
,
name
);
args
=
Py_BuildValue
(
"(s)"
,
name
);
if
(
!
args
)
return
;
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
EndElementHandler
,
args
);
rv
=
PyEval_CallObject
(
self
->
EndElementHandler
,
args
);
Py_XDECREF
(
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
{
if
(
rv
==
NULL
)
goto
err
;
if
(
self
->
jmpbuf_valid
)
Py_DECREF
(
rv
);
longjmp
(
self
->
jmpbuf
,
1
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in EndElementHandler()
\n
"
);
PySys_WriteStderr
(
"Exception in EndElementHandler()
\n
"
);
PyErr_Clear
();
PyErr_Clear
();
}
}
static
void
my_DefaultHandler
(
void
*
userdata
,
const
char
*
data
,
int
len
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
rv
;
if
(
self
->
DefaultHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"(s#)"
,
data
,
len
);
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
DefaultHandler
,
args
);
Py_XDECREF
(
args
);
if
(
rv
==
NULL
)
goto
err
;
Py_XDECREF
(
rv
);
Py_XDECREF
(
rv
);
}
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in DefaultHandler()
\n
"
);
PyErr_Clear
();
}
}
static
void
static
void
my_CharacterDataHandler
(
userdata
,
data
,
len
)
my_CharacterDataHandler
(
void
*
userdata
,
const
char
*
data
,
int
len
)
{
void
*
userdata
;
char
*
data
;
int
len
;
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
args
;
PyObject
*
rv
;
PyObject
*
rv
;
if
(
self
->
CharacterDataHandler
if
(
self
->
CharacterDataHandler
!=
Py_None
)
{
&&
self
->
CharacterDataHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"(s#)"
,
data
,
len
);
args
=
Py_BuildValue
(
"(s#)"
,
data
,
len
);
if
(
!
args
)
return
;
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
CharacterDataHandler
,
args
);
rv
=
PyEval_CallObject
(
self
->
CharacterDataHandler
,
args
);
Py_XDECREF
(
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
{
if
(
rv
==
NULL
)
goto
err
;
if
(
self
->
jmpbuf_valid
)
Py_DECREF
(
rv
);
longjmp
(
self
->
jmpbuf
,
1
);
}
else
my_DefaultHandler
(
userdata
,
data
,
len
);
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in CharacterDataHandler()
\n
"
);
PySys_WriteStderr
(
"Exception in CharacterDataHandler()
\n
"
);
PyErr_Clear
();
PyErr_Clear
();
}
Py_XDECREF
(
rv
);
}
}
}
static
void
static
void
my_ProcessingInstructionHandler
(
userdata
,
target
,
data
)
my_ProcessingInstructionHandler
(
void
*
userdata
,
void
*
userdata
;
const
char
*
target
,
const
char
*
data
)
{
char
*
target
;
char
*
data
;
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
args
;
PyObject
*
rv
;
PyObject
*
rv
;
if
(
self
->
ProcessingInstructionHandler
if
(
self
->
ProcessingInstructionHandler
!=
Py_None
)
{
&&
self
->
ProcessingInstructionHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"(ss)"
,
target
,
data
);
args
=
Py_BuildValue
(
"(ss)"
,
target
,
data
);
if
(
!
args
)
return
;
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
ProcessingInstructionHandler
,
rv
=
PyEval_CallObject
(
self
->
ProcessingInstructionHandler
,
args
);
args
);
Py_XDECREF
(
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
{
if
(
rv
==
NULL
)
goto
err
;
if
(
self
->
jmpbuf_valid
)
Py_DECREF
(
rv
);
longjmp
(
self
->
jmpbuf
,
1
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in ProcessingInstructionHandler()
\n
"
);
PySys_WriteStderr
(
"Exception in ProcessingInstructionHandler()
\n
"
);
PyErr_Clear
();
PyErr_Clear
();
}
static
void
my_CommentHandler
(
void
*
userdata
,
const
char
*
data
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
rv
;
if
(
self
->
CommentHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"(s)"
,
data
);
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
CommentHandler
,
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
goto
err
;
Py_DECREF
(
rv
);
}
}
Py_XDECREF
(
rv
);
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in CommentHandler()
\n
"
);
PyErr_Clear
();
}
static
void
my_StartCdataSectionHandler
(
void
*
userdata
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
rv
;
if
(
self
->
StartCdataSectionHandler
!=
Py_None
)
{
rv
=
PyEval_CallObject
(
self
->
StartCdataSectionHandler
,
NULL
);
if
(
rv
==
NULL
)
goto
err
;
Py_DECREF
(
rv
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in StartCdataSectionHandler()
\n
"
);
PyErr_Clear
();
}
static
void
my_EndCdataSectionHandler
(
void
*
userdata
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
rv
;
if
(
self
->
EndCdataSectionHandler
!=
Py_None
)
{
rv
=
PyEval_CallObject
(
self
->
EndCdataSectionHandler
,
NULL
);
if
(
rv
==
NULL
)
goto
err
;
Py_DECREF
(
rv
);
}
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in EndCdataSectionHandler()
\n
"
);
PyErr_Clear
();
}
}
static
void
my_UnparsedEntityDeclHandler
(
void
*
userdata
,
const
char
*
entityName
,
const
char
*
base
,
const
char
*
systemId
,
const
char
*
publicId
,
const
char
*
notationName
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
,
*
rv
=
0
;
if
(
self
->
UnparsedEntityDeclHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"sssss"
,
entityName
,
base
,
systemId
,
publicId
,
notationName
);
if
(
args
==
NULL
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
UnparsedEntityDeclHandler
,
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
goto
err
;
Py_DECREF
(
rv
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in UnparsedEntityDeclHandler()
\n
"
);
PyErr_Clear
();
}
static
void
my_NotationDeclHandler
(
void
*
userdata
,
const
char
*
notationName
,
const
char
*
base
,
const
char
*
systemId
,
const
char
*
publicId
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
,
*
rv
=
0
;
if
(
self
->
NotationDeclHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"ssss"
,
notationName
,
base
,
systemId
,
publicId
);
if
(
args
==
NULL
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
NotationDeclHandler
,
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
goto
err
;
Py_DECREF
(
rv
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in NotationDeclHandler()
\n
"
);
PyErr_Clear
();
}
static
void
my_StartNamespaceDeclHandler
(
void
*
userdata
,
const
char
*
prefix
,
const
char
*
uri
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
rv
;
if
(
self
->
StartNamespaceDeclHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"(ss)"
,
prefix
,
uri
);
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
StartNamespaceDeclHandler
,
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
goto
err
;
Py_DECREF
(
rv
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in StartNamespaceDeclHandler()
\n
"
);
PyErr_Clear
();
}
static
void
my_EndNamespaceDeclHandler
(
void
*
userdata
,
const
char
*
prefix
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
args
;
PyObject
*
rv
;
if
(
self
->
EndNamespaceDeclHandler
!=
Py_None
)
{
args
=
Py_BuildValue
(
"(s)"
,
prefix
);
if
(
!
args
)
goto
err
;
rv
=
PyEval_CallObject
(
self
->
EndNamespaceDeclHandler
,
args
);
Py_DECREF
(
args
);
if
(
rv
==
NULL
)
goto
err
;
Py_DECREF
(
rv
);
}
return
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in EndNamespaceDeclHandler()
\n
"
);
PyErr_Clear
();
}
static
int
my_NotStandaloneHandler
(
void
*
userdata
)
{
xmlparseobject
*
self
=
(
xmlparseobject
*
)
userdata
;
PyObject
*
rv
;
int
irv
;
if
(
self
->
NotStandaloneHandler
!=
Py_None
)
{
rv
=
PyEval_CallObject
(
self
->
StartCdataSectionHandler
,
NULL
);
if
(
rv
==
NULL
)
goto
err
;
irv
=
PyObject_IsTrue
(
rv
);
Py_DECREF
(
rv
);
return
irv
;
}
return
1
;
err:
if
(
self
->
jmpbuf_valid
)
longjmp
(
self
->
jmpbuf
,
1
);
PySys_WriteStderr
(
"Exception in NotStandaloneHandler()
\n
"
);
PyErr_Clear
();
return
0
;
}
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
...
@@ -187,10 +399,7 @@ static char xmlparse_Parse__doc__[] =
...
@@ -187,10 +399,7 @@ static char xmlparse_Parse__doc__[] =
;
;
static
PyObject
*
static
PyObject
*
xmlparse_Parse
(
self
,
args
)
xmlparse_Parse
(
xmlparseobject
*
self
,
PyObject
*
args
)
{
xmlparseobject
*
self
;
PyObject
*
args
;
{
char
*
s
;
char
*
s
;
int
slen
;
int
slen
;
int
isFinal
=
0
;
int
isFinal
=
0
;
...
@@ -220,47 +429,72 @@ static struct PyMethodDef xmlparse_methods[] = {
...
@@ -220,47 +429,72 @@ static struct PyMethodDef xmlparse_methods[] = {
static
xmlparseobject
*
static
xmlparseobject
*
newxmlparseobject
(
encoding
)
newxmlparseobject
(
char
*
encoding
,
char
*
namespace_separator
,
int
attrdict
)
{
char
*
encoding
;
{
xmlparseobject
*
self
;
xmlparseobject
*
self
;
self
=
PyObject_NEW
(
xmlparseobject
,
&
Xmlparsetype
);
self
=
PyObject_NEW
(
xmlparseobject
,
&
Xmlparsetype
);
if
(
self
==
NULL
)
if
(
self
==
NULL
)
return
NULL
;
return
NULL
;
self
->
StartElementHandler
=
Py_None
;
Py_INCREF
(
Py_None
);
#define INIT_HANDLER(N) self->N=Py_None; Py_INCREF(Py_None)
self
->
EndElementHandler
=
Py_None
;
INIT_HANDLER
(
StartElementHandler
);
Py_INCREF
(
Py_None
);
INIT_HANDLER
(
EndElementHandler
);
self
->
CharacterDataHandler
=
Py_None
;
INIT_HANDLER
(
CharacterDataHandler
);
Py_INCREF
(
Py_None
);
INIT_HANDLER
(
ProcessingInstructionHandler
);
self
->
ProcessingInstructionHandler
=
Py_None
;
INIT_HANDLER
(
CommentHandler
);
Py_INCREF
(
Py_None
);
INIT_HANDLER
(
StartCdataSectionHandler
);
INIT_HANDLER
(
EndCdataSectionHandler
);
INIT_HANDLER
(
DefaultHandler
);
INIT_HANDLER
(
UnparsedEntityDeclHandler
);
INIT_HANDLER
(
NotationDeclHandler
);
INIT_HANDLER
(
StartNamespaceDeclHandler
);
INIT_HANDLER
(
EndNamespaceDeclHandler
);
INIT_HANDLER
(
NotStandaloneHandler
);
#undef INIT_HANDLER
self
->
attrdict
=
attrdict
;
if
(
namespace_separator
)
{
if
((
self
->
itself
=
XML_ParserCreateNS
(
encoding
,
*
namespace_separator
))
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"XML_ParserCreateNS failed"
);
Py_DECREF
(
self
);
return
NULL
;
}
}
else
{
if
((
self
->
itself
=
XML_ParserCreate
(
encoding
))
==
NULL
)
{
if
((
self
->
itself
=
XML_ParserCreate
(
encoding
))
==
NULL
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"XML_ParserCreate failed"
);
PyErr_SetString
(
PyExc_RuntimeError
,
"XML_ParserCreate failed"
);
Py_DECREF
(
self
);
Py_DECREF
(
self
);
return
NULL
;
return
NULL
;
}
}
}
XML_SetUserData
(
self
->
itself
,
(
void
*
)
self
);
XML_SetUserData
(
self
->
itself
,
(
void
*
)
self
);
XML_SetElementHandler
(
self
->
itself
,
my_StartElementHandler
,
my_EndElementHandler
);
XML_SetCharacterDataHandler
(
self
->
itself
,
my_CharacterDataHandler
);
XML_SetProcessingInstructionHandler
(
self
->
itself
,
my_ProcessingInstructionHandler
);
return
self
;
return
self
;
}
}
static
void
static
void
xmlparse_dealloc
(
self
)
xmlparse_dealloc
(
xmlparseobject
*
self
)
{
xmlparseobject
*
self
;
Py_DECREF
(
self
->
StartElementHandler
);
{
Py_DECREF
(
self
->
EndElementHandler
);
Py_XDECREF
(
self
->
StartElementHandler
);
Py_DECREF
(
self
->
CharacterDataHandler
);
Py_XDECREF
(
self
->
EndElementHandler
);
Py_DECREF
(
self
->
ProcessingInstructionHandler
);
Py_XDECREF
(
self
->
CharacterDataHandler
);
Py_DECREF
(
self
->
CommentHandler
);
Py_XDECREF
(
self
->
ProcessingInstructionHandler
);
Py_DECREF
(
self
->
StartCdataSectionHandler
);
Py_DECREF
(
self
->
EndCdataSectionHandler
);
Py_DECREF
(
self
->
DefaultHandler
);
Py_DECREF
(
self
->
UnparsedEntityDeclHandler
);
Py_DECREF
(
self
->
NotationDeclHandler
);
Py_DECREF
(
self
->
StartNamespaceDeclHandler
);
Py_DECREF
(
self
->
EndNamespaceDeclHandler
);
Py_DECREF
(
self
->
NotStandaloneHandler
);
if
(
self
->
itself
)
if
(
self
->
itself
)
XML_ParserFree
(
self
->
itself
);
XML_ParserFree
(
self
->
itself
);
self
->
itself
=
NULL
;
self
->
itself
=
NULL
;
...
@@ -268,28 +502,28 @@ xmlparse_dealloc(self)
...
@@ -268,28 +502,28 @@ xmlparse_dealloc(self)
}
}
static
PyObject
*
static
PyObject
*
xmlparse_getattr
(
self
,
name
)
xmlparse_getattr
(
xmlparseobject
*
self
,
char
*
name
)
{
xmlparseobject
*
self
;
char
*
name
;
{
long
rv
;
long
rv
;
if
(
strcmp
(
name
,
"StartElementHandler"
)
==
0
)
{
#define GET_HANDLER(N) \
Py_INCREF
(
self
->
StartElementHandler
);
if (strcmp(name, #N) == 0) { \
return
self
->
StartElementHandler
;
Py_INCREF(self->N); \
}
return self->N; \
if
(
strcmp
(
name
,
"EndElementHandler"
)
==
0
)
{
Py_INCREF
(
self
->
EndElementHandler
);
return
self
->
EndElementHandler
;
}
if
(
strcmp
(
name
,
"CharacterDataHandler"
)
==
0
)
{
Py_INCREF
(
self
->
CharacterDataHandler
);
return
self
->
CharacterDataHandler
;
}
if
(
strcmp
(
name
,
"ProcessingInstructionHandler"
)
==
0
)
{
Py_INCREF
(
self
->
ProcessingInstructionHandler
);
return
self
->
ProcessingInstructionHandler
;
}
}
GET_HANDLER
(
StartElementHandler
);
GET_HANDLER
(
EndElementHandler
);
GET_HANDLER
(
CharacterDataHandler
);
GET_HANDLER
(
ProcessingInstructionHandler
);
GET_HANDLER
(
CommentHandler
);
GET_HANDLER
(
StartCdataSectionHandler
);
GET_HANDLER
(
EndCdataSectionHandler
);
GET_HANDLER
(
DefaultHandler
);
GET_HANDLER
(
UnparsedEntityDeclHandler
);
GET_HANDLER
(
NotationDeclHandler
);
GET_HANDLER
(
StartNamespaceDeclHandler
);
GET_HANDLER
(
EndNamespaceDeclHandler
);
GET_HANDLER
(
NotStandaloneHandler
);
#undef GET_HANDLER
if
(
strcmp
(
name
,
"ErrorCode"
)
==
0
)
if
(
strcmp
(
name
,
"ErrorCode"
)
==
0
)
return
Py_BuildValue
(
"l"
,
return
Py_BuildValue
(
"l"
,
...
@@ -304,52 +538,100 @@ xmlparse_getattr(self, name)
...
@@ -304,52 +538,100 @@ xmlparse_getattr(self, name)
return
Py_BuildValue
(
"l"
,
return
Py_BuildValue
(
"l"
,
XML_GetErrorByteIndex
(
self
->
itself
));
XML_GetErrorByteIndex
(
self
->
itself
));
if
(
strcmp
(
name
,
"__members__"
)
==
0
)
return
Py_BuildValue
(
"sssssssssssssssss"
,
"StartElementHandler"
,
"EndElementHandler"
,
"CharacterDataHandler"
,
"ProcessingInstructionHandler"
,
"CommentHandler"
,
"StartCdataSectionHandler"
,
"EndCdataSectionHandler"
,
"DefaultHandler"
,
"UnparsedEntityDeclHandler"
,
"NotationDeclHandler"
,
"StartNamespaceDeclHandler"
,
"EndNamespaceDeclHandler"
,
"NotStandaloneHandler"
,
"ErrorCode"
,
"ErrorLineNumber"
,
"ErrorColumnNumber"
,
"ErrorByteIndex"
);
return
Py_FindMethod
(
xmlparse_methods
,
(
PyObject
*
)
self
,
name
);
return
Py_FindMethod
(
xmlparse_methods
,
(
PyObject
*
)
self
,
name
);
}
}
static
int
static
int
xmlparse_setattr
(
self
,
name
,
v
)
xmlparse_setattr
(
xmlparseobject
*
self
,
char
*
name
,
PyObject
*
v
)
{
xmlparseobject
*
self
;
char
*
name
;
PyObject
*
v
;
{
/* Set attribute 'name' to value 'v'. v==NULL means delete */
/* Set attribute 'name' to value 'v'. v==NULL means delete */
if
(
v
==
NULL
)
{
if
(
v
==
NULL
)
v
=
Py_None
;
PyErr_SetString
(
PyExc_RuntimeError
,
"Cannot delete attribute"
);
return
-
1
;
#define XMLSETHANDLERS(N) XML_Set ## N(self->itself, \
}
my_Start ## N, my_End ## N)
if
(
strcmp
(
name
,
"StartElementHandler"
)
==
0
)
{
#define SET_HANDLER(N) Py_XDECREF(self->N); self->N = v; Py_INCREF(v);
Py_XDECREF
(
self
->
StartElementHandler
);
self
->
StartElementHandler
=
v
;
if
(
strncmp
(
name
,
"Start"
,
5
)
==
0
)
{
Py_INCREF
(
v
);
if
(
strcmp
(
name
+
5
,
"ElementHandler"
)
==
0
)
{
SET_HANDLER
(
StartElementHandler
);
XMLSETHANDLERS
(
ElementHandler
);
return
0
;
}
if
(
strcmp
(
name
+
5
,
"CDataSectionHandler"
)
==
0
)
{
SET_HANDLER
(
StartCdataSectionHandler
);
XMLSETHANDLERS
(
CdataSectionHandler
);
return
0
;
}
if
(
strcmp
(
name
+
5
,
"NamespaceDeclHandler"
)
==
0
)
{
SET_HANDLER
(
StartNamespaceDeclHandler
);
XMLSETHANDLERS
(
NamespaceDeclHandler
);
return
0
;
return
0
;
}
}
if
(
strcmp
(
name
,
"EndElementHandler"
)
==
0
)
{
}
Py_XDECREF
(
self
->
EndElementHandler
);
self
->
EndElementHandler
=
v
;
else
if
(
strncmp
(
name
,
"End"
,
3
)
==
0
)
{
Py_INCREF
(
v
);
if
(
strcmp
(
name
+
3
,
"ElementHandler"
)
==
0
)
{
SET_HANDLER
(
EndElementHandler
);
XMLSETHANDLERS
(
ElementHandler
);
return
0
;
return
0
;
}
}
if
(
strcmp
(
name
,
"CharacterDataHandler"
)
==
0
)
{
if
(
strcmp
(
name
+
3
,
"CDataSectionHandler"
)
==
0
)
{
Py_XDECREF
(
self
->
CharacterDataHandler
);
SET_HANDLER
(
EndCdataSectionHandler
);
self
->
CharacterDataHandler
=
v
;
XMLSETHANDLERS
(
CdataSectionHandler
);
Py_INCREF
(
v
);
return
0
;
return
0
;
}
}
if
(
strcmp
(
name
,
"ProcessingInstructionHandler"
)
==
0
)
{
if
(
strcmp
(
name
+
3
,
"NamespaceDeclHandler"
)
==
0
)
{
Py_XDECREF
(
self
->
ProcessingInstructionHandler
);
SET_HANDLER
(
EndNamespaceDeclHandler
);
self
->
ProcessingInstructionHandler
=
v
;
XMLSETHANDLERS
(
NamespaceDeclHandler
);
Py_INCREF
(
v
);
return
0
;
return
0
;
}
}
}
#undef SET_HANDLER
#undef XMLSETHANDLERS
else
{
#define SET_HANDLER(N) \
if (strcmp(name, #N) == 0) { \
Py_XDECREF(self->N); \
self->N = v; \
Py_INCREF(v); \
XML_Set ## N(self->itself, my_ ## N); \
return 0; \
}
SET_HANDLER
(
CharacterDataHandler
);
SET_HANDLER
(
ProcessingInstructionHandler
);
SET_HANDLER
(
CommentHandler
);
SET_HANDLER
(
DefaultHandler
);
SET_HANDLER
(
UnparsedEntityDeclHandler
);
SET_HANDLER
(
NotationDeclHandler
);
SET_HANDLER
(
NotStandaloneHandler
);
}
#undef SET_HANDLER
PyErr_SetString
(
PyExc_AttributeError
,
name
);
return
-
1
;
return
-
1
;
}
}
static
char
Xmlparsetype__doc__
[]
=
"XML parser"
;
static
PyTypeObject
Xmlparsetype
=
{
static
PyTypeObject
Xmlparsetype
=
{
PyObject_HEAD_INIT
(
NULL
)
PyObject_HEAD_INIT
(
NULL
)
0
,
/*ob_size*/
0
,
/*ob_size*/
...
@@ -372,7 +654,7 @@ static PyTypeObject Xmlparsetype = {
...
@@ -372,7 +654,7 @@ static PyTypeObject Xmlparsetype = {
/* Space for future expansion */
/* Space for future expansion */
0L
,
0L
,
0L
,
0L
,
0L
,
0L
,
0L
,
0L
,
Xmlparsetype__doc__
/* Documentation string */
"XML parser"
};
};
/* End of code for xmlparser objects */
/* End of code for xmlparser objects */
...
@@ -380,19 +662,24 @@ static PyTypeObject Xmlparsetype = {
...
@@ -380,19 +662,24 @@ static PyTypeObject Xmlparsetype = {
static
char
pyexpat_ParserCreate__doc__
[]
=
static
char
pyexpat_ParserCreate__doc__
[]
=
"([encoding]) - Return a new XML parser object"
"([encoding
, namespace_separator
]) - Return a new XML parser object"
;
;
static
PyObject
*
static
PyObject
*
pyexpat_ParserCreate
(
self
,
args
)
pyexpat_ParserCreate
(
PyObject
*
notused
,
PyObject
*
args
,
PyObject
*
kw
)
{
PyObject
*
self
;
/* Not used */
char
*
encoding
=
NULL
,
*
namespace_separator
=
NULL
;
PyObject
*
args
;
PyObject
*
attrdict
=
NULL
;
{
static
char
*
kwlist
[]
=
{
"encoding"
,
"namespace_separator"
,
char
*
encoding
=
NULL
;
"attrdict"
,
NULL
};
if
(
!
PyArg_ParseTuple
(
args
,
"|s"
,
&
encoding
))
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"|zsO"
,
kwlist
,
&
encoding
,
&
namespace_separator
,
&
attrdict
))
return
NULL
;
return
NULL
;
return
(
PyObject
*
)
newxmlparseobject
(
encoding
);
return
(
PyObject
*
)
newxmlparseobject
(
encoding
,
namespace_separator
,
attrdict
?
PyObject_IsTrue
(
attrdict
)
:
0
);
}
}
static
char
pyexpat_ErrorString__doc__
[]
=
static
char
pyexpat_ErrorString__doc__
[]
=
...
@@ -400,10 +687,7 @@ static char pyexpat_ErrorString__doc__[] =
...
@@ -400,10 +687,7 @@ static char pyexpat_ErrorString__doc__[] =
;
;
static
PyObject
*
static
PyObject
*
pyexpat_ErrorString
(
self
,
args
)
pyexpat_ErrorString
(
PyObject
*
notused
,
PyObject
*
args
)
{
PyObject
*
self
;
/* Not used */
PyObject
*
args
;
{
long
code
;
long
code
;
if
(
!
PyArg_ParseTuple
(
args
,
"l"
,
&
code
))
if
(
!
PyArg_ParseTuple
(
args
,
"l"
,
&
code
))
...
@@ -415,7 +699,7 @@ pyexpat_ErrorString(self, args)
...
@@ -415,7 +699,7 @@ pyexpat_ErrorString(self, args)
static
struct
PyMethodDef
pyexpat_methods
[]
=
{
static
struct
PyMethodDef
pyexpat_methods
[]
=
{
{
"ParserCreate"
,
(
PyCFunction
)
pyexpat_ParserCreate
,
{
"ParserCreate"
,
(
PyCFunction
)
pyexpat_ParserCreate
,
METH_VARARGS
,
pyexpat_ParserCreate__doc__
},
METH_VARARGS
|
METH_KEYWORDS
,
pyexpat_ParserCreate__doc__
},
{
"ErrorString"
,
(
PyCFunction
)
pyexpat_ErrorString
,
{
"ErrorString"
,
(
PyCFunction
)
pyexpat_ErrorString
,
METH_VARARGS
,
pyexpat_ErrorString__doc__
},
METH_VARARGS
,
pyexpat_ErrorString__doc__
},
...
@@ -430,24 +714,23 @@ static char pyexpat_module_documentation[] =
...
@@ -430,24 +714,23 @@ static char pyexpat_module_documentation[] =
;
;
void
void
initpyexpat
()
initpyexpat
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.6 $"
;
Xmlparsetype
.
ob_type
=
&
PyType_Type
;
Xmlparsetype
.
ob_type
=
&
PyType_Type
;
/* Create the module and add the functions */
m
=
Py_InitModule4
(
"pyexpat"
,
pyexpat_methods
,
m
=
Py_InitModule4
(
"pyexpat"
,
pyexpat_methods
,
pyexpat_module_documentation
,
pyexpat_module_documentation
,
(
PyObject
*
)
NULL
,
PYTHON_API_VERSION
);
(
PyObject
*
)
NULL
,
PYTHON_API_VERSION
);
/* Add some symbolic constants to the module */
d
=
PyModule_GetDict
(
m
);
d
=
PyModule_GetDict
(
m
);
ErrorObject
=
PyString_FromString
(
"pyexpat.error"
);
ErrorObject
=
PyString_FromString
(
"pyexpat.error"
);
PyDict_SetItemString
(
d
,
"error"
,
ErrorObject
);
PyDict_SetItemString
(
d
,
"error"
,
ErrorObject
);
/* XXXX Add constants here */
PyDict_SetItemString
(
d
,
"__version__"
,
PyDict_SetItemString
(
d
,
"version"
,
PyString_FromString
(
VERSION
));
PyString_FromStringAndSize
(
rev
+
11
,
strlen
(
rev
+
11
)
-
2
));
#define MYCONST(name) \
#define MYCONST(name) \
PyDict_SetItemString(d, #name, PyInt_FromLong(name))
PyDict_SetItemString(d, #name, PyInt_FromLong(name))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment