This commit is contained in:
guha 1998-04-08 04:04:58 +00:00
Родитель 95b71081b5
Коммит ca6bc6c3d4
31 изменённых файлов: 8746 добавлений и 3 удалений

Просмотреть файл

@ -89,6 +89,7 @@ REQUIRES = \
hook \
pref \
rdf \
xml \
security \
softupdt \
libreg \
@ -223,6 +224,7 @@ BASIC_LIBS = \
$(DIST)/lib/libxlate.a \
$(DIST)/lib/lib$(LITE_PREFIX)net.a \
$(DIST)/lib/lib$(LITE_PREFIX)rdf.a \
$(DIST)/lib/lib$(LITE_PREFIX)xml.a \
$(DIST)/lib/lib$(LITE_PREFIX)lay.a \
$(DIST)/lib/libpng.a \
$(DIST)/lib/libmariner.a \

Просмотреть файл

@ -28,6 +28,7 @@ DIRS = \
libfont \
libreg \
rdf \
xml \
schedulr \
security \
$(NULL)

Просмотреть файл

@ -41,9 +41,6 @@ CSRCS = bmk2mcf.c \
pm2rdf.c \
es2mcf.c \
columns.c \
xmlparse.c \
xmlglue.c \
xmlss.c \
scook.c \
rdfjava.c \
mcf.c \

38
modules/xml/Makefile Normal file
Просмотреть файл

@ -0,0 +1,38 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../..
MODULE = xml
LIBRARY_NAME = $(LITE_PREFIX)xml
REQUIRES = nspr img layer util
EXPORTS = expat/xmlparse/xmlparse.h
CSRCS = expat/xmltok/xmltok.c \
expat/xmltok/xmlrole.c \
expat/xmlparse/xmlparse.c \
expat/xmlparse/hashtable.c \
glue/xmlglue.c \
glue/xmldom.c \
glue/xmlss.c
LOCAL_INCLUDES = -I./expat/xmltok -I./expat/xmlparse/ -I./glue
include $(DEPTH)/config/rules.mk
$(LIBRARY): $(OBJS)

Просмотреть файл

@ -0,0 +1,420 @@
<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>

Просмотреть файл

@ -0,0 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<TITLE>expat</TITLE>
<BODY>
<H1>expat - XML Parser Toolkit</H1>
<H3>Version 19980405</H3>
<P>
Copyright (c) 1998 James Clark. Expat is subject to the <A
HREF="MPL-1_0.html">Mozilla Public License Version 1.0</A>. You may
not use expat except in compliance with this license. Please contact
me if you wish to negotiate an alternative license.</P><P>
Expat is an <A HREF="http://www.w3.org/TR/1998/REC-xml-19980210">XML
1.0</A> parser written in C. It aims to be fully conforming. It is
currently not a validating XML processor.
Expat can be downloaded from <A href =
"ftp://ftp.jclark.com/pub/xml/expat.zip">ftp://ftp.jclark.com/pub/xml/expat.zip</A>.
This is a beta-test version.</P>
<P>
The directory <SAMP>xmltok</SAMP> contains a low-level library for
tokenizing XML. The interface is documented in <SAMP>xmltok/xmltok.h</SAMP>.</P>
<P>
The directory <SAMP>xmlparse</SAMP> contains an XML parser library
which is built on top of the <SAMP>xmltok</SAMP> library. The
interface is documented in <SAMP>xmlparse/xmlparse.h</SAMP>.</P>
<P>
The directory <SAMP>xmlwf</SAMP> contains the <SAMP>xmlwf</SAMP>
application, which uses the <SAMP>xmlparse</SAMP> library. The
arguments to <SAMP>xmlwf</SAMP> are one or more files which are each
to be checked for well-formedness. An option <SAMP>-d
<VAR>dir</VAR></SAMP> can be specified; for each well-formed input
file the corresponding <A
href="http://www.jclark.com/xml/canonxml.html">canonical XML</A> will
be written to <SAMP>dir/<VAR>f</VAR></SAMP>, where
<SAMP><VAR>f</VAR></SAMP> is the filename (without any path) of the
input file.</P>
<P></P>
<ADDRESS>
<A HREF="mailto:jjc@jclark.com">James Clark</A>
</ADDRESS>
</BODY>
</HTML>

954
modules/xml/expat/expat.mak Normal file
Просмотреть файл

