diff options
author | Stef <stef@ws.local> | 2004-06-29 22:51:34 +0000 |
---|---|---|
committer | Stef <stef@ws.local> | 2004-06-29 22:51:34 +0000 |
commit | 256f6e5222d11be55c06a91a4db360bac0e3a6d6 (patch) | |
tree | 5ebbcee77572f15f4df220ccce95950029c929fc | |
parent | 9786ecb6d1dcf21b332c407810d894c3f57dd90b (diff) |
Updated to new sablot library
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | config.win32.h | 6 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | win32/sablot/INSTALL | 364 | ||||
-rw-r--r-- | win32/sablot/INSTALL_WIN | 134 | ||||
-rw-r--r-- | win32/sablot/README | 95 | ||||
-rw-r--r-- | win32/sablot/README_JS | 107 | ||||
-rw-r--r-- | win32/sablot/RELEASE | 485 | ||||
-rw-r--r-- | win32/sablot/bin/sabcmd.exe | bin | 16384 -> 53248 bytes | |||
-rw-r--r-- | win32/sablot/bin/sablot.dll | bin | 253952 -> 364544 bytes | |||
-rw-r--r-- | win32/sablot/include/sabdbg.h | 58 | ||||
-rw-r--r-- | win32/sablot/include/sablot.h | 594 | ||||
-rw-r--r-- | win32/sablot/include/sablot.lib | bin | 28044 -> 0 bytes | |||
-rw-r--r-- | win32/sablot/include/sdom.h | 957 | ||||
-rw-r--r-- | win32/sablot/include/shandler.h | 371 | ||||
-rw-r--r-- | win32/sablot/include/sxpath.h | 400 | ||||
-rw-r--r-- | win32/sablot/lib/sablot.lib | bin | 28044 -> 28652 bytes |
17 files changed, 3540 insertions, 38 deletions
@@ -1,3 +1,6 @@ +Version 0.9.2 + - Updated windows version to new sablot library + Version 0.9.1 - Changed name to 'rtfx' due to a naming conflict diff --git a/config.win32.h b/config.win32.h index 8fbdf95..1d253c3 100644 --- a/config.win32.h +++ b/config.win32.h @@ -98,13 +98,13 @@ #define PACKAGE_NAME "rtfx" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "rtfx 0.9.1" +#define PACKAGE_STRING "rtfx 0.9.2" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "rtfx" /* Define to the version of this package. */ -#define PACKAGE_VERSION "0.9.1" +#define PACKAGE_VERSION "0.9.2" /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be @@ -118,7 +118,7 @@ #define STDC_HEADERS 1 /* Version number of package */ -#define VERSION "0.9.1" +#define VERSION "0.9.2" /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ diff --git a/configure.in b/configure.in index df8b5df..997e73a 100644 --- a/configure.in +++ b/configure.in @@ -36,8 +36,8 @@ dnl Nate Nielsen <nielsen@memberwebs.com> dnl dnl Process this file with autoconf to produce a configure script. -AC_INIT(rtfx, 0.9.1, nielsen@memberwebs.com) -AM_INIT_AUTOMAKE(rtfx, 0.9.1) +AC_INIT(rtfx, 0.9.2, nielsen@memberwebs.com) +AM_INIT_AUTOMAKE(rtfx, 0.9.2) LDFLAGS="$LDFLAGS -L/usr/local/lib" CPPFLAGS="$CPPFLAGS -I/usr/local/include" diff --git a/win32/sablot/INSTALL b/win32/sablot/INSTALL new file mode 100644 index 0000000..d382aa6 --- /dev/null +++ b/win32/sablot/INSTALL @@ -0,0 +1,364 @@ +This file describes the installation procedure of Sablotron. To know + +more on Sablotron, please read the README file in the same directory + +as this file. + + + +To get more info on installing on *Windows*, please read + +the INSTALL_WIN file. + + + +For specific information on how to build Sablotron with JavaScript + +engine (to enable extensions) see the README_JS file. + + + +1. Intro + +2. Building + +3. Preinstalled Expat + +4. Binary distributions + +5. Environment + +6. Documentation + +7. More info + + + + + +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. + + + +Sablotron should be able to find and link older expat libraries + +(libxmlparse, libxmltok), but this feature is not tested and is + +deprecated. + + + + + +2. Building (sources) + +======================================== + + + +If you have downloaded the binary distribution, you can skip reading this + +section and go to the Environment section. + + + +Sablotron compiles e.g. on the following platforms: + + + +- Linux (RH 5.2 - 7.0, gcc 2.95.2 or later) + +- Windows (NT 4.0, 9x, 2000, VC++ 4.2/6.0) + +- Solaris (Solaris 2.5.1, 2.6, 7, gcc 2.91.57) + +- FreeBSD (FreeBSD 3.4, 4.1) + +- OpenBSD (OpenBSD 2.8 beta) + +- HP-UX + +- Irix + +- MacOS X + + + +If you need any other port, please contact us. + + + +We use GNU autoconf since the version 0.41. So the following steps + +should work on any UNIX platform: + + + + ./configure + + make + + make install (may require the root privileges) + + + +These switches can be passed to ./configure + + + + --enable-javascript + + enables JS extension functions + + --enable-perlconnect + + required when installed with Charlie application framework + + --enable-debugger + + enables XSLT debugger + + --with-readline + + links the debugger with the readline library to make its command-line + + interface more comfortable (SABLOT_GPL=1 must be exported) + + + +These are some other useful switches you may want to pass to the configure + +script: + + + + --help + + display all switches available + + --prefix='path where to install' + + specifies the installation path (/usr/local on most systems) + + --enable-warnings + + force compilation with the -Wall switch (for curious people) + + --disable-adding-meta + + disables adding of the META tag (html output method) + + --disable-static + + static library is not created to make compilation faster + + + + + +3. Preinstalled Expat + +======================================== + + + +This chapter is obsolete, but may contain some useful info for people + +running older configuration. + + + +This version of the build process on all Unix platforms respects the + +presence of Expat sources. If you have installed Sablotron and Expat in + +the past (with `make install'), the configure script writes makefiles, so + +they link Expat from your system directories (the sources win, if present). + + + +If you have installed Expat in some non-system directories in the + +past, configure script won't find headers, and build process will + +fail, even if you specify include path with --includedir switch. To + +fix this problem, set CPLUS_INCLUDE_PATH environment variable to point + +to Expat headers. + + + + + +4. Binary distributions + +======================================== + + + +Binaries are available for Linux Intel (rpm) and Windows32. + + + + + +5. Environment + +======================================== + + + +No environment changes are needed (finally!). That's, + +of course, true only if you've used standard 'make install' + +procedure. + + + +The list of environment variables, you may possibly need modify: + + + +LIBRARY_PATH: set this variable to the directory, where the Expat XML + +parser is installed. Do it in the case the configure/linker couldn't + +find the expat libraries. + + + +LD_LIBRARY_PATH: add lib directory to this variable, if sabcmd reports + +"Can't load shared library libsablot.0.xx" or such thing. + + + +CPLUS_INCLUDE_PATH: is needed if you didn't install Sablotron (and + +mainly Expat) into system directories and you're going compile new + +version against older version of Expat. (see "Preinstalled Expat") + + + +On some systems (UnixWare, NetBSD...) the compiler is unable to find + +headers in /usr/local/include. Consequently the 'configure' script + +doesn't find the expat header and compilation fails. To avoid this + +problem, set CPPFLAGS environment to + +'-I/usr/local/include'. CPLUS_INCLUDE_PATH is not enough. + + + +If want to link Sablotron with GNU readline library you need set SABLOT_GPL + +environment variable to 1 to declare you are going to use this software + +under the GPL. + + + + + +6. Documentation + +======================================== + + + +The source package contains XML sources of three guides: + + + +Sablotron Guide and Reference + +Sablotron Extensions API Reference + +SXP Reference + + + +These guides are translated to HTML during the building of the package. + +By default, you can find the HTML guides in + + + +$(distdir)/doc/apidoc/[sablot|jsdom-ref|sxp] + +and + +$(datadir)/doc/html/[sablot|jsdom-ref|sxp] + + + +directories. + + + +The building of documentation requires Perl and XML::Parser to be installed; + +otherwise the building is skipped. + + + + + +7. More info + +======================================== + + + +We suppose you have read the README file. If you haven't, read it now. + +If it is not enough, take a look at our website: + + + +http://www.gingerall.org + + + + + +Enjoy Sablotron!! + + + +GA + diff --git a/win32/sablot/INSTALL_WIN b/win32/sablot/INSTALL_WIN index a84d7d2..b192bc7 100644 --- a/win32/sablot/INSTALL_WIN +++ b/win32/sablot/INSTALL_WIN @@ -1,124 +1,224 @@ 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=<ex-path> EXPAT_LIB=<ex-lib-path> +Sablotron can be built with many different options. These options are defined + +in sablot_config.msvc file. You can either edit this file or preferably create + +its local copy named sablot_config.local. The config file itself is rather -To build with iconv and JavaScript (these two dependencies are independent -of each other) type: +self-decriptive. - nmake -f Makefile.nt EXPAT=<ex-path> EXPAT_LIB=<ex-lib-path> ICONV=<ic-path> JS=<js-path> -where - <ex-path> is the path to the directory where you installed expat, and - <ex-lib-path> is the full name of expat.lib ***relative to <ex-path>***. - <ic-path> is the path where iconv is installed [OPTIONAL]. - <js-path> 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 +The recommended procedure is the following: + + + +1. copy sablot_config.msvc to sablot_config.local + +2. edit sablot_config.local + +3. type 'nmake -f makefile.msvc' + + Then install the Sablotron DLL and executable as described in section 2. -Make sure expat.dll (iconv.dll, js32.dll) are on your PATH. + +Make sure expat.dll (iconv.dll, js32.dll) are on your PATH (if you link them). + + + 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 index 628a07a..15bfa96 100644 --- a/win32/sablot/README +++ b/win32/sablot/README @@ -1,87 +1,174 @@ 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. + + +So far Sablotron is tested on Linux (RedHat 5.2, 6.0, 6.1, 6.2, 7.0, + +8.0 and 9), 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 index c58760b..10611a9 100644 --- a/win32/sablot/README_JS +++ b/win32/sablot/README_JS @@ -1,107 +1,214 @@ 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 <http://www.exslt.org/functions/script> 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 + ---------------------------------------- + + <?xml version='1.0'?> + <xsl:stylesheet version='1.0' + xmlns:xsl='http://www.w3.org/1999/XSL/Transform' + xmlns:exslt='http://www.exslt.org/functions' + xmlns:my='http://gingerall.org/sablot/myfunc' + extension-element-prefixes='exslt' + exclude-result-prefixes='my'> + + <xsl:output method='xml' indent='yes'/> + + <exslt:script language='javascript' implements-prefix='my'> + <![CDATA[ + + function getNodeNames(nodeList) + { + ret = ''; + for (i = 0; i < nodeList.length; i++) + { + ret += nodeList[i].nodeName + " "; + } + return ret; + } + + ]]> + </exslt:script> + + + <xsl:template match='/'> + <output> + <xsl:value-of select='my:getNodeNames(*)'/> + </output> + </xsl:template> + + </xsl:stylesheet> + diff --git a/win32/sablot/RELEASE b/win32/sablot/RELEASE index 196dc6f..2d837b6 100644 --- a/win32/sablot/RELEASE +++ b/win32/sablot/RELEASE @@ -1,309 +1,792 @@ #====================================================================# + # The release file for Sablotron # + #====================================================================# + + +Version 1.0.1 + +November 24, 2003 + +----------------- + + - minor changes to configure (snprintf tested) + + - fixed a bug of wrong error line numbers in imported or + + included template + + - fixed a bug of count() function argument casting + + - misplaced xsl:import no more processed + + [reported by Bob Kline] + + - fixed a bug of crashing current() [reported by Alex Greg] + + - fixed a bug in DOM (inserting child nodes) + + - fixed a bug of pointers sized differently from boolean on + + 64-bit platforms + + + +Version 1.0 + +August 8, 2003 + +--------------- + + - two flags SAB_DUMP_SHEET_STRUCTURE (0x40) and + + SAB_NO_EXTERNAL_ENTITIES (0x80) added + + - nested xsl:attribute reported as error + + - > is always escaped to prevent problems with CDATA end + + - new configurable set of makefiles for Windows MSVC++ has been + + created to replace existing Makefile.nt file + + [by Rosimildo daSilva, patch by Bob Kline] + + - fixed a type comparison failing on arm, powerpc and s390 + + [reported by Debian maintainers] + + - fixed a bug of default NS in imported/included templates + + - fixed a segfault in keys defined on empty nodes + + [reported by Simon Spanihel] + + - minor changes to compile under QNX 6.2 + + [patch by Adrian Weiler] + + - fixed a bug of nested imports [reported by Dave Brooks] + + - fixed a bug of UTF-16 encoded files on Win + + [reported by Andrey Sokolov] + + - fixed a bug of defenition check in shandler.h for Borland + + compilers [reported by Vladimir Lukianov] + + - fixed a bug of crashing sorting on Windows + + - fixed a bug of crashing key() on RTF + + [reported by Valeriy Ovechkin] + + - solved the issue of too many files open with exsl:document + + - fixed a bug of casting of 64-bit pointers to (int) + + [patch by Steve Crockett] + + - fixed a bug absolute paths starting with a drive letter on + + Windows (unsupported scheme is reported) + + - fixed a bug of SDOM_DestroyDocument + + + +Version 0.98 + +April 7, 2003 + +------------- + + - added stylesheet chaining to sabcmd [by Stefan Behnel] + + - changes in XML::Sablotron (new layout, added DOMHandler SXP + + interface) [by Nicolas Trebst and Anselm Kruis] + + - fixed a bug of variables bound for SXP queries + + - fixed a bug of the self axis (principal node type) + + - fix for Metrowerks C/C++ compiler [suggested by Tim Crook] + + - fixed a bug of forbidden XPath (child::xxx@yyy) + + - configuration fixes (APIDOC docs are built only when + + Perl/XML::Parser found) + + - fixed defaults for xsl:number + + - fixed a bug of required order of top-level variables + + - fixes in the outputting of NS declarations + + - fixes in the import precedence [report by Roy Huggins] + + - added a new config switch for sabcmd to abort on XSLT error + + (--enable-abort-on-error) + + - fixed a bug in namespace-alias + + - fixed segfault occurring when formating big numbers (>1e127) + + - fixed comparison of char to 0 for unsigned-char platforms + + + +Version 0.97 + +December 30, 2002 + +----------------- + + - fixed the problem with Expat 1.95.5 + + - fixed a bug in xsl:message [report by Bob Kline] + + - fixed an infinite loop bug in recursive imports + + [report by Michael Vladimirov] + + - added SablotGetOptions() function + + - added a new option (SAB_FILES_TO_HANDLER) to pass the 'file' + + URIs to the scheme handler + + - fixed collisions with PHP/Java extension, Arena* renamed to + + SabArena [suggested by Christian Stocker] + + - mapping of namespaces added to xql() function (DOM) + + - chars illegal in output encoding displayed as references + + (for xml, html, xhtml output methods) + + - fixed resolution of relative URIs in document() + + - fixed a bug of not overridden imported parameters + + - documentation sources (APIDOC XML) added to distribution + + + 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 <xsl:output indent> + - 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 <META> 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 <xsl:output>, <xsl:comment>, + <xsl:processing-instruction>. + - External general entities work now. + - Bug fixes (thanks for reports and/or patches to Hans Raaf, + Florian Hars, <robin@kitsite.com>, Mark W. Eichin and + Robin Berjon). + - Performance improvements. + + Version 0.36 + ------------ + - optimized string handling, resulting in a significant + performance improvement + - implemented <xsl:copy> + + 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 Binary files differindex 8fb2698..4b209e7 100644 --- a/win32/sablot/bin/sabcmd.exe +++ b/win32/sablot/bin/sabcmd.exe diff --git a/win32/sablot/bin/sablot.dll b/win32/sablot/bin/sablot.dll Binary files differindex c247b57..ee093c5 100644 --- a/win32/sablot/bin/sablot.dll +++ b/win32/sablot/bin/sablot.dll diff --git a/win32/sablot/include/sabdbg.h b/win32/sablot/include/sabdbg.h index 1428af6..3c97944 100644 --- a/win32/sablot/include/sabdbg.h +++ b/win32/sablot/include/sabdbg.h @@ -1,58 +1,116 @@ /* + * 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 <sablot.h> + + /************************************************************/ + /* 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 index 71b05a2..0d63579 100644 --- a/win32/sablot/include/sablot.h +++ b/win32/sablot/include/sablot.h @@ -1,560 +1,1134 @@ /* + * 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 + + * Portions created by Ginger Alliance are Copyright (C) 2000-2003 + * 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" + +#define SAB_VERSION "1.0.1" + +#define SAB_DATE "November 24, 2003" + + /* common types */ + typedef void *SablotHandle; + typedef void *SDOM_Document; + typedef void *SablotSituation; -#if defined(WIN32) && defined(_MSC_VER) + + +#if defined(WIN32) && defined(_MSC_VER) && !defined(SABLOT_STATIC) + #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 + + 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, + + SAB_FILES_TO_HANDLER = 0x20, + + SAB_DUMP_SHEET_STRUCTURE = 0x40, + + SAB_NO_EXTERNAL_ENTITIES = 0x80 + } 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 SablotGetOptions(SablotSituation S); + +) + + + +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 */ + + +#endif diff --git a/win32/sablot/include/sablot.lib b/win32/sablot/include/sablot.lib Binary files differdeleted file mode 100644 index e002170..0000000 --- a/win32/sablot/include/sablot.lib +++ /dev/null diff --git a/win32/sablot/include/sdom.h b/win32/sablot/include/sdom.h index cee53ff..476f32a 100644 --- a/win32/sablot/include/sdom.h +++ b/win32/sablot/include/sdom.h @@ -1,921 +1,1878 @@ /* + * 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 <config.h> + #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); + ) + + +Declare( + +SDOM_Exception SDOM_xql_ns( + + SablotSituation s, + + const SDOM_char *query, + + SDOM_Node currentNode, + + char** nsmap, + + 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); + ) + + +Declare + +( + + SDOM_Exception SDOM_compareNodes( + + SablotSituation s, + + SDOM_Node n1, + + SDOM_Node n2, + + int *res); + +) + + + #endif /* DISABLE_DOM */ + + #endif /* SDomHIncl */ + diff --git a/win32/sablot/include/shandler.h b/win32/sablot/include/shandler.h index ea7fc83..bf4f3fa 100644 --- a/win32/sablot/include/shandler.h +++ b/win32/sablot/include/shandler.h @@ -1,369 +1,738 @@ /* + * 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) + +#if !defined(_MSC_VER) && !defined(__BORLANDC__) + #include <sabcfg.h> + #endif + + #include <stddef.h> + + /* 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 index d6bd448..56888b4 100644 --- a/win32/sablot/include/sxpath.h +++ b/win32/sablot/include/sxpath.h @@ -1,264 +1,664 @@ /* + * 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 SXP_NodeType DOMH_getNodeTypeExt(SXP_Node n, void *userData); + + + typedef const SXP_char* DOMH_getNodeName(SXP_Node n); + +typedef const SXP_char* DOMH_getNodeNameExt(SXP_Node n, void *userData); + + + typedef const SXP_char* DOMH_getNodeNameURI(SXP_Node n); + +typedef const SXP_char* DOMH_getNodeNameURIExt(SXP_Node n, void *userData); + + + typedef const SXP_char* DOMH_getNodeNameLocal(SXP_Node n); + +typedef const SXP_char* DOMH_getNodeNameLocalExt(SXP_Node n, void *userData); + + + typedef const SXP_char* DOMH_getNodeValue(SXP_Node n); + +typedef const SXP_char* DOMH_getNodeValueExt(SXP_Node n, void *userData); + + + typedef SXP_Node DOMH_getNextSibling(SXP_Node n); + +typedef SXP_Node DOMH_getNextSiblingExt(SXP_Node n, void *userData); + + + typedef SXP_Node DOMH_getPreviousSibling(SXP_Node n); + +typedef SXP_Node DOMH_getPreviousSiblingExt(SXP_Node n, void *userData); + + + typedef SXP_Node DOMH_getNextAttrNS(SXP_Node n); + +typedef SXP_Node DOMH_getNextAttrNSExt(SXP_Node n, void *userData); + + + typedef SXP_Node DOMH_getPreviousAttrNS(SXP_Node n); + +typedef SXP_Node DOMH_getPreviousAttrNSExt(SXP_Node n, void *userData); + + + typedef int DOMH_getChildCount(SXP_Node n); + +typedef int DOMH_getChildCountExt(SXP_Node n, void *userData); + + + typedef int DOMH_getAttributeCount(SXP_Node n); + +typedef int DOMH_getAttributeCountExt(SXP_Node n, void *userData); + + + typedef int DOMH_getNamespaceCount(SXP_Node n); + +typedef int DOMH_getNamespaceCountExt(SXP_Node n, void *userData); + + + typedef SXP_Node DOMH_getChildNo(SXP_Node n, int ndx); + +typedef SXP_Node DOMH_getChildNoExt(SXP_Node n, int ndx, void *userData); + + + typedef SXP_Node DOMH_getAttributeNo(SXP_Node n, int ndx); + +typedef SXP_Node DOMH_getAttributeNoExt(SXP_Node n, int ndx, void *userData); + + + typedef SXP_Node DOMH_getNamespaceNo(SXP_Node n, int ndx); + +typedef SXP_Node DOMH_getNamespaceNoExt(SXP_Node n, int ndx, void *userData); + + + typedef SXP_Node DOMH_getParent(SXP_Node n); + +typedef SXP_Node DOMH_getParentExt(SXP_Node n, void *userData); + + + typedef SXP_Document DOMH_getOwnerDocument(SXP_Node n); + +typedef SXP_Document DOMH_getOwnerDocumentExt(SXP_Node n, void *userData); + + + typedef int DOMH_compareNodes(SXP_Node n1, SXP_Node n2); + +typedef int DOMH_compareNodesExt(SXP_Node n1, SXP_Node n2, void *userData); + + + typedef SXP_Document DOMH_retrieveDocument(const SXP_char* uri, + void* udata); + +typedef SXP_Document DOMH_retrieveDocumentExt(const SXP_char* uri, + + const SXP_char* baseUri, + + void* udata); + + + typedef SXP_Node DOMH_getNodeWithID(SXP_Document doc, const SXP_char* id); + +typedef SXP_Node DOMH_getNodeWithIDExt(SXP_Document doc, const SXP_char* id, void *userData); + + + typedef void DOMH_freeBuffer(SXP_char *buff); +typedef void DOMH_freeBufferExt(SXP_Node n, SXP_char *buff, void *userData); + + + + + 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; + + + + DOMH_getNodeTypeExt *getNodeTypeExt; + + DOMH_getNodeNameExt *getNodeNameExt; + + DOMH_getNodeNameURIExt *getNodeNameURIExt; + + DOMH_getNodeNameLocalExt *getNodeNameLocalExt; + + DOMH_getNodeValueExt *getNodeValueExt; + + DOMH_getNextSiblingExt *getNextSiblingExt; + + DOMH_getPreviousSiblingExt *getPreviousSiblingExt; + + DOMH_getNextAttrNSExt *getNextAttrNSExt; + + DOMH_getPreviousAttrNSExt *getPreviousAttrNSExt; + + DOMH_getChildCountExt *getChildCountExt; + + DOMH_getAttributeCountExt *getAttributeCountExt; + + DOMH_getNamespaceCountExt *getNamespaceCountExt; + + DOMH_getChildNoExt *getChildNoExt; + + DOMH_getAttributeNoExt *getAttributeNoExt; + + DOMH_getNamespaceNoExt *getNamespaceNoExt; + + DOMH_getParentExt *getParentExt; + + DOMH_getOwnerDocumentExt *getOwnerDocumentExt; + + DOMH_compareNodesExt *compareNodesExt; + + DOMH_retrieveDocumentExt *retrieveDocumentExt; + + DOMH_getNodeWithIDExt *getNodeWithIDExt; + + /*optional entries - driven by sxpOptions */ + + DOMH_freeBufferExt *freeBufferExt; + + + } 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 Binary files differindex e002170..e334654 100644 --- a/win32/sablot/lib/sablot.lib +++ b/win32/sablot/lib/sablot.lib |