From 53914f770f1e1dc1ab4342c64846fd995825b7e6 Mon Sep 17 00:00:00 2001 From: Stef Date: Wed, 17 Sep 2003 18:34:42 +0000 Subject: Initial Import --- win32/rtfx.dsp | 177 ++++++++ win32/rtfx.dsw | 29 ++ win32/sablot/INSTALL_WIN | 124 ++++++ win32/sablot/README | 87 ++++ win32/sablot/README_JS | 107 +++++ win32/sablot/RELEASE | 309 ++++++++++++++ win32/sablot/bin/sabcmd.exe | Bin 0 -> 16384 bytes win32/sablot/bin/sablot.dll | Bin 0 -> 253952 bytes win32/sablot/include/sabdbg.h | 58 +++ win32/sablot/include/sablot.h | 560 ++++++++++++++++++++++++ win32/sablot/include/sablot.lib | Bin 0 -> 28044 bytes win32/sablot/include/sdom.h | 921 ++++++++++++++++++++++++++++++++++++++++ win32/sablot/include/shandler.h | 369 ++++++++++++++++ win32/sablot/include/sxpath.h | 264 ++++++++++++ win32/sablot/lib/sablot.lib | Bin 0 -> 28044 bytes win32/sablot/lib/sablotd.lib | Bin 0 -> 28044 bytes 16 files changed, 3005 insertions(+) create mode 100644 win32/rtfx.dsp create mode 100644 win32/rtfx.dsw create mode 100644 win32/sablot/INSTALL_WIN create mode 100644 win32/sablot/README create mode 100644 win32/sablot/README_JS create mode 100644 win32/sablot/RELEASE create mode 100644 win32/sablot/bin/sabcmd.exe create mode 100644 win32/sablot/bin/sablot.dll create mode 100644 win32/sablot/include/sabdbg.h create mode 100644 win32/sablot/include/sablot.h create mode 100644 win32/sablot/include/sablot.lib create mode 100644 win32/sablot/include/sdom.h create mode 100644 win32/sablot/include/shandler.h create mode 100644 win32/sablot/include/sxpath.h create mode 100644 win32/sablot/lib/sablot.lib create mode 100644 win32/sablot/lib/sablotd.lib (limited to 'win32') diff --git a/win32/rtfx.dsp b/win32/rtfx.dsp new file mode 100644 index 0000000..0ca726b --- /dev/null +++ b/win32/rtfx.dsp @@ -0,0 +1,177 @@ +# Microsoft Developer Studio Project File - Name="rtfm" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rtfm - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "rtfm.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "rtfm.mak" CFG="rtfm - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "rtfm - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rtfm - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rtfm - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "sablot/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 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 sablot.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 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 /libpath:"sablot/lib" /opt:nowin98 +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "rtfm - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "sablot/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 sablot.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"sablot/lib" + +!ENDIF + +# Begin Target + +# Name "rtfm - Win32 Release" +# Name "rtfm - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\BaseHandler.cpp +# End Source File +# Begin Source File + +SOURCE=.\LevelHandler.cpp +# End Source File +# Begin Source File + +SOURCE=.\RtfAnalyser.cpp +# End Source File +# Begin Source File + +SOURCE=.\rtfm.cpp +# End Source File +# Begin Source File + +SOURCE=.\RtfParseHelpers.cpp +# End Source File +# Begin Source File + +SOURCE=.\RtfReader.cpp +# End Source File +# Begin Source File + +SOURCE=.\sablotr.cpp +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\BaseHandler.h +# End Source File +# Begin Source File + +SOURCE=.\LevelHandler.h +# End Source File +# Begin Source File + +SOURCE=.\Reference.h +# End Source File +# Begin Source File + +SOURCE=.\RtfAnalyser.h +# End Source File +# Begin Source File + +SOURCE=.\RtfFormatting.h +# End Source File +# Begin Source File + +SOURCE=.\RtfParseHelpers.h +# End Source File +# Begin Source File + +SOURCE=.\RtfReader.h +# End Source File +# Begin Source File + +SOURCE=.\sablo.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\usuals.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/win32/rtfx.dsw b/win32/rtfx.dsw new file mode 100644 index 0000000..c65a996 --- /dev/null +++ b/win32/rtfx.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rtfm"=.\rtfm.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/win32/sablot/INSTALL_WIN b/win32/sablot/INSTALL_WIN new file mode 100644 index 0000000..a84d7d2 --- /dev/null +++ b/win32/sablot/INSTALL_WIN @@ -0,0 +1,124 @@ +This file describes Sablotron installation procedure on Windows. To +find out more on Sablotron, please read the README file in the same +directory as this file. To get more info on installing on Linux or Unix, +please read the file INSTALL. + + +1. Intro +2. Sablotron binaries + 2.1. Binaries and dependencies +3. Building Sablotron from sources + 3.1. Notes on dependencies +4. More information + + +1. Intro +======================================== + +Sablotron is based on Expat XML parser. + +There is a significant change of how Expat is used since version +0.50. Sablotron _never_ looks for Expat under its own source tree, but +it supposes, that you have installed Expat library (1.95.1 or later) +in your system. + +To get Expat, visit + +http://sourceforge.net/projects/expat/ + +and download/install source/binary package. + + +2. Sablotron binaries +======================================== + +Download and extract the binary package. The only requirement is that +expat.dll must be installed in your system. You can download +the Sablot dll as binary from http://sourceforge.net/projects/expat/. +If you download a Windows binary of expat you have to rename it to expat.dll +(without a version number). Ensure expat.dll is on your PATH. + +Copy sablot.dll and sabcmd.exe somewhere to your PATH. + +2.1. Binaries and dependencies +------------------------------ + +To support other than built-in charsets you must use the iconv library. +To support JavaScript extensions you must use JS library by Mozilla. +For your convenience, There is a Sablotron binary package available +supporting both iconv and JavaScript. This package +(Sablot-Win-x.xx-FullPack.zip) actualy contains three independent products: + +- Sablotron binary (linking iconv) +- iconv binary (look at ftp://ftp.ilog.fr/pub/Users/haible/gnu/ for sources) +- JavaScript binary (look at http://www.mozilla.org/js/ for sources) + +Copy iconv.dll, js32.exe, sablot.dll and sabcmd.exe somewhere to your PATH. + + +3. Building Sablotron from sources +======================================== + +If you have downloaded the binary distribution, you can skip reading this +section. + +To build Sablotron from sources you have to build expat first. Download +expat sources from http://sourceforge.net/projects/expat/ and build it +(project file for MS DevStudio 6.0 is included). + +Then you need two files from the expat distribution: expat.h and expat.lib. +Copy both of them to a directory of your choice (c:\temp\lib, for example). + +Extract Sablot sources, go to Sablot-x.xx directory and type: + + nmake -f Makefile.nt EXPAT= EXPAT_LIB= + +To build with iconv and JavaScript (these two dependencies are independent +of each other) type: + + nmake -f Makefile.nt EXPAT= EXPAT_LIB= ICONV= JS= + +where + is the path to the directory where you installed expat, and + is the full name of expat.lib ***relative to ***. + is the path where iconv is installed [OPTIONAL]. + is the path where JavaScript is installed. + +For example, + nmake -f Makefile.nt EXPAT=c:\temp\expat EXPAT_LIB=lib\Debug\expat.lib +or + nmake -f Makefile.nt EXPAT=c:\expat-1.95.1 EXPAT_LIB=expat_1_95_1.lib ICONV=\libiconv-1.3 JS=jc:\js-1.5 + +Then install the Sablotron DLL and executable as described in section 2. +Make sure expat.dll (iconv.dll, js32.dll) are on your PATH. + + +3.1. Notes on dependencies +-------------------------- + +Iconv is a library for encoding conversions. You don't need to have it +installed, but in that case, you will only be able to use a few encodings. +Sablot has been tested on NT with Bruno Haible's implementation of iconv, +available from ftp://ftp.ilog.fr/pub/Users/haible/gnu/libiconv-1.3.tar.gz + +If you change the way Sablot or iconv are being built, make sure they both +use the DLL version of the C runtime library (msvcrt.dll), i.e. compile +with /MD. This is because they need to share the global variable errno. + +JavaScript is the popular Netscape-developed object scripting language. +Sablotron has to link the JS engine to enable extension functions. +See http://www.mozilla.org/js/ for more details or to get sources. + + +4. More information +======================================== + +If you are in trouble and haven't read the README file, you may find some +useful information there. You can check our website as well: + +http://www.gingerall.com + + +Enjoy Sablotron!! + +GA diff --git a/win32/sablot/README b/win32/sablot/README new file mode 100644 index 0000000..628a07a --- /dev/null +++ b/win32/sablot/README @@ -0,0 +1,87 @@ +This is the README file for the XSL processor called Sablotron + +1. What is it Sablotron? +2. Licensing +3. Warranty +4. Porting +5. Installation +6. Sablotron and Perl +7. More info + + +1. What is Sablotron? +======================================== + +Sablotron is an XML processor fully implemented in C++. It uses Expat by +James Clark as an XML parser. Sablotron implements XSLT 1.0, XPath 1.0 +and DOM Level2. + +Original creator of Sablotron is Ginger Alliance (www.gingerall.com). + + +2. Licensing +======================================== + +Sablotron is an Open Source project released under the MPL (Mozilla Public +License). Alternatively you may use Sablotron under the GNU's GPL license. + +Please, look at http://www.mozilla.org/MPL or +http://www.gnu.org/copyleft/gpl.html for further info. + +If you want use the debugger, you may optionally ask Sablotron to use +the GNU readline library. Since this library is available under GPL +only, you have to confirm, that you are accepting the GPL for the +whole Sablotron library. You can do it, if you set the SABLOT_GPL=1 +environment during the configure process. + +3. Warranty +======================================== + +We offer NO WARRANTY for using Sablotron in any conditions. + + +4. Porting +======================================== + +So far Sablotron is tested on Linux (RedHat 5.2, 6.0, 6.1, 6.2, and 7.0), +Windows (NT 4.0, 95, 98, 2000), Solaris (2.5.1, 2.6, 7), HP-UX (11.00), +FreeBSD (3.4, 4.1), OpenBSD (2.8 beta) and OpenServer (5.0.x). We hope, +that it should work on most other Unix systems as well. + +If you build Sablotron on some other system, please, let us +know. All porting activities are welcome. + + +5. Installation +======================================== + +To build and run Sablotron read the INSTALL file in the same +directory as this file. + +To install or compile Sablotron on Windows read the INSTALL_WIN +file instead. + + +6. Sablotron and Perl +======================================== + +If you'd like to call Sablotron from Perl, download the XML::Sablotron +module from our website (http://www.gingerall.org) or from CPAN. + +Follow the instructions from the README and INSTALL files of the Perl package. + + +7. More info +======================================== + +For more info (including Sablotron manual and API reference) look at +the Ginger Alliance web site: + +http://www.gingerall.org + +Maillist subscriptions are also available on this site. + + +Enjoy Sablotron!! + +GA diff --git a/win32/sablot/README_JS b/win32/sablot/README_JS new file mode 100644 index 0000000..c58760b --- /dev/null +++ b/win32/sablot/README_JS @@ -0,0 +1,107 @@ +Sablotron XSLT Extensions Readme File +===================================== + +1. Building +---------------------------------------- + +Extension elements and functions as defined by XSLT 1.0 are +implemented in Sablotron since the version 0.80. Sablotron recognizes +the extension element as +suggested by exslt.org. There are some exceptions described later in +this document. Please note, that this feature is still supposed to be +EXPERIMENTAL. + +If you want to benefit form this feature, you have to install +JavaScript engine from mozilla.org (SpiderMonkey). You have to do it +even when you have Mozilla browser installed, because the binary +browser installation doesn't include essential header files. + +An alternative way to get all neccessary JS files is to download and +install Charlie application framework (see gingerall.org). + +All you need to do on Sablotron side is to run the configure script +with --enable-javascript option. To use JS engine from Charlie +installation, type: ./configure --enable-javascript --enable-perlconnect + +If you have installed JS libraries into non-standard directories, you +need to set (and export) CPLUS_INCLUDE_PATH/LIBRARY_PATH to point to +directories where the header files/lib files (e.g. libjs.so) can be found. + +The default name for the linked library is 'js' (-ljs switch) - if you +need to override this value, you may set SABLOT_JSLIB environment +variable - the configure script uses -l$(SABLOT_JSLIB) in this case. + + +2. What is working +---------------------------------------- + +Sablotron supports JavaScript (ECMA) scripting as described in XSTL WD +1.1. with few exceptions: + +- DOM functions handling namespaces (with NS in their name) are not + supported (throw NOT_SUPPORTED exception) + +- DOM model is read only (as supported, may be changed later) + +- XSLTContext.stringValue is not supported + +- Document.getElementsByTagName{NS} are not supported + +- Element.getElementsByTagName{NS} are not supported + +- DTD definition nodes are not supported + + +The following summarizes what IS supported: + +- exslt:script element support + +- XSLTContext object + +- DOM2 acces to a processed document + +- type mapping between XPath and JavaScript including the XSLT + external object support + +- function-available() function + +- element-available() function + + +3. Sample stylesheet +---------------------------------------- + + + + + + + + + + + + + + + + + + diff --git a/win32/sablot/RELEASE b/win32/sablot/RELEASE new file mode 100644 index 0000000..196dc6f --- /dev/null +++ b/win32/sablot/RELEASE @@ -0,0 +1,309 @@ +#====================================================================# +# The release file for Sablotron # +#====================================================================# + +Version 0.96 +September 5, 2002 +------------- + - XSLT debugger implemented (sabcmd --debugger) + - API fixes for PHP extension + - log() function added to write to Sablot's log from JS scripts + - conflicts of top-level elements (variable, key, script) + initializations resolved + - fixed xslt_process buffer overflow + - fixed a bug of duplicate NS qualified attributes + - minor SXP bug fixes [using patches by Tim Crook] + - fixed a bug of the 'mod' operator [report by Jork Behrends] + - fixed a bug of sorting with multiple keys [report by Jork Behrends] + - fixed a bug of comparison [report by Jork Behrends] + - DOM: fixed a bug of the default XML namespace + [report by Albert Micheev] + - DOM: fixed a bug of PIs [report by Albert Micheev] + - improved configuration [by Melvyn Sopacua] + - fragment identifiers allowed in document() for custom + schemes [report by Bob Kline] + +Version 0.95 +June 24, 2002 +------------- + - DOM support upgraded to DOM Level2 + - xsl:strip-space and xsl:preserve-space implemented + - XSLT on external documents (accessed via callbacks) + - esxlt:document instruction implemented + - unparsed-entity-uri() function implemented + - added a manual page for sabcmd + - added a batch mode (multiple sources/stylesheets) + for sabcmd [by Stefan Behnel] + - added a system property to display version + - added a flag for document() to return an empty node-set when + it refers to non-existing document + - fixed a bug in relative paths to ext. entities + - fixed a sorting bug on Solaris + - fixed matching precedence for processing-instruction('lit') + - fixed a bug in xsl:decimal-format/format-number() + - fixed a bug in string() - comments excluded + - fixed a bug of RTFs in xsl:attribute (comment, pi) + - fixed a bug of generate-id for multiple documents + - various minor fixes + +Version 0.90 +March 8, 2002 +------------- + - xsl:import implemented + - fixed a bug in boolean expressions with nodesets + [reported by John Holland] + - current() implementation redesigned + - variables not allowed in 'match' attributes of templates + - fixed a bug in attribute value escaping [Christian Lefebvre] + - fixed a bug in ext. entities base URI [Christian Lefebvre] + - fixed a bug in sabcmd --base option [Christian Lefebvre] + - span not indented with html method + - processing-instruction() node test allows literal arguments + - only top-level variables and params visible in xsl:attribute-set + - fixed a bug in xsl:number + - fixed a bug in master situation cleanup + [patch proposed by Bill Hofmann and Bob Kline] + - fixed a bug in error reports from included files + - correct name of element, attribute and pi is checked + +Version 0.82 +January 30, 2002 +---------------- + - fixed the text output method + (nothing but text nodes are outputted) + - SCRIPT and STYLE escaped for xhtml + - fixed a bug in escaping attributtes (src, href) + - fixed a bug in aliasing doctype declaration + - fixed bugs related to Sun CC compiler [Tim Crook, Greg Cope] + - fixed a memory management bug [Tim Crook] + +Version 0.81 +January 16, 2002 +---------------- + - PUBLIC URLs in doctypes and ext. entities not parsed + by default (SAB_PARSE_PUBLIC_ENTITIES situation option) + - non-xsl elements allowed inside xsl:stylesheet + - xsl attributes not outputted anymore + - xsl:namespace-alias translates attributes as well + - content of SCRIPT and STYLE not escaped for html/xhtml + - Boolean attributes are abbreviated for html output method + +Version 0.80 +January 8, 2002 +--------------- + - implemented extensions (JavaScript functions + DOM, + extension-element-prefixes, xsl:fallback, function-available(), + element-available()) + - fixed a bux in the 'following' axis + - fixed current() assertion fault + - fixed "META tag placed outside HEAD" bug + - fixed a bug in abbreviated [position] expression in + template 'match' attribute + - implemented lang () function + - added 'namespace' attribute of xsl:element + - implemented 'exclude-result-prefixes' + - implemented xsl:attribute-set and 'use-attribute-sets' + - added 'namespace' attribute of xsl:attribute + - fixed translate() bug + - key() now works with document() + - fixed short stylesheet notation output bugs + - added use-attribute-sets attribute to xsl:copy + - minor bugs fixed + +Version 0.71 +November 5, 2001 +---------------- + - sum() bug fixed + - fixed a Solaris problem with key() [report by Archie Russell] + - SXP minor bugs fixed + - implemented axes 'following' and 'preceding' + - added an SXP callback for id() and a 'user data' pointer for + some callbacks + - fixed a namespace bug in SXP + - improved error messages + - fixed a bug in parsing external files [reported by Tim Crook] + - fixed a bug of current() in inner context() + [reported by Ian Davis] + - fixed a bug of calling XSLT instructions inside xsl:text + - fixed a SablorRunProcessorGen assertion bug + - fixed a scheme handler bug [reported by Tim Crook] + +Version 0.70 +September 17, 2001 +------------------ + - added Sablotron XPath processor + - implemented xsl:key and key() + - implemented format-number() and xsl:decimal-format + - implemented xsl:number + - fixed namespace treatment in the DOM part + - the string functions now work correctly with non-ASCII text + [fix partly by Christian Lefebvre] + - fixed a bug in the DOM interface + - fixes for BeOS [Gabe Bauman] + +Version 0.65 +August 15, 2001 +--------------- + - improved HTML indentation + - fixed bug causing output of XML declaration when method='text' + [reported by Jason Dumler] + - parameter entities are always parsed + - xml declaration ends with ?> using HTML method + - > is escaped in HTML + - fixed the RTF serialization [report by Christian Lefebvre] + - fixed the non-ASCII character escaping in URIs + - changed SDOM_xql so it uses namespace declarations on the + document element + - a few more minor bug fixes + +Version 0.60 +June 13, 2001 +------------- + - implemented a subset of DOM level 1 (see sdom.h) + - added sdom.cpp and sdom.h to the project + - new interface methods for Sablotron (preferred use) + SablotRunProcessorGen, SablotAddArgTree, SablotAddArgBuffer + SablotAddParam + - added a simple support of + - fixed a namespace node name bug [report by A. Nuzhdov] + - added support for parametr entities [suggested by Peter Blum] + - fixed a bug related to evaluation of arithmetic + expressions [reported by Sam Brauer] + - fixed a minor bug related to the xhtml output method + +Version 0.52 +March 29, 2001 +-------------- + + - added support for encoding conversions using iconv + - all memory leaks occuring on processing errors are fixed + [thanks for project support to Mitel Networks Corporation] + - fixed the "duplicit attribute error" bug [Marc Lehmann] + - fixed a bug in context evaluation [reported by Marco Guazzone] + - fixed several bugs related to the hash table [Tom Moog] + +Version 0.51 +------------ + - a maintenance release + - fixed the quoting of quotes in HTML output [patch by Mark Bartel]. + - fixes by Tim Crook for AIX + - Sablot runs even without wcsxfrm() or wchar.h (although + it doesn't sort) + - the problem with the type of an iconv() call argument is fixed + - added support for the xhtml output method [Marc Lehmann] + - fixed bug causing elements being output as <:x> [Andreas Buschmann] + - xsl:sort works if wcsxfrm() is not present (sorts naively though) + +Version 0.50 +------------ + - added match predicate optimization + - added proper character class handling [patch by Marc Lehmann] + - fixed a bug in last() [reported by Dirk Siebnich] + - fixed a problem with empty NS decls [reported by S. Tryggvason] + - added SablotSetEncoding(). + - fixed an error with xml:lang [reported by Nicolas Sauret] + - fixed the 'divide by zero' MSVC warning [suggestion by Dirk Siebnich] + - added support for xsl:sort + - fixed an expression parsing error [report by Clayton Cottingham] + - fixed a bug in current() [report by Daniel Hammond] + - minor fix for RedHat 7 [David Hedbor] + - fixed another bug in translate() + - fixed a bug related to starts-with() [reported by Myoungki Kim] + - fixed top-level elements check + +Version 0.44 +------------ + - Fixed an elusive bug in HashTable causing occassional crashes + - Added the namespace-alias() and message() functions + [patch by Major] + - More fixes related to: XML namespace declarations, nested + stylesheet inclusion, Byte Order Mark in UTF-8 doc, + "SYSTEM" in DOCTYPE declaration, the preceding-sibling and + following-sibling axes, iconv. + - Patch for OpenBSD [Anil Madhavapeddy]. + +Version 0.43 +------------ + - Fundamental changes to improve performance. + - Added Latin2 input support [thanks to Matt Sergeant] + - Added Japanese encodings support [patch by Rui Hirokawa] + - Fixed treatment of NaNs etc. [based on patch by Robin Houston] + - Minor bug fixes. + - Added platform.cpp for platform-dependent code. + - Added code to generate the tag when using the + html output method. + +Version 0.42 +------------ + - Sablotron is now thread-safe [thanks to Leo Yu]. + - Output recoding can be done if iconv is present [Sven Neumann]. + - Match predicates work. + - Several bug fixes [Robin Houston]. + - Added: + MiscHandler with documentInfo() + SablotSetBaseForScheme() + the current() function [Robin] + -The actual error code is returned from SablotProcess etc. + +Version 0.41 +------------ + - Sablotron now uses autoconf and works with an unmodified + copy of expat. Its layout is a bit different. + - Bug fix (reported by Kay Sievers). + +Version 0.4 +----------- + - The license was changed to MPL+GPL. + - Output conformance improved considerably (proper escaping + etc.). + - A SAX interface to the result document is available so one + can bypass the construction to the result tree. + - Some changes to the Sablotron interface. + - Implemented , , + . + - External general entities work now. + - Bug fixes (thanks for reports and/or patches to Hans Raaf, + Florian Hars, , Mark W. Eichin and + Robin Berjon). + - Performance improvements. + +Version 0.36 +------------ + - optimized string handling, resulting in a significant + performance improvement + - implemented + +Version 0.35 +------------ + - fixed a bug concerning the descendant axis, reported by Les + Woolsey + - included the Solaris port (patch contributed by Steven Rowe) + - added SablotSetLog() for setting the log file. Turned + logging off by default. + - added SablotRegMessageHandler() for setting a message + handler. Using this, you can handle all error/warning/log + messages the way you like. + - if the xsl prefix is bound to an obsolete URI, a warning is + issued + - added SablotProcessStringsWithBase() which makes it possible + to override the stylesheet's physical URI with a 'hard base + URI' + - added some command-line switches to sabcmd, e.g. --log-file + and --measure + +Version 0.34 +------------ + - bug fixes + - major memory leak fixes + +Version 0.33 +------------ +CVS: tag SABLOT_0_33 (tom, main trunk) + - this release log started + - first major release following Sablotron 0.3 + - added URI processing with relative URI resolution + - added support for the arg: scheme (named buffers) + - added support for passing global parameters + - introduced the SablotProcess() function as a general interface + - sabcmd can pass named buffers as well as the global params + - added a lot of core library functions diff --git a/win32/sablot/bin/sabcmd.exe b/win32/sablot/bin/sabcmd.exe new file mode 100644 index 0000000..8fb2698 Binary files /dev/null and b/win32/sablot/bin/sabcmd.exe differ diff --git a/win32/sablot/bin/sablot.dll b/win32/sablot/bin/sablot.dll new file mode 100644 index 0000000..c247b57 Binary files /dev/null and b/win32/sablot/bin/sablot.dll differ diff --git a/win32/sablot/include/sabdbg.h b/win32/sablot/include/sabdbg.h new file mode 100644 index 0000000..1428af6 --- /dev/null +++ b/win32/sablot/include/sabdbg.h @@ -0,0 +1,58 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +#ifndef SabdbgHIncl +#define SabdbgHIncl + +#define SablotAsExport +#include + +/************************************************************/ +/* DEBUGGER stuff */ +/************************************************************/ + +Declare +( + void debuggerInit(); +) + +Declare +( + void debuggerDone(); +) + +Declare +( + void debuggerEnterIdle(); +) + +#endif diff --git a/win32/sablot/include/sablot.h b/win32/sablot/include/sablot.h new file mode 100644 index 0000000..71b05a2 --- /dev/null +++ b/win32/sablot/include/sablot.h @@ -0,0 +1,560 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +/* +sablot.h +TK Dec 14, 99 +header file for Sablot.cpp +*/ + +#ifndef SablotHIncl +#define SablotHIncl + + +/* version info */ +#define SAB_VERSION "0.96" +#define SAB_DATE "Sep 5, 2002" + +/* common types */ +typedef void *SablotHandle; +typedef void *SDOM_Document; +typedef void *SablotSituation; + +#if defined(WIN32) && defined(_MSC_VER) +#if defined(SablotAsExport) +#define DllImpExp __declspec( dllexport ) +#else +#define DllImpExp __declspec( dllimport ) +#endif /* SablotAsExport */ +#else /* WIN32 && _MSC_VER */ +#define DllImpExp extern +#endif + +#ifdef __cplusplus +#define DeclBegin extern "C" { DllImpExp +#define DeclEnd } +#else +#define DeclBegin DllImpExp +#define DeclEnd +#endif + +#define Declare(STATEMENT) DeclBegin STATEMENT DeclEnd + +#include "shandler.h" +#include "sxpath.h" + +typedef enum +{ + SAB_NO_ERROR_REPORTING = 0x1, + SAB_PARSE_PUBLIC_ENTITIES = 0x2, + SAB_DISABLE_ADDING_META = 0x4, + SAB_DISABLE_STRIPPING = 0x8, + SAB_IGNORE_DOC_NOT_FOUND =0x10 +} SablotFlag; + +/* create a new document */ + +Declare +( + int SablotCreateDocument( + SablotSituation S, + SDOM_Document *D); +) + +/* parse in a document from the given URI */ + +Declare +( + int SablotParse( + SablotSituation S, + const char *uri, + SDOM_Document *D); +) + +/* parse a document given in an in-memory buffer */ + +Declare +( + int SablotParseBuffer( + SablotSituation S, + const char *buffer, + SDOM_Document *D); +) + +Declare +( + int SablotParseStylesheet( + SablotSituation S, + const char *uri, + SDOM_Document *D); +) + + +Declare +( + int SablotParseStylesheetBuffer( + SablotSituation S, + const char *buffer, + SDOM_Document *D); +) + + +/* lock document before using it */ + +Declare +( + int SablotLockDocument( + SablotSituation S, + SDOM_Document D); +) + +Declare +( + int SablotDestroyDocument( + SablotSituation S, + SDOM_Document D); +) + +Declare +( + int SablotAddParam( + SablotSituation S, + void *processor_, + const char *paramName, + const char *paramValue); +) + +Declare +( + int SablotAddArgBuffer( + SablotSituation S, + void *processor_, + const char *argName, + const char *bufferValue); +) + +Declare( + int SablotAddArgTree( + SablotSituation S, + void *processor_, + const char *argName, + SDOM_Document tree); +) + +Declare +( + int SablotRunProcessorGen( + SablotSituation S, + void *processor_, + const char *sheetURI, + const char *inputURI, + const char *resultURI); +) + +Declare +( + int SablotRunProcessorExt( + SablotSituation S, + void *processor_, + const char *sheetURI, + const char *resultURI, + NodeHandle doc); +) + +/* + * Situation functions + */ + +/* Creates a new situation. */ + +Declare +( + int SablotCreateSituation(SablotSituation *sPtr); +) + +/* Sets situation flags. */ + +Declare +( + int SablotSetOptions(SablotSituation S, int flags); +) + +Declare +( + int SablotClearSituation(SablotSituation S); +) + +Declare +( + const char* SablotGetErrorURI(SablotSituation S); +) + +Declare +( + int SablotGetErrorLine(SablotSituation S); +) + +Declare +( + const char* SablotGetErrorMsg(SablotSituation S); +) + +/* Disposes of the situation. */ + +Declare +( + int SablotDestroySituation(SablotSituation S); +) + + +/***************************************************************** +SablotCreateProcessor +creates a new instance of the processor +*****************************************************************/ + +Declare +( + int SablotCreateProcessor(SablotHandle *processorPtr); +) + +/***************************************************************** +SablotCreateProcessorForSituation +use this instead of SablotCreateProcessor with any of the +situation-aware functions like SablotRunProcessorGen, +SablotAddArgTree etc. +*****************************************************************/ + +Declare +( + int SablotCreateProcessorForSituation(SablotSituation S, void **processorPtr); +) + + +/***************************************************************** +SablotDestroyProcessor +destroys the processor +*****************************************************************/ + +Declare +( + int SablotDestroyProcessor(SablotHandle processor_); +) + +/***************************************************************** +SablotRunProcessor +runs the existing instance on the given documents +*****************************************************************/ + +Declare +( + int SablotRunProcessor(SablotHandle processor_, + const char *sheetURI, + const char *inputURI, + const char *resultURI, + const char **params, + const char **arguments); +) + +/***************************************************************** +SablotGetResultArg +gets the result arg buffer from the last Sablot run +the buffer is identified by an URI (to enable output to + multiple documents) +*****************************************************************/ + +Declare +( + int SablotGetResultArg(SablotHandle processor_, + const char *argURI, + char **argValue); +) + +/***************************************************************** +SablotFreeResultArgs +kill all result arg buffers from the last Sablot run +*****************************************************************/ + +Declare +( + int SablotFreeResultArgs(SablotHandle processor_); +) + +/***************************************************************** +SablotRegHandler +General handler registrator. + type the type of the handler (scheme etc.) + handler pointer to the struct of callbacks of the given type + userData the user data this handler wishes to receive +*****************************************************************/ + +Declare +( + int SablotRegHandler( + SablotHandle processor_, + HandlerType type, /* HLR_MESSAGE, HLR_SCHEME, HLR_SAX */ + void *handler, + void *userData); +) + +/***************************************************************** +SablotUnregHandler + + General handler unregistrator. +*****************************************************************/ + +Declare +( + int SablotUnregHandler( + SablotHandle processor_, + HandlerType type, /* HLR_MESSAGE, HLR_SCHEME, HLR_SAX */ + void *handler, + void *userData); +) + +/***************************************************************** +SablotSetBase + + overrides the default base URI for relative reference + resolution. +*****************************************************************/ + +Declare +( + int SablotSetBase( + SablotHandle processor_, + const char *theBase); +) + +/***************************************************************** +SablotSetBaseForScheme + + a softer form of SablotSetBase: the hard base URI will only + be in effect for relative references whose bases have + the given scheme. + + Example: assume we call + SablotSetBaseForScheme( P, "arg", "http://server" ) + and then runs a stylesheet at "arg:/xxx" which contains "document('foo.xml')". + The relative reference is resolved as "http://server/foo.xml" + but if the stylesheet were at "file:/xxx" it would become "file:/foo.xml". +*****************************************************************/ + +Declare +( + int SablotSetBaseForScheme(void* processor_, + const char *scheme, + const char *base); +) + +/**************************************************************** +SablotSetLog + + sets the logging options. Logging is off by default. +*****************************************************************/ + +Declare +( + int SablotSetLog( + SablotHandle processor_, + const char *logFilename, + int logLevel); +) + + +/***************************************************************** +SablotProcess + + the main function published by Sablotron. Feeds given XML + input to a stylesheet. Both of these as well as the location for + output are identified by a URI. One can also pass top-level + stylesheet parameters and named buffers ('args'). +ARGS + sheetURI URI of the XSLT stylesheet + inputURI URI of the XML document + resultURI URI of the output document + params a NULL-terminated array of char*'s defining the top-level + parameters to be passed, interpreted as a + sequence of (name, value) pairs. + arguments a NULL-terminated array of char*'s defining the named + buffers to be passed, interpreted as a + sequence of (name, value) pairs. Both params and arguments + may be NULL. +RETURNS + . nonzero iff error + resultArg in case output goes to a named buffer, *resultArg is set to + point to it (otherwise to NULL). Free it using SablotFree(). +*****************************************************************/ + +Declare +( + int SablotProcess( + const char *sheetURI, const char *inputURI, const char *resultURI, + const char **params, const char **arguments, char **resultArg); +) + +/***************************************************************** +SablotProcessFiles + + calls SablotProcess to process files identified by their + file names. No named buffers or params are passed. Included + for backward compatibility. +ARGUMENTS + styleSheetName, inputName, resultName + file names of the stylesheet, XML input and output, + respectively. +RETURNS + . error flag +*****************************************************************/ + +Declare +( + int SablotProcessFiles( + const char *styleSheetName, + const char *inputName, + const char *resultName); +) + +/***************************************************************** +SablotProcessStrings + + calls SablotProcess to process documents in memory, passing + pointers to the documents. No named buffers or params are passed. + Included for backward compatibility. +ARGUMENTS + styleSheetStr, inputStr + text of the stylesheet and the XML input +RETURNS + . error flag + *resultStr pointer to the newly allocated block containing + the result +*****************************************************************/ + +Declare +( + int SablotProcessStrings( + const char *styleSheetStr, + const char *inputStr, + char **resultStr); +) + +/***************************************************************** +SablotProcessStringsWithBase + + Like SablotProcessStrings but lets you pass an URI that replaces + the stylesheet's URI in relative address resolution. + +ARGUMENTS + styleSheetStr, inputStr + text of the stylesheet and the XML input + theHardBase the "hard base URI" replacing the stylesheet's URI + in all relevant situations +RETURNS + . error flag + *resultStr pointer to the newly allocated block containing + the result +*****************************************************************/ + +Declare +( + int SablotProcessStringsWithBase( + const char *styleSheetStr, + const char *inputStr, + char **resultStr, + const char *theHardBase); +) + +/***************************************************************** +SablotFree + + Frees the Sablotron-allocated buffer. The user cannot free it + directly by free(). +*****************************************************************/ + +Declare +( + int SablotFree(char *resultStr); +) + +/***************************************************************** +SablotClearError + + Clears the pending error for the given instance of Sablot. +*****************************************************************/ + +Declare +( + int SablotClearError(SablotHandle processor_); +) + +/***************************************************************** +SablotGetMsgText + + Returns the text of a message with the given code. +*****************************************************************/ + +Declare +( + const char* SablotGetMsgText(int code); +) + +/***************************************************************** +SablotSetInstanceData +*****************************************************************/ + +Declare +( + void SablotSetInstanceData(SablotHandle processor_, void *idata); +) + +/***************************************************************** +SablotGetInstanceData +*****************************************************************/ + +Declare +( + void* SablotGetInstanceData(SablotHandle processor_); +) + +/* + SablotSetEncoding + sets the output encoding to be used regardless of the encoding + specified by the stylesheet + To unset, call with encoding_ NULL. +*/ + +Declare +( + void SablotSetEncoding(SablotHandle processor_, char *encoding_); +) + +#endif /* defined SablotHIncl */ + diff --git a/win32/sablot/include/sablot.lib b/win32/sablot/include/sablot.lib new file mode 100644 index 0000000..e002170 Binary files /dev/null and b/win32/sablot/include/sablot.lib differ diff --git a/win32/sablot/include/sdom.h b/win32/sablot/include/sdom.h new file mode 100644 index 0000000..cee53ff --- /dev/null +++ b/win32/sablot/include/sdom.h @@ -0,0 +1,921 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +/* sdom.h */ + +#ifndef SDomHIncl +#define SDomHIncl + +//used for DISABLE_DOM only anything else is DANGEROUS +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifndef DISABLE_DOM + +#include "sablot.h" + +/** + ** + ** types + ** + **/ + +typedef void* SDOM_Node; +typedef void* SDOM_NodeList; +/* typedef void* SDOM_Document; */ + +typedef enum +{ + SDOM_ELEMENT_NODE = 1, + SDOM_ATTRIBUTE_NODE = 2, + SDOM_TEXT_NODE = 3, + SDOM_CDATA_SECTION_NODE = 4, + SDOM_ENTITY_REFERENCE_NODE = 5, + SDOM_ENTITY_NODE = 6, + SDOM_PROCESSING_INSTRUCTION_NODE = 7, + SDOM_COMMENT_NODE = 8, + SDOM_DOCUMENT_NODE = 9, + SDOM_DOCUMENT_TYPE_NODE = 10, + SDOM_DOCUMENT_FRAGMENT_NODE = 11, + SDOM_NOTATION_NODE = 12, + SDOM_OTHER_NODE /* not in spec */ +} +SDOM_NodeType; + +/* + * we define DOM_char as char, although the spec says strings should be + * UTF_16. Needs check. + */ +typedef char SDOM_char; + + +/* + * DomException + * will be an enum of all the values given in the spec. + */ + +/* + INDEX_SIZE_ERR, 1 + STRING_SIZE_ERR, 2 + HIERARCHY_REQUEST_ERR, 3 + WRONG_DOCUMENT_ERR, 4 + INVALID_CHARACTER_ERR, 5 + NO_DATA_ALLOWED_ERR, 6 + NO_MODIFICATION_ALLOWED_ERR, 7 + NOT_FOUND_ERR, 8 + NOT_SUPPORTED_ERR, 9 + INUSE_ATTRIBUTE_ERR, 10 + INVALID_STATE_ERR, 11 + SYNTAX_ERR, 12 + INVALID_MODIFICATION_ERR, 13 + NAMESPACE_ERR, 14 + INVALID_ACCESS_ERR, 15 +*/ + +typedef enum +{ + SDOM_OK, + SDOM_INDEX_SIZE_ERR = 1, + SDOM_DOMSTRING_SIZE_ERR = 2, + SDOM_HIERARCHY_REQUEST_ERR = 3, + SDOM_WRONG_DOCUMENT_ERR = 4, + SDOM_INVALID_CHARACTER_ERR = 5, + SDOM_NO_DATA_ALLOWED_ERR = 6, + SDOM_NO_MODIFICATION_ALLOWED_ERR = 7, + SDOM_NOT_FOUND_ERR = 8, + SDOM_NOT_SUPPORTED_ERR = 9, + SDOM_INUSE_ATTRIBUTE_ERR = 10, + SDOM_INVALID_STATE_ERR = 11, + SDOM_SYNTAX_ERR = 12, + SDOM_INVALID_MODIFICATION_ERR = 13, + SDOM_NAMESPACE_ERR = 14, + SDOM_INVALID_ACCESS_ERR = 15, + /* not in spec below this point: */ + SDOM_INVALID_NODE_TYPE, /* eg passing a non-element for an element */ + SDOM_QUERY_PARSE_ERR, + SDOM_QUERY_EXECUTION_ERR, + SDOM_NOT_OK +} SDOM_Exception; + +/** + ** + ** Node + ** n is always the node the function is to operate on (kind of 'this') + ** + **/ + +/* + createElement + Creates a new element Node with NULL parent and specified owner, + and returns it in *pn. + Raises: + */ +Declare( +SDOM_Exception SDOM_createElement( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *tagName); +) + +//_JP_ v +/* + createElementNS + Creates a new element Node with NULL parent and specified owner, + and returns it in *pn. + Raises: + SDOM_NAMESPACE_ERR or SDOM_INVALID_CHARACTER_ERR when qName or uri malformed + */ +Declare( +SDOM_Exception SDOM_createElementNS( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *uri, + const SDOM_char *qName); +) +//_JP_ ^ + +/* + createAttribute + Creates a new attribute Node and returns it in *pn. + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createAttribute( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *name); +) + +//_JP_ v +/* + createAttributeNS + Creates a new attribute Node and returns it in *pn. + Raises: + SDOM_NAMESPACE_ERR or SDOM_INVALID_CHARACTER_ERR when qName or uri malformed + */ +Declare( +SDOM_Exception SDOM_createAttributeNS( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *uri, + const SDOM_char *qName); +) +//_JP_ ^ + + +/* + createTextNode + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createTextNode( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *data); +) + +/* + createAttribute + Creates a new attribute Node and returns it in *pn. + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createCDATASection( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *data); +) + +/* + createComment + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createComment( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *data); +) + +/* + createProcessingInstruction + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createProcessingInstruction( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *target, + const SDOM_char *data); +) + +/* + disposeNode + Frees all memory used by the node. + Raises: + !SPEC: Not in the spec. + */ + +Declare +( +SDOM_Exception SDOM_disposeNode( + SablotSituation s, + SDOM_Node n); +) + + +/* + getNodeType + Returns the node type in *pType. + Raises: + */ + +Declare +( +SDOM_Exception SDOM_getNodeType( + SablotSituation s, + SDOM_Node n, + SDOM_NodeType *pType); +) + + +/* + getNodeName + Returns the pointer to the name of the node in *pName. +*/ + +Declare +( +SDOM_Exception SDOM_getNodeName( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +Declare +( +SDOM_Exception SDOM_getNodeNSUri( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +Declare +( +SDOM_Exception SDOM_getNodePrefix( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +Declare +( +SDOM_Exception SDOM_getNodeLocalName( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +/* + setNodeName + Sets the node name. +*/ +Declare( +SDOM_Exception SDOM_setNodeName( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name); +) + +/* + getNodeValue + Returns in *pValue the string value of the node. +*/ +Declare( +SDOM_Exception SDOM_getNodeValue( + SablotSituation s, + SDOM_Node n, + SDOM_char **pValue); +) + +/* + setNodeValue + Sets the node value. +*/ +Declare( +SDOM_Exception SDOM_setNodeValue( + SablotSituation s, + SDOM_Node n, + const SDOM_char *value); +) + +/* + getParentNode + Returns the parent in *pParent. +*/ +Declare( +SDOM_Exception SDOM_getParentNode( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pParent); +) + +/* + getFirstChild + Returns the first child in *pFirstChild. +*/ +Declare( +SDOM_Exception SDOM_getFirstChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pFirstChild); +) + +/* + getLastChild + Returns the last child in *pLastChild. +*/ +Declare( +SDOM_Exception SDOM_getLastChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pLastChild); +) + +/* + getPreviousSibling + Returns the previous sibling in *pPreviousSibling. +*/ +Declare( +SDOM_Exception SDOM_getPreviousSibling( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pPreviousSibling); +) + +/* + getNextSibling + Returns the next sibling in *pNextSibling. +*/ +Declare( +SDOM_Exception SDOM_getNextSibling( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pNextSibling); +) + +/* + getChildNode + Returns the child node in specified index or NULL. +*/ +Declare( +SDOM_Exception SDOM_getChildNodeIndex( + SablotSituation s, + SDOM_Node n, + int index, + SDOM_Node *pChildNode); +) + +/* + getChildNodeCount + Returns the count of child nodes. +*/ +Declare( +SDOM_Exception SDOM_getChildNodeCount( + SablotSituation s, + SDOM_Node n, + int *count); +) + +/* + getOwnerDocument + Returns, in *pOwnerDocument, the Document owning the node. + !SPEC: If the node is standalone, returns NULL. +*/ +Declare( +SDOM_Exception SDOM_getOwnerDocument( + SablotSituation s, + SDOM_Node n, + SDOM_Document *pOwnerDocument); +) + +/* + insertBefore + Inserts newChild as n's child, just before refChild. +*/ +Declare( +SDOM_Exception SDOM_insertBefore( + SablotSituation s, + SDOM_Node n, + SDOM_Node newChild, + SDOM_Node refChild); +) + +/* + removeChild + Removes oldChild (a child of n) without deallocating it. +*/ + +Declare( +SDOM_Exception SDOM_removeChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node oldChild); +) + +/* + replaceChild + Replaces oldChild (a child of n) by newChild. +*/ +Declare( +SDOM_Exception SDOM_replaceChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node newChild, + SDOM_Node oldChild); +) + +/* + appendChild + Appends newChild as the last of n's children. +*/ +Declare( +SDOM_Exception SDOM_appendChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node newChild); +) + +/* + cloneNode + Duplicates the node, returning the result in *clone. + If deep is nonzero, the cloning process will be recursive. +*/ + +Declare( +SDOM_Exception SDOM_cloneNode( + SablotSituation s, + SDOM_Node n, + int deep, + SDOM_Node *clone); +) + +/* + cloneForeignNode + Duplicates a node from a different doc, returning the result in *clone. + If deep is nonzero, the cloning process will be recursive. + As opposed to cloneNode, represents a Document method +*/ + +Declare( +SDOM_Exception SDOM_cloneForeignNode( + SablotSituation s, + SDOM_Document d, + SDOM_Node n, + int deep, + SDOM_Node *clone); +) + +/* + getAttribute + Returns, in *pValue, the contents of the attribute (of n) named 'name'. +*/ +Declare( +SDOM_Exception SDOM_getAttribute( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name, + SDOM_char **pValue); +) + +/* + getAttributeNS + Returns, in *pValue, the contents of the attribute (of n) with 'uri' and 'local'. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNS( + SablotSituation s, + SDOM_Node n, + SDOM_char *uri, + SDOM_char *local, + SDOM_char **pValue); +) + +/* + getAttributeNode + Returns, in *attr, the attribute named 'name'. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNode( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name, + SDOM_Node *attr); +) + +/* + getAttributeNodeNS + Returns, in *attr, the n's attribute with uri and local. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNodeNS( + SablotSituation s, + SDOM_Node n, + SDOM_char *uri, + SDOM_char *local, + SDOM_Node *attr); +) + +//_JP_ v +/* + getAttributeNodeIndex + Returns, in *attr, the index'th attribute, namespaces precede other atts. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNodeIndex( + SablotSituation s, + SDOM_Node n, + const int index, + SDOM_Node *attr); +) + +/* + getAttributeNodeCount + Returns, in *count, the count of atts, including namespaces in scope. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNodeCount( + SablotSituation s, + SDOM_Node n, + int *count); +) +//_JP_ ^ + +/* + setAttribute + Assigns the given value to n's attribute named 'name'. +*/ +Declare( +SDOM_Exception SDOM_setAttribute( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name, + const SDOM_char *value); +) + +/* + setAttributeNS + Assigns the given value to n's attribute with 'uri' and qualified name 'qName'. +*/ +Declare( +SDOM_Exception SDOM_setAttributeNS( + SablotSituation s, + SDOM_Node n, + const SDOM_char *uri, + const SDOM_char *qName, + const SDOM_char *value); +) + +/* + setAttributeNode + Assigns the given attnode as n's attribute. + Returns replaced, if was replaced some node with the same nodeName. +*/ +Declare( +SDOM_Exception SDOM_setAttributeNode( + SablotSituation s, + SDOM_Node n, + SDOM_Node attnode, + SDOM_Node *replaced); +) + +/* + setAttributeNodeNS + Assigns the given attnode to n's attribute with attnode.uri and attnode.localname. + Returns replaced, if was replaced some node. +*/ +Declare( +SDOM_Exception SDOM_setAttributeNodeNS( + SablotSituation s, + SDOM_Node n, + SDOM_Node attnode, + SDOM_Node *replaced); +) + +/* + removeAttribute + Removes the given attribute of n. +*/ +Declare( +SDOM_Exception SDOM_removeAttribute( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name); +) + +/* + removeAttribute + Removes the given attribute of n. +*/ +Declare( +SDOM_Exception SDOM_removeAttributeNode( + SablotSituation s, + SDOM_Node n, + SDOM_Node attnode, + SDOM_Node *removed); +) +/* + attributeElement + returns owner element of attribute specified +*/ +Declare( +SDOM_Exception SDOM_getAttributeElement( + SablotSituation s, + SDOM_Node attr, + SDOM_Node *owner); +) + +/* + getAttributeList + Returns, in *pAttrList, the list of all attributes of the element n. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_getAttributeList( + SablotSituation s, + SDOM_Node n, + SDOM_NodeList *pAttrList); +) + +/** + ** END Node + **/ + + +/** + ** Functions related to Document + **/ + + +/* + docToString + Serializes the document, returning the resulting string in + *pSerialized, which is a Sablotron-allocated buffer. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_docToString( + SablotSituation s, + SDOM_Document d, + SDOM_char **pSerialized); +) + +Declare( +SDOM_Exception SDOM_nodeToString( + SablotSituation s, + SDOM_Document d, + SDOM_Node n, + SDOM_char **pSerialized); +) + +/** + ** END Document functions + **/ + + +/** + ** NodeList + ** An ordered collection of nodes, returned by xql. + **/ + + +/* + getNodeListLength + Returns, in *pLength, the number of nodes in the list l. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_getNodeListLength( + SablotSituation s, + SDOM_NodeList l, + int *pLength); +) + +/* + getNodeListItem + Returns, in *pItem, the index'th member of the node list l. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_getNodeListItem( + SablotSituation s, + SDOM_NodeList l, + int index, + SDOM_Node *pItem); +) + +/* + disposeNodeList + Destroys the node list l. The nodes themselves are NOT disposed. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_disposeNodeList( + SablotSituation s, + SDOM_NodeList l); +) + +/** + ** END NodeList + **/ + + +/** + ** Miscellaneous + **/ + +/* + xql + Returns, in *pResult, the list of all nodes satisfying the XPath + query given as a string in 'query'. For the evaluation of the query, the + current node will be set to currentNode. + Note that the query is necessarily rather restricted. + After the contents of *pResult have been retrieved, the list should + be freed using disposeNodeList. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_xql( + SablotSituation s, + const SDOM_char *query, + SDOM_Node currentNode, + SDOM_NodeList *pResult); +) + +/** + ** END Miscellaneous + ** + ** + ** + ** Exception retrieval + **/ + +/* + getExceptionCode + returns the code of the pending exception +*/ + +Declare +( + int SDOM_getExceptionCode(SablotSituation s); +) + +/* + getExceptionMessage + returns the message for the pending exception +*/ + +Declare +( + char* SDOM_getExceptionMessage(SablotSituation s); +) + +/* + getExceptionDetails + returns extra information for the pending exception + - on the code and message of the primary error + - on the document and file line where the primary error occured +*/ + +Declare +( + void SDOM_getExceptionDetails( + SablotSituation s, + int *code, + char **message, + char **documentURI, + int *fileLine); +) + +/** + ** END Exception retrieval + ** + ** + ** Internal functions + **/ + +/* + setNodeInstanceData + saves a pointer in a node instance +*/ + +Declare( +void SDOM_setNodeInstanceData(SDOM_Node n, void *data); +) + +/* + getNodeInstanceData + retrieves the saved pointer +*/ +Declare( +void* SDOM_getNodeInstanceData(SDOM_Node n); +) +/* + setDisposeNodeCallback + sets callback to be called on every node disposal +*/ + +typedef void SDOM_NodeCallback(SDOM_Node n); + +Declare +( + void SDOM_setDisposeCallback(SDOM_NodeCallback *f); +) + +Declare +( + SDOM_NodeCallback* SDOM_getDisposeCallback(); +) + +/** + ** FOR IMPLEMENTATION IN PERL + ** None of these fuctions appear in the spec. + **/ + + +/* + ArrayRef getChildNodes(Node n) + Returns the array of n's children. + Implement using getFirstChild and getNextSibling. + + + HashRef getAttributes(Node n) + Returns the hash of n's attributes. + Implement using getAttributeList, getNodeListLength, + getNodeListItem, getNodeName and getNodeValue. + + + setAttributes(Node n, HashRef atts) + Sets n's attributes to atts, keeping the old ones alive but making + them standalone. + Implement using getAttributeList, getNodeListLength, removeAttribute + and setAttribute (not too efficient perhaps). +*/ + + /* _TH_ v */ +Declare +( + void SDOM_tmpListDump(SDOM_Document doc, int p); +) + +#endif /* DISABLE_DOM */ + +#endif /* SDomHIncl */ diff --git a/win32/sablot/include/shandler.h b/win32/sablot/include/shandler.h new file mode 100644 index 0000000..ea7fc83 --- /dev/null +++ b/win32/sablot/include/shandler.h @@ -0,0 +1,369 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +#ifndef ShandlerHIncl +#define ShandlerHIncl + +/* we have to deal with the size_t type, sys/types.h; + is needed on some platforms */ +#if !defined(_MSC_VER) +#include +#endif + +#include + +/* GP: clean */ + +/***************************************************************** + + handler types + +*****************************************************************/ + +typedef enum +{ + HLR_MESSAGE = 0, + HLR_SCHEME, + HLR_SAX, + HLR_MISC, + HLR_ENC +} HandlerType; + +extern const char* hlrTypeNames[]; /* found in base.cpp */ + +typedef enum +{ + SH_ERR_OK = 0, + SH_ERR_NOT_OK = 1, + SH_ERR_UNSUPPORTED_SCHEME +} SchemeHandlerErrors; + +/***************************************************************** +SchemeHandler + + is a structure for a scheme handler. It contains pointers to + the following functions of the handler: + open(), get(), put(), close(). + All of these function return an error flag (0=OK, 1=not). + open() may also return SH_ERR_UNSUPPORTED_SCHEME. +*****************************************************************/ + +/* getAll: open the URI and return the whole string + scheme = URI scheme (e.g. "http") + rest = the rest of the URI (without colon) + the document is returned in a handler-allocated buffer + byteCount holds the byte count on return + return *buffer = NULL if not processed +*/ +typedef int SchemeHandlerGetAll(void *userData, SablotHandle processor_, + const char *scheme, const char *rest, + char **buffer, int *byteCount); + +/* freeMemory: free the buffer allocated by getAll +*/ + +typedef int SchemeHandlerFreeMemory(void *userData, SablotHandle processor_, + char *buffer); + +/* open: open the URI and return a handle + scheme = URI scheme (e.g. "http") + rest = the rest of the URI (without colon) + the resulting handle is returned in '*handle' +*/ +typedef int SchemeHandlerOpen(void *userData, SablotHandle processor_, + const char *scheme, const char *rest, int *handle); + +/* get: retrieve data from the URI + handle = the handle assigned on open + buffer = pointer to the data + *byteCount = number of bytes to read + (the number actually read is returned here) +*/ +typedef int SchemeHandlerGet(void *userData, SablotHandle processor_, + int handle, char *buffer, int *byteCount); + +/* put: save data to the URI (if possible) + handle = the handle assigned on open + buffer = pointer to the data + *byteCount = number of bytes to write + (the number actually written is returned here) +*/ +typedef int SchemeHandlerPut(void *userData, SablotHandle processor_, + int handle, const char *buffer, int *byteCount); + +/* close: close the URI with the given handle + handle = the handle assigned on open +*/ +typedef int SchemeHandlerClose(void *userData, SablotHandle processor_, + int handle); + +typedef struct +{ + SchemeHandlerGetAll *getAll; + SchemeHandlerFreeMemory *freeMemory; + SchemeHandlerOpen *open; + SchemeHandlerGet *get; + SchemeHandlerPut *put; + SchemeHandlerClose *close; +} SchemeHandler; + +/***************************************************************** +MessageHandler + + a structure for external message handlers. Such a handler, if set, + receives all error reports, displays them, keeps the log, the + error trace, etc. +*****************************************************************/ + +/* + define the "facility number" for Sablotron. This does not mean much + nowadays. +*/ + +#define MH_FACILITY_SABLOTRON 2 + +/* type for the error codes used by the message handler */ + +typedef unsigned long MH_ERROR; + +/* logging levels for the message handler */ + +typedef enum +{ + MH_LEVEL_DEBUG, + MH_LEVEL_INFO, + MH_LEVEL_WARN, + MH_LEVEL_ERROR, + MH_LEVEL_CRITICAL +} MH_LEVEL; + +/* + makeCode() + makes the "external" error code to report with log() or error() + call with facility = module id; severity = 1 iff critical. + 'code' is the error code internal to Sablotron. +*/ + +typedef MH_ERROR +MessageHandlerMakeCode( + void *userData, SablotHandle processor_, + int severity, unsigned short facility, unsigned short code); + +/* + log() + pass code created by makeCode, level as necessary + fields is a NULL-terminated list of strings in form "field:contents" + distinguished fields include: msg, file, line, token +*/ + +typedef MH_ERROR +MessageHandlerLog( + void *userData, SablotHandle processor_, + MH_ERROR code, MH_LEVEL level, char **fields); + +/* + error() + for reporting errors, meaning as with log() +*/ + +typedef MH_ERROR +MessageHandlerError(void *userData, SablotHandle processor_, + MH_ERROR code, MH_LEVEL level, char **fields); + +/* the message handler structure. Use SablotRegMessageHandler() to register. */ + +typedef struct +{ + MessageHandlerMakeCode *makeCode; + MessageHandlerLog *log; + MessageHandlerError *error; +} MessageHandler; + + + + + +/* + + SAXHandler + a SAX-like, streaming interface for access to XML docs + +*/ + + +#define SAX_RETURN void + +typedef SAX_RETURN +SAXHandlerStartDocument(void* userData, SablotHandle processor_); + +typedef SAX_RETURN +SAXHandlerStartElement(void* userData, SablotHandle processor_, + const char* name, const char** atts); + +typedef SAX_RETURN +SAXHandlerEndElement(void* userData, SablotHandle processor_, + const char* name); + +typedef SAX_RETURN +SAXHandlerStartNamespace(void* userData, SablotHandle processor_, + const char* prefix, const char* uri); + +typedef SAX_RETURN +SAXHandlerEndNamespace(void* userData, SablotHandle processor_, + const char* prefix); + +typedef SAX_RETURN +SAXHandlerComment(void* userData, SablotHandle processor_, + const char* contents); + +typedef SAX_RETURN +SAXHandlerPI(void* userData, SablotHandle processor_, + const char* target, const char* contents); + +typedef SAX_RETURN +SAXHandlerCharacters(void* userData, SablotHandle processor_, + const char* contents, int length); + +typedef SAX_RETURN +SAXHandlerEndDocument(void* userData, SablotHandle processor_); + + +/* + The SAX handler structure. Use SablotRegSAXHandler() to register. +*/ + + +typedef struct +{ + SAXHandlerStartDocument *startDocument; + SAXHandlerStartElement *startElement; + SAXHandlerEndElement *endElement; + SAXHandlerStartNamespace *startNamespace; + SAXHandlerEndNamespace *endNamespace; + SAXHandlerComment *comment; + SAXHandlerPI *processingInstruction; + SAXHandlerCharacters *characters; + SAXHandlerEndDocument *endDocument; +} SAXHandler; + + +/***************************************************************** +MiscHandler + + Collects miscellaneous callbacks. +*****************************************************************/ + +/* + documentInfo() + If set, this callback gets called after the output of a result + document is finished, giving information about its content type + and encoding. +*/ + +typedef void +MiscHandlerDocumentInfo(void* userData, SablotHandle processor_, + const char *contentType, const char *encoding); + +/* + The Misc handler structure. + Use SablotRegHandler(HLR_MISC, ...) to register. +*/ + +typedef struct +{ + MiscHandlerDocumentInfo *documentInfo; +} MiscHandler; + +/***************************************************************** +EncHandler + + Handler for recoding requests in absence of iconv. +*****************************************************************/ + +#define EH_FROM_UTF8 1 +#define EH_TO_UTF8 0 + +/* + the conversion descriptor like iconv_t +*/ + +typedef void* EHDescriptor; + +typedef enum +{ + EH_OK, + EH_EINVAL, + EH_E2BIG, + EH_EILSEQ +} EHResult; + +/* + open() + direction is either EH_FROM_UTF8 or EH_TO_UTF8 + encoding is the other encoding + RETURN the descriptor, or -1 if the encoding is not supported +*/ + +typedef EHDescriptor EncHandlerOpen(void* userData, SablotHandle processor_, + int direction, const char *encoding); + +/* + conv() + arguments 3 through 7 are just like for iconv, see the manpage + RETURN -1 on error (set errno), a different value (e.g. 0) if OK +*/ + +typedef EHResult EncHandlerConv(void* userData, SablotHandle processor_, + EHDescriptor cd, const char** inbuf, size_t *inbytesleft, + char ** outbuf, size_t *outbytesleft); + +/* + close() + cd is the descriptor to close. Return 0 if OK, -1 on error. +*/ + +typedef int EncHandlerClose(void* userData, SablotHandle processor_, + EHDescriptor cd); + +/* + The EncHandler structure. + Use SablotRegHandler(HLR_ENC, ...) to register. +*/ + +typedef struct +{ + EncHandlerOpen *open; + EncHandlerConv *conv; + EncHandlerClose *close; +} EncHandler; + +#endif diff --git a/win32/sablot/include/sxpath.h b/win32/sablot/include/sxpath.h new file mode 100644 index 0000000..d6bd448 --- /dev/null +++ b/win32/sablot/include/sxpath.h @@ -0,0 +1,264 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +#ifndef SXPathHIncl +#define SXPathHIncl + +/* basic types needed in sablot.h */ +typedef void *SXP_Node; +typedef void *SXP_Document; +typedef void *SXP_NodeList; +typedef SXP_Node NodeHandle; + +#include "sablot.h" + +typedef enum +{ + ELEMENT_NODE = 1, + ATTRIBUTE_NODE = 2, + TEXT_NODE = 3, + PROCESSING_INSTRUCTION_NODE = 7, + COMMENT_NODE = 8, + DOCUMENT_NODE = 9, + NAMESPACE_NODE = 13 +} SXP_NodeType; + +typedef enum +{ + SXP_NONE, + SXP_NUMBER, + SXP_STRING, + SXP_BOOLEAN, + SXP_NODESET +} SXP_ExpressionType; + +typedef char SXP_char; + +typedef void *QueryContext; + +/*option constants */ +typedef enum +{ + SXPF_DISPOSE_NAMES = 0x1, + SXPF_DISPOSE_VALUES = 0x2, + SXPF_SUPPORTS_UNPARSED_ENTITIES =0x4 +} SXPFlags; + +/* + * DOM handler functions + * This handler is registered with the Situation rather than the Processor + */ + +/***************************************************************** +DOMHandler + + Handler providing information about a DOM tree to the XPath + processor +*****************************************************************/ + +typedef SXP_NodeType DOMH_getNodeType(SXP_Node n); +typedef const SXP_char* DOMH_getNodeName(SXP_Node n); +typedef const SXP_char* DOMH_getNodeNameURI(SXP_Node n); +typedef const SXP_char* DOMH_getNodeNameLocal(SXP_Node n); +typedef const SXP_char* DOMH_getNodeValue(SXP_Node n); +typedef SXP_Node DOMH_getNextSibling(SXP_Node n); +typedef SXP_Node DOMH_getPreviousSibling(SXP_Node n); +typedef SXP_Node DOMH_getNextAttrNS(SXP_Node n); +typedef SXP_Node DOMH_getPreviousAttrNS(SXP_Node n); +typedef int DOMH_getChildCount(SXP_Node n); +typedef int DOMH_getAttributeCount(SXP_Node n); +typedef int DOMH_getNamespaceCount(SXP_Node n); +typedef SXP_Node DOMH_getChildNo(SXP_Node n, int ndx); +typedef SXP_Node DOMH_getAttributeNo(SXP_Node n, int ndx); +typedef SXP_Node DOMH_getNamespaceNo(SXP_Node n, int ndx); +typedef SXP_Node DOMH_getParent(SXP_Node n); +typedef SXP_Document DOMH_getOwnerDocument(SXP_Node n); +typedef int DOMH_compareNodes(SXP_Node n1, SXP_Node n2); +typedef SXP_Document DOMH_retrieveDocument(const SXP_char* uri, + void* udata); +typedef SXP_Node DOMH_getNodeWithID(SXP_Document doc, const SXP_char* id); +typedef void DOMH_freeBuffer(SXP_char *buff); + +typedef struct +{ + DOMH_getNodeType *getNodeType; + DOMH_getNodeName *getNodeName; + DOMH_getNodeNameURI *getNodeNameURI; + DOMH_getNodeNameLocal *getNodeNameLocal; + DOMH_getNodeValue *getNodeValue; + DOMH_getNextSibling *getNextSibling; + DOMH_getPreviousSibling *getPreviousSibling; + DOMH_getNextAttrNS *getNextAttrNS; + DOMH_getPreviousAttrNS *getPreviousAttrNS; + DOMH_getChildCount *getChildCount; + DOMH_getAttributeCount *getAttributeCount; + DOMH_getNamespaceCount *getNamespaceCount; + DOMH_getChildNo *getChildNo; + DOMH_getAttributeNo *getAttributeNo; + DOMH_getNamespaceNo *getNamespaceNo; + DOMH_getParent *getParent; + DOMH_getOwnerDocument *getOwnerDocument; + DOMH_compareNodes *compareNodes; + DOMH_retrieveDocument *retrieveDocument; + DOMH_getNodeWithID *getNodeWithID; + /*optional entries - driven by sxpOptions */ + DOMH_freeBuffer *freeBuffer; +} DOMHandler; + +Declare +( + void SXP_registerDOMHandler(SablotSituation S, + DOMHandler *domh, void* udata); +) + +Declare +( + void SXP_unregisterDOMHandler(SablotSituation S); +) + +/* + * + * QueryContext functions + * + */ + +/* options setter getter */ +Declare +( + void SXP_setOptions(SablotSituation S, unsigned long options); +) + +Declare +( + void SXP_setMaskBit(SablotSituation S, int mask); +) + +Declare +( + unsigned long SXP_getOptions(SablotSituation S); +) + +Declare +( + int SXP_createQueryContext(SablotSituation S, QueryContext *Q); +) + +Declare +( + int SXP_addVariableBinding(QueryContext Q, + const SXP_char* name, QueryContext source); +) + +Declare +( + int SXP_addVariableNumber(QueryContext Q, + const SXP_char* name, double value); +) + +Declare +( + int SXP_addVariableString(QueryContext Q, + const SXP_char* name, const SXP_char* value); +) + +Declare +( + int SXP_addVariableBoolean(QueryContext Q, + const SXP_char* name, int value); +) + +Declare +( + int SXP_addNamespaceDeclaration(QueryContext Q, + const SXP_char* prefix, const SXP_char* uri); +) + +Declare +( + int SXP_query(QueryContext Q, const SXP_char* query, + SXP_Node n, int contextPosition, int contextSize); +) + +Declare +( + int SXP_destroyQueryContext(QueryContext Q); +) + +/* + * + * Functions to retrieve the query result and its type + * + */ + +Declare +( + int SXP_getResultType(QueryContext Q, SXP_ExpressionType *type); +) + +Declare +( + int SXP_getResultNumber(QueryContext Q, double *result); +) + +Declare +( + int SXP_getResultBool(QueryContext Q, int *result); +) + +Declare +( + int SXP_getResultString(QueryContext Q, const char **result); +) + +Declare +( + int SXP_getResultNodeset(QueryContext Q, SXP_NodeList *result); +) + +/* + * + * NodeList manipulation + * + */ + +Declare +( + int SXP_getNodeListLength(SXP_NodeList l); +) + +Declare +( + SXP_Node SXP_getNodeListItem(QueryContext Q, SXP_NodeList l, int index); +) + + +#endif /* SXPathHIncl */ diff --git a/win32/sablot/lib/sablot.lib b/win32/sablot/lib/sablot.lib new file mode 100644 index 0000000..e002170 Binary files /dev/null and b/win32/sablot/lib/sablot.lib differ diff --git a/win32/sablot/lib/sablotd.lib b/win32/sablot/lib/sablotd.lib new file mode 100644 index 0000000..4b59629 Binary files /dev/null and b/win32/sablot/lib/sablotd.lib differ -- cgit v1.2.3