@ -0,0 +1,954 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
!IF "$(CFG)" == ""
CFG=xmltok - Win32 Debug
!MESSAGE No configuration specified. Defaulting to xmltok - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "xmlwf - Win32 Release" && "$(CFG)" != "xmlwf - Win32 Debug" &&\
"$(CFG)" != "gennmtab - Win32 Release" && "$(CFG)" != "gennmtab - Win32 Debug"\
&& "$(CFG)" != "xmlparse - Win32 Release" && "$(CFG)" !=\
"xmlparse - Win32 Debug" && "$(CFG)" != "xmltok - Win32 Release" && "$(CFG)" !=\
"xmltok - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "expat.mak" CFG="xmltok - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "xmlwf - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "xmlwf - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "gennmtab - Win32 Release" (based on\
"Win32 (x86) Console Application")
!MESSAGE "gennmtab - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "xmlparse - Win32 Release" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE "xmlparse - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "xmltok - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "xmltok - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "xmltok - Win32 Debug"
!IF "$(CFG)" == "xmlwf - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "xmlwf\Release"
# PROP BASE Intermediate_Dir "xmlwf\Release"
# PROP BASE Target_Dir "xmlwf"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "xmlwf\Release"
# PROP Intermediate_Dir "xmlwf\Release"
# PROP Target_Dir "xmlwf"
OUTDIR=.\xmlwf\Release
INTDIR=.\xmlwf\Release
ALL : "xmlparse - Win32 Release" ".\bin\xmlwf.exe"
CLEAN :
-@erase "$(INTDIR)\win32filemap.obj"
-@erase "$(INTDIR)\xmlwf.obj"
-@erase ".\bin\xmlwf.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "xmlparse" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "." /I "xmlparse" /D "NDEBUG" /D "WIN32" /D\
"_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D\
XMLPARSEAPI=__declspec(dllimport) /Fp"$(INTDIR)/xmlwf.pch" /YX /Fo"$(INTDIR)/"\
/c
CPP_OBJS=.\xmlwf\Release/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlwf.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"bin/xmlwf.exe"
LINK32_FLAGS=setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib\
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\
/pdb:"$(OUTDIR)/xmlwf.pdb" /machine:I386 /out:"bin/xmlwf.exe"
LINK32_OBJS= \
"$(INTDIR)\win32filemap.obj" \
"$(INTDIR)\xmlwf.obj" \
".\xmlparse\Release\xmlparse.lib"
".\bin\xmlwf.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "xmlwf\Debug"
# PROP BASE Intermediate_Dir "xmlwf\Debug"
# PROP BASE Target_Dir "xmlwf"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "xmlwf\Debug"
# PROP Intermediate_Dir "xmlwf\Debug"
# PROP Target_Dir "xmlwf"
OUTDIR=.\xmlwf\Debug
INTDIR=.\xmlwf\Debug
ALL : "xmlparse - Win32 Debug" ".\dbgbin\xmlwf.exe"
CLEAN :
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(INTDIR)\win32filemap.obj"
-@erase "$(INTDIR)\xmlwf.obj"
-@erase "$(OUTDIR)\xmlwf.pdb"
-@erase ".\dbgbin\xmlwf.exe"
-@erase ".\dbgbin\xmlwf.ilk"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "xmlparse" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllimport) /YX /c
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "xmlparse" /D "_DEBUG" /D\
"WIN32" /D "_CONSOLE" /D XMLTOKAPI=__declspec(dllimport) /D\
XMLPARSEAPI=__declspec(dllimport) /Fp"$(INTDIR)/xmlwf.pch" /YX /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c
CPP_OBJS=.\xmlwf\Debug/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlwf.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
LINK32_FLAGS=setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib\
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes\
/pdb:"$(OUTDIR)/xmlwf.pdb" /debug /machine:I386 /out:"dbgbin/xmlwf.exe"
LINK32_OBJS= \
"$(INTDIR)\win32filemap.obj" \
"$(INTDIR)\xmlwf.obj" \
".\xmlparse\Debug\xmlparse.lib"
".\dbgbin\xmlwf.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "gennmtab - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "gennmtab\Release"
# PROP BASE Intermediate_Dir "gennmtab\Release"
# PROP BASE Target_Dir "gennmtab"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "gennmtab\Release"
# PROP Intermediate_Dir "gennmtab\Release"
# PROP Target_Dir "gennmtab"
OUTDIR=.\gennmtab\Release
INTDIR=.\gennmtab\Release
ALL : "$(OUTDIR)\gennmtab.exe"
CLEAN :
-@erase "$(INTDIR)\gennmtab.obj"
-@erase "$(OUTDIR)\gennmtab.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
/Fp"$(INTDIR)/gennmtab.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\gennmtab\Release/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/gennmtab.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:console /incremental:no\
/pdb:"$(OUTDIR)/gennmtab.pdb" /machine:I386 /out:"$(OUTDIR)/gennmtab.exe"
LINK32_OBJS= \
"$(INTDIR)\gennmtab.obj"
"$(OUTDIR)\gennmtab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "gennmtab - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "gennmtab\Debug"
# PROP BASE Intermediate_Dir "gennmtab\Debug"
# PROP BASE Target_Dir "gennmtab"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "gennmtab\Debug"
# PROP Intermediate_Dir "gennmtab\Debug"
# PROP Target_Dir "gennmtab"
OUTDIR=.\gennmtab\Debug
INTDIR=.\gennmtab\Debug
ALL : "$(OUTDIR)\gennmtab.exe"
CLEAN :
-@erase "$(INTDIR)\gennmtab.obj"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(OUTDIR)\gennmtab.exe"
-@erase "$(OUTDIR)\gennmtab.ilk"
-@erase "$(OUTDIR)\gennmtab.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"\
/Fp"$(INTDIR)/gennmtab.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\gennmtab\Debug/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/gennmtab.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:console /incremental:yes\
/pdb:"$(OUTDIR)/gennmtab.pdb" /debug /machine:I386\
/out:"$(OUTDIR)/gennmtab.exe"
LINK32_OBJS= \
"$(INTDIR)\gennmtab.obj"
"$(OUTDIR)\gennmtab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "xmlparse - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "xmlparse\Release"
# PROP BASE Intermediate_Dir "xmlparse\Release"
# PROP BASE Target_Dir "xmlparse"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "xmlparse\Release"
# PROP Intermediate_Dir "xmlparse\Release"
# PROP Target_Dir "xmlparse"
OUTDIR=.\xmlparse\Release
INTDIR=.\xmlparse\Release
ALL : "xmltok - Win32 Release" ".\bin\xmlparse.dll"
CLEAN :
-@erase "$(INTDIR)\hashtable.obj"
-@erase "$(INTDIR)\xmlparse.obj"
-@erase "$(OUTDIR)\xmlparse.exp"
-@erase "$(OUTDIR)\xmlparse.lib"
-@erase ".\bin\xmlparse.dll"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "xmltok" /I "xmlwf" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "xmltok" /I "xmlwf" /D "NDEBUG" /D "WIN32"\
/D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D\
XMLPARSEAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmlparse.pch" /YX\
/Fo"$(INTDIR)/" /c
CPP_OBJS=.\xmlparse\Release/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
MTL=mktyplib.exe
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlparse.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"bin/xmlparse.dll"
# SUBTRACT LINK32 /profile
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\
/pdb:"$(OUTDIR)/xmlparse.pdb" /machine:I386 /out:"bin/xmlparse.dll"\
/implib:"$(OUTDIR)/xmlparse.lib"
LINK32_OBJS= \
"$(INTDIR)\hashtable.obj" \
"$(INTDIR)\xmlparse.obj" \
".\xmltok\Release\xmltok.lib"
".\bin\xmlparse.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "xmlparse\Debug"
# PROP BASE Intermediate_Dir "xmlparse\Debug"
# PROP BASE Target_Dir "xmlparse"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "xmlparse\Debug"
# PROP Intermediate_Dir "xmlparse\Debug"
# PROP Target_Dir "xmlparse"
OUTDIR=.\xmlparse\Debug
INTDIR=.\xmlparse\Debug
ALL : "xmltok - Win32 Debug" ".\dbgbin\xmlparse.dll"
CLEAN :
-@erase "$(INTDIR)\hashtable.obj"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(INTDIR)\xmlparse.obj"
-@erase "$(OUTDIR)\xmlparse.exp"
-@erase "$(OUTDIR)\xmlparse.lib"
-@erase "$(OUTDIR)\xmlparse.pdb"
-@erase ".\dbgbin\xmlparse.dll"
-@erase ".\dbgbin\xmlparse.ilk"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "xmltok" /I "xmlwf" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D XMLPARSEAPI=__declspec(dllexport) /YX /c
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "xmltok" /I "xmlwf" /D "_DEBUG" /D\
"WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllimport) /D\
XMLPARSEAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmlparse.pch" /YX\
/Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\xmlparse\Debug/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
MTL=mktyplib.exe
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmlparse.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmlparse.dll"
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\
/pdb:"$(OUTDIR)/xmlparse.pdb" /debug /machine:I386 /out:"dbgbin/xmlparse.dll"\
/implib:"$(OUTDIR)/xmlparse.lib"
LINK32_OBJS= \
"$(INTDIR)\hashtable.obj" \
"$(INTDIR)\xmlparse.obj" \
".\xmltok\Debug\xmltok.lib"
".\dbgbin\xmlparse.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "xmltok - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "xmltok\Release"
# PROP BASE Intermediate_Dir "xmltok\Release"
# PROP BASE Target_Dir "xmltok"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "xmltok\Release"
# PROP Intermediate_Dir "xmltok\Release"
# PROP Target_Dir "xmltok"
OUTDIR=.\xmltok\Release
INTDIR=.\xmltok\Release
ALL : ".\bin\xmltok.dll"
CLEAN :
-@erase "$(INTDIR)\dllmain.obj"
-@erase "$(INTDIR)\xmlrole.obj"
-@erase "$(INTDIR)\xmltok.obj"
-@erase "$(OUTDIR)\xmltok.exp"
-@erase "$(OUTDIR)\xmltok.lib"
-@erase ".\bin\xmltok.dll"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
XMLTOKAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmltok.pch" /YX /Fo"$(INTDIR)/"\
/c
CPP_OBJS=.\xmltok\Release/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
MTL=mktyplib.exe
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmltok.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386 /out:"bin/xmltok.dll"
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /entry:"DllMain" /subsystem:windows /dll /incremental:no\
/pdb:"$(OUTDIR)/xmltok.pdb" /machine:I386 /out:"bin/xmltok.dll"\
/implib:"$(OUTDIR)/xmltok.lib"
LINK32_OBJS= \
"$(INTDIR)\dllmain.obj" \
"$(INTDIR)\xmlrole.obj" \
"$(INTDIR)\xmltok.obj"
".\bin\xmltok.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "xmltok\Debug"
# PROP BASE Intermediate_Dir "xmltok\Debug"
# PROP BASE Target_Dir "xmltok"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "xmltok\Debug"
# PROP Intermediate_Dir "xmltok\Debug"
# PROP Target_Dir "xmltok"
OUTDIR=.\xmltok\Debug
INTDIR=.\xmltok\Debug
ALL : ".\dbgbin\xmltok.dll"
CLEAN :
-@erase "$(INTDIR)\dllmain.obj"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(INTDIR)\xmlrole.obj"
-@erase "$(INTDIR)\xmltok.obj"
-@erase "$(OUTDIR)\xmltok.exp"
-@erase "$(OUTDIR)\xmltok.lib"
-@erase "$(OUTDIR)\xmltok.pdb"
-@erase ".\dbgbin\xmltok.dll"
-@erase ".\dbgbin\xmltok.ilk"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D XMLTOKAPI=__declspec(dllexport) /YX /c
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\
/D XMLTOKAPI=__declspec(dllexport) /Fp"$(INTDIR)/xmltok.pch" /YX\
/Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\xmltok\Debug/
CPP_SBRS=.\.
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
MTL=mktyplib.exe
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32
RSC=rc.exe
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/xmltok.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"dbgbin/xmltok.dll"
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\
/pdb:"$(OUTDIR)/xmltok.pdb" /debug /machine:I386 /out:"dbgbin/xmltok.dll"\
/implib:"$(OUTDIR)/xmltok.lib"
LINK32_OBJS= \
"$(INTDIR)\dllmain.obj" \
"$(INTDIR)\xmlrole.obj" \
"$(INTDIR)\xmltok.obj"
".\dbgbin\xmltok.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
################################################################################
# Begin Target
# Name "xmlwf - Win32 Release"
# Name "xmlwf - Win32 Debug"
!IF "$(CFG)" == "xmlwf - Win32 Release"
!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\xmlwf\xmlwf.c
DEP_CPP_XMLWF=\
".\xmlparse\xmlparse.h"\
".\xmlwf\filemap.h"\
"$(INTDIR)\xmlwf.obj" : $(SOURCE) $(DEP_CPP_XMLWF) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\xmlwf\win32filemap.c
DEP_CPP_WIN32=\
".\xmlwf\filemap.h"\
"$(INTDIR)\win32filemap.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\xmlwf\unixfilemap.c
DEP_CPP_UNIXF=\
".\xmlwf\filemap.h"\
{$(INCLUDE)}"\sys\stat.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
# PROP Exclude_From_Build 1
# End Source File
################################################################################
# Begin Source File
SOURCE=.\xmlwf\readfilemap.c
DEP_CPP_READF=\
{$(INCLUDE)}"\sys\stat.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
# PROP Exclude_From_Build 1
# End Source File
################################################################################
# Begin Project Dependency
# Project_Dep_Name "xmlparse"
!IF "$(CFG)" == "xmlwf - Win32 Release"
"xmlparse - Win32 Release" :
$(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmlparse - Win32 Release"
!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug"
"xmlparse - Win32 Debug" :
$(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmlparse - Win32 Debug"
!ENDIF
# End Project Dependency
# End Target
################################################################################
# Begin Target
# Name "gennmtab - Win32 Release"
# Name "gennmtab - Win32 Debug"
!IF "$(CFG)" == "gennmtab - Win32 Release"
!ELSEIF "$(CFG)" == "gennmtab - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\gennmtab\gennmtab.c
"$(INTDIR)\gennmtab.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
# End Target
################################################################################
# Begin Target
# Name "xmlparse - Win32 Release"
# Name "xmlparse - Win32 Debug"
!IF "$(CFG)" == "xmlparse - Win32 Release"
!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\xmlparse\xmlparse.c
DEP_CPP_XMLPA=\
".\xmlparse\hashtable.h"\
".\xmlparse\xmlparse.h"\
".\xmltok\xmldef.h"\
".\xmltok\xmlrole.h"\
".\xmltok\xmltok.h"\
NODEP_CPP_XMLPA=\
".\xmltok\nspr.h"\
"$(INTDIR)\xmlparse.obj" : $(SOURCE) $(DEP_CPP_XMLPA) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\xmlparse\hashtable.c
DEP_CPP_HASHT=\
".\xmlparse\hashtable.h"\
".\xmltok\xmldef.h"\
NODEP_CPP_HASHT=\
".\xmltok\nspr.h"\
"$(INTDIR)\hashtable.obj" : $(SOURCE) $(DEP_CPP_HASHT) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Project Dependency
# Project_Dep_Name "xmltok"
!IF "$(CFG)" == "xmlparse - Win32 Release"
"xmltok - Win32 Release" :
$(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmltok - Win32 Release"
!ELSEIF "$(CFG)" == "xmlparse - Win32 Debug"
"xmltok - Win32 Debug" :
$(MAKE) /$(MAKEFLAGS) /F ".\expat.mak" CFG="xmltok - Win32 Debug"
!ENDIF
# End Project Dependency
# End Target
################################################################################
# Begin Target
# Name "xmltok - Win32 Release"
# Name "xmltok - Win32 Debug"
!IF "$(CFG)" == "xmltok - Win32 Release"
!ELSEIF "$(CFG)" == "xmltok - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\xmltok\xmlrole.c
DEP_CPP_XMLRO=\
".\xmltok\xmldef.h"\
".\xmltok\xmlrole.h"\
".\xmltok\xmltok.h"\
NODEP_CPP_XMLRO=\
".\xmltok\nspr.h"\
"$(INTDIR)\xmlrole.obj" : $(SOURCE) $(DEP_CPP_XMLRO) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\xmltok\xmltok.c
DEP_CPP_XMLTO=\
".\xmltok\asciitab.h"\
".\xmltok\iasciitab.h"\
".\xmltok\latin1tab.h"\
".\xmltok\nametab.h"\
".\xmltok\utf8tab.h"\
".\xmltok\xmldef.h"\
".\xmltok\xmltok.h"\
".\xmltok\xmltok_impl.c"\
".\xmltok\xmltok_impl.h"\
NODEP_CPP_XMLTO=\
".\xmltok\nspr.h"\
"$(INTDIR)\xmltok.obj" : $(SOURCE) $(DEP_CPP_XMLTO) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\xmltok\dllmain.c
"$(INTDIR)\dllmain.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
# End Target
# End Project
################################################################################

Просмотреть файл

@ -0,0 +1,127 @@
/*
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 "xmldef.h"
#include "hashtable.h"
#include <stdlib.h>
#include <string.h>
#define INIT_SIZE 64
static
unsigned long hash(const char *s)
{
unsigned long h = 0;
while (*s)
h = (h << 5) + h + (unsigned char)*s++;
return h;
}
NAMED *lookup(HASH_TABLE *table, const char *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 (strcmp(name, table->v[i]->name) == 0)
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;
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
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>
typedef struct {
const char *name;
} NAMED;
typedef struct {
NAMED **v;
size_t size;
size_t used;
size_t usedLim;
} HASH_TABLE;
NAMED *lookup(HASH_TABLE *table, const char *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 *);

Просмотреть файл

@ -0,0 +1,33 @@
/*
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):
*/
/* This file can be used for any definitions needed in
particular environments. */
#define MOZILLA 1
#ifdef MOZILLA
#include "nspr.h"
#define malloc(x) PR_Calloc(1,(x))
#define calloc(x, y) PR_Calloc((x),(y))
#define free(x) PR_Free(x)
#define int int32
#endif /* MOZILLA */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,131 @@
/*
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):
*/
#ifndef XmlParse_INCLUDED
#define XmlParse_INCLUDED 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef XMLPARSEAPI
#define XMLPARSEAPI /* as nothing */
#endif
typedef void *XML_Parser;
/* Constructs a new parser; encoding should be the name of the charset from
the Content-Type header if the Content-Type is text/xml, or null otherwise. */
XML_Parser XMLPARSEAPI
XML_ParserCreate(const char *encoding);
/* Information is UTF-8 encoded. */
/* atts is array of name/value pairs, terminated by NULL;
names and values are '\0' terminated. */
typedef void (*XML_StartElementHandler)(void *userData,
const char *name,
const char **atts);
typedef void (*XML_EndElementHandler)(void *userData,
const char *name);
typedef void (*XML_CharacterDataHandler)(void *userData,
const char *s,
int len);
/* target and data are '\0' terminated */
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
const char *target,
const char *data);
void XMLPARSEAPI
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end);
void XMLPARSEAPI
XML_SetCharacterDataHandler(XML_Parser parser,
XML_CharacterDataHandler handler);
void XMLPARSEAPI
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler);
/* This value is passed as the userData argument to callbacks. */
void XMLPARSEAPI
XML_SetUserData(XML_Parser parser, void *userData);
/* Parses some input. Returns 0 if a fatal error is detected.
The last call to XML_Parse must have isFinal true;
len may be zero for this call (or any other). */
int XMLPARSEAPI
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
void XMLPARSEAPI *
XML_GetBuffer(XML_Parser parser, int len);
int XMLPARSEAPI
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
/* If XML_Parser or XML_ParseEnd have returned 0, then XML_GetError*
returns information about the error. */
enum XML_Error {
XML_ERROR_NONE,
XML_ERROR_NO_MEMORY,
XML_ERROR_SYNTAX,
XML_ERROR_NO_ELEMENTS,
XML_ERROR_INVALID_TOKEN,
XML_ERROR_UNCLOSED_TOKEN,
XML_ERROR_PARTIAL_CHAR,
XML_ERROR_TAG_MISMATCH,
XML_ERROR_DUPLICATE_ATTRIBUTE,
XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
XML_ERROR_PARAM_ENTITY_REF,
XML_ERROR_UNDEFINED_ENTITY,
XML_ERROR_RECURSIVE_ENTITY_REF,
XML_ERROR_ASYNC_ENTITY,
XML_ERROR_BAD_CHAR_REF,
XML_ERROR_BINARY_ENTITY_REF,
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
XML_ERROR_MISPLACED_XML_PI,
XML_ERROR_UNKNOWN_ENCODING,
XML_ERROR_INCORRECT_ENCODING
};
int XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
int XMLPARSEAPI XML_GetErrorLineNumber(XML_Parser parser);
int XMLPARSEAPI XML_GetErrorColumnNumber(XML_Parser parser);
long XMLPARSEAPI XML_GetErrorByteIndex(XML_Parser parser);
void XMLPARSEAPI
XML_ParserFree(XML_Parser parser);
const char XMLPARSEAPI *
XML_ErrorString(int code);
#ifdef __cplusplus
}
#endif
#endif /* not XmlParse_INCLUDED */

