summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-03-23 17:33:07 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-03-23 17:33:07 +0100
commitd4d184a750e2c09a39b95db9a54daf83aac5a446 (patch)
tree337681fd2ec63d6678d28420aa643cb1cbe4ec0f
parentb45b68ae4ab90af1ce35deec52b0c0492a1f49d4 (diff)
Pre-compiled devices removed
Along with the devices, xmlParser which is no longer needed is removed. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--MAINTAINERS4
-rw-r--r--Makefile.am8
-rw-r--r--configure.in2
-rw-r--r--devices/Makefile.am3
-rw-r--r--devices/zmq_forwarder/Makefile.am8
-rw-r--r--devices/zmq_forwarder/zmq_forwarder.cpp124
-rw-r--r--devices/zmq_queue/Makefile.am8
-rw-r--r--devices/zmq_queue/zmq_queue.cpp123
-rw-r--r--devices/zmq_streamer/Makefile.am8
-rw-r--r--devices/zmq_streamer/zmq_streamer.cpp123
-rw-r--r--doc/Makefile.am6
-rw-r--r--doc/zmq_forwarder.txt33
-rw-r--r--doc/zmq_queue.txt33
-rw-r--r--doc/zmq_streamer.txt33
-rw-r--r--foreign/xmlParser/xmlParser.cpp2923
-rw-r--r--foreign/xmlParser/xmlParser.hpp762
16 files changed, 5 insertions, 4196 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 82c328a..0c8c834 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -34,10 +34,6 @@ Component: Multiplexing (zmq_poll)
Maintainer: Martin Sustrik
Contact: sustrik@250bpm.com
-Component: Devices
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
Component: Generic Infrastructure (context, mailbox, command, pipe)
Maintainer: Martin Sustrik
Contact: sustrik@250bpm.com
diff --git a/Makefile.am b/Makefile.am
index e7d221f..9b4a4f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,15 +1,13 @@
ACLOCAL_AMFLAGS = -I config
-SUBDIRS = src doc perf devices tests
-DIST_SUBDIRS = src doc perf devices tests builds/msvc
+SUBDIRS = src doc perf tests
+DIST_SUBDIRS = src doc perf tests builds/msvc
EXTRA_DIST = \
autogen.sh \
version.sh \
MAINTAINERS \
- foreign/openpgm/@pgm_basename@.tar.gz \
- foreign/xmlParser/xmlParser.cpp \
- foreign/xmlParser/xmlParser.hpp
+ foreign/openpgm/@pgm_basename@.tar.gz
MAINTAINERCLEANFILES = \
$(srcdir)/aclocal.m4 \
$(srcdir)/autom4te.cache \
diff --git a/configure.in b/configure.in
index ae7cd44..cf8925e 100644
--- a/configure.in
+++ b/configure.in
@@ -424,8 +424,6 @@ AC_SUBST(LIBZMQ_EXTRA_LDFLAGS)
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile
perf/Makefile src/libzmq.pc \
- devices/Makefile devices/zmq_forwarder/Makefile \
- devices/zmq_streamer/Makefile devices/zmq_queue/Makefile \
builds/msvc/Makefile tests/Makefile])
AC_OUTPUT
diff --git a/devices/Makefile.am b/devices/Makefile.am
deleted file mode 100644
index 85fe596..0000000
--- a/devices/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-
-SUBDIRS = zmq_forwarder zmq_streamer zmq_queue
-DIST_SUBDIRS = zmq_forwarder zmq_streamer zmq_queue
diff --git a/devices/zmq_forwarder/Makefile.am b/devices/zmq_forwarder/Makefile.am
deleted file mode 100644
index 936a305..0000000
--- a/devices/zmq_forwarder/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDES = -I$(top_srcdir)/include
-
-bin_PROGRAMS = zmq_forwarder
-
-zmq_forwarder_LDADD = $(top_builddir)/src/libzmq.la
-zmq_forwarder_SOURCES = zmq_forwarder.cpp
-
-
diff --git a/devices/zmq_forwarder/zmq_forwarder.cpp b/devices/zmq_forwarder/zmq_forwarder.cpp
deleted file mode 100644
index 83ee737..0000000
--- a/devices/zmq_forwarder/zmq_forwarder.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- Copyright (c) 2007-2011 iMatix Corporation
- Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
-
- This file is part of 0MQ.
-
- 0MQ is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- 0MQ is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "../../include/zmq.hpp"
-#include "../../foreign/xmlParser/xmlParser.cpp"
-
-int main (int argc, char *argv [])
-{
- if (argc != 2) {
- fprintf (stderr, "usage: zmq_forwarder <config-file>\n");
- return 1;
- }
-
- XMLNode root = XMLNode::parseFile (argv [1]);
- if (root.isEmpty ()) {
- fprintf (stderr, "configuration file not found or not an XML file\n");
- return 1;
- }
-
- if (strcmp (root.getName (), "forwarder") != 0) {
- fprintf (stderr, "root element in the configuration file should be "
- "named 'forwarder'\n");
- return 1;
- }
-
- XMLNode in_node = root.getChildNode ("in");
- if (in_node.isEmpty ()) {
- fprintf (stderr, "'in' node is missing in the configuration file\n");
- return 1;
- }
-
- XMLNode out_node = root.getChildNode ("out");
- if (out_node.isEmpty ()) {
- fprintf (stderr, "'out' node is missing in the configuration file\n");
- return 1;
- }
-
- // TODO: make the number of I/O threads configurable.
- zmq::context_t ctx (1);
- zmq::socket_t in_socket (ctx, ZMQ_SUB);
- in_socket.setsockopt (ZMQ_SUBSCRIBE, "", 0);
- zmq::socket_t out_socket (ctx, ZMQ_PUB);
-
- int n = 0;
- while (true) {
- XMLNode bind = in_node.getChildNode ("bind", n);
- if (bind.isEmpty ())
- break;
- const char *addr = bind.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'bind' node is missing 'addr' attribute\n");
- return 1;
- }
- in_socket.bind (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode connect = in_node.getChildNode ("connect", n);
- if (connect.isEmpty ())
- break;
- const char *addr = connect.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'connect' node is missing 'addr' attribute\n");
- return 1;
- }
- in_socket.connect (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode bind = out_node.getChildNode ("bind", n);
- if (bind.isEmpty ())
- break;
- const char *addr = bind.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'bind' node is missing 'addr' attribute\n");
- return 1;
- }
- out_socket.bind (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode connect = out_node.getChildNode ("connect", n);
- if (connect.isEmpty ())
- break;
- const char *addr = connect.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'connect' node is missing 'addr' attribute\n");
- return 1;
- }
- out_socket.connect (addr);
- n++;
- }
-
- try {
- zmq::device (ZMQ_FORWARDER, in_socket, out_socket);
- } catch (zmq::error_t& e) {
- fprintf(stderr, "device exit: %s\n", e.what());
- }
-
- return 0;
-}
diff --git a/devices/zmq_queue/Makefile.am b/devices/zmq_queue/Makefile.am
deleted file mode 100644
index 39c0c10..0000000
--- a/devices/zmq_queue/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDES = -I$(top_srcdir)/include
-
-bin_PROGRAMS = zmq_queue
-
-zmq_queue_LDADD = $(top_builddir)/src/libzmq.la
-zmq_queue_SOURCES = zmq_queue.cpp
-
-
diff --git a/devices/zmq_queue/zmq_queue.cpp b/devices/zmq_queue/zmq_queue.cpp
deleted file mode 100644
index cae5250..0000000
--- a/devices/zmq_queue/zmq_queue.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- Copyright (c) 2007-2011 iMatix Corporation
- Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
-
- This file is part of 0MQ.
-
- 0MQ is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- 0MQ is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "../../include/zmq.hpp"
-#include "../../foreign/xmlParser/xmlParser.cpp"
-
-int main (int argc, char *argv [])
-{
- if (argc != 2) {
- fprintf (stderr, "usage: zmq_queue <config-file>\n");
- return 1;
- }
-
- XMLNode root = XMLNode::parseFile (argv [1]);
- if (root.isEmpty ()) {
- fprintf (stderr, "configuration file not found or not an XML file\n");
- return 1;
- }
-
- if (strcmp (root.getName (), "queue") != 0) {
- fprintf (stderr, "root element in the configuration file should be "
- "named 'queue'\n");
- return 1;
- }
-
- XMLNode in_node = root.getChildNode ("in");
- if (in_node.isEmpty ()) {
- fprintf (stderr, "'in' node is missing in the configuration file\n");
- return 1;
- }
-
- XMLNode out_node = root.getChildNode ("out");
- if (out_node.isEmpty ()) {
- fprintf (stderr, "'out' node is missing in the configuration file\n");
- return 1;
- }
-
- // TODO: make the number of I/O threads configurable.
- zmq::context_t ctx (1);
- zmq::socket_t in_socket (ctx, ZMQ_XREP);
- zmq::socket_t out_socket (ctx, ZMQ_XREQ);
-
- int n = 0;
- while (true) {
- XMLNode bind = in_node.getChildNode ("bind", n);
- if (bind.isEmpty ())
- break;
- const char *addr = bind.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'bind' node is missing 'addr' attribute\n");
- return 1;
- }
- in_socket.bind (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode connect = in_node.getChildNode ("connect", n);
- if (connect.isEmpty ())
- break;
- const char *addr = connect.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'connect' node is missing 'addr' attribute\n");
- return 1;
- }
- in_socket.connect (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode bind = out_node.getChildNode ("bind", n);
- if (bind.isEmpty ())
- break;
- const char *addr = bind.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'bind' node is missing 'addr' attribute\n");
- return 1;
- }
- out_socket.bind (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode connect = out_node.getChildNode ("connect", n);
- if (connect.isEmpty ())
- break;
- const char *addr = connect.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'connect' node is missing 'addr' attribute\n");
- return 1;
- }
- out_socket.connect (addr);
- n++;
- }
-
- try {
- zmq::device (ZMQ_QUEUE, in_socket, out_socket);
- } catch (zmq::error_t& e) {
- fprintf(stderr, "device exit: %s\n", e.what());
- }
-
- return 0;
-}
diff --git a/devices/zmq_streamer/Makefile.am b/devices/zmq_streamer/Makefile.am
deleted file mode 100644
index e195a3c..0000000
--- a/devices/zmq_streamer/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDES = -I$(top_srcdir)/include
-
-bin_PROGRAMS = zmq_streamer
-
-zmq_streamer_LDADD = $(top_builddir)/src/libzmq.la
-zmq_streamer_SOURCES = zmq_streamer.cpp
-
-
diff --git a/devices/zmq_streamer/zmq_streamer.cpp b/devices/zmq_streamer/zmq_streamer.cpp
deleted file mode 100644
index 951115c..0000000
--- a/devices/zmq_streamer/zmq_streamer.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- Copyright (c) 2007-2011 iMatix Corporation
- Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
-
- This file is part of 0MQ.
-
- 0MQ is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- 0MQ is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "../../include/zmq.hpp"
-#include "../../foreign/xmlParser/xmlParser.cpp"
-
-int main (int argc, char *argv [])
-{
- if (argc != 2) {
- fprintf (stderr, "usage: zmq_streamer <config-file>\n");
- return 1;
- }
-
- XMLNode root = XMLNode::parseFile (argv [1]);
- if (root.isEmpty ()) {
- fprintf (stderr, "configuration file not found or not an XML file\n");
- return 1;
- }
-
- if (strcmp (root.getName (), "streamer") != 0) {
- fprintf (stderr, "root element in the configuration file should be "
- "named 'streamer'\n");
- return 1;
- }
-
- XMLNode in_node = root.getChildNode ("in");
- if (in_node.isEmpty ()) {
- fprintf (stderr, "'in' node is missing in the configuration file\n");
- return 1;
- }
-
- XMLNode out_node = root.getChildNode ("out");
- if (out_node.isEmpty ()) {
- fprintf (stderr, "'out' node is missing in the configuration file\n");
- return 1;
- }
-
- // TODO: make the number of I/O threads configurable.
- zmq::context_t ctx (1);
- zmq::socket_t in_socket (ctx, ZMQ_PULL);
- zmq::socket_t out_socket (ctx, ZMQ_PUSH);
-
- int n = 0;
- while (true) {
- XMLNode bind = in_node.getChildNode ("bind", n);
- if (bind.isEmpty ())
- break;
- const char *addr = bind.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'bind' node is missing 'addr' attribute\n");
- return 1;
- }
- in_socket.bind (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode connect = in_node.getChildNode ("connect", n);
- if (connect.isEmpty ())
- break;
- const char *addr = connect.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'connect' node is missing 'addr' attribute\n");
- return 1;
- }
- in_socket.connect (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode bind = out_node.getChildNode ("bind", n);
- if (bind.isEmpty ())
- break;
- const char *addr = bind.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'bind' node is missing 'addr' attribute\n");
- return 1;
- }
- out_socket.bind (addr);
- n++;
- }
-
- n = 0;
- while (true) {
- XMLNode connect = out_node.getChildNode ("connect", n);
- if (connect.isEmpty ())
- break;
- const char *addr = connect.getAttribute ("addr");
- if (!addr) {
- fprintf (stderr, "'connect' node is missing 'addr' attribute\n");
- return 1;
- }
- out_socket.connect (addr);
- n++;
- }
-
- try {
- zmq::device (ZMQ_STREAMER, in_socket, out_socket);
- } catch (zmq::error_t& e) {
- fprintf(stderr, "device exit: %s\n", e.what());
- }
-
- return 0;
-}
diff --git a/doc/Makefile.am b/doc/Makefile.am
index ba2b64a..46cb8b0 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,4 +1,3 @@
-MAN1 = zmq_forwarder.1 zmq_streamer.1 zmq_queue.1
MAN3 = zmq_bind.3 zmq_close.3 zmq_connect.3 zmq_init.3 \
zmq_msg_close.3 zmq_msg_copy.3 zmq_msg_data.3 zmq_msg_init.3 \
zmq_msg_init_data.3 zmq_msg_init_size.3 zmq_msg_move.3 zmq_msg_size.3 \
@@ -8,8 +7,7 @@ MAN7 = zmq.7 zmq_tcp.7 zmq_pgm.7 zmq_epgm.7 zmq_inproc.7 zmq_ipc.7 \
zmq_cpp.7
MAN_DOC = $(MAN1) $(MAN3) $(MAN7)
-MAN_TXT = $(MAN1:%.1=%.txt)
-MAN_TXT += $(MAN3:%.3=%.txt)
+MAN_TXT = $(MAN3:%.3=%.txt)
MAN_TXT += $(MAN7:%.7=%.txt)
MAN_HTML = $(MAN_TXT:%.txt=%.html)
@@ -27,7 +25,7 @@ MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML)
dist-hook : $(MAN_DOC) $(MAN_HTML)
if BUILD_DOC
-SUFFIXES=.html .txt .xml .1 .3 .7
+SUFFIXES=.html .txt .xml .3 .7
.txt.html:
asciidoc -d manpage -b xhtml11 -f asciidoc.conf \
diff --git a/doc/zmq_forwarder.txt b/doc/zmq_forwarder.txt
deleted file mode 100644
index b3325f2..0000000
--- a/doc/zmq_forwarder.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-zmq_forwarder(1)
-================
-
-
-NAME
-----
-zmq_forwarder - forwarding device for publish-subscribe messaging
-
-
-SYNOPSIS
---------
-To be written.
-
-
-DESCRIPTION
------------
-To be written.
-
-
-OPTIONS
--------
-To be written.
-
-
-SEE ALSO
---------
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <mato@kotelna.sk>.
diff --git a/doc/zmq_queue.txt b/doc/zmq_queue.txt
deleted file mode 100644
index a3f84f2..0000000
--- a/doc/zmq_queue.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-zmq_queue(1)
-============
-
-
-NAME
-----
-zmq_queue - forwarding device for request-reply messaging
-
-
-SYNOPSIS
---------
-To be written.
-
-
-DESCRIPTION
------------
-To be written.
-
-
-OPTIONS
--------
-To be written.
-
-
-SEE ALSO
---------
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <mato@kotelna.sk>.
diff --git a/doc/zmq_streamer.txt b/doc/zmq_streamer.txt
deleted file mode 100644
index c8d517b..0000000
--- a/doc/zmq_streamer.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-zmq_streamer(1)
-===============
-
-
-NAME
-----
-zmq_streamer - streamer device for parallelized pipeline messaging
-
-
-SYNOPSIS
---------
-To be written.
-
-
-DESCRIPTION
------------
-To be written.
-
-
-OPTIONS
--------
-To be written.
-
-
-SEE ALSO
---------
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <mato@kotelna.sk>.
diff --git a/foreign/xmlParser/xmlParser.cpp b/foreign/xmlParser/xmlParser.cpp
deleted file mode 100644
index ccb1e17..0000000
--- a/foreign/xmlParser/xmlParser.cpp
+++ /dev/null
@@ -1,2923 +0,0 @@
-/**
- ****************************************************************************
- * <P> XML.c - implementation file for basic XML parser written in ANSI C++
- * for portability. It works by using recursion and a node tree for breaking
- * down the elements of an XML document. </P>
- *
- * @version V2.39
- * @author Frank Vanden Berghen
- *
- * NOTE:
- *
- * If you add "#define STRICT_PARSING", on the first line of this file
- * the parser will see the following XML-stream:
- * <a><b>some text</b><b>other text </a>
- * as an error. Otherwise, this tring will be equivalent to:
- * <a><b>some text</b><b>other text</b></a>
- *
- * NOTE:
- *
- * If you add "#define APPROXIMATE_PARSING" on the first line of this file
- * the parser will see the following XML-stream:
- * <data name="n1">
- * <data name="n2">
- * <data name="n3" />
- * as equivalent to the following XML-stream:
- * <data name="n1" />
- * <data name="n2" />
- * <data name="n3" />
- * This can be useful for badly-formed XML-streams but prevent the use
- * of the following XML-stream (problem is: tags at contiguous levels
- * have the same names):
- * <data name="n1">
- * <data name="n2">
- * <data name="n3" />
- * </data>
- * </data>
- *
- * NOTE:
- *
- * If you add "#define _XMLPARSER_NO_MESSAGEBOX_" on the first line of this file
- * the "openFileHelper" function will always display error messages inside the
- * console instead of inside a message-box-window. Message-box-windows are
- * available on windows 9x/NT/2000/XP/Vista only.
- *
- * Copyright (c) 2002, Frank Vanden Berghen
- * All rights reserved.
- *
- * The following license terms apply to projects that are in some way related to
- * the "ZeroMQ project", including applications
- * using "ZeroMQ project" and tools developed
- * for enhancing "ZeroMQ project". All other projects
- * (not related to "ZeroMQ project") have to use this
- * code under the Aladdin Free Public License (AFPL)
- * See the file "AFPL-license.txt" for more informations about the AFPL license.
- * (see http://www.artifex.com/downloads/doc/Public.htm for detailed AFPL terms)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Frank Vanden Berghen nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Frank Vanden Berghen ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************
- */
-
-#if defined _MSC_VER
-#pragma warning (push)
-#pragma warning (disable:4996)
-#endif
-
-#ifndef _CRT_SECURE_NO_DEPRECATE
-#define _CRT_SECURE_NO_DEPRECATE
-#endif
-#include "xmlParser.hpp"
-#ifdef _XMLWINDOWS
-//#ifdef _DEBUG
-//#define _CRTDBG_MAP_ALLOC
-//#include <crtdbg.h>
-//#endif
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h> // to have IsTextUnicode, MultiByteToWideChar, WideCharToMultiByte to handle unicode files
- // to have "MessageBoxA" to display error messages for openFilHelper
-#endif
-
-#include <memory.h>
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-XMLCSTR XMLNode::getVersion() { return _CXML("v2.39"); }
-void freeXMLString(XMLSTR t){if(t)free(t);}
-
-static XMLNode::XMLCharEncoding characterEncoding=XMLNode::char_encoding_UTF8;
-static char guessWideCharChars=1, dropWhiteSpace=1, removeCommentsInMiddleOfText=1;
-
-inline int mmin( const int t1, const int t2 ) { return t1 < t2 ? t1 : t2; }
-
-// You can modify the initialization of the variable "XMLClearTags" below
-// to change the clearTags that are currently recognized by the library.
-// The number on the second columns is the length of the string inside the
-// first column. The "<!DOCTYPE" declaration must be the second in the list.
-// The "<!--" declaration must be the third in the list.
-typedef struct { XMLCSTR lpszOpen; int openTagLen; XMLCSTR lpszClose;} ALLXMLClearTag;
-static ALLXMLClearTag XMLClearTags[] =
-{
- { _CXML("<![CDATA["),9, _CXML("]]>") },
- { _CXML("<!DOCTYPE"),9, _CXML(">") },
- { _CXML("<!--") ,4, _CXML("-->") },
- { _CXML("<PRE>") ,5, _CXML("</PRE>") },
-// { _CXML("<Script>") ,8, _CXML("</Script>")},
- { NULL ,0, NULL }
-};
-
-// You can modify the initialization of the variable "XMLEntities" below
-// to change the character entities that are currently recognized by the library.
-// The number on the second columns is the length of the string inside the
-// first column. Additionally, the syntaxes "&#xA0;" and "&#160;" are recognized.
-typedef struct { XMLCSTR s; int l; XMLCHAR c;} XMLCharacterEntity;
-static XMLCharacterEntity XMLEntities[] =
-{
- { _CXML("&amp;" ), 5, _CXML('&' )},
- { _CXML("&lt;" ), 4, _CXML('<' )},
- { _CXML("&gt;" ), 4, _CXML('>' )},
- { _CXML("&quot;"), 6, _CXML('\"')},
- { _CXML("&apos;"), 6, _CXML('\'')},
- { NULL , 0, '\0' }
-};
-
-// When rendering the XMLNode to a string (using the "createXMLString" function),
-// you can ask for a beautiful formatting. This formatting is using the
-// following indentation character:
-#define INDENTCHAR _CXML('\t')
-
-// The following function parses the XML errors into a user friendly string.
-// You can edit this to change the output language of the library to something else.
-XMLCSTR XMLNode::getError(XMLError xerror)
-{
- switch (xerror)
- {
- case eXMLErrorNone: return _CXML("No error");
- case eXMLErrorMissingEndTag: return _CXML("Warning: Unmatched end tag");
- case eXMLErrorNoXMLTagFound: return _CXML("Warning: No XML tag found");
- case eXMLErrorEmpty: return _CXML("Error: No XML data");
- case eXMLErrorMissingTagName: return _CXML("Error: Missing start tag name");
- case eXMLErrorMissingEndTagName: return _CXML("Error: Missing end tag name");
- case eXMLErrorUnmatchedEndTag: return _CXML("Error: Unmatched end tag");
- case eXMLErrorUnmatchedEndClearTag: return _CXML("Error: Unmatched clear tag end");
- case eXMLErrorUnexpectedToken: return _CXML("Error: Unexpected token found");
- case eXMLErrorNoElements: return _CXML("Error: No elements found");
- case eXMLErrorFileNotFound: return _CXML("Error: File not found");
- case eXMLErrorFirstTagNotFound: return _CXML("Error: First Tag not found");
- case eXMLErrorUnknownCharacterEntity:return _CXML("Error: Unknown character entity");
- case eXMLErrorCharacterCodeAbove255: return _CXML("Error: Character code above 255 is forbidden in MultiByte char mode.");
- case eXMLErrorCharConversionError: return _CXML("Error: unable to convert between WideChar and MultiByte chars");
- case eXMLErrorCannotOpenWriteFile: return _CXML("Error: unable to open file for writing");
- case eXMLErrorCannotWriteFile: return _CXML("Error: cannot write into file");
-
- case eXMLErrorBase64DataSizeIsNotMultipleOf4: return _CXML("Warning: Base64-string length is not a multiple of 4");
- case eXMLErrorBase64DecodeTruncatedData: return _CXML("Warning: Base64-string is truncated");
- case eXMLErrorBase64DecodeIllegalCharacter: return _CXML("Error: Base64-string contains an illegal character");
- case eXMLErrorBase64DecodeBufferTooSmall: return _CXML("Error: Base64 decode output buffer is too small");
- };
- return _CXML("Unknown");
-}
-
-/////////////////////////////////////////////////////////////////////////
-// Here start the abstraction layer to be OS-independent //
-/////////////////////////////////////////////////////////////////////////
-
-// Here is an abstraction layer to access some common string manipulation functions.
-// The abstraction layer is currently working for gcc, Microsoft Visual Studio 6.0,
-// Microsoft Visual Studio .NET, CC (sun compiler) and Borland C++.
-// If you plan to "port" the library to a new system/compiler, all you have to do is
-// to edit the following lines.
-#ifdef XML_NO_WIDE_CHAR
-char myIsTextWideChar(const void *b, int len) { return FALSE; }
-#else
- #if defined (UNDER_CE) || !defined(_XMLWINDOWS)
- char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIsTextUnicode
- {
-#ifdef sun
- // for SPARC processors: wchar_t* buffers must always be alligned, otherwise it's a char* buffer.
- if ((((unsigned long)b)%sizeof(wchar_t))!=0) return FALSE;
-#endif
- const wchar_t *s=(const wchar_t*)b;
-
- // buffer too small:
- if (len<(int)sizeof(wchar_t)) return FALSE;
-
- // odd length test
- if (len&1) return FALSE;
-
- /* only checks the first 256 characters */
- len=mmin(256,len/sizeof(wchar_t));
-
- // Check for the special byte order:
- if (*((unsigned short*)s) == 0xFFFE) return TRUE; // IS_TEXT_UNICODE_REVERSE_SIGNATURE;
- if (*((unsigned short*)s) == 0xFEFF) return TRUE; // IS_TEXT_UNICODE_SIGNATURE
-
- // checks for ASCII characters in the UNICODE stream
- int i,stats=0;
- for (i=0; i<len; i++) if (s[i]<=(unsigned short)255) stats++;
- if (stats>len/2) return TRUE;
-
- // Check for UNICODE NULL chars
- for (i=0; i<len; i++) if (!s[i]) return TRUE;
-
- return FALSE;
- }
- #else
- char myIsTextWideChar(const void *b,int l) { return (char)IsTextUnicode((CONST LPVOID)b,l,NULL); }
- #endif
-#endif
-
-#ifdef _XMLWINDOWS
-// for Microsoft Visual Studio 6.0 and Microsoft Visual Studio .NET and Borland C++ Builder 6.0
- #ifdef _XMLWIDECHAR
- wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce)
- {
- int i;
- if (ce==XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,NULL,0);
- else i=(int)MultiByteToWideChar(CP_ACP ,MB_PRECOMPOSED,s,-1,NULL,0);
- if (i<0) return NULL;
- wchar_t *d=(wchar_t *)malloc((i+1)*sizeof(XMLCHAR));
- if (ce==XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,d,i);
- else i=(int)MultiByteToWideChar(CP_ACP ,MB_PRECOMPOSED,s,-1,d,i);
- d[i]=0;
- return d;
- }
- static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode) { return _wfopen(filename,mode); }
- static inline int xstrlen(XMLCSTR c) { return (int)wcslen(c); }
- static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return _wcsnicmp(c1,c2,l);}
- static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncmp(c1,c2,l);}
- static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return _wcsicmp(c1,c2); }
- static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)wcsstr(c1,c2); }
- static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)wcscpy(c1,c2); }
- #else
- char *myWideCharToMultiByte(const wchar_t *s)
- {
- UINT codePage=CP_ACP; if (characterEncoding==XMLNode::char_encoding_UTF8) codePage=CP_UTF8;
- int i=(int)WideCharToMultiByte(codePage, // code page
- 0, // performance and mapping flags
- s, // wide-character string
- -1, // number of chars in string
- NULL, // buffer for new string
- 0, // size of buffer
- NULL, // default for unmappable chars
- NULL // set when default char used
- );
- if (i<0) return NULL;
- char *d=(char*)malloc(i+1);
- WideCharToMultiByte(codePage, // code page
- 0, // performance and mapping flags
- s, // wide-character string
- -1, // number of chars in string
- d, // buffer for new string
- i, // size of buffer
- NULL, // default for unmappable chars
- NULL // set when default char used
- );
- d[i]=0;
-