Compare commits
100
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9421dd11c1 | ||
|
|
2c255ba0e6 | ||
|
|
013d3f60a4 | ||
|
|
1341e9ae25 | ||
|
|
a62deef4c9 | ||
|
|
86646a28cb | ||
|
|
f3464902ca | ||
|
|
778021047d | ||
|
|
ddae06ab88 | ||
|
|
dfd331cf71 | ||
|
|
dcff7a87cc | ||
|
|
749df96d25 | ||
|
|
d784dbf4af | ||
|
|
45f2d35bfb | ||
|
|
9b3852311c | ||
|
|
aaa3b6e5bf | ||
|
|
3b0208f5d2 | ||
|
|
7e9f661f09 | ||
|
|
e873b03f16 | ||
|
|
4d724a92cf | ||
|
|
8fd4a83318 | ||
|
|
4e9aea4c1b | ||
|
|
3923164dc2 | ||
|
|
8011e61e57 | ||
|
|
a27a7609f6 | ||
|
|
3ec4a069df | ||
|
|
1b330a5078 | ||
|
|
95e916b7a7 | ||
|
|
92e910d8be | ||
|
|
2a9c1fbbcc | ||
|
|
b7d821935a | ||
|
|
55ec9989e5 | ||
|
|
3eac12050f | ||
|
|
195560985f | ||
|
|
0c6d9d601b | ||
|
|
5bff01f98f | ||
|
|
e2ea2c60e2 | ||
|
|
ab5acbf509 | ||
|
|
17c6938a36 | ||
|
|
f009a97514 | ||
|
|
132c80964e | ||
|
|
75ccce3db8 | ||
|
|
b1b875e78e | ||
|
|
99a358f0c0 | ||
|
|
4d08f13896 | ||
|
|
fdd1bd7fc9 | ||
|
|
5799228346 | ||
|
|
74ce84265d | ||
|
|
a5634c52ea | ||
|
|
39cfb55c81 | ||
|
|
4a9169214b | ||
|
|
3dc87550a7 | ||
|
|
7488411c11 | ||
|
|
e157ebf618 | ||
|
|
2b29d5ffe4 | ||
|
|
5c1ae4c2da | ||
|
|
ce57b5dc40 | ||
|
|
cbfa2aaece | ||
|
|
d6eeb473c4 | ||
|
|
6695c33ded | ||
|
|
0333ca86c4 | ||
|
|
56d5132566 | ||
|
|
d311382e80 | ||
|
|
51f81e81ad | ||
|
|
0f5256c936 | ||
|
|
4e58e42cf2 | ||
|
|
e5f05fd608 | ||
|
|
12a0ca511f | ||
|
|
f93c2e14fd | ||
|
|
3a6f59e946 | ||
|
|
4956ba5d3c | ||
|
|
19b7928723 | ||
|
|
973ad606fd | ||
|
|
a7cd413a1e | ||
|
|
7438be7870 | ||
|
|
d7a45119ea | ||
|
|
a5a004adf7 | ||
|
|
9e892f5642 | ||
|
|
78102b202d | ||
|
|
f9560ef835 | ||
|
|
31facc7d20 | ||
|
|
616e521daf | ||
|
|
be92e651ff | ||
|
|
82e73bbdb2 | ||
|
|
d4db56dd39 | ||
|
|
26bf97fad4 | ||
|
|
c2095e6b66 | ||
|
|
d2c1656f5f | ||
|
|
87d01c84d2 | ||
|
|
bfcc4836d0 | ||
|
|
90a5d98cdd | ||
|
|
e52f6237f6 | ||
|
|
5f9225a9f9 | ||
|
|
14196603ad | ||
|
|
7c0757fca2 | ||
|
|
9aad851790 | ||
|
|
04cd15b799 | ||
|
|
694bd5eee6 | ||
|
|
e1f854bf51 | ||
|
|
02b12ad251 |
Executable
+8
@@ -0,0 +1,8 @@
|
||||
bin
|
||||
dbgbin
|
||||
Debug
|
||||
expat.ncb
|
||||
expat.opt
|
||||
Release
|
||||
expat.zip
|
||||
lib
|
||||
@@ -1,420 +0,0 @@
|
||||
<TITLE>Mozilla Public License version 1.0</TITLE>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"
|
||||
LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
|
||||
|
||||
<P ALIGN=CENTER>
|
||||
<FONT SIZE="+2"><B>MOZILLA PUBLIC LICENSE</B></FONT><BR>
|
||||
<B>Version 1.0</B>
|
||||
</P>
|
||||
|
||||
<P><HR WIDTH="20%"><P>
|
||||
|
||||
<P><B>1. Definitions.</B>
|
||||
<UL>
|
||||
|
||||
<B>1.1. ``Contributor''</B> means each entity that creates or contributes
|
||||
to the creation of Modifications.
|
||||
|
||||
<P><B>1.2. ``Contributor Version''</B> means the combination of the
|
||||
Original Code, prior Modifications used by a Contributor, and the
|
||||
Modifications made by that particular Contributor.
|
||||
|
||||
<P><B>1.3. ``Covered Code''</B> means the Original Code or Modifications
|
||||
or the combination of the Original Code and Modifications, in each case
|
||||
including portions thereof<B>.</B>
|
||||
|
||||
<P><B>1.4. ``Electronic Distribution Mechanism''</B> means a mechanism
|
||||
generally accepted in the software development community for the
|
||||
electronic transfer of data.
|
||||
|
||||
<P><B>1.5. ``Executable''</B> means Covered Code in any form other than
|
||||
Source Code.
|
||||
|
||||
<P><B>1.6. ``Initial Developer''</B> means the individual or entity
|
||||
identified as the Initial Developer in the Source Code notice required by
|
||||
<B>Exhibit A</B>.
|
||||
|
||||
<P><B>1.7. ``Larger Work''</B> means a work which combines Covered Code
|
||||
or portions thereof with code not governed by the terms of this License.
|
||||
|
||||
<P><B>1.8. ``License''</B> means this document.
|
||||
|
||||
<P><B>1.9. ``Modifications''</B> means any addition to or deletion from
|
||||
the substance or structure of either the Original Code or any previous
|
||||
Modifications. When Covered Code is released as a series of files, a
|
||||
Modification is:
|
||||
|
||||
<UL>
|
||||
|
||||
<P><B>A.</B> Any addition to or deletion from the contents of a file
|
||||
containing Original Code or previous Modifications.
|
||||
|
||||
<P><B>B.</B> Any new file that contains any part of the Original
|
||||
Code or previous Modifications.
|
||||
|
||||
</UL>
|
||||
|
||||
<P><B>1.10. ``Original Code''</B> means Source Code of computer software
|
||||
code which is described in the Source Code notice required by <B>Exhibit
|
||||
A</B> as Original Code, and which, at the time of its release under this
|
||||
License is not already Covered Code governed by this License.
|
||||
|
||||
<P><B>1.11. ``Source Code''</B> means the preferred form of the Covered
|
||||
Code for making modifications to it, including all modules it contains,
|
||||
plus any associated interface definition files, scripts used to control
|
||||
compilation and installation of an Executable, or a list of source code
|
||||
differential comparisons against either the Original Code or another well
|
||||
known, available Covered Code of the Contributor's choice. The Source
|
||||
Code can be in a compressed or archival form, provided the appropriate
|
||||
decompression or de-archiving software is widely available for no charge.
|
||||
|
||||
<P><B>1.12. ``You''</B> means an individual or a legal entity exercising
|
||||
rights under, and complying with all of the terms of, this License or a
|
||||
future version of this License issued under Section 6.1. For legal
|
||||
entities, ``You'' includes any entity which controls, is controlled by,
|
||||
or is under common control with You. For purposes of this definition,
|
||||
``control'' means (a) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or otherwise,
|
||||
or (b) ownership of fifty percent (50%) or more of the outstanding shares
|
||||
or beneficial ownership of such entity.
|
||||
|
||||
</UL>
|
||||
<B>2. Source Code License.</B>
|
||||
<UL>
|
||||
|
||||
<B>2.1. The Initial Developer Grant.</B>
|
||||
|
||||
<BR>The Initial Developer hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license, subject to third party intellectual property
|
||||
claims:
|
||||
|
||||
<UL>
|
||||
|
||||
<P><B>(a)</B> to use, reproduce, modify, display, perform, sublicense
|
||||
and distribute the Original Code (or portions thereof) with or
|
||||
without Modifications, or as part of a Larger Work; and
|
||||
|
||||
<P><B>(b)</B> under patents now or hereafter owned or controlled by
|
||||
Initial Developer, to make, have made, use and sell (``Utilize'') the
|
||||
Original Code (or portions thereof), but solely to the extent that
|
||||
any such patent is reasonably necessary to enable You to Utilize the
|
||||
Original Code (or portions thereof) and not to any greater extent
|
||||
that may be necessary to Utilize further Modifications or
|
||||
combinations.
|
||||
</UL>
|
||||
|
||||
<P><B>2.2. Contributor Grant.</B>
|
||||
|
||||
<BR>Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license, subject to third party intellectual property
|
||||
claims:
|
||||
|
||||
<UL>
|
||||
|
||||
<P><B>(a)</B> to use, reproduce, modify, display, perform, sublicense and
|
||||
distribute the Modifications created by such Contributor (or portions
|
||||
thereof) either on an unmodified basis, with other Modifications, as
|
||||
Covered Code or as part of a Larger Work; and
|
||||
|
||||
<P><B>(b)</B> under patents now or hereafter owned or controlled by
|
||||
Contributor, to Utilize the Contributor Version (or portions thereof),
|
||||
but solely to the extent that any such patent is reasonably necessary to
|
||||
enable You to Utilize the Contributor Version (or portions thereof), and
|
||||
not to any greater extent that may be necessary to Utilize further
|
||||
Modifications or combinations.
|
||||
|
||||
</UL>
|
||||
|
||||
</UL>
|
||||
<B>3. Distribution Obligations.</B>
|
||||
<UL>
|
||||
|
||||
<B>3.1. Application of License.</B>
|
||||
|
||||
<BR>The Modifications which You create or to which You contribute are
|
||||
governed by the terms of this License, including without limitation
|
||||
Section <B>2.2</B>. The Source Code version of Covered Code may be
|
||||
distributed only under the terms of this License or a future version of
|
||||
this License released under Section <B>6.1</B>, and You must include a
|
||||
copy of this License with every copy of the Source Code You
|
||||
distribute. You may not offer or impose any terms on any Source Code
|
||||
version that alters or restricts the applicable version of this License
|
||||
or the recipients' rights hereunder. However, You may include an
|
||||
additional document offering the additional rights described in Section
|
||||
<B>3.5</B>.
|
||||
|
||||
<P><B>3.2. Availability of Source Code.</B>
|
||||
|
||||
<BR>Any Modification which You create or to which You contribute must be
|
||||
made available in Source Code form under the terms of this License either
|
||||
on the same media as an Executable version or via an accepted Electronic
|
||||
Distribution Mechanism to anyone to whom you made an Executable version
|
||||
available; and if made available via Electronic Distribution Mechanism,
|
||||
must remain available for at least twelve (12) months after the date it
|
||||
initially became available, or at least six (6) months after a subsequent
|
||||
version of that particular Modification has been made available to such
|
||||
recipients. You are responsible for ensuring that the Source Code version
|
||||
remains available even if the Electronic Distribution Mechanism is
|
||||
maintained by a third party.
|
||||
|
||||
<P><B>3.3. Description of Modifications.</B>
|
||||
|
||||
<BR>You must cause all Covered Code to which you contribute to contain a
|
||||
file documenting the changes You made to create that Covered Code and the
|
||||
date of any change. You must include a prominent statement that the
|
||||
Modification is derived, directly or indirectly, from Original Code
|
||||
provided by the Initial Developer and including the name of the Initial
|
||||
Developer in (a) the Source Code, and (b) in any notice in an Executable
|
||||
version or related documentation in which You describe the origin or
|
||||
ownership of the Covered Code.
|
||||
|
||||
<P><B>3.4. Intellectual Property Matters</B>
|
||||
<UL>
|
||||
|
||||
<P><B>(a) Third Party Claims</B>.
|
||||
|
||||
<BR>If You have knowledge that a party claims an intellectual
|
||||
property right in particular functionality or code (or its
|
||||
utilization under this License), you must include a text file with
|
||||
the source code distribution titled ``LEGAL'' which describes the
|
||||
claim and the party making the claim in sufficient detail that a
|
||||
recipient will know whom to contact. If you obtain such knowledge
|
||||
after You make Your Modification available as described in Section
|
||||
<B>3.2</B>, You shall promptly modify the LEGAL file in all copies
|
||||
You make available thereafter and shall take other steps (such as
|
||||
notifying appropriate mailing lists or newsgroups) reasonably
|
||||
calculated to inform those who received the Covered Code that new
|
||||
knowledge has been obtained.
|
||||
|
||||
<P><B>(b) Contributor APIs</B>.
|
||||
|
||||
<BR>If Your Modification is an application programming interface and
|
||||
You own or control patents which are reasonably necessary to
|
||||
implement that API, you must also include this information in the
|
||||
LEGAL file.
|
||||
|
||||
</UL>
|
||||
|
||||
<P><B>3.5. Required Notices.</B>
|
||||
|
||||
<BR>You must duplicate the notice in <B>Exhibit A</B> in each file of the
|
||||
Source Code, and this License in any documentation for the Source Code,
|
||||
where You describe recipients' rights relating to Covered Code. If You
|
||||
created one or more Modification(s), You may add your name as a
|
||||
Contributor to the notice described in <B>Exhibit A</B>. If it is not
|
||||
possible to put such notice in a particular Source Code file due to its
|
||||
structure, then you must include such notice in a location (such as a
|
||||
relevant directory file) where a user would be likely to look for such a
|
||||
notice. You may choose to offer, and to charge a fee for, warranty,
|
||||
support, indemnity or liability obligations to one or more recipients of
|
||||
Covered Code. However, You may do so only on Your own behalf, and not on
|
||||
behalf of the Initial Developer or any Contributor. You must make it
|
||||
absolutely clear than any such warranty, support, indemnity or liability
|
||||
obligation is offered by You alone, and You hereby agree to indemnify the
|
||||
Initial Developer and every Contributor for any liability incurred by the
|
||||
Initial Developer or such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer.
|
||||
|
||||
<P><B>3.6. Distribution of Executable Versions.</B>
|
||||
|
||||
<BR>You may distribute Covered Code in Executable form only if the
|
||||
requirements of Section <B>3.1-3.5</B> have been met for that Covered
|
||||
Code, and if You include a notice stating that the Source Code version of
|
||||
the Covered Code is available under the terms of this License, including
|
||||
a description of how and where You have fulfilled the obligations of
|
||||
Section <B>3.2</B>. The notice must be conspicuously included in any
|
||||
notice in an Executable version, related documentation or collateral in
|
||||
which You describe recipients' rights relating to the Covered Code. You
|
||||
may distribute the Executable version of Covered Code under a license of
|
||||
Your choice, which may contain terms different from this License,
|
||||
provided that You are in compliance with the terms of this License and
|
||||
that the license for the Executable version does not attempt to limit or
|
||||
alter the recipient's rights in the Source Code version from the rights
|
||||
set forth in this License. If You distribute the Executable version under
|
||||
a different license You must make it absolutely clear that any terms
|
||||
which differ from this License are offered by You alone, not by the
|
||||
Initial Developer or any Contributor. You hereby agree to indemnify the
|
||||
Initial Developer and every Contributor for any liability incurred by the
|
||||
Initial Developer or such Contributor as a result of any such terms You
|
||||
offer.
|
||||
|
||||
<P><B>3.7. Larger Works.</B>
|
||||
|
||||
<BR>You may create a Larger Work by combining Covered Code with other
|
||||
code not governed by the terms of this License and distribute the Larger
|
||||
Work as a single product. In such a case, You must make sure the
|
||||
requirements of this License are fulfilled for the Covered Code.
|
||||
|
||||
</UL>
|
||||
<B>4. Inability to Comply Due to Statute or Regulation.</B>
|
||||
<UL>
|
||||
|
||||
<P>If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Code due to statute or
|
||||
regulation then You must: (a) comply with the terms of this License to
|
||||
the maximum extent possible; and (b) describe the limitations and the
|
||||
code they affect. Such description must be included in the LEGAL file
|
||||
described in Section <B>3.4</B> and must be included with all
|
||||
distributions of the Source Code. Except to the extent prohibited by
|
||||
statute or regulation, such description must be sufficiently detailed for
|
||||
a recipient of ordinary skill
|
||||
to be able to understand it.
|
||||
|
||||
</UL>
|
||||
<B>5. Application of this License.</B>
|
||||
<UL>
|
||||
|
||||
This License applies to code to which the Initial Developer has attached
|
||||
the notice in <B>Exhibit A</B>, and to related Covered Code.
|
||||
|
||||
</UL>
|
||||
<B>6. Versions of the License.</B>
|
||||
<UL>
|
||||
|
||||
<B>6.1. New Versions</B>.
|
||||
|
||||
<BR>Netscape Communications Corporation (``Netscape'') may publish
|
||||
revised and/or new versions of the License from time to time. Each
|
||||
version will be given a distinguishing version number.
|
||||
|
||||
<P><B>6.2. Effect of New Versions</B>.
|
||||
|
||||
<BR>Once Covered Code has been published under a particular version of
|
||||
the License, You may always continue to use it under the terms of that
|
||||
version. You may also choose to use such Covered Code under the terms of
|
||||
any subsequent version of the License published by Netscape. No one other
|
||||
than Netscape has the right to modify the terms applicable to Covered
|
||||
Code created under this License.
|
||||
|
||||
<P><B>6.3. Derivative Works</B>.
|
||||
|
||||
<BR>If you create or use a modified version of this License (which you
|
||||
may only do in order to apply it to code which is not already Covered
|
||||
Code governed by this License), you must (a) rename Your license so that
|
||||
the phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL''
|
||||
or any confusingly similar phrase do not appear anywhere in your license
|
||||
and (b) otherwise make it clear that your version of the license contains
|
||||
terms which differ from the Mozilla Public License and Netscape Public
|
||||
License. (Filling in the name of the Initial Developer, Original Code or
|
||||
Contributor in the notice described in <B>Exhibit A</B> shall not of
|
||||
themselves be deemed to be modifications of this License.)
|
||||
|
||||
</UL>
|
||||
<B>7. DISCLAIMER OF WARRANTY.</B>
|
||||
<UL>
|
||||
|
||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
|
||||
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS,
|
||||
MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE
|
||||
RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH
|
||||
YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
|
||||
INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY
|
||||
NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY
|
||||
CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE
|
||||
IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
</UL>
|
||||
<B>8. TERMINATION.</B>
|
||||
<UL>
|
||||
|
||||
This License and the rights granted hereunder will terminate
|
||||
automatically if You fail to comply with terms herein and fail to cure
|
||||
such breach within 30 days of becoming aware of the breach. All
|
||||
sublicenses to the Covered Code which are properly granted shall survive
|
||||
any termination of this License. Provisions which, by their nature, must
|
||||
remain in effect beyond the termination of this License shall survive.
|
||||
|
||||
</UL>
|
||||
<B>9. LIMITATION OF LIABILITY.</B>
|
||||
<UL>
|
||||
|
||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
|
||||
NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY
|
||||
OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF
|
||||
ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
|
||||
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER
|
||||
INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
|
||||
STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
|
||||
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL
|
||||
NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH
|
||||
PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH
|
||||
LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION
|
||||
OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION
|
||||
MAY NOT APPLY TO YOU.
|
||||
|
||||
</UL>
|
||||
<B>10. U.S. GOVERNMENT END USERS.</B>
|
||||
<UL>
|
||||
|
||||
The Covered Code is a ``commercial item,'' as that term is defined in 48
|
||||
C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer software''
|
||||
and ``commercial computer software documentation,'' as such terms are
|
||||
used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212
|
||||
and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all
|
||||
U.S. Government End Users acquire Covered Code with only those rights set
|
||||
forth herein.
|
||||
|
||||
</UL>
|
||||
<B>11. MISCELLANEOUS.</B>
|
||||
<UL>
|
||||
|
||||
This License represents the complete agreement concerning subject matter
|
||||
hereof. If any provision of this License is held to be unenforceable,
|
||||
such provision shall be reformed only to the extent necessary to make it
|
||||
enforceable. This License shall be governed by California law provisions
|
||||
(except to the extent applicable law, if any, provides otherwise),
|
||||
excluding its conflict-of-law provisions. With respect to disputes in
|
||||
which at least one party is a citizen of, or an entity chartered or
|
||||
registered to do business in, the United States of America: (a) unless
|
||||
otherwise agreed in writing, all disputes relating to this License
|
||||
(excepting any dispute relating to intellectual property rights) shall be
|
||||
subject to final and binding arbitration, with the losing party paying
|
||||
all costs of arbitration; (b) any arbitration relating to this Agreement
|
||||
shall be held in Santa Clara County, California, under the auspices of
|
||||
JAMS/EndDispute; and (c) any litigation relating to this Agreement shall
|
||||
be subject to the jurisdiction of the Federal Courts of the Northern
|
||||
District of California, with venue lying in Santa Clara County,
|
||||
California, with the losing party responsible for costs, including
|
||||
without limitation, court costs and reasonable attorneys fees and
|
||||
expenses. The application of the United Nations Convention on Contracts
|
||||
for the International Sale of Goods is expressly excluded. Any law or
|
||||
regulation which provides that the language of a contract shall be
|
||||
construed against the drafter shall not apply to this License.
|
||||
|
||||
</UL>
|
||||
<B>12. RESPONSIBILITY FOR CLAIMS.</B>
|
||||
<UL>
|
||||
|
||||
Except in cases where another Contributor has failed to comply with
|
||||
Section <B>3.4</B>, You are responsible for damages arising, directly or
|
||||
indirectly, out of Your utilization of rights under this License, based
|
||||
on the number of copies of Covered Code you made available, the revenues
|
||||
you received from utilizing such rights, and other relevant factors. You
|
||||
agree to work with affected parties to distribute responsibility on an
|
||||
equitable basis.
|
||||
|
||||
</UL>
|
||||
<B>EXHIBIT A.</B>
|
||||
<UL>
|
||||
|
||||
``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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
<P>Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations under
|
||||
the License.
|
||||
|
||||
<P>The Original Code is ______________________________________.
|
||||
|
||||
<P>The Initial Developer of the Original Code is
|
||||
________________________. Portions created by ______________________ are
|
||||
Copyright (C) ______ _______________________. All Rights Reserved.
|
||||
|
||||
<P>Contributor(s): ______________________________________.''
|
||||
|
||||
</UL>
|
||||
+19
-12
@@ -1,30 +1,37 @@
|
||||
CC=gcc
|
||||
# If you know what your system's byte order is, define BYTE_ORDER:
|
||||
# use -DBYTE_ORDER=12 for little-endian byte order;
|
||||
# use -DBYTE_ORDER=21 for big-endian (network) byte order.
|
||||
# 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
|
||||
# -DXML_DTD adds full support for parsing DTDs
|
||||
CFLAGS=-Wall -O2 -Ixmltok -Ixmlparse -DXML_NS -DXML_DTD
|
||||
AR=ar
|
||||
# Use one of the next two lines; unixfilemap is better if it works.
|
||||
FILEMAP_OBJ=xmlwf/unixfilemap.o
|
||||
#FILEMAP_OBJ=xmlwf/readfilemap.o
|
||||
OBJS=xmltok/xmltok.o \
|
||||
LIBOBJS=xmltok/xmltok.o \
|
||||
xmltok/xmlrole.o \
|
||||
xmlwf/xmlwf.o \
|
||||
xmlparse/xmlparse.o
|
||||
|
||||
OBJS=xmlwf/xmlwf.o \
|
||||
xmlwf/xmlfile.o \
|
||||
xmlwf/codepage.o \
|
||||
xmlparse/xmlparse.o \
|
||||
xmlparse/hashtable.o \
|
||||
$(FILEMAP_OBJ)
|
||||
LIB=xmlparse/libexpat.a
|
||||
EXE=
|
||||
XMLWF=xmlwf/xmlwf$(EXE)
|
||||
|
||||
all: xmlwf/xmlwf$(EXE)
|
||||
all: $(XMLWF)
|
||||
|
||||
xmlwf/xmlwf$(EXE): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS)
|
||||
$(XMLWF): $(OBJS) $(LIB)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIB)
|
||||
|
||||
$(LIB): $(LIBOBJS)
|
||||
$(AR) rc $(LIB) $(LIBOBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) xmlwf/xmlwf$(EXE)
|
||||
rm -f $(OBJS) $(LIBOBJS) $(LIB) $(XMLWF)
|
||||
|
||||
xmltok/nametab.h: gennmtab/gennmtab$(EXE)
|
||||
rm -f $@
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,46 +0,0 @@
|
||||
/* This is simple demonstration of how to use expat. This program
|
||||
reads an XML document from standard input and writes a line with the
|
||||
name of each element to standard output indenting child elements by
|
||||
one tab stop more than their parent element. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "xmlparse.h"
|
||||
|
||||
void startElement(void *userData, const char *name, const char **atts)
|
||||
{
|
||||
int i;
|
||||
int *depthPtr = userData;
|
||||
for (i = 0; i < *depthPtr; i++)
|
||||
putchar('\t');
|
||||
puts(name);
|
||||
*depthPtr += 1;
|
||||
}
|
||||
|
||||
void endElement(void *userData, const char *name)
|
||||
{
|
||||
int *depthPtr = userData;
|
||||
*depthPtr -= 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
int done;
|
||||
int depth = 0;
|
||||
XML_SetUserData(parser, &depth);
|
||||
XML_SetElementHandler(parser, startElement, endElement);
|
||||
do {
|
||||
size_t len = fread(buf, 1, sizeof(buf), stdin);
|
||||
done = len < sizeof(buf);
|
||||
if (!XML_Parse(parser, buf, len, done)) {
|
||||
fprintf(stderr,
|
||||
"%s at line %d\n",
|
||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||
XML_GetCurrentLineNumber(parser));
|
||||
return 1;
|
||||
}
|
||||
} while (!done);
|
||||
XML_ParserFree(parser);
|
||||
return 0;
|
||||
}
|
||||
+7
-4
@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "gennmtab"=".\gennmtab\gennmtab.dsp" - Package Owner=<4>
|
||||
Project: "gennmtab"=.\gennmtab\gennmtab.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
@@ -15,7 +15,7 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "xmlparse"=".\xmlparse\xmlparse.dsp" - Package Owner=<4>
|
||||
Project: "xmlparse"=.\xmlparse\xmlparse.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
@@ -30,7 +30,7 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "xmltok"=".\xmltok\xmltok.dsp" - Package Owner=<4>
|
||||
Project: "xmltok"=.\xmltok\xmltok.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
@@ -38,11 +38,14 @@ Package=<5>
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name gennmtab
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "xmlwf"=".\xmlwf\xmlwf.dsp" - Package Owner=<4>
|
||||
Project: "xmlwf"=.\xmlwf\xmlwf.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
|
||||
+27
-10
@@ -9,20 +9,27 @@
|
||||
|
||||
<H1>expat - XML Parser Toolkit</H1>
|
||||
|
||||
<H3>Version 19990109</H3>
|
||||
<H3>Version 20000512</H3>
|
||||
|
||||
<P>Copyright (c) 1998, 1999 James Clark. Expat is subject to the <A
|
||||
HREF="MPL-1_0.html">Mozilla Public License Version 1.0</A>. You may
|
||||
as a special exception <A href="gplelect.html">elect to use the GNU
|
||||
General Public License</A>. Please contact me if you wish to
|
||||
negotiate an alternative license.</P>
|
||||
<P>Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center
|
||||
Ltd. Expat is freely available with source under a very liberal <a
|
||||
href="copying.txt">license</a> (the MIT license).</P>
|
||||
|
||||
<P>This is a test version of expat which adds support for parsing
|
||||
external DTDs and parameter entities. Compiling with -DXML_DTD
|
||||
enables this support. There's a new <CODE>-p</CODE> option for xmlwf
|
||||
which will cause it to process external DTDs and parameter entities;
|
||||
this implies the <CODE>-x</CODE> option. See the comment above
|
||||
<CODE>XML_SetParamEntityParsing</CODE> in <CODE>xmlparse.h</CODE> for
|
||||
the API addition that enables this.</P>
|
||||
|
||||
<P>Expat is an <A
|
||||
HREF="http://www.w3.org/TR/1998/REC-xml-19980210">XML 1.0</A> parser
|
||||
written in C. It aims to be fully conforming. It is currently not a
|
||||
validating XML processor. The current production version of expat can
|
||||
be downloaded from <A href = "ftp://ftp.jclark.com/pub/xml/expat.zip"
|
||||
>ftp://ftp.jclark.com/pub/xml/expat.zip</A>.</P>
|
||||
be downloaded from <A href =
|
||||
"http://www.ThaiOpenSource.com/dist/expat/expat.zip"
|
||||
>http://www.ThaiOpenSource.com/dist/expat/expat.zip</A>.</P>
|
||||
|
||||
<P>The directory <SAMP>xmltok</SAMP> contains a low-level library for
|
||||
tokenizing XML. The interface is documented in
|
||||
@@ -45,16 +52,26 @@ href="http://www.jclark.com/xml/canonxml.html">canonical XML</A> will
|
||||
be written to <SAMP>dir/<VAR>f</VAR></SAMP>, where
|
||||
<SAMP><VAR>f</VAR></SAMP> is the filename (without any path) of the
|
||||
input file. A <CODE>-x</CODE> option will cause references to
|
||||
external general entities to be processed.</P>
|
||||
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.ThaiOpenSource.com/product/expat/expatfaq.html">expat
|
||||
FAQ</A>.</P>
|
||||
|
||||
<P></P>
|
||||
|
||||
<ADDRESS>
|
||||
|
||||
<A HREF="mailto:jjc@jclark.com">James Clark</A>
|
||||
<A HREF="mailto:jjc@ThaiOpenSource.com">James Clark</A>
|
||||
|
||||
</ADDRESS>
|
||||
|
||||
|
||||
-1071
File diff suppressed because it is too large
Load Diff
@@ -1,54 +0,0 @@
|
||||
--MKS Project--
|
||||
$Revision: 1.17 $
|
||||
block _mks_variant_projects
|
||||
1.11=vp0000.pj, "V1_0maintain"
|
||||
end
|
||||
EndOptions
|
||||
$(projectdir)/MPL-1_0.html a 1.1
|
||||
$(projectdir)/Makefile a 1.10
|
||||
$(projectdir)/expat.dsw a 1.1
|
||||
$(projectdir)/expat.html a 1.14
|
||||
$(projectdir)/expat.mak a 1.14
|
||||
$(projectdir)/expatfaq.html a 1.1
|
||||
$(projectdir)/files.txt a 1.8
|
||||
$(projectdir)/gplelect.html a 1.1
|
||||
$(projectdir)/makedist.ksh a 1.2
|
||||
$(projectdir)/win32files.txt a 1.1
|
||||
$(projectdir)/gennmtab/gennmtab.c a 1.2
|
||||
$(projectdir)/gennmtab/gennmtab.dsp a 1.1
|
||||
$(projectdir)/sample/build.bat a 1.2
|
||||
$(projectdir)/sample/elements.c a 1.1
|
||||
$(projectdir)/xmlparse/hashtable.c a 1.8
|
||||
$(projectdir)/xmlparse/hashtable.h a 1.4
|
||||
$(projectdir)/xmlparse/xmlparse.c a 1.73
|
||||
$(projectdir)/xmlparse/xmlparse.dsp a 1.5
|
||||
$(projectdir)/xmlparse/xmlparse.h a 1.30
|
||||
$(projectdir)/xmltok/asciitab.h a 1.5
|
||||
$(projectdir)/xmltok/dllmain.c a 1.3
|
||||
$(projectdir)/xmltok/iasciitab.h a 1.3
|
||||
$(projectdir)/xmltok/latin1tab.h a 1.2
|
||||
$(projectdir)/xmltok/utf8tab.h a 1.4
|
||||
$(projectdir)/xmltok/xmldef.h a 1.7
|
||||
$(projectdir)/xmltok/xmlrole.c a 1.10
|
||||
$(projectdir)/xmltok/xmlrole.h a 1.5
|
||||
$(projectdir)/xmltok/xmltok.c a 1.44
|
||||
$(projectdir)/xmltok/xmltok.dsp a 1.4
|
||||
$(projectdir)/xmltok/xmltok.h a 1.25
|
||||
$(projectdir)/xmltok/xmltok_impl.c a 1.33
|
||||
$(projectdir)/xmltok/xmltok_impl.h a 1.6
|
||||
$(projectdir)/xmltok/xmltok_ns.c a 1.3
|
||||
$(projectdir)/xmlwf/codepage.c a 1.5
|
||||
$(projectdir)/xmlwf/codepage.h a 1.3
|
||||
$(projectdir)/xmlwf/filemap.h a 1.3
|
||||
$(projectdir)/xmlwf/readfilemap.c a 1.3
|
||||
$(projectdir)/xmlwf/unixfilemap.c a 1.2
|
||||
$(projectdir)/xmlwf/win32filemap.c a 1.6
|
||||
$(projectdir)/xmlwf/xmlfile.c a 1.2
|
||||
$(projectdir)/xmlwf/xmlfile.h a 1.1
|
||||
$(projectdir)/xmlwf/xmlmime.c a 1.1
|
||||
$(projectdir)/xmlwf/xmlmime.h a 1.1
|
||||
$(projectdir)/xmlwf/xmltchar.h a 1.1
|
||||
$(projectdir)/xmlwf/xmlurl.h a 1.1
|
||||
$(projectdir)/xmlwf/xmlwf.c a 1.38
|
||||
$(projectdir)/xmlwf/xmlwf.dsp a 1.2
|
||||
$(projectdir)/xmlwf/xmlwin32url.cxx a 1.1
|
||||
+23
-24
@@ -12,18 +12,19 @@
|
||||
<H4>Where can I get the latest version of expat?</H4>
|
||||
|
||||
<p>The latest production version is always available from <a
|
||||
href="ftp://ftp.jclark.com/pub/xml/expat.zip"
|
||||
>ftp://ftp.jclark.com/pub/xml/expat.zip</a>. The latest test version
|
||||
is always available from <a
|
||||
href="ftp://ftp.jclark.com/pub/test/expat.zip"
|
||||
>ftp://ftp.jclark.com/pub/test/expat.zip</a>.</p>
|
||||
href="http://www.ThaiOpenSource.com/dist/expat"
|
||||
>http://www.ThaiOpenSource.com/dist/expat</a>. If there is a test
|
||||
version, then it will be available from <a
|
||||
href="http://www.ThaiOpenSource.com/dist/expat/test"
|
||||
>http://www.ThaiOpenSource.com/dist/expat/test</a>.</p>
|
||||
|
||||
<H4>Where can I get help in using expat?</H4>
|
||||
|
||||
<p>Try the xml-dev mailing list (subscribe by mailing to <a
|
||||
href="mailto:majordomo@ic.ac.uk">majordomo@ic.ac.uk</a> with the
|
||||
message <code>subscribe xml-dev</code>). Alternatively try the <a
|
||||
href="news:comp.text.xml">comp.text.xml</a> USENET newsgroup.</p>
|
||||
href="mailto:majordomo@xml.org&BODY=subscribe%20xml-dev">majordomo@xml.org</a>
|
||||
with the message <code>subscribe xml-dev</code>). Alternatively try
|
||||
the <a href="news:comp.text.xml">comp.text.xml</a> USENET
|
||||
newsgroup.</p>
|
||||
|
||||
<H4>Where is expat's API documented?</H4>
|
||||
|
||||
@@ -31,6 +32,10 @@ href="news:comp.text.xml">comp.text.xml</a> USENET newsgroup.</p>
|
||||
low-level API you can use which is documented in
|
||||
<code>xmltok/xmltok.h</code>.</p>
|
||||
|
||||
<p>There's also an excellent <a
|
||||
href="http://www.xml.com/pub/1999/09/expat/index.html">article</a>
|
||||
about expat on XML.com by Clark Cooper.</p>
|
||||
|
||||
<H4>Is there a simple example of using expat's API?</H4>
|
||||
|
||||
<p>See <code>sample/elements.c</code></p>
|
||||
@@ -67,21 +72,8 @@ an argument of <code>"iso-8859-1"</code> to
|
||||
|
||||
<H4>How can I get expat to read my DTD?</H4>
|
||||
|
||||
<p>expat only reads the internal DTD subset. It doesn't process an
|
||||
external DTD nor parameter entity references. This behaviour is in
|
||||
conformance with the XML Recommendation.</p>
|
||||
|
||||
<H4>Why does expat give the wrong result for the more complex example in
|
||||
Appendix D of the XML Recommendation?</H4>
|
||||
|
||||
<P>expat does not process parameter entity references. (The XML
|
||||
Recommendation only requires parsers to process parameter entity
|
||||
references when validating. See section 4.4.8.)</P>
|
||||
|
||||
<H4>Why does expat give the wrong result for test cases in James
|
||||
Clark's test suite in the <code>xmltest/valid/not-sa</code>?</H4>
|
||||
|
||||
<P>expat doesn't process parameter entities.</P>
|
||||
<p>Compile with <code>-DXML_DTD</code> and call
|
||||
<code>XML_SetParamEntityParsing</code>.</p>
|
||||
|
||||
<H4>How can I get expat to recover from errors?</H4>
|
||||
|
||||
@@ -93,9 +85,16 @@ continue normal processing after a fatal error.</p>
|
||||
|
||||
<p>Use <code>XML_SetCharacterDataHandler</code>.</p>
|
||||
|
||||
<H4>How can I minimize the size of expat?</H4>
|
||||
|
||||
<p>Compile with <code>-DXML_MIN_SIZE</code>. With Visual C++, use the
|
||||
<code>Win32 MinSize</code> configuration: this creates an
|
||||
<code>xmlparse.dll</code> that does not require
|
||||
<code>xmltok.dll</code>.</p>
|
||||
|
||||
<ADDRESS>
|
||||
|
||||
<A HREF="mailto:jjc@jclark.com">James Clark</A>
|
||||
<A HREF="mailto:jjc@ThaiOpenSource.com">James Clark</A>
|
||||
|
||||
</ADDRESS>
|
||||
|
||||
|
||||
+1
-4
@@ -1,6 +1,5 @@
|
||||
expat.html
|
||||
MPL-1_0.html
|
||||
gplelect.html
|
||||
xmltok/ascii.h
|
||||
xmltok/asciitab.h
|
||||
xmltok/dllmain.c
|
||||
gennmtab/gennmtab.c
|
||||
@@ -17,8 +16,6 @@ xmltok/xmltok.h
|
||||
xmltok/xmltok_impl.c
|
||||
xmltok/xmltok_impl.h
|
||||
xmltok/xmltok_ns.c
|
||||
xmlparse/hashtable.c
|
||||
xmlparse/hashtable.h
|
||||
xmlparse/xmlparse.c
|
||||
xmlparse/xmlparse.h
|
||||
xmlwf/codepage.c
|
||||
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
Debug
|
||||
Release
|
||||
gennmtab.plg
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
|
||||
<HTML>
|
||||
|
||||
<TITLE>Using the GPL for expat</TITLE>
|
||||
|
||||
<BODY>
|
||||
|
||||
<H1>Using the GPL for expat</H1>
|
||||
|
||||
<P>Instead of using the Mozilla Public License, you may instead elect
|
||||
to use the <A href="http://www.gnu.org/copyleft/gpl.html">GNU General
|
||||
Public License</A> (GPL) for a particular copy of expat. The election
|
||||
to use the GPL is irrevocable for that particular copy. If you do
|
||||
elect to use the GPL, then you must replace the copyright notice on
|
||||
each file with the following:</P>
|
||||
|
||||
<PRE>
|
||||
expat XML parser
|
||||
Copyright (C) 1998 James Clark
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
</PRE>
|
||||
|
||||
<P>and you must change readme.html to say that an election has been
|
||||
made to use this copy under the GPL. If you redistribute expat, you
|
||||
should also include a copy of the GPL.</P>
|
||||
|
||||
<P>Note that I will probably not accept patches under terms that allow
|
||||
me to distribute them only under the GPL.</P>
|
||||
|
||||
<P></P>
|
||||
|
||||
<ADDRESS>
|
||||
|
||||
<A HREF="mailto:jjc@jclark.com">James Clark</A>
|
||||
|
||||
</ADDRESS>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
xcopy /y xmltok\Release\xmltok.lib lib
|
||||
xcopy /y xmlparse\Release\xmlparse.lib lib
|
||||
rm -f expat.zip
|
||||
cd ..
|
||||
sed -e 's;^^;expat/;' expat\files.txt | zip -qr expat\expat.zip -@ -ll
|
||||
sed -e 's;^^;expat/;' expat\win32files.txt | zip -qr expat\expat.zip -@
|
||||
cd expat
|
||||
@@ -1,9 +0,0 @@
|
||||
xcopy xmltok\\Release\\xmltok.lib lib
|
||||
xcopy xmlparse\\Release\\xmlparse.lib lib
|
||||
rm -fr expat
|
||||
mkdir expat
|
||||
tar cf - `cat files.txt win32files.txt` | (cd expat; tar xf -)
|
||||
(cd expat; flip -u `cat ../files.txt`)
|
||||
rm -f expat.zip
|
||||
zip -qr expat.zip expat
|
||||
rm -fr expat
|
||||
@@ -1,5 +1,4 @@
|
||||
expat.dsw
|
||||
expat.mak
|
||||
gennmtab/gennmtab.dsp
|
||||
sample/build.bat
|
||||
xmlparse/xmlparse.dsp
|
||||
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
Debug
|
||||
Release
|
||||
xmlparse.plg
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
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
|
||||
csompliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
*/
|
||||
|
||||
#include "xmldef.h"
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#ifndef XML_UNICODE
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
#define INIT_SIZE 64
|
||||
|
||||
static
|
||||
int keyeq(KEY s1, KEY s2)
|
||||
{
|
||||
for (; *s1 == *s2; s1++, s2++)
|
||||
if (*s1 == 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
unsigned long hash(KEY s)
|
||||
{
|
||||
unsigned long h = 0;
|
||||
while (*s)
|
||||
h = (h << 5) + h + (unsigned char)*s++;
|
||||
return h;
|
||||
}
|
||||
|
||||
NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize)
|
||||
{
|
||||
size_t i;
|
||||
if (table->size == 0) {
|
||||
if (!createSize)
|
||||
return 0;
|
||||
table->v = calloc(INIT_SIZE, sizeof(NAMED *));
|
||||
if (!table->v)
|
||||
return 0;
|
||||
table->size = INIT_SIZE;
|
||||
table->usedLim = INIT_SIZE / 2;
|
||||
i = hash(name) & (table->size - 1);
|
||||
}
|
||||
else {
|
||||
unsigned long h = hash(name);
|
||||
for (i = h & (table->size - 1);
|
||||
table->v[i];
|
||||
i == 0 ? i = table->size - 1 : --i) {
|
||||
if (keyeq(name, table->v[i]->name))
|
||||
return table->v[i];
|
||||
}
|
||||
if (!createSize)
|
||||
return 0;
|
||||
if (table->used == table->usedLim) {
|
||||
/* check for overflow */
|
||||
size_t newSize = table->size * 2;
|
||||
NAMED **newV = calloc(newSize, sizeof(NAMED *));
|
||||
if (!newV)
|
||||
return 0;
|
||||
for (i = 0; i < table->size; i++)
|
||||
if (table->v[i]) {
|
||||
size_t j;
|
||||
for (j = hash(table->v[i]->name) & (newSize - 1);
|
||||
newV[j];
|
||||
j == 0 ? j = newSize - 1 : --j)
|
||||
;
|
||||
newV[j] = table->v[i];
|
||||
}
|
||||
free(table->v);
|
||||
table->v = newV;
|
||||
table->size = newSize;
|
||||
table->usedLim = newSize/2;
|
||||
for (i = h & (table->size - 1);
|
||||
table->v[i];
|
||||
i == 0 ? i = table->size - 1 : --i)
|
||||
;
|
||||
}
|
||||
}
|
||||
table->v[i] = calloc(1, createSize);
|
||||
if (!table->v[i])
|
||||
return 0;
|
||||
table->v[i]->name = name;
|
||||
(table->used)++;
|
||||
return table->v[i];
|
||||
}
|
||||
|
||||
void hashTableDestroy(HASH_TABLE *table)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < table->size; i++) {
|
||||
NAMED *p = table->v[i];
|
||||
if (p)
|
||||
free(p);
|
||||
}
|
||||
free(table->v);
|
||||
}
|
||||
|
||||
void hashTableInit(HASH_TABLE *p)
|
||||
{
|
||||
p->size = 0;
|
||||
p->usedLim = 0;
|
||||
p->used = 0;
|
||||
p->v = 0;
|
||||
}
|
||||
|
||||
void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table)
|
||||
{
|
||||
iter->p = table->v;
|
||||
iter->end = iter->p + table->size;
|
||||
}
|
||||
|
||||
NAMED *hashTableIterNext(HASH_TABLE_ITER *iter)
|
||||
{
|
||||
while (iter->p != iter->end) {
|
||||
NAMED *tem = *(iter->p)++;
|
||||
if (tem)
|
||||
return tem;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef XML_UNICODE
|
||||
typedef const wchar_t *KEY;
|
||||
#else
|
||||
typedef const char *KEY;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
KEY name;
|
||||
} NAMED;
|
||||
|
||||
typedef struct {
|
||||
NAMED **v;
|
||||
size_t size;
|
||||
size_t used;
|
||||
size_t usedLim;
|
||||
} HASH_TABLE;
|
||||
|
||||
NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize);
|
||||
void hashTableInit(HASH_TABLE *);
|
||||
void hashTableDestroy(HASH_TABLE *);
|
||||
|
||||
typedef struct {
|
||||
NAMED **p;
|
||||
NAMED **end;
|
||||
} HASH_TABLE_ITER;
|
||||
|
||||
void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
|
||||
NAMED *hashTableIterNext(HASH_TABLE_ITER *);
|
||||
+1096
-328
File diff suppressed because it is too large
Load Diff
Executable
+3693
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir "."
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\xmltok" /I "..\xmlwf" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\xmltok" /I "..\xmlwf" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /D "NDEBUG" /D "XML_NS" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
@@ -54,8 +54,8 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmlparse.dll"
|
||||
# SUBTRACT LINK32 /profile
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmlparse.dll" /link50compat
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
|
||||
|
||||
@@ -71,7 +71,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir "."
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\xmltok" /I "..\xmlwf" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\xmltok" /I "..\xmlwf" /D "_DEBUG" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
@@ -141,10 +141,6 @@ SOURCE=..\xmltok\dllmain.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\hashtable.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\xmlparse.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -187,10 +183,6 @@ SOURCE=..\xmltok\xmltok.c
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\hashtable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\xmlparse.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
+116
-19
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlParse_INCLUDED
|
||||
@@ -127,6 +112,15 @@ typedef void (*XML_DefaultHandler)(void *userData,
|
||||
const XML_Char *s,
|
||||
int len);
|
||||
|
||||
/* This is called for the start of the DOCTYPE declaration when the
|
||||
name of the DOCTYPE is encountered. */
|
||||
typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
|
||||
const XML_Char *doctypeName);
|
||||
|
||||
/* This is called for the start of the DOCTYPE declaration when the
|
||||
closing > is encountered, but after processing any external subset. */
|
||||
typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
|
||||
|
||||
/* 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.
|
||||
@@ -149,6 +143,38 @@ typedef void (*XML_NotationDeclHandler)(void *userData,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
|
||||
typedef void (*XML_ExternalParsedEntityDeclHandler)(void *userData,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
|
||||
typedef void (*XML_InternalParsedEntityDeclHandler)(void *userData,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *replacementText,
|
||||
int replacementTextLength);
|
||||
|
||||
/* 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
|
||||
@@ -277,6 +303,11 @@ void XMLPARSEAPI
|
||||
XML_SetDefaultHandlerExpand(XML_Parser parser,
|
||||
XML_DefaultHandler handler);
|
||||
|
||||
void XMLPARSEAPI
|
||||
XML_SetDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start,
|
||||
XML_EndDoctypeDeclHandler end);
|
||||
|
||||
void XMLPARSEAPI
|
||||
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
|
||||
XML_UnparsedEntityDeclHandler handler);
|
||||
@@ -285,6 +316,23 @@ void XMLPARSEAPI
|
||||
XML_SetNotationDeclHandler(XML_Parser parser,
|
||||
XML_NotationDeclHandler handler);
|
||||
|
||||
void XMLPARSEAPI
|
||||
XML_SetExternalParsedEntityDeclHandler(XML_Parser parser,
|
||||
XML_ExternalParsedEntityDeclHandler handler);
|
||||
|
||||
void XMLPARSEAPI
|
||||
XML_SetInternalParsedEntityDeclHandler(XML_Parser parser,
|
||||
XML_InternalParsedEntityDeclHandler 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);
|
||||
@@ -313,7 +361,7 @@ XML_SetUserData(XML_Parser parser, void *userData);
|
||||
#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
|
||||
to XML_ParserCreate. It must not be called after XML_Parse
|
||||
or XML_ParseBuffer. */
|
||||
|
||||
int XMLPARSEAPI
|
||||
@@ -339,6 +387,20 @@ XML_SetBase(XML_Parser parser, const XML_Char *base);
|
||||
const XML_Char XMLPARSEAPI *
|
||||
XML_GetBase(XML_Parser parser);
|
||||
|
||||
/* Returns the number of the attribute/value pairs passed in last call
|
||||
to the XML_StartElementHandler that were specified in the start-tag
|
||||
rather than defaulted. Each attribute/value pair counts as 2; thus
|
||||
this correspondds to an index into the atts array passed to the
|
||||
XML_StartElementHandler. */
|
||||
|
||||
int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
|
||||
|
||||
/* Returns the index of the ID attribute passed in the last call to
|
||||
XML_StartElementHandler, or -1 if there is no ID attribute. Each
|
||||
attribute/value pair counts as 2; thus this correspondds to an index
|
||||
into the atts array passed to the XML_StartElementHandler. */
|
||||
int XMLPARSEAPI XML_GetIdAttributeIndex(XML_Parser parser);
|
||||
|
||||
/* Parses some input. Returns 0 if a fatal error is detected.
|
||||
The last call to XML_Parse must have isFinal true;
|
||||
len may be zero for this call (or any other). */
|
||||
@@ -369,6 +431,35 @@ XML_ExternalEntityParserCreate(XML_Parser parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *encoding);
|
||||
|
||||
enum XML_ParamEntityParsing {
|
||||
XML_PARAM_ENTITY_PARSING_NEVER,
|
||||
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
|
||||
XML_PARAM_ENTITY_PARSING_ALWAYS
|
||||
};
|
||||
|
||||
/* Controls parsing of parameter entities (including the external DTD
|
||||
subset). If parsing of parameter entities is enabled, then references
|
||||
to external parameter entities (including the external DTD subset)
|
||||
will be passed to the handler set with
|
||||
XML_SetExternalEntityRefHandler. The context passed will be 0.
|
||||
Unlike external general entities, external parameter entities can only
|
||||
be parsed synchronously. If the external parameter entity is to be
|
||||
parsed, it must be parsed during the call to the external entity ref
|
||||
handler: the complete sequence of XML_ExternalEntityParserCreate,
|
||||
XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
|
||||
this call. After XML_ExternalEntityParserCreate has been called to
|
||||
create the parser for the external parameter entity (context must be 0
|
||||
for this call), it is illegal to make any calls on the old parser
|
||||
until XML_ParserFree has been called on the newly created parser. If
|
||||
the library has been compiled without support for parameter entity
|
||||
parsing (ie without XML_DTD being defined), then
|
||||
XML_SetParamEntityParsing will return 0 if parsing of parameter
|
||||
entities is requested; otherwise it will return non-zero. */
|
||||
|
||||
int XMLPARSEAPI
|
||||
XML_SetParamEntityParsing(XML_Parser parser,
|
||||
enum XML_ParamEntityParsing parsing);
|
||||
|
||||
enum XML_Error {
|
||||
XML_ERROR_NONE,
|
||||
XML_ERROR_NO_MEMORY,
|
||||
@@ -391,7 +482,8 @@ enum XML_Error {
|
||||
XML_ERROR_UNKNOWN_ENCODING,
|
||||
XML_ERROR_INCORRECT_ENCODING,
|
||||
XML_ERROR_UNCLOSED_CDATA_SECTION,
|
||||
XML_ERROR_EXTERNAL_ENTITY_HANDLING
|
||||
XML_ERROR_EXTERNAL_ENTITY_HANDLING,
|
||||
XML_ERROR_NOT_STANDALONE
|
||||
};
|
||||
|
||||
/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
|
||||
@@ -411,6 +503,11 @@ 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
|
||||
|
||||
Executable
+458
@@ -0,0 +1,458 @@
|
||||
/*
|
||||
The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.1 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998, 1999
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms
|
||||
of the GNU General Public License (the "GPL"), in which case the
|
||||
provisions of the GPL are applicable instead of those above. If you
|
||||
wish to allow use of your version of this file only under the terms of
|
||||
the GPL and not to allow others to use your version of this file under
|
||||
the MPL, indicate your decision by deleting the provisions above and
|
||||
replace them with the notice and other provisions required by the
|
||||
GPL. If you do not delete the provisions above, a recipient may use
|
||||
your version of this file under either the MPL or the GPL.
|
||||
*/
|
||||
|
||||
#ifndef XmlParse_INCLUDED
|
||||
#define XmlParse_INCLUDED 1
|
||||
|
||||
#ifndef XMLPARSEAPI
|
||||
#define XMLPARSEAPI /* as nothing */
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
|
||||
/* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
|
||||
uses Unicode. */
|
||||
/* Information is UTF-16 encoded as wchar_ts */
|
||||
|
||||
#ifndef XML_UNICODE
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
|
||||
#else /* not XML_UNICODE_WCHAR_T */
|
||||
|
||||
#ifdef XML_UNICODE
|
||||
|
||||
/* Information is UTF-16 encoded as unsigned shorts */
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
|
||||
#else /* not XML_UNICODE */
|
||||
|
||||
/* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
|
||||
#endif /* not XML_UNICODE */
|
||||
|
||||
#endif /* not XML_UNICODE_WCHAR_T */
|
||||
|
||||
class XML_ElementHandler {
|
||||
public:
|
||||
/* atts is array of name/value pairs, terminated by 0; names and
|
||||
values are 0 terminated. */
|
||||
virtual void startElement(const XML_Char *name, const XML_Char **atts) = 0;
|
||||
virtual void endElement(const XML_Char *name) = 0;
|
||||
};
|
||||
|
||||
class XML_CharacterDataHandler {
|
||||
public:
|
||||
/* s is not 0 terminated. */
|
||||
virtual void characterData(const XML_Char *s, int len) = 0;
|
||||
};
|
||||
|
||||
class XML_ProcessingInstructionHandler {
|
||||
public:
|
||||
/* target and data are 0 terminated */
|
||||
virtual void processingInstruction(const XML_Char *target, const XML_Char *data) = 0;
|
||||
};
|
||||
|
||||
/* data is 0 terminated */
|
||||
class XML_CommentHandler {
|
||||
public:
|
||||
virtual void comment(const XML_Char *data) = 0;
|
||||
};
|
||||
|
||||
class XML_CdataSectionHandler {
|
||||
public:
|
||||
virtual void startCdataSection() = 0;
|
||||
virtual void endCdataSection() = 0;
|
||||
};
|
||||
|
||||
class XML_DefaultHandler {
|
||||
public:
|
||||
/* 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. */
|
||||
virtual void doDefault(const XML_Char *s, int len) = 0;
|
||||
};
|
||||
|
||||
class XML_DoctypeDeclHandler {
|
||||
public:
|
||||
/* This is called for the start of the DOCTYPE declaration when the
|
||||
name of the DOCTYPE is encountered. */
|
||||
virtual void startDoctypeDecl(const XML_Char *doctypeName) = 0;
|
||||
/* This is called for the start of the DOCTYPE declaration when the
|
||||
closing > is encountered, but after processing any external subset. */
|
||||
virtual void endDoctypeDecl() = 0;
|
||||
};
|
||||
|
||||
class XML_UnparsedEntityDeclHandler {
|
||||
public:
|
||||
/* 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. */
|
||||
virtual void unparsedEntityDecl(const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
const XML_Char *notationName) = 0;
|
||||
};
|
||||
|
||||
class XML_NotationDeclHandler {
|
||||
public:
|
||||
/* 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. */
|
||||
virtual void notationDecl(const XML_Char *notationName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId) = 0;
|
||||
};
|
||||
|
||||
class XML_NamespaceDeclHandler {
|
||||
public:
|
||||
/* 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. */
|
||||
|
||||
virtual void startNamespaceDecl(const XML_Char *prefix,
|
||||
const XML_Char *uri) = 0;
|
||||
|
||||
virtual void endNamespaceDecl(const XML_Char *prefix) = 0;
|
||||
};
|
||||
|
||||
class XML_NotStandaloneHandler {
|
||||
public:
|
||||
/* 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
|
||||
ERROR_NOT_STANDALONE error. */
|
||||
virtual int notStandalone() = 0;
|
||||
};
|
||||
|
||||
class XML_Parser;
|
||||
|
||||
class XML_ExternalEntityRefHandler {
|
||||
public:
|
||||
/* 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
|
||||
externalEntityParserCreate. The parser argument is the parser
|
||||
parsing the entity containing the reference; it can be passed as
|
||||
the parser argument to 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 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 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 ERROR_EXTERNAL_ENTITY_HANDLING error. Note that
|
||||
unlike other handlers the first argument is the parser, not
|
||||
userData. */
|
||||
|
||||
virtual int externalEntityRef(XML_Parser *parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId) = 0;
|
||||
};
|
||||
|
||||
/* This object is returned 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. */
|
||||
|
||||
class XMLPARSEAPI XML_Encoding {
|
||||
public:
|
||||
int map[256];
|
||||
virtual int convert(const char *s);
|
||||
virtual void release();
|
||||
};
|
||||
|
||||
class XML_UnknownEncodingHandler {
|
||||
public:
|
||||
/* 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. */
|
||||
virtual XML_Encoding *unknownEncoding(const XML_Char *name) = 0;
|
||||
};
|
||||
|
||||
class XMLPARSEAPI XML_Parser {
|
||||
public:
|
||||
/* Constructs a new parser; encoding is the encoding specified by
|
||||
the external protocol or null if there is none specified. */
|
||||
static XML_Parser *parserCreate(const XML_Char *encoding = 0);
|
||||
|
||||
/* 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. */
|
||||
|
||||
static XML_Parser *parserCreateNS(const XML_Char *encoding,
|
||||
XML_Char namespaceSeparator);
|
||||
|
||||
virtual void release() = 0;
|
||||
virtual void setElementHandler(XML_ElementHandler *handler) = 0;
|
||||
virtual void setCharacterDataHandler(XML_CharacterDataHandler *handler) = 0;
|
||||
virtual void setProcessingInstructionHandler(XML_ProcessingInstructionHandler *handler) = 0;
|
||||
virtual void setCommentHandler(XML_CommentHandler *handler) = 0;
|
||||
virtual void setCdataSectionHandler(XML_CdataSectionHandler *handler) = 0;
|
||||
|
||||
/* This sets the default handler and also inhibits expansion of
|
||||
internal entities. The entity reference will be passed to the
|
||||
default handler. */
|
||||
|
||||
virtual void setDefaultHandler(XML_DefaultHandler *handler) = 0;
|
||||
|
||||
/* This sets the default handler but does not inhibit expansion of
|
||||
internal entities. The entity reference will not be passed to
|
||||
the default handler. */
|
||||
|
||||
virtual void setDefaultHandlerExpand(XML_DefaultHandler *handler) = 0;
|
||||
|
||||
virtual void setDoctypeDeclHandler(XML_DoctypeDeclHandler *handler) = 0;
|
||||
virtual void setUnparsedEntityDeclHandler(XML_UnparsedEntityDeclHandler *handler) = 0;
|
||||
virtual void setNotationDeclHandler(XML_NotationDeclHandler *handler) = 0;
|
||||
virtual void setNamespaceDeclHandler(XML_NamespaceDeclHandler *handler) = 0;
|
||||
virtual void setNotStandaloneHandler(XML_NotStandaloneHandler *handler) = 0;
|
||||
virtual void setExternalEntityRefHandler(XML_ExternalEntityRefHandler *handler) = 0;
|
||||
virtual void setUnknownEncodingHandler(XML_UnknownEncodingHandler *handler) = 0;
|
||||
|
||||
/* 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. */
|
||||
virtual void defaultCurrent() = 0;
|
||||
|
||||
/* This is equivalent to supplying an encoding argument
|
||||
to XML_ParserCreate. It must not be called after XML_Parse
|
||||
or XML_ParseBuffer. */
|
||||
virtual int setEncoding(const XML_Char *encoding) = 0;
|
||||
|
||||
/* 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. */
|
||||
|
||||
virtual int setBase(const XML_Char *base) = 0;
|
||||
|
||||
virtual const XML_Char *getBase() = 0;
|
||||
|
||||
/* Returns the number of the attributes passed in last call to the
|
||||
XML_StartElementHandler that were specified in the start-tag rather
|
||||
than defaulted. */
|
||||
virtual int getSpecifiedAttributeCount() = 0;
|
||||
|
||||
/* Parses some input. Returns 0 if a fatal error is detected.
|
||||
The last call to XML_Parse must have isFinal true;
|
||||
len may be zero for this call (or any other). */
|
||||
virtual int parse(const char *s, int len, int isFinal) = 0;
|
||||
|
||||
virtual char *getBuffer(int len) = 0;
|
||||
|
||||
virtual int parseBuffer(int len, int isFinal) = 0;
|
||||
|
||||
/* Creates an XML_Parser object that can parse an external general
|
||||
entity; context is a '\0'-terminated string specifying the parse
|
||||
context; encoding is a '\0'-terminated string giving the name of
|
||||
the externally specified encoding, or null if there is no
|
||||
externally specified encoding. The context string consists of a
|
||||
sequence of tokens separated by formfeeds (\f); a token
|
||||
consisting of a name specifies that the general entity of the
|
||||
name is open; a token of the form prefix=uri specifies the
|
||||
namespace for a particular prefix; a token of the form =uri
|
||||
specifies the default namespace. This can be called at any point
|
||||
after the first call to an ExternalEntityRefHandler so longer as
|
||||
the parser has not yet been freed. The new parser is completely
|
||||
independent and may safely be used in a separate thread. The
|
||||
handlers and userData are initialized from the parser argument.
|
||||
Returns 0 if out of memory. Otherwise returns a new XML_Parser
|
||||
object. */
|
||||
|
||||
virtual XML_Parser *externalEntityParserCreate(const XML_Char *context,
|
||||
const XML_Char *encoding) = 0;
|
||||
|
||||
enum ParamEntityParsing {
|
||||
PARAM_ENTITY_PARSING_NEVER,
|
||||
PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
|
||||
PARAM_ENTITY_PARSING_ALWAYS
|
||||
};
|
||||
|
||||
/* Controls parsing of parameter entities (including the external
|
||||
DTD subset). If parsing of parameter entities is enabled, then
|
||||
references to external parameter entities (including the external
|
||||
DTD subset) will be passed to the handler set with
|
||||
XML_SetExternalEntityRefHandler. The context passed will be 0.
|
||||
Unlike external general entities, external parameter entities can
|
||||
only be parsed synchronously. If the external parameter entity
|
||||
is to be parsed, it must be parsed during the call to the
|
||||
external entity ref handler: the complete sequence of
|
||||
XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
|
||||
XML_ParserFree calls must be made during this call. After
|
||||
XML_ExternalEntityParserCreate has been called to create the
|
||||
parser for the external parameter entity (context must be 0 for
|
||||
this call), it is illegal to make any calls on the old parser
|
||||
until XML_ParserFree has been called on the newly created parser.
|
||||
If the library has been compiled without support for parameter
|
||||
entity parsing (ie without XML_DTD being defined), then
|
||||
XML_SetParamEntityParsing will return 0 if parsing of parameter
|
||||
entities is requested; otherwise it will return non-zero. */
|
||||
|
||||
virtual int setParamEntityParsing(ParamEntityParsing parsing) = 0;
|
||||
|
||||
enum Error {
|
||||
ERROR_NONE,
|
||||
ERROR_NO_MEMORY,
|
||||
ERROR_SYNTAX,
|
||||
ERROR_NO_ELEMENTS,
|
||||
ERROR_INVALID_TOKEN,
|
||||
ERROR_UNCLOSED_TOKEN,
|
||||
ERROR_PARTIAL_CHAR,
|
||||
ERROR_TAG_MISMATCH,
|
||||
ERROR_DUPLICATE_ATTRIBUTE,
|
||||
ERROR_JUNK_AFTER_DOC_ELEMENT,
|
||||
ERROR_PARAM_ENTITY_REF,
|
||||
ERROR_UNDEFINED_ENTITY,
|
||||
ERROR_RECURSIVE_ENTITY_REF,
|
||||
ERROR_ASYNC_ENTITY,
|
||||
ERROR_BAD_CHAR_REF,
|
||||
ERROR_BINARY_ENTITY_REF,
|
||||
ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
|
||||
ERROR_MISPLACED_XML_PI,
|
||||
ERROR_UNKNOWN_ENCODING,
|
||||
ERROR_INCORRECT_ENCODING,
|
||||
ERROR_UNCLOSED_CDATA_SECTION,
|
||||
ERROR_EXTERNAL_ENTITY_HANDLING,
|
||||
ERROR_NOT_STANDALONE
|
||||
};
|
||||
|
||||
/* If parse or XML_parseBuffer have returned 0, then XML_GetErrorCode
|
||||
returns information about the error. */
|
||||
|
||||
virtual Error getErrorCode() = 0;
|
||||
|
||||
/* 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. */
|
||||
|
||||
virtual int getCurrentLineNumber() = 0;
|
||||
virtual int getCurrentColumnNumber() = 0;
|
||||
virtual long getCurrentByteIndex() = 0;
|
||||
|
||||
/* Return the number of bytes in the current event.
|
||||
Returns 0 if the event is in an internal entity. */
|
||||
virtual int getCurrentByteCount() = 0;
|
||||
|
||||
/* Returns a string describing the error. */
|
||||
static const XML_LChar *errorString(int code);
|
||||
protected:
|
||||
~XML_Parser() { }
|
||||
};
|
||||
|
||||
#endif /* not XmlParse_INCLUDED */
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
nametab.h
|
||||
Release
|
||||
Debug
|
||||
Executable
+86
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#define ASCII_A 0x41
|
||||
#define ASCII_B 0x42
|
||||
#define ASCII_C 0x43
|
||||
#define ASCII_D 0x44
|
||||
#define ASCII_E 0x45
|
||||
#define ASCII_F 0x46
|
||||
#define ASCII_G 0x47
|
||||
#define ASCII_H 0x48
|
||||
#define ASCII_I 0x49
|
||||
#define ASCII_J 0x4A
|
||||
#define ASCII_K 0x4B
|
||||
#define ASCII_L 0x4C
|
||||
#define ASCII_M 0x4D
|
||||
#define ASCII_N 0x4E
|
||||
#define ASCII_O 0x4F
|
||||
#define ASCII_P 0x50
|
||||
#define ASCII_Q 0x51
|
||||
#define ASCII_R 0x52
|
||||
#define ASCII_S 0x53
|
||||
#define ASCII_T 0x54
|
||||
#define ASCII_U 0x55
|
||||
#define ASCII_V 0x56
|
||||
#define ASCII_W 0x57
|
||||
#define ASCII_X 0x58
|
||||
#define ASCII_Y 0x59
|
||||
#define ASCII_Z 0x5A
|
||||
|
||||
#define ASCII_a 0x61
|
||||
#define ASCII_b 0x62
|
||||
#define ASCII_c 0x63
|
||||
#define ASCII_d 0x64
|
||||
#define ASCII_e 0x65
|
||||
#define ASCII_f 0x66
|
||||
#define ASCII_g 0x67
|
||||
#define ASCII_h 0x68
|
||||
#define ASCII_i 0x69
|
||||
#define ASCII_j 0x6A
|
||||
#define ASCII_k 0x6B
|
||||
#define ASCII_l 0x6C
|
||||
#define ASCII_m 0x6D
|
||||
#define ASCII_n 0x6E
|
||||
#define ASCII_o 0x6F
|
||||
#define ASCII_p 0x70
|
||||
#define ASCII_q 0x71
|
||||
#define ASCII_r 0x72
|
||||
#define ASCII_s 0x73
|
||||
#define ASCII_t 0x74
|
||||
#define ASCII_u 0x75
|
||||
#define ASCII_v 0x76
|
||||
#define ASCII_w 0x77
|
||||
#define ASCII_x 0x78
|
||||
#define ASCII_y 0x79
|
||||
#define ASCII_z 0x7A
|
||||
|
||||
#define ASCII_0 0x30
|
||||
#define ASCII_1 0x31
|
||||
#define ASCII_2 0x32
|
||||
#define ASCII_3 0x33
|
||||
#define ASCII_4 0x34
|
||||
#define ASCII_5 0x35
|
||||
#define ASCII_6 0x36
|
||||
#define ASCII_7 0x37
|
||||
#define ASCII_8 0x38
|
||||
#define ASCII_9 0x39
|
||||
|
||||
#define ASCII_TAB 0x09
|
||||
#define ASCII_SPACE 0x20
|
||||
#define ASCII_EXCL 0x21
|
||||
#define ASCII_QUOT 0x22
|
||||
#define ASCII_AMP 0x26
|
||||
#define ASCII_APOS 0x27
|
||||
#define ASCII_MINUS 0x2D
|
||||
#define ASCII_PERIOD 0x2E
|
||||
#define ASCII_COLON 0x3A
|
||||
#define ASCII_SEMI 0x3B
|
||||
#define ASCII_LT 0x3C
|
||||
#define ASCII_EQUALS 0x3D
|
||||
#define ASCII_GT 0x3E
|
||||
#define ASCII_LSQB 0x5B
|
||||
#define ASCII_RSQB 0x5D
|
||||
#define ASCII_UNDERSCORE 0x5F
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#define STRICT 1
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
static const unsigned namingBitmap[] = {
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
|
||||
0x00000000, 0x04200400, 0xFF7FFFFF, 0xFF7FFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFC3FFFFF,
|
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xF9FF01FF, 0x00000003, 0x0000001F,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x04000000,
|
||||
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
||||
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
||||
0x000000FF, 0x00000000, 0xFFFF0000, 0x000707FF,
|
||||
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
|
||||
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
|
||||
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
|
||||
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
|
||||
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
|
||||
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
|
||||
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
|
||||
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
|
||||
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
|
||||
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
|
||||
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
|
||||
0xFEF02596, 0x200D6CAE, 0x3000001F, 0x00000000,
|
||||
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0x83FFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFF07, 0xFFFFFFFF, 0x03FFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
|
||||
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
|
||||
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x80000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x3F2FFC84, 0x01FBFD50, 0x00000000, 0xFFFFFFFF,
|
||||
0x00000007, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
|
||||
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
|
||||
0xFFFFFFE0, 0xFFFE1FFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x00007FFF, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
|
||||
0x00000000, 0x04A00400, 0xFF7FFFFF, 0xFF7FFFFF,
|
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xF9FF01FF, 0x00030003, 0x0000001F,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x04000003,
|
||||
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
||||
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
||||
0xFFFE00FF, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
|
||||
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
|
||||
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
|
||||
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
|
||||
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
|
||||
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
|
||||
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
|
||||
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
|
||||
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
|
||||
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
|
||||
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
|
||||
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
|
||||
0xFEF02596, 0x3BFF6CAE, 0x33FF3F5F, 0x00000000,
|
||||
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
|
||||
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
|
||||
0x0000F000, 0x00007C00, 0x00000000, 0x8000FC00,
|
||||
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
|
||||
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
|
||||
0x7E1FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
|
||||
};
|
||||
static const unsigned char nmstrtPages[] = {
|
||||
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
|
||||
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
||||
0x14, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x16, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char namePages[] = {
|
||||
0x1A, 0x03, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x00,
|
||||
0x00, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
||||
0x27, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x28, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#define UNICODE 1
|
||||
#include "xmltok.c"
|
||||
+20
-21
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -41,13 +26,27 @@ Contributor(s):
|
||||
/* This file can be used for any definitions needed in
|
||||
particular environments. */
|
||||
|
||||
#ifdef MOZILLA
|
||||
/* Mozilla specific defines */
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
|
||||
#include "nspr.h"
|
||||
#define malloc(x) PR_Malloc(x)
|
||||
#define realloc(x, y) PR_Realloc((x), (y))
|
||||
#define malloc(x) PR_Malloc((size_t)(x))
|
||||
#define realloc(x, y) PR_Realloc((x), (size_t)(y))
|
||||
#define calloc(x, y) PR_Calloc((x),(y))
|
||||
#define free(x) PR_Free(x)
|
||||
#if PR_BYTES_PER_INT != 4
|
||||
#define int int32
|
||||
#endif
|
||||
|
||||
#endif /* MOZILLA */
|
||||
/* Enable Unicode string processing in expat. */
|
||||
#ifndef XML_UNICODE
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
|
||||
/* Enable external parameter entity parsing in expat */
|
||||
#ifndef XML_DTD
|
||||
#define XML_DTD 1
|
||||
#endif
|
||||
|
||||
#endif /* MOZILLA_CLIENT */
|
||||
|
||||
+267
-105
@@ -1,25 +1,11 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include "xmldef.h"
|
||||
#include "xmlrole.h"
|
||||
#include "ascii.h"
|
||||
|
||||
/* Doesn't check:
|
||||
|
||||
@@ -28,11 +14,44 @@ Contributor(s):
|
||||
|
||||
*/
|
||||
|
||||
static const char KW_ANY[] = { ASCII_A, ASCII_N, ASCII_Y, '\0' };
|
||||
static const char KW_ATTLIST[] = { ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' };
|
||||
static const char KW_CDATA[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
|
||||
static const char KW_DOCTYPE[] = { ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' };
|
||||
static const char KW_ELEMENT[] = { ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' };
|
||||
static const char KW_EMPTY[] = { ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' };
|
||||
static const char KW_ENTITIES[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' };
|
||||
static const char KW_ENTITY[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' };
|
||||
static const char KW_FIXED[] = { ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' };
|
||||
static const char KW_ID[] = { ASCII_I, ASCII_D, '\0' };
|
||||
static const char KW_IDREF[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
|
||||
static const char KW_IDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
|
||||
static const char KW_IGNORE[] = { ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' };
|
||||
static const char KW_IMPLIED[] = { ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' };
|
||||
static const char KW_INCLUDE[] = { ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' };
|
||||
static const char KW_NDATA[] = { ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
|
||||
static const char KW_NMTOKEN[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' };
|
||||
static const char KW_NMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' };
|
||||
static const char KW_NOTATION[] = { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, '\0' };
|
||||
static const char KW_PCDATA[] = { ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
|
||||
static const char KW_PUBLIC[] = { ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' };
|
||||
static const char KW_REQUIRED[] = { ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, '\0' };
|
||||
static const char KW_SYSTEM[] = { ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' };
|
||||
|
||||
#ifndef MIN_BYTES_PER_CHAR
|
||||
#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar)
|
||||
#endif
|
||||
|
||||
typedef int PROLOG_HANDLER(struct prolog_state *state,
|
||||
#ifdef XML_DTD
|
||||
#define setTopLevel(state) \
|
||||
((state)->handler = ((state)->documentEntity \
|
||||
? internalSubset \
|
||||
: externalSubset1))
|
||||
#else /* not XML_DTD */
|
||||
#define setTopLevel(state) ((state)->handler = internalSubset)
|
||||
#endif /* not XML_DTD */
|
||||
|
||||
typedef int PROLOG_HANDLER(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
@@ -49,11 +68,15 @@ static PROLOG_HANDLER
|
||||
attlist7, attlist8, attlist9,
|
||||
element0, element1, element2, element3, element4, element5, element6,
|
||||
element7,
|
||||
#ifdef XML_DTD
|
||||
externalSubset0, externalSubset1,
|
||||
condSect0, condSect1, condSect2,
|
||||
#endif /* XML_DTD */
|
||||
declClose,
|
||||
error;
|
||||
|
||||
static
|
||||
int syntaxError(PROLOG_STATE *);
|
||||
int common(PROLOG_STATE *state, int tok);
|
||||
|
||||
static
|
||||
int prolog0(PROLOG_STATE *state,
|
||||
@@ -79,7 +102,8 @@ int prolog0(PROLOG_STATE *state,
|
||||
case XML_TOK_DECL_OPEN:
|
||||
if (!XmlNameMatchesAscii(enc,
|
||||
ptr + 2 * MIN_BYTES_PER_CHAR(enc),
|
||||
"DOCTYPE"))
|
||||
end,
|
||||
KW_DOCTYPE))
|
||||
break;
|
||||
state->handler = doctype0;
|
||||
return XML_ROLE_NONE;
|
||||
@@ -87,7 +111,7 @@ int prolog0(PROLOG_STATE *state,
|
||||
state->handler = error;
|
||||
return XML_ROLE_INSTANCE_START;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -107,7 +131,8 @@ int prolog1(PROLOG_STATE *state,
|
||||
case XML_TOK_DECL_OPEN:
|
||||
if (!XmlNameMatchesAscii(enc,
|
||||
ptr + 2 * MIN_BYTES_PER_CHAR(enc),
|
||||
"DOCTYPE"))
|
||||
end,
|
||||
KW_DOCTYPE))
|
||||
break;
|
||||
state->handler = doctype0;
|
||||
return XML_ROLE_NONE;
|
||||
@@ -115,7 +140,7 @@ int prolog1(PROLOG_STATE *state,
|
||||
state->handler = error;
|
||||
return XML_ROLE_INSTANCE_START;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -135,7 +160,7 @@ int prolog2(PROLOG_STATE *state,
|
||||
state->handler = error;
|
||||
return XML_ROLE_INSTANCE_START;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -153,7 +178,7 @@ int doctype0(PROLOG_STATE *state,
|
||||
state->handler = doctype1;
|
||||
return XML_ROLE_DOCTYPE_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -173,17 +198,17 @@ int doctype1(PROLOG_STATE *state,
|
||||
state->handler = prolog2;
|
||||
return XML_ROLE_DOCTYPE_CLOSE;
|
||||
case XML_TOK_NAME:
|
||||
if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
|
||||
state->handler = doctype3;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
|
||||
state->handler = doctype2;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -200,7 +225,7 @@ int doctype2(PROLOG_STATE *state,
|
||||
state->handler = doctype3;
|
||||
return XML_ROLE_DOCTYPE_PUBLIC_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -217,7 +242,7 @@ int doctype3(PROLOG_STATE *state,
|
||||
state->handler = doctype4;
|
||||
return XML_ROLE_DOCTYPE_SYSTEM_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -237,7 +262,7 @@ int doctype4(PROLOG_STATE *state,
|
||||
state->handler = prolog2;
|
||||
return XML_ROLE_DOCTYPE_CLOSE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -254,7 +279,7 @@ int doctype5(PROLOG_STATE *state,
|
||||
state->handler = prolog2;
|
||||
return XML_ROLE_DOCTYPE_CLOSE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -270,25 +295,29 @@ int internalSubset(PROLOG_STATE *state,
|
||||
case XML_TOK_DECL_OPEN:
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + 2 * MIN_BYTES_PER_CHAR(enc),
|
||||
"ENTITY")) {
|
||||
end,
|
||||
KW_ENTITY)) {
|
||||
state->handler = entity0;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + 2 * MIN_BYTES_PER_CHAR(enc),
|
||||
"ATTLIST")) {
|
||||
end,
|
||||
KW_ATTLIST)) {
|
||||
state->handler = attlist0;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + 2 * MIN_BYTES_PER_CHAR(enc),
|
||||
"ELEMENT")) {
|
||||
end,
|
||||
KW_ELEMENT)) {
|
||||
state->handler = element0;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + 2 * MIN_BYTES_PER_CHAR(enc),
|
||||
"NOTATION")) {
|
||||
end,
|
||||
KW_NOTATION)) {
|
||||
state->handler = notation0;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
@@ -302,9 +331,56 @@ int internalSubset(PROLOG_STATE *state,
|
||||
state->handler = doctype5;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static
|
||||
int externalSubset0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc)
|
||||
{
|
||||
state->handler = externalSubset1;
|
||||
if (tok == XML_TOK_XML_DECL)
|
||||
return XML_ROLE_TEXT_DECL;
|
||||
return externalSubset1(state, tok, ptr, end, enc);
|
||||
}
|
||||
|
||||
static
|
||||
int externalSubset1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc)
|
||||
{
|
||||
switch (tok) {
|
||||
case XML_TOK_COND_SECT_OPEN:
|
||||
state->handler = condSect0;
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_COND_SECT_CLOSE:
|
||||
if (state->includeLevel == 0)
|
||||
break;
|
||||
state->includeLevel -= 1;
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_CLOSE_BRACKET:
|
||||
break;
|
||||
case XML_TOK_NONE:
|
||||
if (state->includeLevel)
|
||||
break;
|
||||
return XML_ROLE_NONE;
|
||||
default:
|
||||
return internalSubset(state, tok, ptr, end, enc);
|
||||
}
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static
|
||||
int entity0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
@@ -322,7 +398,7 @@ int entity0(PROLOG_STATE *state,
|
||||
state->handler = entity2;
|
||||
return XML_ROLE_GENERAL_ENTITY_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -339,7 +415,7 @@ int entity1(PROLOG_STATE *state,
|
||||
state->handler = entity7;
|
||||
return XML_ROLE_PARAM_ENTITY_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -353,11 +429,11 @@ int entity2(PROLOG_STATE *state,
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_NAME:
|
||||
if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
|
||||
state->handler = entity4;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
|
||||
state->handler = entity3;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
@@ -366,7 +442,7 @@ int entity2(PROLOG_STATE *state,
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_ENTITY_VALUE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -383,7 +459,7 @@ int entity3(PROLOG_STATE *state,
|
||||
state->handler = entity4;
|
||||
return XML_ROLE_ENTITY_PUBLIC_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
|
||||
@@ -401,7 +477,7 @@ int entity4(PROLOG_STATE *state,
|
||||
state->handler = entity5;
|
||||
return XML_ROLE_ENTITY_SYSTEM_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -415,16 +491,16 @@ int entity5(PROLOG_STATE *state,
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_DECL_CLOSE:
|
||||
state->handler = internalSubset;
|
||||
return XML_ROLE_NONE;
|
||||
setTopLevel(state);
|
||||
return XML_ROLE_EXTERNAL_GENERAL_ENTITY_NO_NOTATION;
|
||||
case XML_TOK_NAME:
|
||||
if (XmlNameMatchesAscii(enc, ptr, "NDATA")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) {
|
||||
state->handler = entity6;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -441,7 +517,7 @@ int entity6(PROLOG_STATE *state,
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_ENTITY_NOTATION_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -455,11 +531,11 @@ int entity7(PROLOG_STATE *state,
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_NAME:
|
||||
if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
|
||||
state->handler = entity9;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
|
||||
state->handler = entity8;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
@@ -468,7 +544,7 @@ int entity7(PROLOG_STATE *state,
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_ENTITY_VALUE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -485,7 +561,7 @@ int entity8(PROLOG_STATE *state,
|
||||
state->handler = entity9;
|
||||
return XML_ROLE_ENTITY_PUBLIC_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -502,7 +578,7 @@ int entity9(PROLOG_STATE *state,
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_ENTITY_SYSTEM_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -519,7 +595,7 @@ int notation0(PROLOG_STATE *state,
|
||||
state->handler = notation1;
|
||||
return XML_ROLE_NOTATION_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -533,17 +609,17 @@ int notation1(PROLOG_STATE *state,
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_NAME:
|
||||
if (XmlNameMatchesAscii(enc, ptr, "SYSTEM")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
|
||||
state->handler = notation3;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, ptr, "PUBLIC")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
|
||||
state->handler = notation2;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -560,7 +636,7 @@ int notation2(PROLOG_STATE *state,
|
||||
state->handler = notation4;
|
||||
return XML_ROLE_NOTATION_PUBLIC_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -577,7 +653,7 @@ int notation3(PROLOG_STATE *state,
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_NOTATION_SYSTEM_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -594,10 +670,10 @@ int notation4(PROLOG_STATE *state,
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_NOTATION_SYSTEM_ID;
|
||||
case XML_TOK_DECL_CLOSE:
|
||||
state->handler = internalSubset;
|
||||
setTopLevel(state);
|
||||
return XML_ROLE_NOTATION_NO_SYSTEM_ID;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -615,7 +691,7 @@ int attlist0(PROLOG_STATE *state,
|
||||
state->handler = attlist1;
|
||||
return XML_ROLE_ATTLIST_ELEMENT_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -629,14 +705,14 @@ int attlist1(PROLOG_STATE *state,
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_DECL_CLOSE:
|
||||
state->handler = internalSubset;
|
||||
setTopLevel(state);
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_NAME:
|
||||
case XML_TOK_PREFIXED_NAME:
|
||||
state->handler = attlist2;
|
||||
return XML_ROLE_ATTRIBUTE_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -652,23 +728,23 @@ int attlist2(PROLOG_STATE *state,
|
||||
case XML_TOK_NAME:
|
||||
{
|
||||
static const char *types[] = {
|
||||
"CDATA",
|
||||
"ID",
|
||||
"IDREF",
|
||||
"IDREFS",
|
||||
"ENTITY",
|
||||
"ENTITIES",
|
||||
"NMTOKEN",
|
||||
"NMTOKENS",
|
||||
KW_CDATA,
|
||||
KW_ID,
|
||||
KW_IDREF,
|
||||
KW_IDREFS,
|
||||
KW_ENTITY,
|
||||
KW_ENTITIES,
|
||||
KW_NMTOKEN,
|
||||
KW_NMTOKENS,
|
||||
};
|
||||
int i;
|
||||
for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++)
|
||||
if (XmlNameMatchesAscii(enc, ptr, types[i])) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, types[i])) {
|
||||
state->handler = attlist8;
|
||||
return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i;
|
||||
}
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, ptr, "NOTATION")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) {
|
||||
state->handler = attlist5;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
@@ -677,7 +753,7 @@ int attlist2(PROLOG_STATE *state,
|
||||
state->handler = attlist3;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -696,7 +772,7 @@ int attlist3(PROLOG_STATE *state,
|
||||
state->handler = attlist4;
|
||||
return XML_ROLE_ATTRIBUTE_ENUM_VALUE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -716,7 +792,7 @@ int attlist4(PROLOG_STATE *state,
|
||||
state->handler = attlist3;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -733,7 +809,7 @@ int attlist5(PROLOG_STATE *state,
|
||||
state->handler = attlist6;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
|
||||
@@ -751,7 +827,7 @@ int attlist6(PROLOG_STATE *state,
|
||||
state->handler = attlist7;
|
||||
return XML_ROLE_ATTRIBUTE_NOTATION_VALUE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -771,7 +847,7 @@ int attlist7(PROLOG_STATE *state,
|
||||
state->handler = attlist6;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
/* default value */
|
||||
@@ -788,19 +864,22 @@ int attlist8(PROLOG_STATE *state,
|
||||
case XML_TOK_POUND_NAME:
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + MIN_BYTES_PER_CHAR(enc),
|
||||
"IMPLIED")) {
|
||||
end,
|
||||
KW_IMPLIED)) {
|
||||
state->handler = attlist1;
|
||||
return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + MIN_BYTES_PER_CHAR(enc),
|
||||
"REQUIRED")) {
|
||||
end,
|
||||
KW_REQUIRED)) {
|
||||
state->handler = attlist1;
|
||||
return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + MIN_BYTES_PER_CHAR(enc),
|
||||
"FIXED")) {
|
||||
end,
|
||||
KW_FIXED)) {
|
||||
state->handler = attlist9;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
@@ -809,7 +888,7 @@ int attlist8(PROLOG_STATE *state,
|
||||
state->handler = attlist1;
|
||||
return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -826,7 +905,7 @@ int attlist9(PROLOG_STATE *state,
|
||||
state->handler = attlist1;
|
||||
return XML_ROLE_FIXED_ATTRIBUTE_VALUE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -844,7 +923,7 @@ int element0(PROLOG_STATE *state,
|
||||
state->handler = element1;
|
||||
return XML_ROLE_ELEMENT_NAME;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -858,11 +937,11 @@ int element1(PROLOG_STATE *state,
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_NAME:
|
||||
if (XmlNameMatchesAscii(enc, ptr, "EMPTY")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) {
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_CONTENT_EMPTY;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, ptr, "ANY")) {
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) {
|
||||
state->handler = declClose;
|
||||
return XML_ROLE_CONTENT_ANY;
|
||||
}
|
||||
@@ -872,7 +951,7 @@ int element1(PROLOG_STATE *state,
|
||||
state->level = 1;
|
||||
return XML_ROLE_GROUP_OPEN;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -888,7 +967,8 @@ int element2(PROLOG_STATE *state,
|
||||
case XML_TOK_POUND_NAME:
|
||||
if (XmlNameMatchesAscii(enc,
|
||||
ptr + MIN_BYTES_PER_CHAR(enc),
|
||||
"PCDATA")) {
|
||||
end,
|
||||
KW_PCDATA)) {
|
||||
state->handler = element3;
|
||||
return XML_ROLE_CONTENT_PCDATA;
|
||||
}
|
||||
@@ -911,7 +991,7 @@ int element2(PROLOG_STATE *state,
|
||||
state->handler = element7;
|
||||
return XML_ROLE_CONTENT_ELEMENT_PLUS;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -932,7 +1012,7 @@ int element3(PROLOG_STATE *state,
|
||||
state->handler = element4;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -950,7 +1030,7 @@ int element4(PROLOG_STATE *state,
|
||||
state->handler = element5;
|
||||
return XML_ROLE_CONTENT_ELEMENT;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -970,7 +1050,7 @@ int element5(PROLOG_STATE *state,
|
||||
state->handler = element4;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -1000,7 +1080,7 @@ int element6(PROLOG_STATE *state,
|
||||
state->handler = element7;
|
||||
return XML_ROLE_CONTENT_ELEMENT_PLUS;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -1040,9 +1120,72 @@ int element7(PROLOG_STATE *state,
|
||||
state->handler = element6;
|
||||
return XML_ROLE_GROUP_CHOICE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static
|
||||
int condSect0(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc)
|
||||
{
|
||||
switch (tok) {
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_NAME:
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) {
|
||||
state->handler = condSect1;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) {
|
||||
state->handler = condSect2;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
int condSect1(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc)
|
||||
{
|
||||
switch (tok) {
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_OPEN_BRACKET:
|
||||
state->handler = externalSubset1;
|
||||
state->includeLevel += 1;
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
static
|
||||
int condSect2(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc)
|
||||
{
|
||||
switch (tok) {
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_OPEN_BRACKET:
|
||||
state->handler = externalSubset1;
|
||||
return XML_ROLE_IGNORE_SECT;
|
||||
}
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static
|
||||
int declClose(PROLOG_STATE *state,
|
||||
int tok,
|
||||
@@ -1054,10 +1197,10 @@ int declClose(PROLOG_STATE *state,
|
||||
case XML_TOK_PROLOG_S:
|
||||
return XML_ROLE_NONE;
|
||||
case XML_TOK_DECL_CLOSE:
|
||||
state->handler = internalSubset;
|
||||
setTopLevel(state);
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -1076,23 +1219,27 @@ int ignore(PROLOG_STATE *state,
|
||||
default:
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
return syntaxError(state);
|
||||
return common(state, tok);
|
||||
}
|
||||
#endif
|
||||
|
||||
static
|
||||
int error(PROLOG_STATE *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc)
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc)
|
||||
{
|
||||
return XML_ROLE_NONE;
|
||||
}
|
||||
|
||||
static
|
||||
int syntaxError(PROLOG_STATE *state)
|
||||
int common(PROLOG_STATE *state, int tok)
|
||||
{
|
||||
#ifdef XML_DTD
|
||||
if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF)
|
||||
return XML_ROLE_INNER_PARAM_ENTITY_REF;
|
||||
#endif
|
||||
state->handler = error;
|
||||
return XML_ROLE_ERROR;
|
||||
}
|
||||
@@ -1100,4 +1247,19 @@ int syntaxError(PROLOG_STATE *state)
|
||||
void XmlPrologStateInit(PROLOG_STATE *state)
|
||||
{
|
||||
state->handler = prolog0;
|
||||
#ifdef XML_DTD
|
||||
state->documentEntity = 1;
|
||||
state->includeLevel = 0;
|
||||
#endif /* XML_DTD */
|
||||
}
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
void XmlPrologStateInitExternalEntity(PROLOG_STATE *state)
|
||||
{
|
||||
state->handler = externalSubset0;
|
||||
state->documentEntity = 0;
|
||||
state->includeLevel = 0;
|
||||
}
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
+16
-18
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlRole_INCLUDED
|
||||
@@ -77,7 +62,13 @@ enum {
|
||||
XML_ROLE_CONTENT_ELEMENT_REP,
|
||||
XML_ROLE_CONTENT_ELEMENT_OPT,
|
||||
XML_ROLE_CONTENT_ELEMENT_PLUS,
|
||||
XML_ROLE_PARAM_ENTITY_REF
|
||||
#ifdef XML_DTD
|
||||
XML_ROLE_TEXT_DECL,
|
||||
XML_ROLE_IGNORE_SECT,
|
||||
XML_ROLE_INNER_PARAM_ENTITY_REF,
|
||||
#endif /* XML_DTD */
|
||||
XML_ROLE_PARAM_ENTITY_REF,
|
||||
XML_ROLE_EXTERNAL_GENERAL_ENTITY_NO_NOTATION
|
||||
};
|
||||
|
||||
typedef struct prolog_state {
|
||||
@@ -87,9 +78,16 @@ typedef struct prolog_state {
|
||||
const char *end,
|
||||
const ENCODING *enc);
|
||||
unsigned level;
|
||||
#ifdef XML_DTD
|
||||
unsigned includeLevel;
|
||||
int documentEntity;
|
||||
#endif /* XML_DTD */
|
||||
} PROLOG_STATE;
|
||||
|
||||
void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *);
|
||||
#ifdef XML_DTD
|
||||
void XMLTOKAPI XmlPrologStateInitExternalEntity(PROLOG_STATE *);
|
||||
#endif /* XML_DTD */
|
||||
|
||||
#define XmlTokenRole(state, tok, ptr, end, enc) \
|
||||
(((state)->handler)(state, tok, ptr, end, enc))
|
||||
|
||||
+102
-62
@@ -1,29 +1,21 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include "xmldef.h"
|
||||
#include "xmltok.h"
|
||||
#include "nametab.h"
|
||||
|
||||
#ifdef XML_DTD
|
||||
#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok)
|
||||
#else
|
||||
#define IGNORE_SECTION_TOK_VTABLE /* as nothing */
|
||||
#endif
|
||||
|
||||
#define VTABLE1 \
|
||||
{ PREFIX(prologTok), PREFIX(contentTok), PREFIX(cdataSectionTok) }, \
|
||||
{ PREFIX(prologTok), PREFIX(contentTok), \
|
||||
PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \
|
||||
{ PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
|
||||
PREFIX(sameName), \
|
||||
PREFIX(nameMatchesAscii), \
|
||||
@@ -176,6 +168,7 @@ struct normal_encoding {
|
||||
static int checkCharRefNumber(int);
|
||||
|
||||
#include "xmltok_impl.h"
|
||||
#include "ascii.h"
|
||||
|
||||
#ifdef XML_MIN_SIZE
|
||||
#define sb_isNameMin isNever
|
||||
@@ -213,7 +206,7 @@ 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))
|
||||
#endif
|
||||
|
||||
#define IS_NAME_CHAR(enc, p, n) \
|
||||
@@ -658,7 +651,7 @@ int little2_isNmstrtMin(const ENCODING *enc, const char *p)
|
||||
|
||||
static const struct normal_encoding little2_encoding_ns = {
|
||||
{ VTABLE, 2, 0,
|
||||
#if BYTE_ORDER == 12
|
||||
#if XML_BYTE_ORDER == 12
|
||||
1
|
||||
#else
|
||||
0
|
||||
@@ -675,7 +668,7 @@ static const struct normal_encoding little2_encoding_ns = {
|
||||
|
||||
static const struct normal_encoding little2_encoding = {
|
||||
{ VTABLE, 2, 0,
|
||||
#if BYTE_ORDER == 12
|
||||
#if XML_BYTE_ORDER == 12
|
||||
1
|
||||
#else
|
||||
0
|
||||
@@ -690,7 +683,7 @@ static const struct normal_encoding little2_encoding = {
|
||||
STANDARD_VTABLE(little2_)
|
||||
};
|
||||
|
||||
#if BYTE_ORDER != 21
|
||||
#if XML_BYTE_ORDER != 21
|
||||
|
||||
#ifdef XML_NS
|
||||
|
||||
@@ -797,7 +790,7 @@ int big2_isNmstrtMin(const ENCODING *enc, const char *p)
|
||||
|
||||
static const struct normal_encoding big2_encoding_ns = {
|
||||
{ VTABLE, 2, 0,
|
||||
#if BYTE_ORDER == 21
|
||||
#if XML_BYTE_ORDER == 21
|
||||
1
|
||||
#else
|
||||
0
|
||||
@@ -814,7 +807,7 @@ static const struct normal_encoding big2_encoding_ns = {
|
||||
|
||||
static const struct normal_encoding big2_encoding = {
|
||||
{ VTABLE, 2, 0,
|
||||
#if BYTE_ORDER == 21
|
||||
#if XML_BYTE_ORDER == 21
|
||||
1
|
||||
#else
|
||||
0
|
||||
@@ -829,7 +822,7 @@ static const struct normal_encoding big2_encoding = {
|
||||
STANDARD_VTABLE(big2_)
|
||||
};
|
||||
|
||||
#if BYTE_ORDER != 12
|
||||
#if XML_BYTE_ORDER != 12
|
||||
|
||||
#ifdef XML_NS
|
||||
|
||||
@@ -865,10 +858,10 @@ 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 (ASCII_a <= c1 && c1 <= ASCII_z)
|
||||
c1 += ASCII_A - ASCII_a;
|
||||
if (ASCII_a <= c2 && c2 <= ASCII_z)
|
||||
c2 += ASCII_A - ASCII_a;
|
||||
if (c1 != c2)
|
||||
return 0;
|
||||
if (!c1)
|
||||
@@ -900,10 +893,10 @@ static
|
||||
int isSpace(int c)
|
||||
{
|
||||
switch (c) {
|
||||
case ' ':
|
||||
case '\r':
|
||||
case '\n':
|
||||
case '\t':
|
||||
case 0x20:
|
||||
case 0xD:
|
||||
case 0xA:
|
||||
case 0x9:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -916,6 +909,7 @@ int parsePseudoAttribute(const ENCODING *enc,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const char **namePtr,
|
||||
const char **nameEndPtr,
|
||||
const char **valPtr,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
@@ -943,13 +937,16 @@ int parsePseudoAttribute(const ENCODING *enc,
|
||||
*nextTokPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
if (c == '=')
|
||||
if (c == ASCII_EQUALS) {
|
||||
*nameEndPtr = ptr;
|
||||
break;
|
||||
}
|
||||
if (isSpace(c)) {
|
||||
*nameEndPtr = ptr;
|
||||
do {
|
||||
ptr += enc->minBytesPerChar;
|
||||
} while (isSpace(c = toAscii(enc, ptr, end)));
|
||||
if (c != '=') {
|
||||
if (c != ASCII_EQUALS) {
|
||||
*nextTokPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
@@ -967,7 +964,7 @@ int parsePseudoAttribute(const ENCODING *enc,
|
||||
ptr += enc->minBytesPerChar;
|
||||
c = toAscii(enc, ptr, end);
|
||||
}
|
||||
if (c != '"' && c != '\'') {
|
||||
if (c != ASCII_QUOT && c != ASCII_APOS) {
|
||||
*nextTokPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
@@ -978,12 +975,12 @@ int parsePseudoAttribute(const ENCODING *enc,
|
||||
c = toAscii(enc, ptr, end);
|
||||
if (c == open)
|
||||
break;
|
||||
if (!('a' <= c && c <= 'z')
|
||||
&& !('A' <= c && c <= 'Z')
|
||||
&& !('0' <= c && c <= '9')
|
||||
&& c != '.'
|
||||
&& c != '-'
|
||||
&& c != '_') {
|
||||
if (!(ASCII_a <= c && c <= ASCII_z)
|
||||
&& !(ASCII_A <= c && c <= ASCII_Z)
|
||||
&& !(ASCII_0 <= c && c <= ASCII_9)
|
||||
&& c != ASCII_PERIOD
|
||||
&& c != ASCII_MINUS
|
||||
&& c != ASCII_UNDERSCORE) {
|
||||
*nextTokPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
@@ -992,6 +989,26 @@ int parsePseudoAttribute(const ENCODING *enc,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char KW_version[] = {
|
||||
ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0'
|
||||
};
|
||||
|
||||
static const char KW_encoding[] = {
|
||||
ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0'
|
||||
};
|
||||
|
||||
static const char KW_standalone[] = {
|
||||
ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, ASCII_n, ASCII_e, '\0'
|
||||
};
|
||||
|
||||
static const char KW_yes[] = {
|
||||
ASCII_y, ASCII_e, ASCII_s, '\0'
|
||||
};
|
||||
|
||||
static const char KW_no[] = {
|
||||
ASCII_n, ASCII_o, '\0'
|
||||
};
|
||||
|
||||
static
|
||||
int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
|
||||
const char *,
|
||||
@@ -1008,13 +1025,14 @@ int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
|
||||
{
|
||||
const char *val = 0;
|
||||
const char *name = 0;
|
||||
const char *nameEnd = 0;
|
||||
ptr += 5 * enc->minBytesPerChar;
|
||||
end -= 2 * enc->minBytesPerChar;
|
||||
if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr) || !name) {
|
||||
if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) || !name) {
|
||||
*badPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
if (!XmlNameMatchesAscii(enc, name, "version")) {
|
||||
if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) {
|
||||
if (!isGeneralTextEntity) {
|
||||
*badPtr = name;
|
||||
return 0;
|
||||
@@ -1023,7 +1041,7 @@ int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
|
||||
else {
|
||||
if (versionPtr)
|
||||
*versionPtr = val;
|
||||
if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) {
|
||||
if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
|
||||
*badPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
@@ -1036,9 +1054,9 @@ int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, name, "encoding")) {
|
||||
if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) {
|
||||
int c = toAscii(enc, val, end);
|
||||
if (!('a' <= c && c <= 'z') && !('A' <= c && c <= 'Z')) {
|
||||
if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) {
|
||||
*badPtr = val;
|
||||
return 0;
|
||||
}
|
||||
@@ -1046,22 +1064,22 @@ int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
|
||||
*encodingName = val;
|
||||
if (encoding)
|
||||
*encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar);
|
||||
if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) {
|
||||
if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
|
||||
*badPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
if (!name)
|
||||
return 1;
|
||||
}
|
||||
if (!XmlNameMatchesAscii(enc, name, "standalone") || isGeneralTextEntity) {
|
||||
if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) || isGeneralTextEntity) {
|
||||
*badPtr = name;
|
||||
return 0;
|
||||
}
|
||||
if (XmlNameMatchesAscii(enc, val, "yes")) {
|
||||
if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) {
|
||||
if (standalone)
|
||||
*standalone = 1;
|
||||
}
|
||||
else if (XmlNameMatchesAscii(enc, val, "no")) {
|
||||
else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) {
|
||||
if (standalone)
|
||||
*standalone = 0;
|
||||
}
|
||||
@@ -1158,7 +1176,7 @@ struct unknown_encoding {
|
||||
char utf8[256][4];
|
||||
};
|
||||
|
||||
int XmlSizeOfUnknownEncoding()
|
||||
int XmlSizeOfUnknownEncoding(void)
|
||||
{
|
||||
return sizeof(struct unknown_encoding);
|
||||
}
|
||||
@@ -1253,7 +1271,7 @@ XmlInitUnknownEncoding(void *mem,
|
||||
{
|
||||
int i;
|
||||
struct unknown_encoding *e = mem;
|
||||
for (i = 0; i < sizeof(struct normal_encoding); i++)
|
||||
for (i = 0; i < (int)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
|
||||
@@ -1338,21 +1356,40 @@ enum {
|
||||
NO_ENC
|
||||
};
|
||||
|
||||
static const char KW_ISO_8859_1[] = {
|
||||
ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, ASCII_MINUS, ASCII_1, '\0'
|
||||
};
|
||||
static const char KW_US_ASCII[] = {
|
||||
ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, '\0'
|
||||
};
|
||||
static const char KW_UTF_8[] = {
|
||||
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0'
|
||||
};
|
||||
static const char KW_UTF_16[] = {
|
||||
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0'
|
||||
};
|
||||
static const char KW_UTF_16BE[] = {
|
||||
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, '\0'
|
||||
};
|
||||
static const char KW_UTF_16LE[] = {
|
||||
ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, '\0'
|
||||
};
|
||||
|
||||
static
|
||||
int getEncodingIndex(const char *name)
|
||||
{
|
||||
static const char *encodingNames[] = {
|
||||
"ISO-8859-1",
|
||||
"US-ASCII",
|
||||
"UTF-8",
|
||||
"UTF-16",
|
||||
"UTF-16BE"
|
||||
"UTF-16LE",
|
||||
KW_ISO_8859_1,
|
||||
KW_US_ASCII,
|
||||
KW_UTF_8,
|
||||
KW_UTF_16,
|
||||
KW_UTF_16BE,
|
||||
KW_UTF_16LE,
|
||||
};
|
||||
int i;
|
||||
if (name == 0)
|
||||
return NO_ENC;
|
||||
for (i = 0; i < sizeof(encodingNames)/sizeof(encodingNames[0]); i++)
|
||||
for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++)
|
||||
if (streqci(name, encodingNames[i]))
|
||||
return i;
|
||||
return UNKNOWN_ENC;
|
||||
@@ -1361,7 +1398,8 @@ int getEncodingIndex(const char *name)
|
||||
/* 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)
|
||||
#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16)
|
||||
#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i)
|
||||
|
||||
/* This is what detects the encoding.
|
||||
encodingTable maps from encoding indices to encodings;
|
||||
@@ -1386,9 +1424,11 @@ int initScan(const ENCODING **encodingTable,
|
||||
encPtr = enc->encPtr;
|
||||
if (ptr + 1 == end) {
|
||||
/* only a single byte available for auto-detection */
|
||||
#ifndef XML_DTD /* FIXME */
|
||||
/* a well-formed document entity must have more than one byte */
|
||||
if (state != XML_CONTENT_STATE)
|
||||
return XML_TOK_PARTIAL;
|
||||
#endif
|
||||
/* 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)) {
|
||||
@@ -1510,7 +1550,7 @@ XmlInitUnknownEncodingNS(void *mem,
|
||||
{
|
||||
ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
|
||||
if (enc)
|
||||
((struct normal_encoding *)enc)->type[':'] = BT_COLON;
|
||||
((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON;
|
||||
return enc;
|
||||
}
|
||||
|
||||
|
||||
+39
-3
@@ -43,7 +43,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir "."
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D XMLTOKAPI=__declspec(dllexport) /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "XML_NS" /D XMLTOKAPI=__declspec(dllexport) /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
@@ -53,7 +53,8 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmltok.dll"
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"..\bin\xmltok.dll" /link50compat
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
|
||||
|
||||
@@ -69,7 +70,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir "."
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D XMLTOKAPI=__declspec(dllexport) /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "XML_NS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
@@ -96,6 +97,41 @@ SOURCE=.\dllmain.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\gennmtab\gennmtab.c
|
||||
|
||||
!IF "$(CFG)" == "xmltok - Win32 Release"
|
||||
|
||||
# PROP Ignore_Default_Tool 1
|
||||
# Begin Custom Build - Creating nametab.h
|
||||
InputDir=\home\work\xmls\gennmtab
|
||||
OutDir=.\Release
|
||||
ProjDir=.
|
||||
InputPath=..\gennmtab\gennmtab.c
|
||||
|
||||
"$(ProjDir)\nametab.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(InputDir)\$(OutDir)\gennmtab >$(ProjDir)\nametab.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
|
||||
|
||||
# PROP Ignore_Default_Tool 1
|
||||
# Begin Custom Build - Creating nametab.h
|
||||
InputDir=\home\work\xmls\gennmtab
|
||||
OutDir=.\Debug
|
||||
ProjDir=.
|
||||
InputPath=..\gennmtab\gennmtab.c
|
||||
|
||||
"$(ProjDir)\nametab.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(InputDir)\$(OutDir)\gennmtab >$(ProjDir)\nametab.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\xmlrole.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+31
-27
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlTok_INCLUDED
|
||||
@@ -98,10 +83,22 @@ extern "C" {
|
||||
for a name with a colon. */
|
||||
#define XML_TOK_PREFIXED_NAME 41
|
||||
|
||||
#ifdef XML_DTD
|
||||
#define XML_TOK_IGNORE_SECT 42
|
||||
#endif /* XML_DTD */
|
||||
|
||||
#ifdef XML_DTD
|
||||
#define XML_N_STATES 4
|
||||
#else /* not XML_DTD */
|
||||
#define XML_N_STATES 3
|
||||
#endif /* not XML_DTD */
|
||||
|
||||
#define XML_PROLOG_STATE 0
|
||||
#define XML_CONTENT_STATE 1
|
||||
#define XML_CDATA_SECTION_STATE 2
|
||||
#ifdef XML_DTD
|
||||
#define XML_IGNORE_SECTION_STATE 3
|
||||
#endif /* XML_DTD */
|
||||
|
||||
#define XML_N_LITERAL_TYPES 2
|
||||
#define XML_ATTRIBUTE_VALUE_LITERAL 0
|
||||
@@ -140,7 +137,7 @@ struct encoding {
|
||||
int (*sameName)(const ENCODING *,
|
||||
const char *, const char *);
|
||||
int (*nameMatchesAscii)(const ENCODING *,
|
||||
const char *, const char *);
|
||||
const char *, const char *, const char *);
|
||||
int (*nameLength)(const ENCODING *, const char *);
|
||||
const char *(*skipS)(const ENCODING *, const char *);
|
||||
int (*getAtts)(const ENCODING *enc, const char *ptr,
|
||||
@@ -201,6 +198,13 @@ literals, comments and processing instructions.
|
||||
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
/* This is used for performing a 2nd-level tokenization on
|
||||
the content of a literal that has already been returned by XmlTok. */
|
||||
|
||||
@@ -215,8 +219,8 @@ the content of a literal that has already been returned by XmlTok. */
|
||||
|
||||
#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
|
||||
|
||||
#define XmlNameMatchesAscii(enc, ptr1, ptr2) \
|
||||
(((enc)->nameMatchesAscii)(enc, ptr1, ptr2))
|
||||
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
|
||||
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
|
||||
|
||||
#define XmlNameLength(enc, ptr) \
|
||||
(((enc)->nameLength)(enc, ptr))
|
||||
@@ -261,16 +265,16 @@ int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
|
||||
int *standalonePtr);
|
||||
|
||||
int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding();
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding();
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding(void);
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding(void);
|
||||
int XMLTOKAPI XmlUtf8Encode(int charNumber, char *buf);
|
||||
int XMLTOKAPI XmlUtf16Encode(int charNumber, unsigned short *buf);
|
||||
|
||||
int XMLTOKAPI XmlSizeOfUnknownEncoding();
|
||||
int XMLTOKAPI XmlSizeOfUnknownEncoding(void);
|
||||
ENCODING XMLTOKAPI *
|
||||
XmlInitUnknownEncoding(void *mem,
|
||||
int *table,
|
||||
int (*convert)(void *userData, const char *p),
|
||||
int (*conv)(void *userData, const char *p),
|
||||
void *userData);
|
||||
|
||||
int XMLTOKAPI XmlParseXmlDeclNS(int isGeneralTextEntity,
|
||||
@@ -283,12 +287,12 @@ int XMLTOKAPI XmlParseXmlDeclNS(int isGeneralTextEntity,
|
||||
const ENCODING **namedEncodingPtr,
|
||||
int *standalonePtr);
|
||||
int XMLTOKAPI XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncodingNS();
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncodingNS();
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncodingNS(void);
|
||||
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncodingNS(void);
|
||||
ENCODING XMLTOKAPI *
|
||||
XmlInitUnknownEncodingNS(void *mem,
|
||||
int *table,
|
||||
int (*convert)(void *userData, const char *p),
|
||||
int (*conv)(void *userData, const char *p),
|
||||
void *userData);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+127
-98
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef IS_INVALID_CHAR
|
||||
@@ -107,7 +92,7 @@ int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
if (ptr != end) {
|
||||
if (!CHAR_MATCHES(enc, ptr, '-')) {
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
|
||||
*nextTokPtr = ptr;
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
@@ -118,10 +103,10 @@ int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
case BT_MINUS:
|
||||
if ((ptr += MINBPC(enc)) == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, '-')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
|
||||
if ((ptr += MINBPC(enc)) == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (!CHAR_MATCHES(enc, ptr, '>')) {
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
*nextTokPtr = ptr;
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
@@ -195,9 +180,9 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
if (end - ptr != MINBPC(enc)*3)
|
||||
return 1;
|
||||
switch (BYTE_TO_ASCII(enc, ptr)) {
|
||||
case 'x':
|
||||
case ASCII_x:
|
||||
break;
|
||||
case 'X':
|
||||
case ASCII_X:
|
||||
upper = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -205,9 +190,9 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
}
|
||||
ptr += MINBPC(enc);
|
||||
switch (BYTE_TO_ASCII(enc, ptr)) {
|
||||
case 'm':
|
||||
case ASCII_m:
|
||||
break;
|
||||
case 'M':
|
||||
case ASCII_M:
|
||||
upper = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -215,9 +200,9 @@ int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
}
|
||||
ptr += MINBPC(enc);
|
||||
switch (BYTE_TO_ASCII(enc, ptr)) {
|
||||
case 'l':
|
||||
case ASCII_l:
|
||||
break;
|
||||
case 'L':
|
||||
case ASCII_L:
|
||||
upper = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -261,7 +246,7 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, '>')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
*nextTokPtr = ptr + MINBPC(enc);
|
||||
return tok;
|
||||
}
|
||||
@@ -280,7 +265,7 @@ int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, '>')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
*nextTokPtr = ptr + MINBPC(enc);
|
||||
return tok;
|
||||
}
|
||||
@@ -298,12 +283,13 @@ static
|
||||
int PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, ASCII_LSQB };
|
||||
int i;
|
||||
/* CDATA[ */
|
||||
if (end - ptr < 6 * MINBPC(enc))
|
||||
return XML_TOK_PARTIAL;
|
||||
for (i = 0; i < 6; i++, ptr += MINBPC(enc)) {
|
||||
if (!CHAR_MATCHES(enc, ptr, "CDATA["[i])) {
|
||||
if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) {
|
||||
*nextTokPtr = ptr;
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
@@ -332,12 +318,12 @@ int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *en
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (!CHAR_MATCHES(enc, ptr, ']'))
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
|
||||
break;
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (!CHAR_MATCHES(enc, ptr, '>')) {
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
ptr -= MINBPC(enc);
|
||||
break;
|
||||
}
|
||||
@@ -475,7 +461,7 @@ int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
if (ptr != end) {
|
||||
if (CHAR_MATCHES(enc, ptr, 'x'))
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_x))
|
||||
return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
|
||||
switch (BYTE_TYPE(enc, ptr)) {
|
||||
case BT_DIGIT:
|
||||
@@ -668,7 +654,7 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (!CHAR_MATCHES(enc, ptr, '>')) {
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
*nextTokPtr = ptr;
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
@@ -777,7 +763,7 @@ int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (!CHAR_MATCHES(enc, ptr, '>')) {
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
*nextTokPtr = ptr;
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
@@ -826,12 +812,12 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_TRAILING_RSQB;
|
||||
if (!CHAR_MATCHES(enc, ptr, ']'))
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
|
||||
break;
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_TRAILING_RSQB;
|
||||
if (!CHAR_MATCHES(enc, ptr, '>')) {
|
||||
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
ptr -= MINBPC(enc);
|
||||
break;
|
||||
}
|
||||
@@ -856,12 +842,12 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
#undef LEAD_CASE
|
||||
case BT_RSQB:
|
||||
if (ptr + MINBPC(enc) != end) {
|
||||
if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ']')) {
|
||||
if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) {
|
||||
ptr += MINBPC(enc);
|
||||
break;
|
||||
}
|
||||
if (ptr + 2*MINBPC(enc) != end) {
|
||||
if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), '>')) {
|
||||
if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) {
|
||||
ptr += MINBPC(enc);
|
||||
break;
|
||||
}
|
||||
@@ -943,7 +929,7 @@ int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
}
|
||||
return XML_TOK_PARTIAL;
|
||||
return -XML_TOK_POUND_NAME;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -961,7 +947,7 @@ int PREFIX(scanLit)(int open, const ENCODING *enc,
|
||||
if (t != open)
|
||||
break;
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
return -XML_TOK_LITERAL;
|
||||
*nextTokPtr = ptr;
|
||||
switch (BYTE_TYPE(enc, ptr)) {
|
||||
case BT_S: case BT_CR: case BT_LF:
|
||||
@@ -1023,7 +1009,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
}
|
||||
case BT_CR:
|
||||
if (ptr + MINBPC(enc) == end)
|
||||
return XML_TOK_TRAILING_CR;
|
||||
return -XML_TOK_PROLOG_S;
|
||||
/* fall through */
|
||||
case BT_S: case BT_LF:
|
||||
for (;;) {
|
||||
@@ -1056,11 +1042,11 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
case BT_RSQB:
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, ']')) {
|
||||
return -XML_TOK_CLOSE_BRACKET;
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
|
||||
if (ptr + MINBPC(enc) == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr + MINBPC(enc), '>')) {
|
||||
if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) {
|
||||
*nextTokPtr = ptr + 2*MINBPC(enc);
|
||||
return XML_TOK_COND_SECT_CLOSE;
|
||||
}
|
||||
@@ -1073,7 +1059,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
case BT_RPAR:
|
||||
ptr += MINBPC(enc);
|
||||
if (ptr == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
return -XML_TOK_CLOSE_PAREN;
|
||||
switch (BYTE_TYPE(enc, ptr)) {
|
||||
case BT_AST:
|
||||
*nextTokPtr = ptr + MINBPC(enc);
|
||||
@@ -1203,7 +1189,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
}
|
||||
return XML_TOK_PARTIAL;
|
||||
return -tok;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -1316,6 +1302,61 @@ int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end
|
||||
return XML_TOK_DATA_CHARS;
|
||||
}
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static
|
||||
int PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
int level = 0;
|
||||
if (MINBPC(enc) > 1) {
|
||||
size_t n = end - ptr;
|
||||
if (n & (MINBPC(enc) - 1)) {
|
||||
n &= ~(MINBPC(enc) - 1);
|
||||
end = ptr + n;
|
||||
}
|
||||
}
|
||||
while (ptr != end) {
|
||||
switch (BYTE_TYPE(enc, ptr)) {
|
||||
INVALID_CASES(ptr, nextTokPtr)
|
||||
case BT_LT:
|
||||
if ((ptr += MINBPC(enc)) == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) {
|
||||
if ((ptr += MINBPC(enc)) == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) {
|
||||
++level;
|
||||
ptr += MINBPC(enc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BT_RSQB:
|
||||
if ((ptr += MINBPC(enc)) == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
|
||||
if ((ptr += MINBPC(enc)) == end)
|
||||
return XML_TOK_PARTIAL;
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
|
||||
ptr += MINBPC(enc);
|
||||
if (level == 0) {
|
||||
*nextTokPtr = ptr;
|
||||
return XML_TOK_IGNORE_SECT;
|
||||
}
|
||||
--level;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ptr += MINBPC(enc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static
|
||||
int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **badPtr)
|
||||
@@ -1347,7 +1388,7 @@ int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
#endif
|
||||
break;
|
||||
case BT_S:
|
||||
if (CHAR_MATCHES(enc, ptr, '\t')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) {
|
||||
*badPtr = ptr;
|
||||
return 0;
|
||||
}
|
||||
@@ -1381,7 +1422,8 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
|
||||
{
|
||||
enum { other, inName, inValue } state = inName;
|
||||
int nAtts = 0;
|
||||
int open;
|
||||
int open = 0; /* defined when state == inValue;
|
||||
initialization just to shut up compilers */
|
||||
|
||||
for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) {
|
||||
switch (BYTE_TYPE(enc, ptr)) {
|
||||
@@ -1442,8 +1484,8 @@ int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
|
||||
&& nAtts < attsMax
|
||||
&& atts[nAtts].normalized
|
||||
&& (ptr == atts[nAtts].valuePtr
|
||||
|| BYTE_TO_ASCII(enc, ptr) != ' '
|
||||
|| BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ' '
|
||||
|| BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE
|
||||
|| BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE
|
||||
|| BYTE_TYPE(enc, ptr + MINBPC(enc)) == open))
|
||||
atts[nAtts].normalized = 0;
|
||||
break;
|
||||
@@ -1473,22 +1515,22 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
|
||||
int result = 0;
|
||||
/* skip &# */
|
||||
ptr += 2*MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 'x')) {
|
||||
for (ptr += MINBPC(enc); !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC(enc)) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_x)) {
|
||||
for (ptr += MINBPC(enc); !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) {
|
||||
int c = BYTE_TO_ASCII(enc, ptr);
|
||||
switch (c) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4:
|
||||
case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9:
|
||||
result <<= 4;
|
||||
result |= (c - '0');
|
||||
result |= (c - ASCII_0);
|
||||
break;
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case ASCII_A: case ASCII_B: case ASCII_C: case ASCII_D: case ASCII_E: case ASCII_F:
|
||||
result <<= 4;
|
||||
result += 10 + (c - 'A');
|
||||
result += 10 + (c - ASCII_A);
|
||||
break;
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case ASCII_a: case ASCII_b: case ASCII_c: case ASCII_d: case ASCII_e: case ASCII_f:
|
||||
result <<= 4;
|
||||
result += 10 + (c - 'a');
|
||||
result += 10 + (c - ASCII_a);
|
||||
break;
|
||||
}
|
||||
if (result >= 0x110000)
|
||||
@@ -1496,10 +1538,10 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (; !CHAR_MATCHES(enc, ptr, ';'); ptr += MINBPC(enc)) {
|
||||
for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) {
|
||||
int c = BYTE_TO_ASCII(enc, ptr);
|
||||
result *= 10;
|
||||
result += (c - '0');
|
||||
result += (c - ASCII_0);
|
||||
if (result >= 0x110000)
|
||||
return -1;
|
||||
}
|
||||
@@ -1512,46 +1554,46 @@ int PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const cha
|
||||
{
|
||||
switch ((end - ptr)/MINBPC(enc)) {
|
||||
case 2:
|
||||
if (CHAR_MATCHES(enc, ptr + MINBPC(enc), 't')) {
|
||||
if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) {
|
||||
switch (BYTE_TO_ASCII(enc, ptr)) {
|
||||
case 'l':
|
||||
return '<';
|
||||
case 'g':
|
||||
return '>';
|
||||
case ASCII_l:
|
||||
return ASCII_LT;
|
||||
case ASCII_g:
|
||||
return ASCII_GT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (CHAR_MATCHES(enc, ptr, 'a')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_a)) {
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 'm')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_m)) {
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 'p'))
|
||||
return '&';
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_p))
|
||||
return ASCII_AMP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (BYTE_TO_ASCII(enc, ptr)) {
|
||||
case 'q':
|
||||
case ASCII_q:
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 'u')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_u)) {
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 'o')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_o)) {
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 't'))
|
||||
return '"';
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_t))
|
||||
return ASCII_QUOT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
case ASCII_a:
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 'p')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_p)) {
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 'o')) {
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_o)) {
|
||||
ptr += MINBPC(enc);
|
||||
if (CHAR_MATCHES(enc, ptr, 's'))
|
||||
return '\'';
|
||||
if (CHAR_MATCHES(enc, ptr, ASCII_s))
|
||||
return ASCII_APOS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1625,29 +1667,16 @@ int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
|
||||
}
|
||||
|
||||
static
|
||||
int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, const char *ptr2)
|
||||
int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
|
||||
const char *end1, const char *ptr2)
|
||||
{
|
||||
for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {
|
||||
if (ptr1 == end1)
|
||||
return 0;
|
||||
if (!CHAR_MATCHES(enc, ptr1, *ptr2))
|
||||
return 0;
|
||||
}
|
||||
switch (BYTE_TYPE(enc, ptr1)) {
|
||||
case BT_LEAD2:
|
||||
case BT_LEAD3:
|
||||
case BT_LEAD4:
|
||||
case BT_NONASCII:
|
||||
case BT_NMSTRT:
|
||||
#ifdef XML_NS
|
||||
case BT_COLON:
|
||||
#endif
|
||||
case BT_HEX:
|
||||
case BT_DIGIT:
|
||||
case BT_NAME:
|
||||
case BT_MINUS:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return ptr1 == end1;
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
enum {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
const ENCODING *NS(XmlGetUtf8InternalEncoding)()
|
||||
const ENCODING *NS(XmlGetUtf8InternalEncoding)(void)
|
||||
{
|
||||
return &ns(internal_utf8_encoding).enc;
|
||||
}
|
||||
|
||||
const ENCODING *NS(XmlGetUtf16InternalEncoding)()
|
||||
const ENCODING *NS(XmlGetUtf16InternalEncoding)(void)
|
||||
{
|
||||
#if BYTE_ORDER == 12
|
||||
#if XML_BYTE_ORDER == 12
|
||||
return &ns(internal_little2_encoding).enc;
|
||||
#elif BYTE_ORDER == 21
|
||||
#elif XML_BYTE_ORDER == 21
|
||||
return &ns(internal_big2_encoding).enc;
|
||||
#else
|
||||
const short n = 1;
|
||||
@@ -45,7 +45,7 @@ int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *n
|
||||
int i = getEncodingIndex(name);
|
||||
if (i == UNKNOWN_ENC)
|
||||
return 0;
|
||||
INIT_ENC_INDEX(p) = (char)i;
|
||||
SET_INIT_ENC_INDEX(p, i);
|
||||
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
|
||||
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
|
||||
p->initEnc.updatePosition = initUpdatePosition;
|
||||
@@ -65,7 +65,7 @@ const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const cha
|
||||
if (ptr != end)
|
||||
return 0;
|
||||
*p = 0;
|
||||
if (streqci(buf, "UTF-16") && enc->minBytesPerChar == 2)
|
||||
if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
|
||||
return enc;
|
||||
i = getEncodingIndex(buf);
|
||||
if (i == UNKNOWN_ENC)
|
||||
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
Debug
|
||||
Release
|
||||
xmlwf.plg
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include "codepage.h"
|
||||
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
int codepageMap(int cp, int *map);
|
||||
|
||||
Executable
+145
@@ -0,0 +1,145 @@
|
||||
#define CHARSET_MAX 41
|
||||
|
||||
static
|
||||
const char *getTok(const char **pp)
|
||||
{
|
||||
enum { inAtom, inString, init, inComment };
|
||||
int state = init;
|
||||
const char *tokStart = 0;
|
||||
for (;;) {
|
||||
switch (**pp) {
|
||||
case '\0':
|
||||
return 0;
|
||||
case ' ':
|
||||
case '\r':
|
||||
case '\t':
|
||||
case '\n':
|
||||
if (state == inAtom)
|
||||
return tokStart;
|
||||
break;
|
||||
case '(':
|
||||
if (state == inAtom)
|
||||
return tokStart;
|
||||
if (state != inString)
|
||||
state++;
|
||||
break;
|
||||
case ')':
|
||||
if (state > init)
|
||||
--state;
|
||||
else if (state != inString)
|
||||
return 0;
|
||||
break;
|
||||
case ';':
|
||||
case '/':
|
||||
case '=':
|
||||
if (state == inAtom)
|
||||
return tokStart;
|
||||
if (state == init)
|
||||
return (*pp)++;
|
||||
break;
|
||||
case '\\':
|
||||
++*pp;
|
||||
if (**pp == '\0')
|
||||
return 0;
|
||||
break;
|
||||
case '"':
|
||||
switch (state) {
|
||||
case inString:
|
||||
++*pp;
|
||||
return tokStart;
|
||||
case inAtom:
|
||||
return tokStart;
|
||||
case init:
|
||||
tokStart = *pp;
|
||||
state = inString;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (state == init) {
|
||||
tokStart = *pp;
|
||||
state = inAtom;
|
||||
}
|
||||
break;
|
||||
}
|
||||
++*pp;
|
||||
}
|
||||
/* not reached */
|
||||
}
|
||||
|
||||
/* key must be lowercase ASCII */
|
||||
|
||||
static
|
||||
int matchkey(const char *start, const char *end, const char *key)
|
||||
{
|
||||
if (!start)
|
||||
return 0;
|
||||
for (; start != end; start++, key++)
|
||||
if (*start != *key && *start != 'A' + (*key - 'a'))
|
||||
return 0;
|
||||
return *key == '\0';
|
||||
}
|
||||
|
||||
void getXMLCharset(const char *buf, char *charset)
|
||||
{
|
||||
const char *next, *p;
|
||||
|
||||
charset[0] = '\0';
|
||||
next = buf;
|
||||
p = getTok(&next);
|
||||
if (matchkey(p, next, "text"))
|
||||
strcpy(charset, "us-ascii");
|
||||
else if (!matchkey(p, next, "application"))
|
||||
return;
|
||||
p = getTok(&next);
|
||||
if (!p || *p != '/')
|
||||
return;
|
||||
p = getTok(&next);
|
||||
if (matchkey(p, next, "xml"))
|
||||
isXml = 1;
|
||||
p = getTok(&next);
|
||||
while (p) {
|
||||
if (*p == ';') {
|
||||
p = getTok(&next);
|
||||
if (matchkey(p, next, "charset")) {
|
||||
p = getTok(&next);
|
||||
if (p && *p == '=') {
|
||||
p = getTok(&next);
|
||||
if (p) {
|
||||
char *s = charset;
|
||||
if (*p == '"') {
|
||||
while (++p != next - 1) {
|
||||
if (*p == '\\')
|
||||
++p;
|
||||
if (s == charset + CHARSET_MAX - 1) {
|
||||
charset[0] = '\0';
|
||||
break;
|
||||
}
|
||||
*s++ = *p;
|
||||
}
|
||||
*s++ = '\0';
|
||||
}
|
||||
else {
|
||||
if (next - p > CHARSET_MAX - 1)
|
||||
break;
|
||||
while (p != next)
|
||||
*s++ = *p++;
|
||||
*s = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
p = getTok(&next);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char buf[CHARSET_MAX];
|
||||
getXMLCharset(argv[1], buf);
|
||||
printf("charset = \"%s\"\n", buf);
|
||||
return 0;
|
||||
}
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#define STRICT 1
|
||||
|
||||
+7
-18
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -63,7 +48,7 @@ void reportError(XML_Parser parser, const XML_Char *filename)
|
||||
int code = XML_GetErrorCode(parser);
|
||||
const XML_Char *message = XML_ErrorString(code);
|
||||
if (message)
|
||||
ftprintf(stdout, T("%s:%d:%ld: %s\n"),
|
||||
ftprintf(stdout, T("%s:%d:%d: %s\n"),
|
||||
filename,
|
||||
XML_GetErrorLineNumber(parser),
|
||||
XML_GetErrorColumnNumber(parser),
|
||||
@@ -88,12 +73,16 @@ void processFile(const void *data,
|
||||
*retPtr = 1;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
static
|
||||
int isAsciiLetter(XML_Char c)
|
||||
{
|
||||
return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z'));
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
static
|
||||
const XML_Char *resolveSystemId(const XML_Char *base, const XML_Char *systemId, XML_Char **toFree)
|
||||
{
|
||||
|
||||
+2
-17
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#define XML_MAP_FILE 01
|
||||
|
||||
+265
-87
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
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
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is expat.
|
||||
|
||||
The Initial Developer of the Original Code is James Clark.
|
||||
Portions created by James Clark are Copyright (C) 1998
|
||||
James Clark. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file copying.txt for copying permission.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -32,6 +17,8 @@ Contributor(s):
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
/* This ensures proper sorting. */
|
||||
|
||||
#define NSSEP T('\001')
|
||||
|
||||
static void characterData(void *userData, const XML_Char *s, int len)
|
||||
@@ -48,6 +35,11 @@ static void characterData(void *userData, const XML_Char *s, int len)
|
||||
case T('>'):
|
||||
fputts(T(">"), fp);
|
||||
break;
|
||||
#ifdef W3C14N
|
||||
case 13:
|
||||
fputts(T("
"), fp);
|
||||
break;
|
||||
#else
|
||||
case T('"'):
|
||||
fputts(T("""), fp);
|
||||
break;
|
||||
@@ -56,6 +48,7 @@ static void characterData(void *userData, const XML_Char *s, int len)
|
||||
case 13:
|
||||
ftprintf(fp, T("&#%d;"), *s);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
puttc(*s, fp);
|
||||
break;
|
||||
@@ -63,6 +56,53 @@ static void characterData(void *userData, const XML_Char *s, int len)
|
||||
}
|
||||
}
|
||||
|
||||
static void attributeValue(FILE *fp, const XML_Char *s)
|
||||
{
|
||||
puttc(T('='), fp);
|
||||
puttc(T('"'), fp);
|
||||
for (;;) {
|
||||
switch (*s) {
|
||||
case 0:
|
||||
case NSSEP:
|
||||
puttc(T('"'), fp);
|
||||
return;
|
||||
case T('&'):
|
||||
fputts(T("&"), fp);
|
||||
break;
|
||||
case T('<'):
|
||||
fputts(T("<"), fp);
|
||||
break;
|
||||
case T('"'):
|
||||
fputts(T("""), fp);
|
||||
break;
|
||||
#ifdef W3C14N
|
||||
case 9:
|
||||
fputts(T("	"), fp);
|
||||
break;
|
||||
case 10:
|
||||
fputts(T("
"), fp);
|
||||
break;
|
||||
case 13:
|
||||
fputts(T("
"), fp);
|
||||
break;
|
||||
#else
|
||||
case T('>'):
|
||||
fputts(T(">"), fp);
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
case 13:
|
||||
ftprintf(fp, T("&#%d;"), *s);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
puttc(*s, fp);
|
||||
break;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Lexicographically comparing UTF-8 encoded attribute values,
|
||||
is equivalent to lexicographically comparing based on the character number. */
|
||||
|
||||
@@ -88,10 +128,7 @@ static void startElement(void *userData, const XML_Char *name, const XML_Char **
|
||||
while (*atts) {
|
||||
puttc(T(' '), fp);
|
||||
fputts(*atts++, fp);
|
||||
puttc(T('='), fp);
|
||||
puttc(T('"'), fp);
|
||||
characterData(userData, *atts, tcslen(*atts));
|
||||
puttc(T('"'), fp);
|
||||
attributeValue(fp, *atts);
|
||||
atts++;
|
||||
}
|
||||
puttc(T('>'), fp);
|
||||
@@ -106,6 +143,17 @@ static void endElement(void *userData, const XML_Char *name)
|
||||
puttc(T('>'), fp);
|
||||
}
|
||||
|
||||
static int nsattcmp(const void *p1, const void *p2)
|
||||
{
|
||||
const XML_Char *att1 = *(const XML_Char **)p1;
|
||||
const XML_Char *att2 = *(const XML_Char **)p2;
|
||||
int sep1 = (tcsrchr(att1, NSSEP) != 0);
|
||||
int sep2 = (tcsrchr(att1, NSSEP) != 0);
|
||||
if (sep1 != sep2)
|
||||
return sep1 - sep2;
|
||||
return tcscmp(att1, att2);
|
||||
}
|
||||
|
||||
static void startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
int nAtts;
|
||||
@@ -117,16 +165,15 @@ static void startElementNS(void *userData, const XML_Char *name, const XML_Char
|
||||
|
||||
sep = tcsrchr(name, NSSEP);
|
||||
if (sep) {
|
||||
fputts(T("ns0:"), fp);
|
||||
fputts(T("n1:"), fp);
|
||||
fputts(sep + 1, fp);
|
||||
fputts(T(" xmlns:ns0=\""), fp);
|
||||
characterData(userData, name, sep - name);
|
||||
puttc(T('"'), fp);
|
||||
nsi = 1;
|
||||
fputts(T(" xmlns:n1"), fp);
|
||||
attributeValue(fp, name);
|
||||
nsi = 2;
|
||||
}
|
||||
else {
|
||||
fputts(name, fp);
|
||||
nsi = 0;
|
||||
nsi = 1;
|
||||
}
|
||||
|
||||
p = atts;
|
||||
@@ -134,24 +181,22 @@ static void startElementNS(void *userData, const XML_Char *name, const XML_Char
|
||||
++p;
|
||||
nAtts = (p - atts) >> 1;
|
||||
if (nAtts > 1)
|
||||
qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp);
|
||||
qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp);
|
||||
while (*atts) {
|
||||
name = *atts++;
|
||||
sep = tcsrchr(name, NSSEP);
|
||||
puttc(T(' '), fp);
|
||||
if (sep) {
|
||||
ftprintf(fp, T(" xmlns:ns%d=\""), nsi);
|
||||
characterData(userData, name, sep - name);
|
||||
puttc(T('"'), fp);
|
||||
name = sep + 1;
|
||||
ftprintf(fp, T(" ns%d:"), nsi++);
|
||||
ftprintf(fp, T("n%d:"), nsi);
|
||||
fputts(sep + 1, fp);
|
||||
}
|
||||
else
|
||||
puttc(T(' '), fp);
|
||||
fputts(name, fp);
|
||||
puttc(T('='), fp);
|
||||
puttc(T('"'), fp);
|
||||
characterData(userData, *atts, tcslen(*atts));
|
||||
puttc(T('"'), fp);
|
||||
fputts(name, fp);
|
||||
attributeValue(fp, *atts);
|
||||
if (sep) {
|
||||
ftprintf(fp, T(" xmlns:n%d"), nsi++);
|
||||
attributeValue(fp, name);
|
||||
}
|
||||
atts++;
|
||||
}
|
||||
puttc(T('>'), fp);
|
||||
@@ -165,7 +210,7 @@ static void endElementNS(void *userData, const XML_Char *name)
|
||||
puttc(T('/'), fp);
|
||||
sep = tcsrchr(name, NSSEP);
|
||||
if (sep) {
|
||||
fputts(T("ns0:"), fp);
|
||||
fputts(T("n1:"), fp);
|
||||
fputts(sep + 1, fp);
|
||||
}
|
||||
else
|
||||
@@ -173,6 +218,8 @@ static void endElementNS(void *userData, const XML_Char *name)
|
||||
puttc(T('>'), fp);
|
||||
}
|
||||
|
||||
#ifndef W3C14N
|
||||
|
||||
static void processingInstruction(void *userData, const XML_Char *target, const XML_Char *data)
|
||||
{
|
||||
FILE *fp = userData;
|
||||
@@ -185,6 +232,8 @@ static void processingInstruction(void *userData, const XML_Char *target, const
|
||||
puttc(T('>'), fp);
|
||||
}
|
||||
|
||||
#endif /* not W3C14N */
|
||||
|
||||
static void defaultCharacterData(XML_Parser parser, const XML_Char *s, int len)
|
||||
{
|
||||
XML_DefaultCurrent(parser);
|
||||
@@ -235,8 +284,9 @@ void metaLocation(XML_Parser parser)
|
||||
if (uri)
|
||||
ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri);
|
||||
ftprintf(XML_GetUserData(parser),
|
||||
T(" byte=\"%ld\" line=\"%d\" col=\"%d\""),
|
||||
T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""),
|
||||
XML_GetCurrentByteIndex(parser),
|
||||
XML_GetCurrentByteCount(parser),
|
||||
XML_GetCurrentLineNumber(parser),
|
||||
XML_GetCurrentColumnNumber(parser));
|
||||
}
|
||||
@@ -257,6 +307,15 @@ static
|
||||
void metaStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
const XML_Char **specifiedAttsEnd
|
||||
= atts + XML_GetSpecifiedAttributeCount(parser);
|
||||
const XML_Char **idAttPtr;
|
||||
int idAttIndex = XML_GetIdAttributeIndex(parser);
|
||||
if (idAttIndex < 0)
|
||||
idAttPtr = 0;
|
||||
else
|
||||
idAttPtr = atts + idAttIndex;
|
||||
|
||||
ftprintf(fp, T("<starttag name=\"%s\""), name);
|
||||
metaLocation(parser);
|
||||
if (*atts) {
|
||||
@@ -264,7 +323,12 @@ void metaStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **
|
||||
do {
|
||||
ftprintf(fp, T("<attribute name=\"%s\" value=\""), atts[0]);
|
||||
characterData(fp, atts[1], tcslen(atts[1]));
|
||||
fputts(T("\"/>\n"), fp);
|
||||
if (atts >= specifiedAttsEnd)
|
||||
fputts(T("\" defaulted=\"yes\"/>\n"), fp);
|
||||
else if (atts == idAttPtr)
|
||||
fputts(T("\" id=\"yes\"/>\n"), fp);
|
||||
else
|
||||
fputts(T("\"/>\n"), fp);
|
||||
} while (*(atts += 2));
|
||||
fputts(T("</starttag>\n"), fp);
|
||||
}
|
||||
@@ -332,13 +396,31 @@ void metaCharacterData(XML_Parser parser, const XML_Char *s, int len)
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static
|
||||
void metaStartDoctypeDecl(XML_Parser parser, const XML_Char *doctypeName)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static
|
||||
void metaEndDoctypeDecl(XML_Parser parser)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
fputts(T("<enddoctype"), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static
|
||||
void metaUnparsedEntityDecl(XML_Parser parser,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
const XML_Char *notationName)
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
const XML_Char *notationName)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<entity name=\"%s\""), entityName);
|
||||
@@ -373,6 +455,66 @@ void metaNotationDecl(XML_Parser parser,
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void metaExternalParsedEntityDecl(XML_Parser parser,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<entity name=\"%s\""), entityName);
|
||||
if (publicId)
|
||||
ftprintf(fp, T(" public=\"%s\""), publicId);
|
||||
fputts(T(" system=\""), fp);
|
||||
characterData(fp, systemId, tcslen(systemId));
|
||||
puttc(T('"'), fp);
|
||||
metaLocation(parser);
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static
|
||||
void metaInternalParsedEntityDecl(XML_Parser parser,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *text,
|
||||
int textLen)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
ftprintf(fp, T("<entity name=\"%s\""), entityName);
|
||||
metaLocation(parser);
|
||||
puttc(T('>'), fp);
|
||||
characterData(fp, text, textLen);
|
||||
fputts(T("</entity/>\n"), fp);
|
||||
}
|
||||
|
||||
static
|
||||
void metaStartNamespaceDecl(XML_Parser parser,
|
||||
const XML_Char *prefix,
|
||||
const XML_Char *uri)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
fputts(T("<startns"), fp);
|
||||
if (prefix)
|
||||
ftprintf(fp, T(" prefix=\"%s\""), prefix);
|
||||
if (uri) {
|
||||
fputts(T(" ns=\""), fp);
|
||||
characterData(fp, uri, tcslen(uri));
|
||||
fputts(T("\"/>\n"), fp);
|
||||
}
|
||||
else
|
||||
fputts(T("/>\n"), fp);
|
||||
}
|
||||
|
||||
static
|
||||
void metaEndNamespaceDecl(XML_Parser parser, const XML_Char *prefix)
|
||||
{
|
||||
FILE *fp = XML_GetUserData(parser);
|
||||
if (!prefix)
|
||||
fputts(T("<endns/>\n"), fp);
|
||||
else
|
||||
ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
|
||||
}
|
||||
|
||||
static
|
||||
int unknownEncodingConvert(void *data, const char *p)
|
||||
{
|
||||
@@ -417,67 +559,85 @@ int unknownEncoding(void *userData,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static
|
||||
int notStandalone(void *userData)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void usage(const XML_Char *prog)
|
||||
{
|
||||
ftprintf(stderr, T("usage: %s [-n] [-r] [-w] [-x] [-d output-dir] [-e encoding] file ...\n"), prog);
|
||||
ftprintf(stderr, T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] [-e encoding] file ...\n"), prog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int tmain(int argc, XML_Char **argv)
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
const XML_Char *outputDir = 0;
|
||||
const XML_Char *encoding = 0;
|
||||
unsigned processFlags = XML_MAP_FILE;
|
||||
int windowsCodePages = 0;
|
||||
int outputType = 0;
|
||||
int useNamespaces = 0;
|
||||
int requireStandalone = 0;
|
||||
int paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
|
||||
#endif
|
||||
|
||||
i = 1;
|
||||
while (i < argc && argv[i][0] == T('-')) {
|
||||
int j;
|
||||
if (argv[i][1] == T('-') && argv[i][2] == T('\0')) {
|
||||
i++;
|
||||
break;
|
||||
j = 0;
|
||||
while (i < argc) {
|
||||
if (j == 0) {
|
||||
if (argv[i][0] != T('-'))
|
||||
break;
|
||||
if (argv[i][1] == T('-') && argv[i][2] == T('\0')) {
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
j = 1;
|
||||
if (argv[i][j] == T('r')) {
|
||||
switch (argv[i][j]) {
|
||||
case T('r'):
|
||||
processFlags &= ~XML_MAP_FILE;
|
||||
j++;
|
||||
}
|
||||
if (argv[i][j] == T('n')) {
|
||||
useNamespaces = 1;
|
||||
outputType = 0;
|
||||
break;
|
||||
case T('s'):
|
||||
requireStandalone = 1;
|
||||
j++;
|
||||
}
|
||||
if (argv[i][j] == T('x')) {
|
||||
break;
|
||||
case T('n'):
|
||||
useNamespaces = 1;
|
||||
j++;
|
||||
break;
|
||||
case T('p'):
|
||||
paramEntityParsing = XML_PARAM_ENTITY_PARSING_ALWAYS;
|
||||
/* fall through */
|
||||
case T('x'):
|
||||
processFlags |= XML_EXTERNAL_ENTITIES;
|
||||
j++;
|
||||
}
|
||||
if (argv[i][j] == T('w')) {
|
||||
break;
|
||||
case T('w'):
|
||||
windowsCodePages = 1;
|
||||
j++;
|
||||
}
|
||||
if (argv[i][j] == T('m')) {
|
||||
break;
|
||||
case T('m'):
|
||||
outputType = 'm';
|
||||
useNamespaces = 0;
|
||||
j++;
|
||||
}
|
||||
if (argv[i][j] == T('c')) {
|
||||
break;
|
||||
case T('c'):
|
||||
outputType = 'c';
|
||||
useNamespaces = 0;
|
||||
j++;
|
||||
}
|
||||
if (argv[i][j] == T('t')) {
|
||||
break;
|
||||
case T('t'):
|
||||
outputType = 't';
|
||||
j++;
|
||||
}
|
||||
if (argv[i][j] == T('d')) {
|
||||
break;
|
||||
case T('d'):
|
||||
if (argv[i][j + 1] == T('\0')) {
|
||||
if (++i == argc)
|
||||
usage(argv[0]);
|
||||
@@ -486,8 +646,9 @@ int tmain(int argc, XML_Char **argv)
|
||||
else
|
||||
outputDir = argv[i] + j + 1;
|
||||
i++;
|
||||
}
|
||||
else if (argv[i][j] == T('e')) {
|
||||
j = 0;
|
||||
break;
|
||||
case T('e'):
|
||||
if (argv[i][j + 1] == T('\0')) {
|
||||
if (++i == argc)
|
||||
usage(argv[0]);
|
||||
@@ -496,11 +657,18 @@ int tmain(int argc, XML_Char **argv)
|
||||
else
|
||||
encoding = argv[i] + j + 1;
|
||||
i++;
|
||||
}
|
||||
else if (argv[i][j] == T('\0') && j > 1)
|
||||
i++;
|
||||
else
|
||||
j = 0;
|
||||
break;
|
||||
case T('\0'):
|
||||
if (j > 1) {
|
||||
i++;
|
||||
j = 0;
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
usage(argv[0]);
|
||||
}
|
||||
}
|
||||
if (i == argc)
|
||||
usage(argv[0]);
|
||||
@@ -513,7 +681,18 @@ int tmain(int argc, XML_Char **argv)
|
||||
parser = XML_ParserCreateNS(encoding, NSSEP);
|
||||
else
|
||||
parser = XML_ParserCreate(encoding);
|
||||
if (outputDir) {
|
||||
if (requireStandalone)
|
||||
XML_SetNotStandaloneHandler(parser, notStandalone);
|
||||
XML_SetParamEntityParsing(parser, paramEntityParsing);
|
||||
if (outputType == 't') {
|
||||
/* This is for doing timings; this gives a more realistic estimate of
|
||||
the parsing time. */
|
||||
outputDir = 0;
|
||||
XML_SetElementHandler(parser, nopStartElement, nopEndElement);
|
||||
XML_SetCharacterDataHandler(parser, nopCharacterData);
|
||||
XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
|
||||
}
|
||||
else if (outputDir) {
|
||||
const XML_Char *file = argv[i];
|
||||
if (tcsrchr(file, T('/')))
|
||||
file = tcsrchr(file, T('/')) + 1;
|
||||
@@ -543,8 +722,12 @@ int tmain(int argc, XML_Char **argv)
|
||||
XML_SetCommentHandler(parser, metaComment);
|
||||
XML_SetCdataSectionHandler(parser, metaStartCdataSection, metaEndCdataSection);
|
||||
XML_SetCharacterDataHandler(parser, metaCharacterData);
|
||||
XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, metaEndDoctypeDecl);
|
||||
XML_SetUnparsedEntityDeclHandler(parser, metaUnparsedEntityDecl);
|
||||
XML_SetNotationDeclHandler(parser, metaNotationDecl);
|
||||
XML_SetExternalParsedEntityDeclHandler(parser, metaExternalParsedEntityDecl);
|
||||
XML_SetInternalParsedEntityDeclHandler(parser, metaInternalParsedEntityDecl);
|
||||
XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, metaEndNamespaceDecl);
|
||||
metaStartDocument(parser);
|
||||
break;
|
||||
case 'c':
|
||||
@@ -554,20 +737,15 @@ int tmain(int argc, XML_Char **argv)
|
||||
XML_SetCharacterDataHandler(parser, defaultCharacterData);
|
||||
XML_SetProcessingInstructionHandler(parser, defaultProcessingInstruction);
|
||||
break;
|
||||
case 't':
|
||||
/* This is for doing timings; this gives a more realistic estimate of
|
||||
the parsing time. */
|
||||
XML_SetElementHandler(parser, nopStartElement, nopEndElement);
|
||||
XML_SetCharacterDataHandler(parser, nopCharacterData);
|
||||
XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
|
||||
break;
|
||||
default:
|
||||
if (useNamespaces)
|
||||
XML_SetElementHandler(parser, startElementNS, endElementNS);
|
||||
else
|
||||
XML_SetElementHandler(parser, startElement, endElement);
|
||||
XML_SetCharacterDataHandler(parser, characterData);
|
||||
#ifndef W3C14N
|
||||
XML_SetProcessingInstructionHandler(parser, processingInstruction);
|
||||
#endif /* not W3C14N */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user