Просмотреть файл

@ -0,0 +1,52 @@
/*
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):
*/
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_NMSTRT, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,

Просмотреть файл

@ -0,0 +1,27 @@
/*
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 <windows.h>
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}

Просмотреть файл

@ -0,0 +1,53 @@
/*
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):
*/
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_NMSTRT, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,

Просмотреть файл

@ -0,0 +1,52 @@
/*
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):
*/
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,

Просмотреть файл

@ -0,0 +1,150 @@
static const unsigned namingBitmap[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
0x40000000, 0xF580C900, 0x00000007, 0x02010800,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
0x00000000, 0x00004C40, 0x00000000, 0x00000000,
0x00000007, 0x00000000, 0x00000000, 0x00000000,
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
};
static const unsigned char nmstrtPages[] = {
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char namePages[] = {
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

Просмотреть файл

@ -0,0 +1,53 @@
/*
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):
*/
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,

Просмотреть файл

@ -0,0 +1,32 @@
/*
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):
*/
/* This file can be used for any definitions needed in
particular environments. */
#ifdef MOZILLA
#include "nspr.h"
#define malloc(x) PR_Calloc(1,(x))
#define calloc(x, y) PR_Calloc((x),(y))
#define free(x) PR_Free(x)
#define int int32
#endif /* MOZILLA */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,100 @@
/*
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):
*/
#ifndef XmlRole_INCLUDED
#define XmlRole_INCLUDED 1
#include "xmltok.h"
#ifdef __cplusplus
extern "C" {
#endif
enum {
XML_ROLE_ERROR = -1,
XML_ROLE_NONE = 0,
XML_ROLE_XML_DECL,
XML_ROLE_INSTANCE_START,
XML_ROLE_DOCTYPE_NAME,
XML_ROLE_DOCTYPE_SYSTEM_ID,
XML_ROLE_DOCTYPE_PUBLIC_ID,
XML_ROLE_DOCTYPE_CLOSE,
XML_ROLE_GENERAL_ENTITY_NAME,
XML_ROLE_PARAM_ENTITY_NAME,
XML_ROLE_ENTITY_VALUE,
XML_ROLE_ENTITY_SYSTEM_ID,
XML_ROLE_ENTITY_PUBLIC_ID,
XML_ROLE_ENTITY_NOTATION_NAME,
XML_ROLE_NOTATION_NAME,
XML_ROLE_NOTATION_SYSTEM_ID,
XML_ROLE_NOTATION_PUBLIC_ID,
XML_ROLE_ATTRIBUTE_NAME,
XML_ROLE_ATTRIBUTE_TYPE_CDATA,
XML_ROLE_ATTRIBUTE_TYPE_ID,
XML_ROLE_ATTRIBUTE_TYPE_IDREF,
XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
XML_ROLE_ATTRIBUTE_ENUM_VALUE,
XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
XML_ROLE_ATTLIST_ELEMENT_NAME,
XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
XML_ROLE_FIXED_ATTRIBUTE_VALUE,
XML_ROLE_ELEMENT_NAME,
XML_ROLE_CONTENT_ANY,
XML_ROLE_CONTENT_EMPTY,
XML_ROLE_CONTENT_PCDATA,
XML_ROLE_GROUP_OPEN,
XML_ROLE_GROUP_CLOSE,
XML_ROLE_GROUP_CLOSE_REP,
XML_ROLE_GROUP_CLOSE_OPT,
XML_ROLE_GROUP_CLOSE_PLUS,
XML_ROLE_GROUP_CHOICE,
XML_ROLE_GROUP_SEQUENCE,
XML_ROLE_CONTENT_ELEMENT,
XML_ROLE_CONTENT_ELEMENT_REP,
XML_ROLE_CONTENT_ELEMENT_OPT,
XML_ROLE_CONTENT_ELEMENT_PLUS,
XML_ROLE_PARAM_ENTITY_REF
};
typedef struct prolog_state {
int (*handler)(struct prolog_state *state,
int tok,
const char *ptr,
const char *end,
const ENCODING *enc);
unsigned level;
} PROLOG_STATE;
void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *);
#define XmlTokenRole(state, tok, ptr, end, enc) \
(((state)->handler)(state, tok, ptr, end, enc))
#ifdef __cplusplus
}
#endif
#endif /* not XmlRole_INCLUDED */

Просмотреть файл

@ -0,0 +1,759 @@
/*
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 "xmldef.h"
#include "xmltok.h"
#include "nametab.h"
#define VTABLE1 \
{ PREFIX(prologTok), PREFIX(contentTok) }, \
{ PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
PREFIX(sameName), \
PREFIX(nameMatchesAscii), \
PREFIX(nameLength), \
PREFIX(skipS), \
PREFIX(getAtts), \
PREFIX(charRefNumber), \
PREFIX(updatePosition), \
PREFIX(isPublicId)
#define VTABLE2 \
PREFIX(encode), \
{ PREFIX(toUtf8) }
#define VTABLE VTABLE1, VTABLE2
#define UCS2_GET_NAMING(pages, hi, lo) \
(namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
/* A 2 byte UTF-8 representation splits the characters 11 bits
between the bottom 5 and 6 bits of the bytes.
We need 8 bits to index into pages, 3 bits to add to that index and
5 bits to generate the mask. */
#define UTF8_GET_NAMING2(pages, byte) \
(namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
+ ((((byte)[0]) & 3) << 1) \
+ ((((byte)[1]) >> 5) & 1)] \
& (1 << (((byte)[1]) & 0x1F)))
/* A 3 byte UTF-8 representation splits the characters 16 bits
between the bottom 4, 6 and 6 bits of the bytes.
We need 8 bits to index into pages, 3 bits to add to that index and
5 bits to generate the mask. */
#define UTF8_GET_NAMING3(pages, byte) \
(namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \
+ ((((byte)[1]) >> 2) & 0xF)] \
<< 3) \
+ ((((byte)[1]) & 3) << 1) \
+ ((((byte)[2]) >> 5) & 1)] \
& (1 << (((byte)[2]) & 0x1F)))
#define UTF8_GET_NAMING(pages, p, n) \
((n) == 2 \
? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \
: ((n) == 3 \
? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \
: 0))
#define UTF8_INVALID3(p) \
((*p) == 0xED \
? (((p)[1] & 0x20) != 0) \
: ((*p) == 0xEF \
? ((p)[1] == 0xBF && ((p)[2] == 0xBF || (p)[2] == 0xBE)) \
: 0))
#define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0)
struct normal_encoding {
ENCODING enc;
unsigned char type[256];
};
static int checkCharRefNumber(int);
#include "xmltok_impl.h"
/* minimum bytes per character */
#define MINBPC 1
#define BYTE_TYPE(enc, p) \
(((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
#define BYTE_TO_ASCII(enc, p) (*p)
#define IS_NAME_CHAR(enc, p, n) UTF8_GET_NAMING(namePages, p, n)
#define IS_NMSTRT_CHAR(enc, p, n) UTF8_GET_NAMING(nmstrtPages, p, n)
#define IS_INVALID_CHAR(enc, p, n) \
((n) == 3 \
? UTF8_INVALID3((const unsigned char *)(p)) \
: ((n) == 4 ? UTF8_INVALID4((const unsigned char *)(p)) : 0))
/* c is an ASCII character */
#define CHAR_MATCHES(enc, p, c) (*(p) == c)
#define PREFIX(ident) normal_ ## ident
#include "xmltok_impl.c"
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NMSTRT_CHAR
#undef IS_INVALID_CHAR
enum {
/* cvalN is value of masked first byte of N byte sequence */
cval1 = 0x00,
cval2 = 0xc0,
cval3 = 0xe0,
cval4 = 0xf0,
/* minN is minimum legal resulting value for N byte sequence */
min2 = 0x80,
min3 = 0x800,
min4 = 0x10000
};
static
int utf8_encode(const ENCODING *enc, int c, char *buf)
{
if (c < 0)
return 0;
if (c < min2) {
buf[0] = (c | cval1);
return 1;
}
if (c < min3) {
buf[0] = ((c >> 6) | cval2);
buf[1] = ((c & 0x3f) | 0x80);
return 2;
}
if (c < min4) {
buf[0] = ((c >> 12) | cval3);
buf[1] = (((c >> 6) & 0x3f) | 0x80);
buf[2] = ((c & 0x3f) | 0x80);
return 3;
}
if (c < 0x110000) {
buf[0] = ((c >> 18) | cval4);
buf[1] = (((c >> 12) & 0x3f) | 0x80);
buf[2] = (((c >> 6) & 0x3f) | 0x80);
buf[3] = ((c & 0x3f) | 0x80);
return 4;
}
return 0;
}
static
void utf8_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
char *to;
const char *from;
if (fromLim - *fromP > toLim - *toP) {
/* Avoid copying partial characters. */
for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--)
if (((unsigned char)fromLim[-1] & 0xc0) != 0x80)
break;
}
for (to = *toP, from = *fromP; from != fromLim; from++, to++)
*to = *from;
*fromP = from;
*toP = to;
}
static const struct normal_encoding utf8_encoding = {
{ VTABLE1, utf8_encode, { utf8_toUtf8 }, 1 },
{
#include "asciitab.h"
#include "utf8tab.h"
}
};
static const struct normal_encoding internal_utf8_encoding = {
{ VTABLE1, utf8_encode, { utf8_toUtf8 }, 1 },
{
#include "iasciitab.h"
#include "utf8tab.h"
}
};
static
int latin1_encode(const ENCODING *enc, int c, char *buf)
{
if (c < 0)
return 0;
if (c <= 0xFF) {
buf[0] = (char)c;
return 1;
}
return 0;
}
static
void latin1_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
for (;;) {
unsigned char c;
if (*fromP == fromLim)
break;
c = (unsigned char)**fromP;
if (c & 0x80) {
if (toLim - *toP < 2)
break;
*(*toP)++ = ((c >> 6) | cval2);
*(*toP)++ = ((c & 0x3f) | 0x80);
(*fromP)++;
}
else {
if (*toP == toLim)
break;
*(*toP)++ = *(*fromP)++;
}
}
}
static const struct normal_encoding latin1_encoding = {
{ VTABLE1, latin1_encode, { latin1_toUtf8 }, 1 },
{
#include "asciitab.h"
#include "latin1tab.h"
}
};
#define latin1tab (latin1_encoding.type)
#undef PREFIX
static int unicode_byte_type(char hi, char lo)
{
switch ((unsigned char)hi) {
case 0xD8: case 0xD9: case 0xDA: case 0xDB:
return BT_LEAD4;
case 0xDC: case 0xDD: case 0xDE: case 0xDF:
return BT_TRAIL;
case 0xFF:
switch ((unsigned char)lo) {
case 0xFF:
case 0xFE:
return BT_NONXML;
}
break;
}
return BT_NONASCII;
}
#define DEFINE_UTF16_ENCODE \
static \
int PREFIX(encode)(const ENCODING *enc, int charNum, char *buf) \
{ \
if (charNum < 0) \
return 0; \
if (charNum < 0x10000) { \
SET2(buf, charNum); \
return 2; \
} \
if (charNum < 0x110000) { \
charNum -= 0x10000; \
SET2(buf, (charNum >> 10) + 0xD800); \
SET2(buf + 2, (charNum & 0x3FF) + 0xDC00); \
return 4; \
} \
return 0; \
}
#define DEFINE_UTF16_TO_UTF8 \
static \
void PREFIX(toUtf8)(const ENCODING *enc, \
const char **fromP, const char *fromLim, \
char **toP, const char *toLim) \
{ \
const char *from; \
for (from = *fromP; from != fromLim; from += 2) { \
int plane; \
unsigned char lo2; \
unsigned char lo = GET_LO(from); \
unsigned char hi = GET_HI(from); \
switch (hi) { \
case 0: \
if (lo < 0x80) { \
if (*toP == toLim) { \
*fromP = from; \
return; \
} \
*(*toP)++ = lo; \
break; \
} \
/* fall through */ \
case 0x1: case 0x2: case 0x3: \
case 0x4: case 0x5: case 0x6: case 0x7: \
if (toLim - *toP < 2) { \
*fromP = from; \
return; \
} \
*(*toP)++ = ((lo >> 6) | (hi << 2) | cval2); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
break; \
default: \
if (toLim - *toP < 3) { \
*fromP = from; \
return; \
} \
/* 16 bits divided 4, 6, 6 amongst 3 bytes */ \
*(*toP)++ = ((hi >> 4) | cval3); \
*(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
break; \
case 0xD8: case 0xD9: case 0xDA: case 0xDB: \
if (toLim - *toP < 4) { \
*fromP = from; \
return; \
} \
plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
*(*toP)++ = ((plane >> 2) | cval4); \
*(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \
from += 2; \
lo2 = GET_LO(from); \
*(*toP)++ = (((lo & 0x3) << 4) \
| ((GET_HI(from) & 0x3) << 2) \
| (lo2 >> 6) \
| 0x80); \
*(*toP)++ = ((lo2 & 0x3f) | 0x80); \
break; \
} \
} \
*fromP = from; \
}
#define PREFIX(ident) little2_ ## ident
#define MINBPC 2
#define BYTE_TYPE(enc, p) \
((p)[1] == 0 ? latin1tab[(unsigned char)*(p)] : unicode_byte_type((p)[1], (p)[0]))
#define BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1)
#define CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c)
#define IS_NAME_CHAR(enc, p, n) \
UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
#define IS_NMSTRT_CHAR(enc, p, n) \
UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
#include "xmltok_impl.c"
#define SET2(ptr, ch) \
(((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))
#define GET_LO(ptr) ((unsigned char)(ptr)[0])
#define GET_HI(ptr) ((unsigned char)(ptr)[1])
DEFINE_UTF16_ENCODE
DEFINE_UTF16_TO_UTF8
#undef SET2
#undef GET_LO
#undef GET_HI
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NMSTRT_CHAR
#undef IS_INVALID_CHAR
static const struct encoding little2_encoding = { VTABLE, 2 };
#undef PREFIX
#define PREFIX(ident) big2_ ## ident
#define MINBPC 2
/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
#define BYTE_TYPE(enc, p) \
((p)[0] == 0 ? latin1tab[(unsigned char)(p)[1]] : unicode_byte_type((p)[0], (p)[1]))
#define BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1)
#define CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c)
#define IS_NAME_CHAR(enc, p, n) \
UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
#define IS_NMSTRT_CHAR(enc, p, n) \
UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
#include "xmltok_impl.c"
#define SET2(ptr, ch) \
(((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))
#define GET_LO(ptr) ((unsigned char)(ptr)[1])
#define GET_HI(ptr) ((unsigned char)(ptr)[0])
DEFINE_UTF16_ENCODE
DEFINE_UTF16_TO_UTF8
#undef SET2
#undef GET_LO
#undef GET_HI
#undef MINBPC
#undef BYTE_TYPE
#undef BYTE_TO_ASCII
#undef CHAR_MATCHES
#undef IS_NAME_CHAR
#undef IS_NMSTRT_CHAR
#undef IS_INVALID_CHAR
static const struct encoding big2_encoding = { VTABLE, 2 };
#undef PREFIX
static
int streqci(const char *s1, const char *s2)
{
for (;;) {
char c1 = *s1++;
char c2 = *s2++;
if ('a' <= c1 && c1 <= 'z')
c1 += 'A' - 'a';
if ('a' <= c2 && c2 <= 'z')
c2 += 'A' - 'a';
if (c1 != c2)
return 0;
if (!c1)
break;
}
return 1;
}
static
int initScan(const ENCODING *enc, int state, const char *ptr, const char *end,
const char **nextTokPtr)
{
const ENCODING **encPtr;
if (ptr == end)
return XML_TOK_NONE;
encPtr = ((const INIT_ENCODING *)enc)->encPtr;
if (ptr + 1 == end) {
switch ((unsigned char)*ptr) {
case 0xFE:
case 0xFF:
case 0x00:
case 0x3C:
return XML_TOK_PARTIAL;
}
}
else {
switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) {
case 0x003C:
*encPtr = &big2_encoding;
return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
case 0xFEFF:
*nextTokPtr = ptr + 2;
*encPtr = &big2_encoding;
return XML_TOK_BOM;
case 0x3C00:
*encPtr = &little2_encoding;
return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
case 0xFFFE:
*nextTokPtr = ptr + 2;
*encPtr = &little2_encoding;
return XML_TOK_BOM;
}
}
*encPtr = &utf8_encoding.enc;
return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
}
static
int initScanProlog(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return initScan(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr);
}
static
int initScanContent(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return initScan(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr);
}
static
void initUpdatePosition(const ENCODING *enc, const char *ptr,
const char *end, POSITION *pos)
{
normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
}
const ENCODING *XmlGetInternalEncoding(int e)
{
switch (e) {
case XML_UTF8_ENCODING:
return &internal_utf8_encoding.enc;
}
return 0;
}
int XmlInitEncoding(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
{
if (name) {
if (streqci(name, "ISO-8859-1")) {
*encPtr = &latin1_encoding.enc;
return 1;
}
if (streqci(name, "UTF-8")) {
*encPtr = &utf8_encoding.enc;
return 1;
}
if (!streqci(name, "UTF-16"))
return 0;
}
p->initEnc.scanners[XML_PROLOG_STATE] = initScanProlog;
p->initEnc.scanners[XML_CONTENT_STATE] = initScanContent;
p->initEnc.updatePosition = initUpdatePosition;
p->initEnc.minBytesPerChar = 1;
p->encPtr = encPtr;
*encPtr = &(p->initEnc);
return 1;
}
static
int toAscii(const ENCODING *enc, const char *ptr, const char *end)
{
char buf[1];
char *p = buf;
XmlConvert(enc, XML_UTF8_ENCODING, &ptr, end, &p, p + 1);
if (p == buf)
return -1;
else
return buf[0];
}
static
int isSpace(int c)
{
switch (c) {
case ' ':
case '\r':
case '\n':
case '\t':
return 1;
}
return 0;
}
/* Return 1 if there's just optional white space
or there's an S followed by name=val. */
static
int parsePseudoAttribute(const ENCODING *enc,
const char *ptr,
const char *end,
const char **namePtr,
const char **valPtr,
const char **nextTokPtr)
{
int c;
char open;
if (ptr == end) {
*namePtr = 0;
return 1;
}
if (!isSpace(toAscii(enc, ptr, end))) {
*nextTokPtr = ptr;
return 0;
}
do {
ptr += enc->minBytesPerChar;
} while (isSpace(toAscii(enc, ptr, end)));
if (ptr == end) {
*namePtr = 0;
return 1;
}
*namePtr = ptr;
for (;;) {
c = toAscii(enc, ptr, end);
if (c == -1) {
*nextTokPtr = ptr;
return 0;
}
if (c == '=')
break;
if (isSpace(c)) {
do {
ptr += enc->minBytesPerChar;
} while (isSpace(c = toAscii(enc, ptr, end)));
if (c != '=') {
*nextTokPtr = ptr;
return 0;
}
break;
}
ptr += enc->minBytesPerChar;
}
if (ptr == *namePtr) {
*nextTokPtr = ptr;
return 0;
}
ptr += enc->minBytesPerChar;
c = toAscii(enc, ptr, end);
while (isSpace(c)) {
ptr += enc->minBytesPerChar;
c = toAscii(enc, ptr, end);
}
if (c != '"' && c != '\'') {
*nextTokPtr = ptr;
return 0;
}
open = c;
ptr += enc->minBytesPerChar;
*valPtr = ptr;
for (;; ptr += enc->minBytesPerChar) {
c = toAscii(enc, ptr, end);
if (c == open)
break;
if (!('a' <= c && c <= 'z')
&& !('A' <= c && c <= 'Z')
&& !('0' <= c && c <= '9')
&& c != '.'
&& c != '-'
&& c != '_') {
*nextTokPtr = ptr;
return 0;
}
}
*nextTokPtr = ptr + enc->minBytesPerChar;
return 1;
}
static
const ENCODING *findEncoding(const ENCODING *enc, const char *ptr, const char *end)
{
#define ENCODING_MAX 128
char buf[ENCODING_MAX];
char *p = buf;
int i;
XmlConvert(enc, XML_UTF8_ENCODING, &ptr, end, &p, p + ENCODING_MAX - 1);
if (ptr != end)
return 0;
*p = 0;
for (i = 0; buf[i]; i++) {
if ('a' <= buf[i] && buf[i] <= 'z')
buf[i] += 'A' - 'a';
}
if (streqci(buf, "UTF-8"))
return &utf8_encoding.enc;
if (streqci(buf, "ISO-8859-1"))
return &latin1_encoding.enc;
if (streqci(buf, "UTF-16")) {
static const unsigned short n = 1;
if (enc->minBytesPerChar == 2)
return enc;
return &big2_encoding;
}
return 0;
}
int XmlParseXmlDecl(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingName,
const ENCODING **encoding,
int *standalone)
{
const char *val = 0;
const char *name = 0;
ptr += 5 * enc->minBytesPerChar;
end -= 2 * enc->minBytesPerChar;
if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr) || !name) {
*badPtr = ptr;
return 0;
}
if (!XmlNameMatchesAscii(enc, name, "version")) {
if (!isGeneralTextEntity) {
*badPtr = name;
return 0;
}
}
else {
if (versionPtr)
*versionPtr = val;
if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) {
*badPtr = ptr;
return 0;
}
if (!name)
return 1;
}
if (XmlNameMatchesAscii(enc, name, "encoding")) {
int c = toAscii(enc, val, end);
if (!('a' <= c && c <= 'z') && !('A' <= c && c <= 'Z')) {
*badPtr = val;
return 0;
}
if (encodingName)
*encodingName = val;
if (encoding)
*encoding = findEncoding(enc, val, ptr - enc->minBytesPerChar);
if (!parsePseudoAttribute(enc, ptr, end, &name, &val, &ptr)) {
*badPtr = ptr;
return 0;
}
if (!name)
return 1;
}
if (!XmlNameMatchesAscii(enc, name, "standalone") || isGeneralTextEntity) {
*badPtr = name;
return 0;
}
if (XmlNameMatchesAscii(enc, val, "yes")) {
if (standalone)
*standalone = 1;
}
else if (XmlNameMatchesAscii(enc, val, "no")) {
if (standalone)
*standalone = 0;
}
else {
*badPtr = val;
return 0;
}
while (isSpace(toAscii(enc, ptr, end)))
ptr += enc->minBytesPerChar;
if (ptr != end) {
*badPtr = ptr;
return 0;
}
return 1;
}
static
int checkCharRefNumber(int result)
{
switch (result >> 8) {
case 0xD8: case 0xD9: case 0xDA: case 0xDB:
case 0xDC: case 0xDD: case 0xDE: case 0xDF:
return -1;
case 0:
if (latin1_encoding.type[result] == BT_NONXML)
return -1;
break;
case 0xFF:
if (result == 0xFFFE || result == 0xFFFF)
return -1;
break;
}
return result;
}

Просмотреть файл

@ -0,0 +1,252 @@
/*
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):
*/
#ifndef XmlTok_INCLUDED
#define XmlTok_INCLUDED 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef XMLTOKAPI
#define XMLTOKAPI /* as nothing */
#endif
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
#define XML_TOK_NONE -4 /* The string to be scanned is empty */
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
might be part of CRLF sequence */
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
#define XML_TOK_PARTIAL -1 /* only part of a token */
#define XML_TOK_INVALID 0
/* The following tokens are returned by XmlContentTok; some are also
returned by XmlAttributeValueTok and XmlEntityTok */
#define XML_TOK_START_TAG_WITH_ATTS 1
#define XML_TOK_START_TAG_NO_ATTS 2
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
#define XML_TOK_END_TAG 5
#define XML_TOK_DATA_CHARS 6
#define XML_TOK_DATA_NEWLINE 7
#define XML_TOK_CDATA_SECTION 8
#define XML_TOK_ENTITY_REF 9
#define XML_TOK_CHAR_REF 10 /* numeric character reference */
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
#define XML_TOK_PI 11 /* processing instruction */
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
#define XML_TOK_COMMENT 13
#define XML_TOK_BOM 14 /* Byte order mark */
/* The following tokens are returned only by XmlPrologTok */
#define XML_TOK_PROLOG_S 15
#define XML_TOK_DECL_OPEN 16 /* <!foo */
#define XML_TOK_DECL_CLOSE 17 /* > */
#define XML_TOK_NAME 18
#define XML_TOK_NMTOKEN 19
#define XML_TOK_POUND_NAME 20 /* #name */
#define XML_TOK_OR 21 /* | */
#define XML_TOK_PERCENT 22
#define XML_TOK_OPEN_PAREN 23
#define XML_TOK_CLOSE_PAREN 24
#define XML_TOK_OPEN_BRACKET 25
#define XML_TOK_CLOSE_BRACKET 26
#define XML_TOK_LITERAL 27
#define XML_TOK_PARAM_ENTITY_REF 28
#define XML_TOK_INSTANCE_START 29
/* The following occur only in element type declarations */
#define XML_TOK_NAME_QUESTION 30 /* name? */
#define XML_TOK_NAME_ASTERISK 31 /* name* */
#define XML_TOK_NAME_PLUS 32 /* name+ */
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
#define XML_TOK_COMMA 38
/* The following tokens is returned only by XmlAttributeValueTok */
#define XML_TOK_ATTRIBUTE_VALUE_S 39
#define XML_N_STATES 2
#define XML_PROLOG_STATE 0
#define XML_CONTENT_STATE 1
#define XML_N_LITERAL_TYPES 2
#define XML_ATTRIBUTE_VALUE_LITERAL 0
#define XML_ENTITY_VALUE_LITERAL 1
#define XML_N_INTERNAL_ENCODINGS 1
#define XML_UTF8_ENCODING 0
#if 0
#define XML_UTF16_ENCODING 1
#define XML_UCS4_ENCODING 2
#endif
#define XML_MAX_BYTES_PER_CHAR 4
typedef struct position {
/* first line and first column are 0 not 1 */
unsigned long lineNumber;
unsigned long columnNumber;
} POSITION;
typedef struct {
const char *name;
const char *valuePtr;
const char *valueEnd;
char normalized;
} ATTRIBUTE;
struct encoding;
typedef struct encoding ENCODING;
struct encoding {
int (*scanners[XML_N_STATES])(const ENCODING *,
const char *,
const char *,
const char **);
int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
const char *,
const char *,
const char **);
int (*sameName)(const ENCODING *,
const char *, const char *);
int (*nameMatchesAscii)(const ENCODING *,
const char *, const char *);
int (*nameLength)(const ENCODING *, const char *);
const char *(*skipS)(const ENCODING *, const char *);
int (*getAtts)(const ENCODING *enc, const char *ptr,
int attsMax, ATTRIBUTE *atts);
int (*charRefNumber)(const ENCODING *enc, const char *ptr);
void (*updatePosition)(const ENCODING *,
const char *ptr,
const char *end,
POSITION *);
int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
const char **badPtr);
int (*encode)(const ENCODING *enc,
int charNum,
char *buf);
void (*convert[XML_N_INTERNAL_ENCODINGS])(const ENCODING *enc,
const char **fromP,
const char *fromLim,
char **toP,
const char *toLim);
int minBytesPerChar;
};
/*
Scan the string starting at ptr until the end of the next complete token,
but do not scan past eptr. Return an integer giving the type of token.
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
Return XML_TOK_PARTIAL when the string does not contain a complete token;
nextTokPtr will not be set.
Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr
will be set to point to the character which made the token invalid.
Otherwise the string starts with a valid token; nextTokPtr will be set to point
to the character following the end of that token.
Each data character counts as a single token, but adjacent data characters
may be returned together. Similarly for characters in the prolog outside
literals, comments and processing instructions.
*/
#define XmlTok(enc, state, ptr, end, nextTokPtr) \
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
/* This is used for performing a 2nd-level tokenization on
the content of a literal that has already been returned by XmlTok. */
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
#define XmlNameMatchesAscii(enc, ptr1, ptr2) \
(((enc)->nameMatchesAscii)(enc, ptr1, ptr2))
#define XmlNameLength(enc, ptr) \
(((enc)->nameLength)(enc, ptr))
#define XmlSkipS(enc, ptr) \
(((enc)->skipS)(enc, ptr))
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
(((enc)->getAtts)(enc, ptr, attsMax, atts))
#define XmlCharRefNumber(enc, ptr) \
(((enc)->charRefNumber)(enc, ptr))
#define XmlUpdatePosition(enc, ptr, end, pos) \
(((enc)->updatePosition)(enc, ptr, end, pos))
#define XmlIsPublicId(enc, ptr, end, badPtr) \
(((enc)->isPublicId)(enc, ptr, end, badPtr))
#define XmlEncode(enc, ch, buf) \
(((enc)->encode)(enc, ch, buf))
#define XmlConvert(enc, targetEnc, fromP, fromLim, toP, toLim) \
(((enc)->convert[targetEnc])(enc, fromP, fromLim, toP, toLim))
typedef struct {
ENCODING initEnc;
const ENCODING **encPtr;
} INIT_ENCODING;
int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingNamePtr,
const ENCODING **namedEncodingPtr,
int *standalonePtr);
int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING XMLTOKAPI *XmlGetInternalEncoding(int);
#ifdef __cplusplus
}
#endif
#endif /* not XmlTok_INCLUDED */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,60 @@
/*
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):
*/
enum {
BT_NONXML,
BT_MALFORM,
BT_LT,
BT_AMP,
BT_RSQB,
BT_LEAD2,
BT_LEAD3,
BT_LEAD4,
BT_TRAIL,
BT_CR,
BT_LF,
BT_GT,
BT_QUOT,
BT_APOS,
BT_EQUALS,
BT_QUEST,
BT_EXCL,
BT_SOL,
BT_SEMI,
BT_NUM,
BT_LSQB,
BT_S,
BT_NMSTRT,
BT_HEX,
BT_DIGIT,
BT_NAME,
BT_MINUS,
BT_OTHER, /* known not to be a name or name start character */
BT_NONASCII, /* might be a name or name start character */
BT_PERCNT,
BT_LPAR,
BT_RPAR,
BT_AST,
BT_PLUS,
BT_COMMA,
BT_VERBAR
};
#include <stddef.h>

49
modules/xml/glue/utils.h Normal file
Просмотреть файл

@ -0,0 +1,49 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _XML_UTILS_H_
#define _XML_UTILS_H_
#include "xp.h"
#include <stdarg.h>
#include <ctype.h>
/* utils.c data structures and defines */
#define CONTAINER_FLAG 0x01
#define LOCKED_FLAG 0x02
/* utils.c function prototypes */
XP_BEGIN_PROTOS
char * append2Strings (const char* str1, const char* str2);
void stringAppendBase (char* dest, const char* addition);
void stringAppend (char* dest, const char* addition);
int16 charSearch (const char c, const char* data);
PRBool endsWith (const char* pattern, const char* uuid);
PRBool startsWith (const char* pattern, const char* uuid);
PRBool substring (const char* pattern, const char* data);
int16 revCharSearch (const char c, const char* data);
PRBool urlEquals (const char* url1, const char* url2);
XP_END_PROTOS
#endif

209
modules/xml/glue/xmldom.c Normal file
Просмотреть файл

@ -0,0 +1,209 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
This file is used to build a persistent XML parse tree.
Eventually, this file will also contain the code to implement
the DOM APIs for access to this tree (any volunteers?)
If you have questions, send them to guha@netscape.com
*/
#include "xmlglue.h"
#define href "href"
#define XLL "XML-Link"
void
XMLDOM_CharHandler (XMLFile f, const char* content, int len) {
XMLElement xmle = (XMLElement)getMem(sizeof(XMLElementStruct));
xmle->content = getMem(len+1);
memcpy(xmle->content, content, len);
xmle->tag = "xml:content";
addChild(f->current, xmle);
}
char *
xmlgetAttributeValue (const char** attlist, char* elName)
{
size_t n = 0;
if (!attlist) return NULL;
while ((n < 2*MAX_ATTRIBUTES) && (*(attlist + n) != NULL)) {
if (strcmp(*(attlist + n), elName) == 0) return (char*)*(attlist + n + 1);
n = n + 2;
}
return NULL;
}
char **
copyCharStarList (char** list)
{
size_t length = 0;
while (*(list + length++)){}
if (length == 0) {
return NULL;
} else {
char** ans = getMem(length * sizeof(char*));
size_t n = 0;
while (*(list + n++)) {
*(ans + n - 1) = copyString(*(list + n - 1));
}
return ans;
}
}
char *
makeAbsoluteURL (char* p1, char* p2)
{
#ifdef XP_MAC
return p2;
#else
return NET_MakeAbsoluteURL(p1, p2);
#endif
}
void
addStyleSheet(XMLFile f, StyleSheet ss)
{
if (f->ss == NULL) {
f->ss = ss;
} else {
StyleSheet nss = f->ss;
while (nss->next != NULL) nss = nss->next;
nss->next = ss;
}
}
void
addChild (XMLElement parent, XMLElement child)
{
if (parent->child == NULL) {
parent->child = child;
} else {
XMLElement nc = parent->child;
while (nc->next) {nc = nc->next;}
nc->next = child;
}
}
void XMLDOM_EndHandler (XMLFile f, const char* elementName) {
f->current = f->current->parent;
}
void XMLDOM_StartHandler (XMLFile f, const char* elementName, const char** attlist) {
XMLElement xmle = (XMLElement)getMem(sizeof(XMLElementStruct));
xmle->parent = f->current;
if (f->top == NULL) f->top = xmle;
xmle->tag = copyString(elementName);
xmle->attributes = copyCharStarList((char**)attlist);
if (f->current) addChild(f->current, xmle);
f->current = xmle;
if (xmlgetAttributeValue(xmle->attributes, XLL) != NULL) {
char* linkTag = xmlgetAttributeValue(xmle->attributes, XLL);
char* hrefVal = xmlgetAttributeValue(xmle->attributes, href);
char* type = xmlgetAttributeValue(xmle->attributes, "Role");
char* show = xmlgetAttributeValue(xmle->attributes, "Show");
if (linkTag && (stringEquals(linkTag, "LINK")) &&
hrefVal && type && stringEquals(type, "HTML") &&
show && (stringEquals(show, "Embed"))) {
XMLHTMLInclusion incl = (XMLHTMLInclusion)getMem(sizeof(XMLHTMLInclusionStruct));
incl->xml = f;
incl->content = (char**)getMem(400);
xmle->content = (char*) incl;
f->numOpenStreams++;
readHTML(makeAbsoluteURL(f->address, hrefVal), incl);
}
}
}
void XMLDOM_PIHandler (XMLFile f, const char *elementName, const char *data) {
if (startsWith("xml:stylesheet", elementName)) {
char* url ;
char* attlist[2*MAX_ATTRIBUTES+1];
char* attv;
char* xdata = ((data == NULL) ? NULL : copyString(data));
StyleSheet ss;
tokenizeXMLElement ((char*) xdata, (char**)attlist);
attv = xmlgetAttributeValue(attlist, "type");
if (!(attv && (startsWith("text/css", attv)))) {
freeMem(xdata);
return;
}
url = xmlgetAttributeValue(attlist, href);
ss = (StyleSheet) getMem(sizeof(StyleSheetStruct));
ss->address = makeAbsoluteURL(f->address, url);
ss->line = (char*)getMem(XML_BUF_SIZE);
ss->holdOver = (char*)getMem(XML_BUF_SIZE);
ss->lineSize = XML_BUF_SIZE;
ss->xmlFile = f;
f->numOpenStreams++;
addStyleSheet(f, ss);
readCSS(ss);
freeMem(xdata);
return;
}
}
void
tokenizeXMLElement (char* attr, char** attlist)
{
size_t n = 0;
size_t s = strlen(attr);
char c ;
size_t m = 0;
size_t atc = 0;
PRBool inAttrNamep = 1;
while (atc < 2*MAX_ATTRIBUTES+1) {*(attlist + atc++) = NULL;}
atc = 0;
while (n < s) {
PRBool attributeOpenStringSeenp = 0;
m = 0;
c = attr[n++];
while ((n <= s) && (atc < 2*MAX_ATTRIBUTES)) {
if (inAttrNamep && (m > 0) && (wsc(c) || (c == '='))) {
attr[n-1] = '\0';
*(attlist + atc++) = &attr[n-m-1];
break;
}
if (!inAttrNamep && attributeOpenStringSeenp && (c == '"')) {
attr[n-1] = '\0';
*(attlist + atc++) = &attr[n-m-1];
break;
}
if (inAttrNamep) {
if ((m > 0) || (!wsc(c))) m++;
} else {
if (c == '"') {
attributeOpenStringSeenp = 1;
} else {
if ((m > 0) || (!(wsc(c)))) m++;
}
}
c = attr[n++];
}
inAttrNamep = (inAttrNamep ? 0 : 1);
}
}

349
modules/xml/glue/xmlglue.c Normal file
Просмотреть файл

@ -0,0 +1,349 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
This is some glue code for feeding data into the xml parser.
It also has glue code for using CSS to specify display properties
for an xml file.
For more info on XML in navigator, look at the XML section
of www.mozilla.org.
If you have questions, send them to guha@netscape.com
*/
#include "xmlglue.h"
#include "xmlparse.h"
#include "xmlss.h"
unsigned int
xml_write_ready(NET_StreamClass *stream)
{
return XML_LINE_SIZE;
}
int xml_parse_abort (NET_StreamClass *stream) {
XMLFile obj= (XMLFile) stream->data_object;
NET_StreamClass *newstream;
URL_Struct *urls = obj->urls;
const char* error = XML_ErrorString(XML_GetErrorCode(obj->parser));
char* buff = getMem(150);
int n = XML_GetErrorLineNumber(obj->parser);
URL_Struct *nurls = NET_CreateURLStruct(copyString(urls->address), NET_DONT_RELOAD);
StrAllocCopy(nurls->content_type, TEXT_HTML);
newstream = NET_StreamBuilder(1, nurls, (MWContext*)obj->mwcontext);
sprintf(buff, "<B>Bad XML at line %i :</B><BR><P> ERROR = ", n);
(*(newstream->put_block))(newstream, buff, strlen(buff));
(*(newstream->put_block))(newstream, error, strlen(error));
newstream->complete(newstream);
freeMem(buff);
NET_FreeURLStruct(nurls);
return -1;
}
void
xml_abort(NET_StreamClass *stream, int status)
{
XMLFile obj= (XMLFile) stream->data_object;
if (obj->status != 1) {
xml_parse_abort(stream);
} else {
XML_Parse(obj->parser, NULL, 0, 1);
}
XML_ParserFree(obj->parser);
}
int
xml_write(NET_StreamClass *stream, char* data, int32 len)
{
XMLFile obj= (XMLFile) stream->data_object;
char* ndata = getMem(len+1);
memcpy(ndata, data, len);
if (obj->status == 1) obj->status = XML_Parse(obj->parser, ndata, len, 0);
return 0;
}
void
xml_complete (NET_StreamClass *stream)
{
NET_StreamClass *newstream;
XMLFile obj= (XMLFile) stream->data_object;
URL_Struct *urls = obj->urls;
if (obj->status != 1) {
xml_parse_abort(stream);
return;
}
XML_Parse(obj->parser, NULL, 0, 1);
XML_ParserFree(obj->parser);
obj->numOpenStreams--;
if (obj->numOpenStreams < 1) {
/* direct the stream to the html parser */
URL_Struct *nurls = NET_CreateURLStruct(copyString(urls->address), NET_DONT_RELOAD);
StrAllocCopy(nurls->content_type, TEXT_HTML);
newstream = NET_StreamBuilder(1, nurls, (MWContext*)obj->mwcontext);
obj->stream = newstream;
convertToHTML(obj);
newstream->complete(newstream);
NET_FreeURLStruct(nurls);
}
}
void
outputToStream (XMLFile f, char* s)
{
int ans = 0;
NET_StreamClass *stream = (NET_StreamClass*) f->stream;
char* buff = copyString(s);
#ifdef DEBUG
/* FE_Trace(s); */
#endif
if (buff) (*(stream->put_block))(stream, buff, strlen(s));
freeMem(buff);
}
#ifdef XP_MAC
PR_PUBLIC_API(NET_StreamClass *)
#else
PUBLIC NET_StreamClass *
#endif
XML_XMLConverter(FO_Present_Types format_out, void *data_object, URL_Struct *URL_s, MWContext *window_id)
{
NET_StreamClass* stream;
XMLFile xmlf;
TRACEMSG(("Setting up display stream. Have URL: %s\n", URL_s->address));
xmlf = (XMLFile) getMem(sizeof(XMLFileStruct));
xmlf->urls = URL_s;
xmlf->parser = XML_ParserCreate(NULL) ;
XML_SetElementHandler(xmlf->parser, XMLDOM_StartHandler, XMLDOM_EndHandler);
XML_SetCharacterDataHandler(xmlf->parser, XMLDOM_CharHandler);
XML_SetProcessingInstructionHandler(xmlf->parser, XMLDOM_PIHandler);
XML_SetUserData(xmlf->parser, xmlf);
xmlf->status = 1;
xmlf->address = copyString(URL_s->address);
xmlf->mwcontext = window_id;
xmlf->numOpenStreams = 1;
/* URL_s->fedata = xmlf; */
stream = NET_NewStream("XML", (MKStreamWriteFunc)xml_write,
(MKStreamCompleteFunc)xml_complete,
(MKStreamAbortFunc)xml_abort,
(MKStreamWriteReadyFunc)xml_write_ready, xmlf, window_id);
if (stream == NULL) freeMem(xmlf);
return(stream);
}
/* XML-CSS stuff */
unsigned int
xmlcss_write_ready(NET_StreamClass *stream)
{
return XML_LINE_SIZE;
}
void
xmlcss_abort(NET_StreamClass *stream, int status)
{
StyleSheet obj=stream->data_object;
XMLFile xml = obj->xmlFile;
xml->numOpenStreams--;
freeMem(obj->holdOver);
freeMem(obj->line);
obj->line = obj->holdOver = NULL;
}
void
xmlcss_complete (NET_StreamClass *stream)
{
StyleSheet ss =stream->data_object;
URL_Struct *urls = ss->urls;
XMLFile xml = ss->xmlFile;
freeMem(ss->holdOver);
freeMem(ss->line);
ss->line = ss->holdOver = NULL;
xml->numOpenStreams--;
if (xml->numOpenStreams == 0) {
/* direct the stream to the html parser */
NET_StreamClass *newstream;
URL_Struct *nurls = NET_CreateURLStruct(copyString(xml->address), NET_DONT_RELOAD);
StrAllocCopy(nurls->content_type, TEXT_HTML);
newstream = NET_StreamBuilder(1, nurls, (MWContext*) xml->mwcontext);
xml->stream = newstream;
convertToHTML(xml);
newstream->complete(newstream);
NET_FreeURLStruct(nurls);
}
}
#ifdef XP_MAC
PR_PUBLIC_API(NET_StreamClass *)
#else
PUBLIC NET_StreamClass *
#endif
XML_CSSConverter(FO_Present_Types format_out, void *data_object, URL_Struct *URL_s, MWContext *window_id)
{
StyleSheet ss = (StyleSheet) URL_s->fe_data;
TRACEMSG(("Setting up style sheet stream. Have URL: %s\n", URL_s->address));
return NET_NewStream("XML-CSS", (MKStreamWriteFunc)parseNextXMLCSSBlob,
(MKStreamCompleteFunc)xmlcss_complete,
(MKStreamAbortFunc)xmlcss_abort,
(MKStreamWriteReadyFunc)xmlcss_write_ready, ss, window_id);
}
void
xmlcss_GetUrlExitFunc (URL_Struct *urls, int status, MWContext *cx)
{
}
void
readCSS (StyleSheet ss)
{
URL_Struct *urls;
urls = NET_CreateURLStruct(ss->address, NET_DONT_RELOAD);
if (urls == NULL) {
ss->xmlFile->numOpenStreams--;
return;
}
urls->fe_data = ss;
NET_GetURL(urls, FO_CACHE_AND_XMLCSS, ss->xmlFile->mwcontext, xmlcss_GetUrlExitFunc);
}
int
xmlhtml_write(NET_StreamClass *stream, const char *str, int32 len)
{
XMLHTMLInclusion obj=stream->data_object;
char* newStr;
if (obj == NULL || len < 0) {
return MK_INTERRUPTED;
}
newStr = getMem(len+1);
memcpy(newStr, str, len);
*(obj->content + obj->n++) = newStr;
return (len);
}
unsigned int
xmlhtml_write_ready(NET_StreamClass *stream)
{
return XML_LINE_SIZE;
}
void
xmlhtml_abort(NET_StreamClass *stream, int status)
{
}
void
xmlhtml_complete (NET_StreamClass *stream)
{
XMLHTMLInclusion ss =stream->data_object;
XMLFile xml = ss->xml;
xml->numOpenStreams--;
if (xml->numOpenStreams == 0) {
/* direct the stream to the html parser */
NET_StreamClass *newstream;
URL_Struct *nurls = NET_CreateURLStruct(copyString(xml->address), NET_DONT_RELOAD);
StrAllocCopy(nurls->content_type, TEXT_HTML);
newstream = NET_StreamBuilder(1, nurls, (MWContext*) xml->mwcontext);
xml->stream = newstream;
convertToHTML(xml);
newstream->complete(newstream);
NET_FreeURLStruct(nurls);
}
}
#ifdef XP_MAC
PR_PUBLIC_API(NET_StreamClass *)
#else
PUBLIC NET_StreamClass *
#endif
XML_HTMLConverter(FO_Present_Types format_out, void *data_object, URL_Struct *URL_s, MWContext *window_id)
{
XMLHTMLInclusion ss = (XMLHTMLInclusion) URL_s->fe_data;
return NET_NewStream("XML-HTML", (MKStreamWriteFunc)xmlhtml_write,
(MKStreamCompleteFunc)xmlhtml_complete,
(MKStreamAbortFunc)xmlhtml_abort,
(MKStreamWriteReadyFunc)xmlhtml_write_ready, ss, window_id);
}
void
xmlhtml_GetUrlExitFunc (URL_Struct *urls, int status, MWContext *cx)
{
}
void
readHTML (char* url, XMLHTMLInclusion ss)
{
URL_Struct *urls;
urls = NET_CreateURLStruct(url, NET_DONT_RELOAD);
if (urls == NULL) {
ss->xml->numOpenStreams--;
return;
}
urls->fe_data = ss;
NET_GetURL(urls, FO_CACHE_AND_XMLHTML, ss->xml->mwcontext, xmlhtml_GetUrlExitFunc);
}

180
modules/xml/glue/xmlglue.h Normal file
Просмотреть файл

@ -0,0 +1,180 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _RDF_XMLGLUE_H_
#define _RDF_XMLGLUE_H_
#include "xmlparse.h"
#ifdef XP_UNIX
#include <sys/fcntl.h>
#elif defined(XP_MAC)
#include <fcntl.h>
#endif
/* xmlglue.c data structures and defines */
#define XML_LINE_SIZE 500
#include <stdlib.h>
#include <string.h>
#include "nspr.h"
#include "plhash.h"
#include "ntypes.h"
#include "net.h"
#include "xp.h"
#include "xp_str.h"
#include "utils.h"
#include "xmlparse.h"
#define getMem(x) PR_Calloc(1,(x))
#define freeMem(x) PR_Free((x))
#define copyString(source) XP_STRDUP(source)
#define stringEquals(x, y) (strcasecomp(x, y) ==0)
#ifndef true
#define true PR_TRUE
#endif
#ifndef false
#define false PR_FALSE
#endif
#define null NULL
#define nullp(x) (((void*)x) == ((void*)0))
/* xmlparse.c data structures and defines */
#define MAX_TAG_SIZE 100
#define MAX_ATTRIBUTES 10
#define XML_BUF_SIZE 4096
#define wsc(c) ((c == ' ') || (c == '\r') || (c == '\n') || (c == '\t'))
typedef struct _XMLFileStruct {
int32 status;
struct _StyleSheetStruct* ss;
struct _XMLElementStruct* top;
struct _XMLElementStruct* current;
void* stream;
int8 numOpenStreams;
void* urls;
void* mwcontext;
char* address;
XML_Parser parser;
} XMLFileStruct;
typedef XMLFileStruct* XMLFile;
typedef struct _StyleSheetStruct {
XMLFile xmlFile;
struct _StyleElementStruct* el;
struct _StyleSheetStruct* next;
void* urls;
char* holdOver;
int32 lineSize;
char* line;
char* address;
} StyleSheetStruct;
typedef StyleSheetStruct* StyleSheet;
typedef struct _StyleElementStruct {
char** tagStack;
char* style;
struct _StyleElementStruct* next;
} StyleElementStruct;
typedef StyleElementStruct* StyleElement;
typedef struct _XMLElementStruct {
char* tag;
char** attributes;
char* content;
struct _XMLElementStruct* parent;
struct _XMLElementStruct* child;
struct _XMLElementStruct* next;
} XMLElementStruct;
typedef XMLElementStruct* XMLElement;
typedef struct _XMLHTMLInclusionStruct {
char** content;
XMLFile xml;
int32 n;
} XMLHTMLInclusionStruct;
typedef XMLHTMLInclusionStruct *XMLHTMLInclusion;
/* xmlparse.c function prototypes */
XP_BEGIN_PROTOS
int parseNextXMLBlob (NET_StreamClass *stream, char* blob, int32 size);
void processNextXMLContent (XMLFile f, char* content);
char ** copyCharStarList (char** list);
char * makeAbsoluteURL (char* p1, char* p2);
void processNextXMLElement (XMLFile f, char* attr);
void addStyleSheet(XMLFile f, StyleSheet ss);
void addChild (XMLElement parent, XMLElement child);
char * getTagHTMLEquiv (XMLFile f, XMLElement el);
void outputAttributes(XMLFile f, char** attlist);
void outputAsHTML (XMLFile f, XMLElement el);
void convertToHTML (XMLFile xf);
void outputStyleSpan (XMLFile f, XMLElement el, PRBool endp);
char * getAttributeValue (const char** attlist, char* elName);
void tokenizeXMLElement (char* attr, char** attlist);
void readCSS(StyleSheet ss);
void outputToStream(XMLFile f, char* s);
void XMLDOM_CharHandler (XMLFile f, const char* content, int len) ;
void XMLDOM_EndHandler (XMLFile f, const char* elementName) ;
void XMLDOM_StartHandler (XMLFile f, const char* elementName, const char** attlist) ;
void XMLDOM_PIHandler (XMLFile f, const char *elementName, const char *attlist) ;
unsigned int xml_write_ready(NET_StreamClass *stream);
void xml_abort(NET_StreamClass *stream, int status);
void xml_complete (NET_StreamClass *stream);
unsigned int xmlcss_write_ready(NET_StreamClass *stream);
void xmlcss_abort(NET_StreamClass *stream, int status);
void xmlcss_complete (NET_StreamClass *stream);
void outputToStream (XMLFile f, char* s);
void xmlcss_GetUrlExitFunc (URL_Struct *urls, int status, MWContext *cx);
void readCSS (StyleSheet ss);
int xmlhtml_write(NET_StreamClass *stream, const char *str, int32 len);
unsigned int xmlhtml_write_ready(NET_StreamClass *stream);
void xmlhtml_abort(NET_StreamClass *stream, int status);
void xmlhtml_complete (NET_StreamClass *stream);
void xmlhtml_GetUrlExitFunc (URL_Struct *urls, int status, MWContext *cx);
void readHTML (char* url, XMLHTMLInclusion ss);
PUBLIC NET_StreamClass * XML_XMLConverter(FO_Present_Types format_out, void *data_object, URL_Struct *URL_s, MWContext *window_id);
PUBLIC NET_StreamClass * XML_CSSConverter(FO_Present_Types format_out, void *data_object, URL_Struct *URL_s, MWContext *window_id);
PUBLIC NET_StreamClass * XML_HTMLConverter(FO_Present_Types format_out, void *data_object, URL_Struct *URL_s, MWContext *window_id);
XP_END_PROTOS
#endif

316
modules/xml/glue/xmlss.c Normal file
Просмотреть файл

@ -0,0 +1,316 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
This is some glue code for a semi-parsing CSS. Its used to
output html from XML.
This will be changed when we incorporate the real xml parser
from James Clark will replace this within the next few weeks.
For more information on this file, contact rjc or guha
For more information on RDF, look at the RDF section of www.mozilla.org
For more info on XML in navigator, look at the XML section
of www.mozilla.org.
*/
#include "xmlss.h"
#define href "href"
#define XLL "XML-Link"
#define BUF_SIZE 500
int
parseNextXMLCSSBlob (NET_StreamClass *stream, char* blob, int32 size)
{
StyleSheet ss;
int32 n, last, m;
PRBool somethingseenp = false;
n = last = 0;
ss = (StyleSheet)(stream->data_object);
if ((ss == NULL) || (size < 0)) {
return MK_INTERRUPTED;
}
while (n < size) {
char c = blob[n];
m = 0;
memset(ss->line, '\0', ss->lineSize);
if (ss->holdOver[0] != '\0') {
memcpy(ss->line, ss->holdOver, strlen(ss->holdOver));
m = strlen(ss->holdOver);
memset(ss->holdOver, '\0', BUF_SIZE);
}
while ((m < 300) && (c != '{') && (c != '}')) {
ss->line[m] = c;
m++;
somethingseenp = (somethingseenp || ((c != ' ') &&
(c != '\r') && (c != '\n')));
n++;
if (n < size) {
c = blob[n];
} else break;
}
if (c == '}') ss->line[m] = c;
n++;
if (m > 0) {
if ((c == '}') || (c == '{')) {
last = n;
if (c == '{') ss->holdOver[0] = '{';
if (somethingseenp) {
parseNextXMLCSSElement(ss, ss->line);
} else if (size > last) {
memcpy(ss->holdOver, ss->line, m);
}
} else if (c == '{') ss->holdOver[0] = '{';
}
}
return(size);
}
void
parseNextXMLCSSElement (StyleSheet ss, char* ele)
{
if (ele[0] == '{') {
char* sty = getMem(strlen(ele)-1);
memcpy(sty, &ele[1], strlen(ele)-2);
ss->el->style = sty;
} else {
StyleElement se = (StyleElement) getMem(sizeof(StyleElementStruct));
size_t numTags, size, n, count;
se->next = ss->el;
ss->el = se;
size = strlen(ele);
count = n = 0;
numTags = countTagStackSize(ele);
while (count < numTags) {
size_t st = 0;
char** tgs = (char**) getMem(numTags * sizeof(char**));
se->tagStack = tgs;
while (st < numTags) {
*(tgs + st++) = getNextSSTag(ele, &n);
}
count++;
}
}
}
size_t
countSSNumTags (char* ele)
{
size_t n = 0;
size_t m = 1;
size_t sz = strlen(ele);
while (n < sz) {
if (ele[n++] == ',') m++;
}
return m;
}
size_t
countTagStackSize (char* ele)
{
size_t n = 0;
size_t m = 0;
PRBool inSpace = 1;
size_t sz = strlen(ele);
while (n < sz) {
if (ele[n] == ',') break;
if ((ele[n] != ' ') && (ele[n] != '\r') && (ele[n] != '\n')) {
if (inSpace) {
m++;
inSpace = 0;
}
} else inSpace = 1;
n++;
}
return m;
}
char*
getNextSSTag (char* ele, size_t* n)
{
char tag[100];
size_t m = 0;
char c = ele[*n];
size_t s = strlen(ele);
memset(tag, '\0', 100);
while ((c == '\r') || (c == ' ') || (c == '\n')) {
*n = *n + 1;
c = ele[*n];
}
while ((c != ' ') && (c != ',') && (*n < s)) {
tag[m++] = c;
*n = *n + 1;
c = ele[*n];
}
return copyString(tag);
}
void
outputAttributes(XMLFile f, char** attlist)
{
uint32 n = 0;
PRBool xmlinkp = (getAttributeValue(attlist, XLL) != NULL);
if (!attlist) return ;
while ((n < 2*MAX_ATTRIBUTES) && (*(attlist + n) != NULL)) {
if (!(xmlinkp && stringEquals(*(attlist + n), href))) {
outputToStream(f, *(attlist + n));
outputToStream(f, "=\"");
outputToStream(f, *(attlist + n + 1));
outputToStream(f, "\" ");
}
n = n + 2;
}
}
void
outputAsHTML (XMLFile f, XMLElement el)
{
if (strcmp(el->tag, "xml:content") == 0) {
outputToStream(f, el->content);
} else {
char* htmlEquiv = getAttributeValue(el->attributes, "html");
char* linkTag = getAttributeValue(el->attributes, XLL);
char* htmlBuff = getMem(1024);
XMLElement child = el->child;
PRBool suppressTag = !startsWith("html:", el->tag) ;
if (linkTag && (stringEquals(linkTag, "LINK"))) {
char* hrefVal = getAttributeValue(el->attributes, href);
if (hrefVal) {
char* type = getAttributeValue(el->attributes, "Role");
char* show = getAttributeValue(el->attributes, "Show");
if (show &&(strcmp(show, "EMBED") == 0)) {
if (type && (strcmp(type, "HTML") == 0)) {
int32 n = 0;
XMLHTMLInclusion incl = (XMLHTMLInclusion) el->content;
while (incl && *(incl->content + n)) {
outputToStream(f, (*(incl->content + n)));
n++;
}
} else if (type && (strcmp(type, "IMAGE") == 0)) {
sprintf(htmlBuff, "<img src=%s>\n", hrefVal);
outputToStream(f, htmlBuff);
}
freeMem(htmlBuff);
return;
} else {
sprintf(htmlBuff, "<a href=\"%s\">", hrefVal);
outputToStream(f, htmlBuff);
}
} else {
linkTag = 0;
}
}
outputStyleSpan(f, el, 0);
if (htmlEquiv) {
sprintf(htmlBuff, "<%s ", htmlEquiv);
outputToStream(f, htmlBuff);
outputAttributes(f, el->attributes);
outputToStream(f, ">\n");
} else if (!suppressTag){
sprintf(htmlBuff, "<%s ", &((el->tag)[5]));
outputToStream(f, htmlBuff);
outputAttributes(f, el->attributes);
outputToStream(f, ">\n");
}
while (child) {
outputAsHTML(f, child);
child = child->next;
}
if (htmlEquiv) {
sprintf(htmlBuff, "</%s>\n", htmlEquiv);
outputToStream(f, htmlBuff);
} else if (!suppressTag) {
sprintf(htmlBuff, "</%s>\n", &((el->tag)[5]));
outputToStream(f, htmlBuff);
}
outputStyleSpan(f, el, 1);
if (linkTag) outputToStream(f, "</a>");
freeMem(htmlBuff);
}
}
void
convertToHTML (XMLFile xf) {
XMLElement el = xf->top;
xf->numOpenStreams--;
if (xf->numOpenStreams < 1) {
outputToStream(xf, "<html><body>");
outputAsHTML(xf, el);
outputToStream(xf, "</body></html>");
}
}
void
outputStyleSpan (XMLFile f, XMLElement el, PRBool endp)
{
StyleSheet ss ;
StyleElement se;
for (ss = f->ss; (ss != NULL) ; ss = ss->next) {
for (se = ss->el; (se != NULL) ; se = se->next) {
if (stringEquals((se->tagStack)[0], el->tag)) {
PRBool divp = startsWith("Display:Block;", se->style);
PRBool listp = startsWith("Display:List-item;", se->style);
if (!endp) {
if (divp) {
outputToStream(f, "<div style=\"");
outputToStream(f, &(se->style)[14]);
} else if (listp) {
outputToStream(f, "<UL><LI><span style=\"");
outputToStream(f, &(se->style)[20]);
} else {
outputToStream(f, "<span style=\"");
outputToStream(f, se->style);
}
outputToStream(f, "\">\n");
} else {
if (divp) {
outputToStream(f, "</div>");
} else if (listp) {
outputToStream(f, "</UL></span>");
} else {
outputToStream(f, "</span>");
}
}
}
}
}
}

45
modules/xml/glue/xmlss.h Normal file
Просмотреть файл

@ -0,0 +1,45 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _RDF_XMLSS_H_
#define _RDF_XMLSS_H_
#include "xmlglue.h"
/* xmlss.c data structures */
/* xmlss.c function prototypes */
XP_BEGIN_PROTOS
int parseNextXMLCSSBlob (NET_StreamClass *stream, char* blob, int32 size);
void parseNextXMLCSSElement (StyleSheet f, char* ele);
size_t countSSNumTags (char* ele);
size_t countTagStackSize (char* ele);
char* getNextSSTag (char* ele, size_t* n);
XP_END_PROTOS
#endif