summaryrefslogtreecommitdiff
path: root/Build/source/utils/xindy/rte
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/xindy/rte')
-rw-r--r--Build/source/utils/xindy/rte/Makefile.am99
-rw-r--r--Build/source/utils/xindy/rte/Makefile.in336
-rw-r--r--Build/source/utils/xindy/rte/NEWS16
-rw-r--r--Build/source/utils/xindy/rte/README31
-rw-r--r--Build/source/utils/xindy/rte/ordrules/Makefile.in38
-rw-r--r--Build/source/utils/xindy/rte/ordrules/debug.h166
-rwxr-xr-xBuild/source/utils/xindy/rte/ordrules/link.sh11
-rw-r--r--Build/source/utils/xindy/rte/ordrules/mkind.h67
-rw-r--r--Build/source/utils/xindy/rte/ordrules/ordrulei.lsp111
-rw-r--r--Build/source/utils/xindy/rte/ordrules/ordrules.c733
-rw-r--r--Build/source/utils/xindy/rte/ordrules/ordrules.h208
-rw-r--r--Build/source/utils/xindy/rte/ordrules/rxsub.c173
-rw-r--r--Build/source/utils/xindy/rte/ordrules/rxsub.h102
-rw-r--r--Build/source/utils/xindy/rte/ordrules/version.lisp.in13
14 files changed, 2104 insertions, 0 deletions
diff --git a/Build/source/utils/xindy/rte/Makefile.am b/Build/source/utils/xindy/rte/Makefile.am
new file mode 100644
index 00000000000..1e0957ec8dd
--- /dev/null
+++ b/Build/source/utils/xindy/rte/Makefile.am
@@ -0,0 +1,99 @@
+## Use `autoreconf' in top-level directory to recreate all
+## autoconf/automake files.
+## Or, call `automake Makefile' to create only Makefile.in.
+
+## Copyright (C) 2004-2005 by Gour.
+## Copyright (C) 2006-2007 by Jörg Sommer.
+## Copyright (C) 2008 by Joachim Schrod.
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2 of the
+## License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program in the file COPYING; if not, write to the
+## Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+## Boston, MA 02110-1301 USA.
+
+clisp_src = clisp-2.43
+
+clisp_builddir = $(shell pwd)/clisp-build-dir
+
+if EXT_CLISP
+ export CLISP_DIR = @CLISP_DIR@
+ export CLISP_PATH = @CLISP_PATH@
+ CLISP_PREREQ =
+else
+ export CLISP_DIR = $(clisp_builddir)
+ export CLISP_PATH = $(CLISP_DIR)/clisp
+ CLISP_PREREQ = $(clisp_link) $(fulldir)
+endif
+
+export CLISP_LINKKIT = $(CLISP_DIR)/linkkit
+fulldir = $(CLISP_DIR)/full
+clisp_link = $(CLISP_DIR)/clisp-link
+
+binariesdir = ../binaries
+
+#clisp_modules=--with-export-syscalls --with-dynamic-ffi --ignore-absence-of-libsigsegv
+clisp_modules := --with-dynamic-ffi --ignore-absence-of-libsigsegv
+
+# testing for MacOS X platform to circumvent faulty 'readline'
+# provided by Maarten Sneep <maarten.sneep@xs4all.nl>
+# FIXME: GNU make ifeq/endif clauses do not work in Automake files.
+# Either determine that case during configure or make them work.
+#ifeq ($(shell uname -s), Darwin)
+# clisp_modules += --without-readline
+#endif
+
+all: xindy-build-dir
+
+RM_R = rm -rf
+
+if !EXT_CLISP
+$(clisp_builddir): $(clisp_src)
+ cd $(clisp_src) && ./configure $(clisp_builddir) $(clisp_modules)
+ cd $(clisp_builddir) && ./makemake $(clisp_modules) > Makefile
+
+$(CLISP_PREREQ): $(clisp_builddir)
+ $(MAKE) -C $(clisp_builddir)
+
+# Target names that are easy to type, to build CLISP alone during development.
+clisp-configure: $(clisp_builddir)
+clisp: $(CLISP_PREREQ)
+
+check:
+ $(MAKE) -C $(clisp_builddir) check || $(MAKE) -C $(clisp_builddir) check
+endif
+
+xindy-build-dir: $(CLISP_PREREQ)
+ $(RM_R) xindy-build-dir
+ $(MAKE) -C ordrules ordrulei.c
+ $(clisp_link) add-module-set ordrules $(fulldir) $@
+ cp $@/lisp.run $(binariesdir)/xindy.run
+ cp $@/lispinit.mem $(binariesdir)/base.mem
+
+clean-local:
+ $(RM_R) xindy-build-dir
+ $(MAKE) -C ordrules clean
+if !EXT_CLISP
+ if [ -e $(clisp_builddir) ]; then $(MAKE) -C $(clisp_builddir) clean; fi
+endif
+
+# remove some extra files to match pristine clisp source
+distclean-local: clean
+ $(MAKE) -C ordrules distclean
+if !EXT_CLISP
+ $(RM_R) $(clisp_builddir)
+endif
+
+# dist rules for clisp are handled via 'darcs dist', so here we include
+# only the rest of the 'rte' package + modified clisp's configure script!!
+
+EXTRA_DIST = NEWS README configure ordrules $(clisp_src)/configure
diff --git a/Build/source/utils/xindy/rte/Makefile.in b/Build/source/utils/xindy/rte/Makefile.in
new file mode 100644
index 00000000000..7e147fb97ff
--- /dev/null
+++ b/Build/source/utils/xindy/rte/Makefile.in
@@ -0,0 +1,336 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = rte
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_latex.m4 \
+ $(top_srcdir)/m4/ac_prog_pdflatex.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILDDOCS_FALSE = @BUILDDOCS_FALSE@
+BUILDDOCS_TRUE = @BUILDDOCS_TRUE@
+BUILDRULES_FALSE = @BUILDRULES_FALSE@
+BUILDRULES_TRUE = @BUILDRULES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLISP_DIR = @CLISP_DIR@
+CLISP_PATH = @CLISP_PATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXT_CLISP_FALSE = @EXT_CLISP_FALSE@
+EXT_CLISP_TRUE = @EXT_CLISP_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+YACC = @YACC@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+latex = @latex@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdflatex = @pdflatex@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+clisp_src = clisp-2.43
+clisp_builddir = $(shell pwd)/clisp-build-dir
+@EXT_CLISP_FALSE@CLISP_PREREQ = $(clisp_link) $(fulldir)
+@EXT_CLISP_TRUE@CLISP_PREREQ =
+fulldir = $(CLISP_DIR)/full
+clisp_link = $(CLISP_DIR)/clisp-link
+binariesdir = ../binaries
+
+#clisp_modules=--with-export-syscalls --with-dynamic-ffi --ignore-absence-of-libsigsegv
+clisp_modules := --with-dynamic-ffi --ignore-absence-of-libsigsegv
+RM_R = rm -rf
+
+# dist rules for clisp are handled via 'darcs dist', so here we include
+# only the rest of the 'rte' package + modified clisp's configure script!!
+EXTRA_DIST = NEWS README configure ordrules $(clisp_src)/configure
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign rte/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign rte/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-local mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-local \
+ distclean distclean-generic distclean-local dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
+
+
+@EXT_CLISP_TRUE@ export CLISP_DIR = @CLISP_DIR@
+@EXT_CLISP_TRUE@ export CLISP_PATH = @CLISP_PATH@
+@EXT_CLISP_FALSE@ export CLISP_DIR = $(clisp_builddir)
+@EXT_CLISP_FALSE@ export CLISP_PATH = $(CLISP_DIR)/clisp
+
+export CLISP_LINKKIT = $(CLISP_DIR)/linkkit
+
+# testing for MacOS X platform to circumvent faulty 'readline'
+# provided by Maarten Sneep <maarten.sneep@xs4all.nl>
+# FIXME: GNU make ifeq/endif clauses do not work in Automake files.
+# Either determine that case during configure or make them work.
+#ifeq ($(shell uname -s), Darwin)
+# clisp_modules += --without-readline
+#endif
+
+all: xindy-build-dir
+
+@EXT_CLISP_FALSE@$(clisp_builddir): $(clisp_src)
+@EXT_CLISP_FALSE@ cd $(clisp_src) && ./configure $(clisp_builddir) $(clisp_modules)
+@EXT_CLISP_FALSE@ cd $(clisp_builddir) && ./makemake $(clisp_modules) > Makefile
+
+@EXT_CLISP_FALSE@$(CLISP_PREREQ): $(clisp_builddir)
+@EXT_CLISP_FALSE@ $(MAKE) -C $(clisp_builddir)
+
+# Target names that are easy to type, to build CLISP alone during development.
+@EXT_CLISP_FALSE@clisp-configure: $(clisp_builddir)
+@EXT_CLISP_FALSE@clisp: $(CLISP_PREREQ)
+
+@EXT_CLISP_FALSE@check:
+@EXT_CLISP_FALSE@ $(MAKE) -C $(clisp_builddir) check || $(MAKE) -C $(clisp_builddir) check
+
+xindy-build-dir: $(CLISP_PREREQ)
+ $(RM_R) xindy-build-dir
+ $(MAKE) -C ordrules ordrulei.c
+ $(clisp_link) add-module-set ordrules $(fulldir) $@
+ cp $@/lisp.run $(binariesdir)/xindy.run
+ cp $@/lispinit.mem $(binariesdir)/base.mem
+
+clean-local:
+ $(RM_R) xindy-build-dir
+ $(MAKE) -C ordrules clean
+@EXT_CLISP_FALSE@ if [ -e $(clisp_builddir) ]; then $(MAKE) -C $(clisp_builddir) clean; fi
+
+# remove some extra files to match pristine clisp source
+distclean-local: clean
+ $(MAKE) -C ordrules distclean
+@EXT_CLISP_FALSE@ $(RM_R) $(clisp_builddir)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/utils/xindy/rte/NEWS b/Build/source/utils/xindy/rte/NEWS
new file mode 100644
index 00000000000..d5ab36e69ca
--- /dev/null
+++ b/Build/source/utils/xindy/rte/NEWS
@@ -0,0 +1,16 @@
+# $Id: NEWS,v 1.3 2008/01/09 11:35:06 jschrod Exp $
+#------------------------------------------------------------
+
+
+XINDY RUN TIME ENVIRONMENT RELEASE NOTES
+========================================
+
+
+Version Date Remarks
+
+2.3 2008-01-09 Release 2.3
+ Updated to CLISP 2.43; this can be compiled with gcc 4.
+
+2.2 2005-06-14 Release 2.2, `LaTeX Companion Release'.
+ ordrules module ported to current CLISP.
+ Created "configure ; make ; make install" installation.
diff --git a/Build/source/utils/xindy/rte/README b/Build/source/utils/xindy/rte/README
new file mode 100644
index 00000000000..32c827cb2de
--- /dev/null
+++ b/Build/source/utils/xindy/rte/README
@@ -0,0 +1,31 @@
+
+This is the source distribution of the xindy run time environment.
+It consists of CLISP (see http://clisp.cons.org/) and the
+xindy-specific CLISP module ordrules.
+
+Release notes are available in the file NEWS, in this directory.
+
+
+LEGALESE
+--------
+
+This package is freely distributable software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License
+(GPL) as published by the Free Software Foundation.
+
+This package contains CLISP which is released under GPL, version 2
+(only). Please refer to clisp-<version>/COPYRIGHT for the formal
+statement.
+
+The xindy-specific parts of this package, i.e., everything outside the
+clisp-<version>/ directory, are release under GPL version 2 or any
+later version.
+
+This software is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License in
+the file COPYING along with this package; if not, write to the Free
+Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/Build/source/utils/xindy/rte/ordrules/Makefile.in b/Build/source/utils/xindy/rte/ordrules/Makefile.in
new file mode 100644
index 00000000000..fa329f6ed85
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/Makefile.in
@@ -0,0 +1,38 @@
+# $Id: Makefile.in,v 1.2 2005/06/14 01:41:56 jschrod Exp $
+#------------------------------------------------------------
+
+#
+# Makefile for CLISP module ordrules
+#
+# copied from CLISP module regex
+
+CC = @CC@
+CPPFLAGS = @CPPFLAGS@
+CFLAGS = @CFLAGS@
+INCLUDES=
+
+CLISP = $(CLISP_PATH) -q -norc
+
+all : ordrulei.o ordrules.o rxsub.o
+
+ordrulei.c : ordrulei.lsp
+ $(CLISP) -c ordrulei.lsp
+
+ordrulei.o : ordrulei.c
+ $(CC) $(CFLAGS) -I$(INCLUDES) -c ordrulei.c
+
+ordrules.o : ordrules.c ordrules.h rxsub.h debug.h mkind.h
+ $(CC) $(CFLAGS) -funsigned-char -I. -c ordrules.c
+
+rxsub.o : rxsub.c rxsub.h mkind.h
+ $(CC) $(CFLAGS) -I. -c rxsub.c
+
+# Make a module
+clisp-module : all
+
+clean:
+ rm -f core ordrulei.c *.o *.a
+ rm -f *.fas *.lib
+
+distclean: clean
+ rm -f version.lisp Makefile
diff --git a/Build/source/utils/xindy/rte/ordrules/debug.h b/Build/source/utils/xindy/rte/ordrules/debug.h
new file mode 100644
index 00000000000..6c59927d61a
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/debug.h
@@ -0,0 +1,166 @@
+/* $Id: debug.h,v 1.3 2005/05/02 21:39:53 jschrod Exp $
+ *------------------------------------------------------------
+ *
+ * AU: Makros zur Unterstuetzung von Debug-Ausgaben
+ * with friendly permission by U. Graef
+ *
+ * ST: Um die Macros zu definieren:
+ * #define debug
+ * #include "debug.h"
+ * Im Hauptprogramm bzw. Tester mu"s dann noch debug.o dazugebunden
+ * werden, um die externe Variable Debug_Output_Indent zur Verf"ugung
+ * zu stellen.
+ * Um im Modul die Macros zu deaktivieren:
+ * #undef debug
+ * #include "debug.h"
+ *
+ * PO: HPUX, Linux, AIX
+ */
+
+
+#ifndef _debug_h
+#define _debug_h
+
+/*
+ * Beim ersten include werden folgende Deklarationen defininert:
+ *
+ * Die globale Variable f"ur die Einr"uckung wird definiert.
+ */
+extern
+int Debug_Output_Indent;
+
+#ifdef debug_special
+/*
+ * Die Funktion f"ur den Memory-Print wird definiert
+ */
+extern
+void debug_printmem_asc( char* desc, char* str, char* lenname, int len );
+#endif /* debug_special */
+
+#define Debug_Output_Indent_Step 4
+
+#endif /* _debug_h */
+
+
+/*
+ * Falls die Macros bereits definiert waren, dann werden sie jetzt
+ * zuerst wegdefiniert. Damit kann man "debug.h" benutzen um die Macros
+ * zu (de-)aktivieren.
+ */
+
+#ifdef dispstart
+
+#undef dispstart
+#undef dispend
+#undef displong
+#undef dispint
+#undef dispuint
+#undef dispdouble
+#undef dispchar
+#undef dispstr
+#undef dispmem
+#undef dispmsg
+
+#endif
+
+/*
+ * Hier werden die Macros wieder definert bzw. erstmals definiert
+ */
+#ifdef debug
+
+/* Start und Ende von Prozeduren */
+
+#define dispstart(p) \
+ { \
+ fprintf( stderr, "\n%*s%s: Start -----\n", \
+ Debug_Output_Indent, "", #p ); \
+ Debug_Output_Indent += Debug_Output_Indent_Step; \
+ }
+
+#define dispend(p) \
+ { \
+ Debug_Output_Indent -= Debug_Output_Indent_Step; \
+ fprintf( stderr, "%*s%s: End -----\n\n", \
+ Debug_Output_Indent, "", #p ); \
+ }
+
+
+/* Ausgabe von Werten verschiedenen Typs */
+/* (mit Ausgabe der Variablen bzw. des Ausdrucks) */
+
+
+#define displong(l) \
+ fprintf( stderr, "%*s%s = %ld = 0x%lX \n",\
+ Debug_Output_Indent, "", #l, (long) l, (long) l );
+
+
+#define dispint(i) \
+ fprintf( stderr, "%*s%s = %d = 0x%X \n", \
+ Debug_Output_Indent, "", #i, (int) i, (int) i );
+
+#define dispuint(i) \
+ fprintf( stderr, "%*s%s = %d = 0x%X \n", \
+ Debug_Output_Indent, "", #i, (unsigned int) i, (unsigned int) i );
+
+#define dispdouble(d) \
+ fprintf( stderr, "%*s%s = %20.10g \n",\
+ Debug_Output_Indent, "", #d, (double) d );
+
+#define dispchar(c) \
+ fprintf( stderr, "%*s%s = %d = 0x%X = '%c' \n", \
+ Debug_Output_Indent, "", #c, (char) c, \
+ (char) c, (char) c );
+
+#define dispstr(s) \
+ fprintf( stderr, "%*s%s = \"%s\"\n", \
+ Debug_Output_Indent, "", #s, (char*) s );
+
+#ifdef debug_special
+#define dispmem(str,len) \
+ debug_printmem_asc( (char*)#str, (char*)str, (char*)#len, (int) len );
+#endif /* debug_special */
+
+#define dispmsg(p) \
+ { \
+ fprintf( stderr, "%*s%s:\n", Debug_Output_Indent, "", #p ); \
+ }
+
+#else /* debug */
+
+/*
+ * Falls kein weiteres Debugging erw"unscht, dann definiere die
+ * Macros auf leer.
+ */
+#define dispstart(p)
+#define dispend(p)
+#define displong(l)
+#define dispint(i)
+#define dispuint(i)
+#define dispdouble(d)
+#define dispchar(c)
+#define dispstr(s)
+#define dispmem(str,len)
+#define dispmsg(p)
+
+#endif /* debug */
+
+
+/*======================================================================
+ *
+ * $Log: debug.h,v $
+ * Revision 1.3 2005/05/02 21:39:53 jschrod
+ * xindy run time engine 3.0; as used for CLISP 2.33.2.
+ *
+ * Revision 1.2 1996/07/18 15:56:38 kehr
+ * Checkin after all changes that resulted from the define-letter-group
+ * modification were finished. Additionally I found an ugly bug in the
+ * ordrules.c file that was discovered when running the system under
+ * Solaris (which seems to have signed chars..Whee!). This is fixed now
+ * and the Imakefiles and that stuff was improved, too.
+ *
+ * Revision 1.1 1996/03/27 20:29:03 kehr
+ * It works. Today I had my first success in getting the FFI running with
+ * the ordrules-library. The interface is defined in `ordrulei.lsp' and
+ * allows direct access to the functions in `ordrules.c'.
+ *
+ */
diff --git a/Build/source/utils/xindy/rte/ordrules/link.sh b/Build/source/utils/xindy/rte/ordrules/link.sh
new file mode 100755
index 00000000000..acc843285a0
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/link.sh
@@ -0,0 +1,11 @@
+file_list=''
+mod_list=''
+if test -r ordrulei.c; then
+ file_list="$file_list"' ordrulei.o'
+ mod_list="$mod_list"' ordrulei'
+fi
+make clisp-module CC="${CC}" CFLAGS="${CFLAGS}" INCLUDES="$absolute_linkkitdir"
+NEW_FILES="$file_list ordrules.o rxsub.o"
+NEW_LIBS="$file_list ordrules.o rxsub.o"
+NEW_MODULES="$mod_list"
+TO_LOAD='ordrulei version'
diff --git a/Build/source/utils/xindy/rte/ordrules/mkind.h b/Build/source/utils/xindy/rte/ordrules/mkind.h
new file mode 100644
index 00000000000..2defd7077fa
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/mkind.h
@@ -0,0 +1,67 @@
+/*
+ $Id: mkind.h,v 1.2 1999/07/30 08:35:38 kehr Exp $
+
+ This is the minimum excerpt form the original `mkind.h' of the
+ makeindex-3 system making the modified version of ordrules compile.
+
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef _MKIND_H
+#define _MKIND_H
+
+#ifndef PROTO
+#define PROTO( x ) x
+#endif
+
+#if ANSI_PROTOTYPES
+#define ARGS(arg_list) arg_list
+#define VOIDP void*
+#else
+#define ARGS(arg_list) ()
+#define const
+#define VOIDP char*
+#endif
+
+#define SIZE_T unsigned
+
+#undef TRUE
+#define TRUE 1
+
+#undef FALSE
+#define FALSE 0
+
+#ifndef STRING_MAX
+/* T. Henlich reported a bug that was caused by the 128Byte limit
+ here, which was too small for his applications. Stupid thing,
+ really took me 1.5 hours to find it ;-(
+*/
+
+#define STRING_MAX 1024 /* 128 */
+#endif
+
+#define BSH '\\'
+
+#undef NUL
+#define NUL '\0'
+
+extern VOIDP fmalloc ARGS((SIZE_T size));
+
+#endif /* _MKIND_H */
+
+
+/*
+ $Log: mkind.h,v $
+ Revision 1.2 1999/07/30 08:35:38 kehr
+ Lifted length of STRING_MAX to 4096. Caused bugs in Linux as reported
+ by T. Henlich.
+
+ Revision 1.1 1996/03/27 20:29:05 kehr
+ It works. Today I had my first success in getting the FFI running with
+ the ordrules-library. The interface is defined in `ordrulei.lsp' and
+ allows direct access to the functions in `ordrules.c'.
+
+
+ */
diff --git a/Build/source/utils/xindy/rte/ordrules/ordrulei.lsp b/Build/source/utils/xindy/rte/ordrules/ordrulei.lsp
new file mode 100644
index 00000000000..c18294c2670
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/ordrulei.lsp
@@ -0,0 +1,111 @@
+;; $Id: ordrulei.lsp,v 1.5 2005/05/02 21:39:53 jschrod Exp $
+;; ------------------------------------------------------------
+
+;;;
+;;; Interface definition of the ordrules module
+;;;
+
+(defpackage :ordrules
+ (:use :cl :ffi)
+ (:export :initialize
+ :add-keyword-sort-rule :add-keyword-merge-rule
+ :gen-keyword-sortkey :gen-keyword-mergekey))
+
+(in-package :ordrules)
+
+(c-lines "#include \"ordrules.h\"~%")
+
+; Common OS definitions:
+(def-c-type size_t uint)
+
+(def-c-var *string-buffer*
+ (:name "ordrules_string_buffer")
+ (:type (c-array char 1024))
+ (:alloc :NONE))
+
+(def-c-var *string-buffer-used-bytes*
+ (:name "ordrules_string_buffer_used_bytes")
+ (:type int)
+ (:alloc :NONE))
+
+(def-c-var *string-buffer-used-bytes*
+ (:name "ordrules_string_buffer_used_bytes")
+ (:type int)
+ (:alloc :NONE))
+
+(def-c-var *message-logging*
+ (:name "ordrules_msg_logging")
+ (:type int)
+ (:alloc :NONE))
+
+(def-c-var *message-buffer*
+ (:name "ordrules_msg_buffer")
+ (:type c-string)
+ (:alloc :NONE))
+
+(def-c-var *message-buffer-ptr*
+ (:name "ordrules_msg_buffer_ptr")
+ (:type int)
+ (:alloc :NONE))
+
+(def-call-out initialize
+ (:language :stdc)
+ (:name "initialize")
+ (:arguments (num-sort-tables int))
+ (:return-type int))
+
+(def-call-out add-keyword-sort-rule
+ (:language :stdc)
+ (:name "add_sort_rule")
+ (:arguments (run int)
+ (left c-string)
+ (right c-string)
+ (isreject int)
+ (ruletype int))
+ (:return-type int))
+
+(def-call-out add-keyword-merge-rule
+ (:language :stdc)
+ (:name "add_merge_rule")
+ (:arguments (left c-string)
+ (right c-string)
+ (isreject int)
+ (ruletype int))
+ (:return-type int))
+
+(def-call-out gen-keyword-sortkey
+ (:language :stdc)
+ (:name "gen_sortkey")
+ (:arguments (key c-string)
+ (run int))
+ (:return-type c-string :malloc-free))
+
+(def-call-out gen-keyword-mergekey
+ (:language :stdc)
+ (:name "gen_mergekey")
+ (:arguments (key c-string))
+ (:return-type c-string :malloc-free))
+
+#|
+
+ $Log: ordrulei.lsp,v $
+ Revision 1.5 2005/05/02 21:39:53 jschrod
+ xindy run time engine 3.0; as used for CLISP 2.33.2.
+
+ Revision 1.4 1997/10/20 11:23:12 kehr
+ New version of sorting rules. Sorting of more complex indexes (i.e.
+ French) is now possible.
+
+ Revision 1.3 1997/01/17 16:43:38 kehr
+ Several changes for new version 1.1.
+
+ Revision 1.2 1996/04/30 15:56:38 kehr
+ Renamed some of the functions to avoid conflicts with other functions
+ in other packages (only for the sake of convenience).
+
+ Revision 1.1 1996/03/27 20:29:07 kehr
+ It works. Today I had my first success in getting the FFI running with
+ the ordrules-library. The interface is defined in `ordrulei.lsp' and
+ allows direct access to the functions in `ordrules.c'.
+
+|#
diff --git a/Build/source/utils/xindy/rte/ordrules/ordrules.c b/Build/source/utils/xindy/rte/ordrules/ordrules.c
new file mode 100644
index 00000000000..6e9b6fa08fe
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/ordrules.c
@@ -0,0 +1,733 @@
+/* $Id: ordrules.c,v 1.9 2008/01/09 11:33:44 jschrod Exp $
+ *----------------------------------------------------------------------
+ *
+ * Ordering Rules for Strings
+ *
+ * [history at end]
+ */
+
+#include "ordrules.h"
+#include "rxsub.h"
+
+#include <string.h>
+
+/* switch on debugging by excluding the undef directive. */
+#define debug
+#undef debug /* */
+#include "debug.h"
+
+#ifdef debug
+#define DEBUG
+#endif
+
+RULE_TABLE* SortRules; /* rules for generating sortkeys */
+
+RULE_TABLE MergeRules; /* rules for generating mergekeys */
+GROUP_LIST GroupList; /* list of character groups */
+GROUP_LIST HeadingList; /* list of group headings */
+
+/* The following rule-types can be set by the user: */
+#define RT_AUTOMATIC 0
+#define RT_STRING 1
+#define RT_REGEXP_BASIC 2
+#define RT_REGEXP_EXTENDED 3
+#define RT_CHAR 4
+
+static RULE_TYPE get_ruletype PROTO(( char *lside, char *rside ));
+static int is_regexp PROTO(( char *s ));
+static int is_CHR_RULE PROTO(( char *s, char *r ));
+
+char ordrules_string_buffer [BUFLEN];
+int ordrules_string_buffer_used_bytes = 0;
+
+ int ordrules_msg_logging = 0;
+ char* ordrules_msg_buffer = 0;
+ int ordrules_msg_buffer_ptr = 0;
+static size_t ordrules_msg_buffer_len = BUFLEN;
+static size_t ordrules_msg_buffer_avail = 0;
+static int ordrules_sort_rule_tables = 0;
+
+#define DEFAULT_SORT_RULE_TABLES 8
+
+#define DBG( expr ) if (ordrules_msg_logging!=0) { expr; }
+
+
+void
+logs( msg )
+char* msg;
+{
+ size_t msglen = strlen( msg );
+
+ if (NULL == ordrules_msg_buffer) {
+ ordrules_msg_buffer = (char*) malloc (ordrules_msg_buffer_len);
+ ordrules_msg_buffer_avail = ordrules_msg_buffer_len - 1;
+ ordrules_msg_buffer_ptr = 0;
+ }
+ if (msglen > ordrules_msg_buffer_avail) {
+ ordrules_msg_buffer_len *= 2;
+ ordrules_msg_buffer = (char*) realloc (ordrules_msg_buffer,
+ ordrules_msg_buffer_len);
+ ordrules_msg_buffer_avail = ordrules_msg_buffer_len -
+ ordrules_msg_buffer_ptr - 1;
+ }
+ strcpy(&ordrules_msg_buffer[ordrules_msg_buffer_ptr], msg );
+ ordrules_msg_buffer_ptr += msglen;
+ ordrules_msg_buffer_avail -= msglen;
+ ordrules_msg_buffer[ordrules_msg_buffer_ptr] = '\0';
+}
+
+void
+logc( c )
+char c;
+{
+ char msg[2];
+ msg[0] = c;
+ msg[1] = '\0';
+ logs(msg);
+}
+
+void
+logi( n )
+int n;
+{
+ char msg[16];
+ sprintf(msg, "%d", n);
+ logs(msg);
+}
+
+/*
+ * This function initializes the memory for the SortRules. Since the
+ * number of tables is defined dynamically, we allow the repeated
+ * definition of tables. In this case the old table is discarded.
+ */
+
+int
+initialize (num_sort_tables)
+int num_sort_tables;
+{
+ size_t fullsize = num_sort_tables * sizeof(RULE_TABLE);
+ if (SortRules != NULL) {
+ logs("ORDRULES: Removing old Sort-Tables!\n");
+ free( SortRules );
+ }
+ ordrules_sort_rule_tables = num_sort_tables;
+ SortRules = (RULE_TABLE*) malloc (fullsize);
+ if (SortRules == NULL) {
+ fprintf(stderr,"ordrules: malloc() of %d SortTables failed!\n",
+ num_sort_tables);
+ exit(1);
+ }
+ logs("ORDRULES: Initializing "); logi(num_sort_tables);
+ logs(" Sort Tables.\n");
+ memset(SortRules, 0, fullsize);
+ return(num_sort_tables);
+}
+
+int
+add_sort_rule (run, left, right, isreject, ruletype)
+int run;
+char *left;
+char *right;
+int isreject;
+int ruletype;
+{
+ if (SortRules == NULL) { /* No malloc() done yet */
+ if (ordrules_sort_rule_tables == 0) { /* No specification yet. */
+ ordrules_sort_rule_tables = DEFAULT_SORT_RULE_TABLES; /* use default */
+ }
+ logs("ORDRULES: Performing implicit initialization.\n");
+ initialize( ordrules_sort_rule_tables ); /* ...then initialize */
+ }
+ if (0 <= run && run < ordrules_sort_rule_tables) {
+ return( add_rule( SortRules[run], left, right, isreject, ruletype, run ));
+ } else {
+ logs("ORDRULES: add_sort_rule(): run is out of range.\n");
+ return -1;
+ }
+}
+
+int
+add_merge_rule (left, right, isreject, ruletype)
+char *left;
+char *right;
+int isreject;
+int ruletype;
+{
+ return( add_rule( MergeRules, left, right, isreject, ruletype, -1));
+}
+
+/* insert rule 'left --> right' into ruletable 'table' */
+int
+add_rule( table, left, right, isreject, ruletype, run)
+RULE_TABLE table;
+char *left;
+char *right;
+int isreject;
+int ruletype;
+int run;
+{
+ RULE *r;
+ RULE_LIST *list;
+ char buffer[STRING_MAX];
+ char *bptr = buffer;
+ unsigned int pos = 0;
+
+ /* new stuff */
+ int errcode;
+ char errmsg[STRING_MAX];
+
+ /* Use extended regular expression syntax as default. */
+ int cflag = REG_EXTENDED;
+
+ dispstart( add_rule );
+ dispstr( left );
+ dispstr( right );
+
+ r = (RULE *) malloc( sizeof(RULE) );
+
+ switch ( ruletype ) {
+ case RT_AUTOMATIC:
+ r->type = get_ruletype( left, right ); break;
+ case RT_STRING:
+ r->type = STR_RULE; break;
+ case RT_CHAR:
+ r->type = CHR_RULE; break;
+ case RT_REGEXP_BASIC:
+ case RT_REGEXP_EXTENDED:
+ r->type = REG_RULE; break;
+ }
+
+ switch (r->type) {
+
+ case REG_RULE:
+
+ if (ruletype == RT_REGEXP_BASIC) {
+ /* Use the basic regular expressions as specified. */
+ cflag = 0;
+ }
+ dispstart( REG_RULE );
+ dispmsg( bptr copy );
+ /* insert '^' in regular expression to match string prefix only */
+ *bptr++ = '^'; strcpy( bptr, left );
+ r->r.reg.lstr = (char *) malloc( strlen(buffer) + 1);
+ r->r.reg.type = cflag;
+ strcpy( r->r.reg.lstr, buffer );
+ dispmsg( malloc );
+ r->r.reg.lside = (regex_t*) malloc (sizeof(regex_t));
+ displong( r->r.reg.lside );
+ dispstart( regcomp );
+ if ( 0 != (errcode = regcomp( r->r.reg.lside, buffer, REG_EXTENDED ))) {
+ regerror( errcode, r->r.reg.lside, errmsg, STRING_MAX );
+ DBG(logs("Regular Expression Error: "); logs(errmsg); logs("\n");)
+ return( errcode );
+ }
+ dispend( regcomp );
+ r->r.reg.rside = (char *) malloc( strlen(right) + 1);
+ strcpy( r->r.reg.rside, right );
+ dispstr( r->r.reg.rside );
+ displong( r->type );
+
+ /*
+ * calculate table index as the first character of 'left'
+ * or FORALL_POS if the rule does not start with a fixed charater.
+ * A rule starts with a fixed character if this char is escaped.
+ * Otherwise the first character might be variable (ie, a character
+ * class) or it might be optional.
+ */
+
+ if ( left[0] == BSH ) pos = (unsigned char)(left[1]); /* quoted */
+ else
+ if ( strchr(".([",left[0])==NULL || strchr("*?",left[1])==NULL )
+ pos = FORALL_POS; /* character class or optional */
+ else
+ pos = (unsigned char)(left[0]); /* fixed */
+
+ dispend( REG_RULE );
+ break;
+
+ case CHR_RULE:
+ dispstart( CHR_RULE );
+ r->r.chr = *right;
+ pos = (unsigned char)(*left);
+ dispend( CHR_RULE );
+ break;
+
+ case STR_RULE:
+ dispstart( STR_RULE );
+ r->r.str.llen = strlen(left);
+ r->r.str.lside = (char *) malloc( (size_t)(r->r.str.llen + 1) );
+ strcpy(r->r.str.lside,left);
+ r->r.str.rlen = strlen(right);
+ r->r.str.rside = (char *) malloc( (size_t)(r->r.str.rlen + 1) );
+ strcpy(r->r.str.rside,right);
+ pos = (unsigned char)(*left);
+ dispend( STR_RULE );
+ break;
+ }
+
+ if (isreject) r->type |= REJECT;
+
+ /* insert new rule into table */
+ dispstart(inserting into table);
+ dispuint(pos);
+ displong(&table[0]);
+ list = &table[pos];
+ displong(list);
+ displong(NULL);
+ displong(list->first);
+ displong(r);
+ if (list->first == NULL) {
+ list->first = r;
+ } else {
+ displong(list->last);
+ displong(list->last->next);
+ list->last->next = r;
+ }
+ displong(list->last);
+ list->last = r;
+ displong(r->next);
+ r->next = NULL;
+ dispend(inserting into table);
+
+ DBG(
+ logs("Mappings: add (");
+ if (table == MergeRules) logs("merge"); else logs("sort");
+ logs("-rule ");
+ switch ( r->type & ~REJECT ) {
+ case CHR_RULE:
+ logs("`");logc(*left);logs("' `");logc(r->r.chr);logs("' :char");
+ break;
+ case STR_RULE:
+ logs("`");;logs(r->r.str.lside); logs("' `");
+ logs(r->r.str.rside);logs("' :string");
+ break;
+ case REG_RULE:
+ logs("`");logs(buffer);logs("' `");
+ logs(r->r.reg.rside);logs("' :");
+ logc( (r->r.reg.type == REG_EXTENDED) ? 'e' : 'b' );
+ logs("regexp");
+ break;
+ }
+ if (run != -1) {
+ logs(" :run ");
+ logi(run);
+ }
+ if (r->type&REJECT) logs(" :again");
+ logs(").\n");
+ )
+ dispend( add_rule );
+ return( 0 );
+}
+
+/* get the type of the rule 'lside --> rside' */
+static
+RULE_TYPE get_ruletype( lside, rside )
+char *lside;
+char *rside;
+{
+ if ( is_regexp( lside ) || is_regexp( rside ) ) return REG_RULE;
+
+ if ( lside[0] != NUL && lside[1] == NUL &&
+ rside[0] != NUL && rside[1] == NUL ) return CHR_RULE;
+
+ return STR_RULE;
+}
+
+static
+int is_CHR_RULE ( lside, rside )
+char *lside;
+char *rside;
+{
+ if ( lside[0] != NUL && lside[1] == NUL &&
+ rside[0] != NUL && rside[1] == NUL ) return CHR_RULE;
+
+ return STR_RULE;
+}
+
+/* return TRUE, if 's' is a regular expression. */
+static
+int is_regexp( s )
+char *s;
+{
+ for (;*s ; s++ )
+ if (*s == BSH) {
+ s++;
+ if ('0' <= *s && *s <= '9') return TRUE;
+ }
+ else if (strchr("[]().*+$^?&",*s)) return TRUE;
+ return FALSE;
+}
+
+#ifdef UNESCAPE
+/* not necessary anymore */
+
+/* replace all '\x' sequences with the character they represent */
+static void
+unescape( s )
+register char *s;
+{
+ register char *d;
+ for (d = s; *d = *s; d++)
+ if (*s++ == BSH) *d = *s++;
+}
+#endif
+
+/* apply the rules from 'table' to 'source' and place the substituted result
+ in 'dest' */
+void apply_rules( table, source, dest, buflen )
+RULE_TABLE table;
+register char *source;
+register char *dest;
+register size_t buflen;
+{
+ register RULE *r;
+ register RULE_TYPE rtype;
+ register char *newdest = 0;
+ char newsource[STRING_MAX];
+
+ /* new stuff */
+#define NMATCH 10
+ regmatch_t regmatch [NMATCH];
+ int eflags = 0;
+
+#ifdef DEBUG
+ char *in = source, *out = dest;
+#endif
+
+ dispstart( apply_rules );
+ dispstr( source );
+ dispstr( dest );
+ dispint( buflen );
+
+ while ( *source ) {
+
+ /* first check the rules beginning with character '*source' */
+ dispint( (unsigned) *source );
+ dispint( (unsigned)(*source) );
+ dispint( (unsigned char)(*source) );
+ dispint( (unsigned int)(*source) );
+ for ( r = table[(unsigned char) *source].first; r; r = r->next ) {
+
+ displong( r );
+ rtype = (r->type & ~REJECT);
+
+ if ( rtype == CHR_RULE ) {
+ dispstart( CHR_RULE );
+ if ((r->type & REJECT))
+ newdest = dest;
+ DBG(
+ logs("Mappings: (compare `");logs(source);logs("' :char `");
+ logc(*source); logs("') match!\n");
+ )
+ *dest++ = r->r.chr;
+ source++;
+ dispend( CHR_RULE );
+ break;
+ }
+
+ else if ( rtype == STR_RULE &&
+ !strncmp(source, r->r.str.lside, (size_t)r->r.str.llen)) {
+ DBG(
+ logs("Mappings: (compare `");logs(source);logs("' :string `");
+ logs(r->r.str.lside); logs("') match!\n");
+ )
+ dispstart( STR_RULE );
+ displong( dest );
+ strcpy(dest, r->r.str.rside);
+ if ((r->type & REJECT)) newdest = dest;
+ displong( newdest );
+ dest += r->r.str.rlen;
+ displong( dest );
+ source += r->r.str.llen;
+ displong( source );
+ dispend( STR_RULE );
+ break;
+ }
+
+ else {
+ if ( rtype == REG_RULE ) {
+ dispstart( REG_RULE );
+ DBG(
+ logs("Mappings: (compare `");logs(source);logs("' :");
+ logc( (r->r.reg.type == REG_EXTENDED) ? 'e' : 'b' );
+ logs("regexp `");
+ logs(r->r.reg.lstr); logs("')");
+ )
+ if ( 0 == regexec( r->r.reg.lside, source,
+ NMATCH, regmatch, eflags ) ) {
+ DBG( logs(" match!\n"); )
+ nrxsub( r->r.reg.rside, regmatch, source, dest, buflen );
+ if ((r->type & REJECT))
+ newdest = dest;
+ dest = strchr(dest,0);
+ source += regmatch[0].rm_eo;
+ dispend( REG_RULE );
+ break;
+ }
+ DBG( logs("\n"); )
+ dispend( REG_RULE );
+ }
+ }
+
+ }
+
+ displong( r );
+ if ( r == NULL ) {
+
+ dispmsg( r == NULL );
+ /* check regular expression rules, that could match all prefixes */
+ for ( r = table[FORALL_POS].first; r; r = r->next ) {
+ dispstart( for-loop regexps );
+ dispstr( r->r.reg.lstr );
+ dispstr( r->r.reg.rside );
+ displong( r->type );
+ dispstr( source );
+ DBG(
+ logs("Mappings: (compare `");logs(source);logs("' :");
+ logc( (r->r.reg.type == REG_EXTENDED) ? 'e' : 'b' );
+ logs("regexp `");
+ logs(r->r.reg.lstr); logs("')");
+ )
+ if ( 0 == regexec( r->r.reg.lside, source,
+ NMATCH, regmatch, eflags ) ) {
+ DBG( logs(" match!\n"); )
+ dispstart( regexec match! );
+ nrxsub( r->r.reg.rside, regmatch, source, dest, buflen );
+ if ((r->type & REJECT)) newdest = dest;
+ displong( dest );
+ displong( newdest );
+ source += regmatch[0].rm_eo;
+ displong( source );
+ dest = strchr(dest,0);
+ displong( dest );
+ dispend( regexec match! );
+ dispend( for-loop regexps );
+ break;
+ }
+ DBG( logs("\n"); )
+ dispend( for-loop regexps );
+ }
+ /* no rule matched, copy character */
+ if ( r == NULL ){
+ dispstart( no rule matched! );
+ displong( dest );
+ displong( source );
+ *dest++ = *source++;
+ displong( dest );
+ displong( source );
+ dispend( no rule matched! );
+ }
+ }
+
+ displong( r );
+ /* should we reject? */
+ if ( r != NULL && (r->type & REJECT)) {
+ dispstart( REJECT );
+ strcpy(dest,source);
+ strcpy(newsource,newdest);
+#ifdef DEBUG
+ fprintf(stderr,"\nordrules: reject in '%s': '%s'.",in,newsource);
+#endif
+ apply_rules( table, newsource, newdest, STRING_MAX );
+ dispend( REJECT );
+ dispend( apply_rules );
+ return;
+ }
+ }
+
+ dispstart( last part );
+ displong( dest );
+ *dest = 0;
+ ordrules_string_buffer_used_bytes = strlen( ordrules_string_buffer );
+#ifdef DEBUG
+#ifdef debug
+ dispstr( out );
+#endif
+#endif
+
+#ifdef DEBUG
+ /* if ( strcmp(in,out) ) */
+ fprintf(stderr,"\nordrules: %s '%s' generated for '%s'.", table == MergeRules ? "mergekey" : "sortkey", out, in );
+#endif
+
+ dispend( last part );
+ dispend( apply_rules );
+}
+
+char *gen_sortkey ( key, run )
+char *key;
+int run;
+{
+ char *sortkey;
+ dispstart( gen_sortkey );
+ dispstr( key );
+
+ /* If no initialization has been done yet, then do a fallback to the
+ default tables. This should not happen usually. */
+ if (SortRules == NULL) {
+ logs("ORDRULES: Performing implicit initialization.\n");
+ initialize( DEFAULT_SORT_RULE_TABLES );
+ }
+
+ if (0 <= run && run < ordrules_sort_rule_tables) {
+ apply_rules( SortRules[run], key, ordrules_string_buffer, BUFLEN );
+ }
+
+ sortkey = (char*) malloc (strlen( ordrules_string_buffer ) +1);
+ strcpy( sortkey, ordrules_string_buffer );
+ DBG(
+ logs("Mappings: (sort-mapping `"); logs(key);
+ logs("' :run "); logi(run); logs(") -> `");
+ logs(sortkey); logs("'.\n\n");
+ )
+ dispend( gen_sortkey );
+ return( sortkey );
+}
+
+
+char *gen_mergekey ( key )
+char *key;
+{
+ char *mergekey;
+ apply_rules( MergeRules, key, ordrules_string_buffer, BUFLEN );
+ mergekey = (char*) malloc (strlen( ordrules_string_buffer ) +1);
+ strcpy( mergekey, ordrules_string_buffer );
+ DBG(
+ logs("Mappings: (merge-mapping `"); logs(key); logs("') -> `");
+ logs(mergekey); logs("'.\n\n");
+ )
+ return( mergekey );
+}
+
+
+/* insert a new group entry ('group','letter') into 'list' */
+#if 0
+void
+add_group( list, group, letter )
+GROUP_LIST *list;
+int group;
+char *letter;
+{
+ GROUP_RULE *new;
+ new = (GROUP_RULE *) malloc(sizeof(GROUP_RULE));
+ new->id = (group >= 0 ? group + USORTGROUP : group - USORTGROUP);
+ new->len = strlen(letter);
+ new->let = (char *) malloc(new->len + 1);
+ strcpy(new->let,letter);
+
+ /* insert rule into list */
+ if (list->first == NULL) list->first = new;
+ else list->last->next = new;
+ list->last = new;
+ new->next = NULL;
+
+#ifdef DEBUG
+ fprintf(stderr,"\nordrules: added group into list '%s' '%s' -> group: %d.",list == &GroupList ? "GroupList" : "HeadingList", new->let,new->id);
+#endif
+}
+
+/* find the user defined group id for 'sortkey' */
+int get_group( sortkey )
+char *sortkey;
+{
+ register GROUP_RULE *r;
+ for (r = GroupList.first; r && strncmp(sortkey,r->let,r->len); r = r->next);
+#ifdef DEBUG
+ if (r != NULL)
+ fprintf(stderr,"\nordrules: sortkey '%s' is in group: %d.",sortkey,r->id);
+#endif
+ return ( r ? r->id : *sortkey );
+}
+
+/* find the user defined group heading for id 'group' */
+char *get_heading( group )
+int group;
+{
+ register GROUP_RULE *r;
+ for ( r = HeadingList.first; r && r->id != group; r = r->next);
+#ifdef DEBUG
+ if (r != NULL)
+ fprintf(stderr,"\nordrules: group: %d has heading '%s'.",r->id,r->let);
+#endif
+ return ( r ? r->let : NULL );
+}
+#endif
+
+
+/*======================================================================
+ *
+ * $Log: ordrules.c,v $
+ * Revision 1.9 2008/01/09 11:33:44 jschrod
+ * Update to CLISP 2.43.
+ *
+ * Revision 1.8 2005/05/02 21:39:53 jschrod
+ * xindy run time engine 3.0; as used for CLISP 2.33.2.
+ *
+ * Revision 1.7 1999/07/30 08:34:32 kehr
+ * Checked in some debug stuff that was integrated for better testing.
+ *
+ * Revision 1.6 1997/10/20 11:23:13 kehr
+ * New version of sorting rules. Sorting of more complex indexes (i.e.
+ * French) is now possible.
+ *
+ * Revision 1.5 1997/01/17 16:43:40 kehr
+ * Several changes for new version 1.1.
+ *
+ * Revision 1.4 1996/07/18 15:56:40 kehr
+ * Checkin after all changes that resulted from the define-letter-group
+ * modification were finished. Additionally I found an ugly bug in the
+ * ordrules.c file that was discovered when running the system under
+ * Solaris (which seems to have signed chars..Whee!). This is fixed now
+ * and the Imakefiles and that stuff was improved, too.
+ *
+ * Revision 1.3 1996/07/03 18:48:48 kehr
+ * Changed ordrules.c. The unescape() mechanism was removed so that not too
+ * much quoting is necessary anymore. This feature was olnly for the use in
+ * the old makeindex-3 systems.
+ *
+ * Revision 1.2 1996/03/27 20:29:10 kehr
+ * It works. Today I had my first success in getting the FFI running with
+ * the ordrules-library. The interface is defined in `ordrulei.lsp' and
+ * allows direct access to the functions in `ordrules.c'.
+ *
+ * Revision 1.1 1996/03/26 17:30:58 kehr
+ * First check-in of the rx-support for clisp.
+ *
+ * Revision 1.9 1992/01/03 13:22:10 schrod
+ * "unsigned" is not a type. Computation of table index was wrong.
+ *
+ * Revision 1.8 1991/12/16 14:44:54 schrod
+ * fmalloc() statt allocate()
+ *
+ * Revision 1.7 1991/12/10 20:25:50 schrod
+ * Changed all function declarations to ANSI prototypes using ARGS().
+ *
+ * Revision 1.6 1991/12/10 20:09:58 schrod
+ * Reject-rules (*merge_rule and *sort_rule) implemented.
+ *
+ * Revision 1.5 1991/12/10 19:59:53 schrod
+ * Fixed bug in ordrules. Inserting a new group rule at the beginning of
+ * a rule list works not with groups, that have the same prefix:
+ *
+ * group_rule "ae" 1
+ * group_rule "a" 2
+ *
+ * would put 'aexxx' in group 2.
+ *
+ * Revision 1.4 1991/12/10 19:49:59 schrod
+ * Optimized group-rule handling.
+ *
+ * Revision 1.3 1991/12/10 19:43:38 schrod
+ * Optimized module 'ordrules':
+ * - all three types of rules (chr,str,regexp) now allowed for both sort
+ * and merge keys
+ *
+ * Revision 1.2 1991/12/10 19:20:31 schrod
+ * Changed the group merging algorithm to create the group-id of an index key
+ * using user defined rules (specified in the style file with commands:
+ * `sort_group' and `group_head') instead of the sortkey's first character.
+ *
+ * Revision 1.1 1991/12/10 17:15:54 schrod
+ * Initial revision
+ *
+ */
diff --git a/Build/source/utils/xindy/rte/ordrules/ordrules.h b/Build/source/utils/xindy/rte/ordrules/ordrules.h
new file mode 100644
index 00000000000..6b5f1b48a77
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/ordrules.h
@@ -0,0 +1,208 @@
+/* $Id: ordrules.h,v 1.9 2008/01/09 11:33:44 jschrod Exp $
+ *----------------------------------------------------------------------
+ *
+ * Ordering Rules for Strings
+ *
+ * [history at end]
+ */
+
+#ifndef _ORDRULES_H
+#define _ORDRULES_H
+
+#include <stdio.h>
+#include "mkind.h"
+#undef debug
+#include "debug.h"
+#include "regex.h"
+
+#define BEGIN 1 /* representation of '\b' */
+#define END 255 /* representation of '\e' */
+
+/* values for RULE_TYPE */
+#define CHR_RULE 0001
+#define STR_RULE 0002
+#define REG_RULE 0004
+#define REJECT 0200
+
+#define RULE_TYPE unsigned char
+
+/* structure representing a substitution rule */
+typedef struct rule {
+
+ RULE_TYPE type; /* rule descriptor */
+
+ union {
+
+ char chr; /* character transformation: 'chr1' --> 'chr2' */
+
+ struct { /* string substitution: 'str1' --> 'str2' */
+ char *lside;
+ int llen;
+ char *rside;
+ int rlen;
+ } str;
+
+ struct { /* regular expression rule: 'rexp' --> 'str' */
+ regex_t *lside;
+ char *lstr;
+ char *rside;
+ char type;
+ } reg;
+
+ } r;
+
+ struct rule *next; /* link to next rule */
+
+} RULE;
+
+/* RULE_LIST is a linked list of RULE's with a pointer to the last entry,
+ which allows efficient appending of new rules. */
+typedef struct {
+ RULE *first;
+ RULE *last;
+} RULE_LIST;
+
+/* RULE_TABLE is a table of RULE_LIST's, where at position 'c' it contains
+ rules that could match strings beginning with character 'c'. The
+ last position (FORALL_POS) in this table has a special meaning. It stands for
+ regular expression rules that begin with a character class and
+ therefore they should be matched against all strings.
+
+ RULE_TABLE[c] rules in this list: 'cxxxxx' --> 'foo'
+ RULE_TABLE[FORALL_POS] rules in this list: '[y-z]xxxx' --> 'foo'
+
+*/
+
+#define MAX_RULE_TABLE 257 /* # entries in a rule table */
+#define FORALL_POS 256 /* position of regexp rules, that must be applied to all strings */
+
+typedef RULE_LIST RULE_TABLE[MAX_RULE_TABLE];
+
+extern RULE_TABLE* SortRules; /* rules for generating sortkeys */
+extern RULE_TABLE MergeRules; /* rules for generating mergekeys */
+
+typedef struct grouprule {
+ short id; /* group id */
+ char *let; /* sortkey prefix */
+ int len; /* len(let) */
+ struct grouprule *next; /* link to next rule */
+} GROUP_RULE;
+
+typedef struct {
+ GROUP_RULE *first;
+ GROUP_RULE *last;
+} GROUP_LIST;
+
+extern GROUP_LIST GroupList; /* list of character groups */
+extern GROUP_LIST HeadingList; /* list of group headings */
+
+/* These variables are used in ordrulei.lsp. The generated code, in
+ ordrulei.c uses sizeof() on them, thus the buffer size must be
+ defined. */
+#define BUFLEN ((size_t)1024)
+extern char ordrules_string_buffer[BUFLEN];
+extern int ordrules_string_buffer_used_bytes;
+extern int ordrules_msg_logging;
+extern char* ordrules_msg_buffer;
+extern int ordrules_msg_buffer_ptr;
+
+
+#define add_group_rule(letter, group) \
+ add_group( &GroupList, group, letter )
+
+#define add_heading(group, head) \
+ add_group( &HeadingList, group, head )
+
+int initialize PROTO(( int num_sort_tables ));
+int open_debug_file PROTO(( char* filename ));
+int close_debug_file PROTO(( ));
+
+int get_group PROTO(( char *sortkey ));
+char *get_heading PROTO(( int group ));
+
+int add_rule PROTO(( RULE_TABLE table, char *left, char *right,
+ int isreject, int ruletype, int run ));
+void apply_rules PROTO(( RULE_TABLE table, char *source, char *dest, size_t buflen ));
+void add_group PROTO(( GROUP_LIST *list, int group, char *letter ));
+
+int add_sort_rule PROTO((int run, char *left, char *right, int isreject, int ruletype));
+int add_merge_rule PROTO((char *left, char *right, int isreject, int ruletype));
+
+char* gen_sortkey PROTO((char *key, int run));
+char* gen_mergekey PROTO((char *key));
+
+#endif /* _ORDRULES_H */
+
+
+/*======================================================================
+ *
+ * $Log: ordrules.h,v $
+ * Revision 1.9 2008/01/09 11:33:44 jschrod
+ * Update to CLISP 2.43.
+ *
+ * Revision 1.8 2005/06/14 11:22:04 jschrod
+ * ordrulei.lisp is now ordrulei.lsp in distribution, as it is in CVS.
+ *
+ * Revision 1.7 2005/05/02 21:39:53 jschrod
+ * xindy run time engine 3.0; as used for CLISP 2.33.2.
+ *
+ * Revision 1.6 1999/07/30 08:37:38 kehr
+ * Intermediate checkin.
+ *
+ * Revision 1.5 1997/10/20 11:23:14 kehr
+ * New version of sorting rules. Sorting of more complex indexes (i.e.
+ * French) is now possible.
+ *
+ * Revision 1.4 1997/01/17 16:43:42 kehr
+ * Several changes for new version 1.1.
+ *
+ * Revision 1.3 1996/07/18 15:56:42 kehr
+ * Checkin after all changes that resulted from the define-letter-group
+ * modification were finished. Additionally I found an ugly bug in the
+ * ordrules.c file that was discovered when running the system under
+ * Solaris (which seems to have signed chars..Whee!). This is fixed now
+ * and the Imakefiles and that stuff was improved, too.
+ *
+ * Revision 1.2 1996/03/27 20:29:11 kehr
+ * It works. Today I had my first success in getting the FFI running with
+ * the ordrules-library. The interface is defined in `ordrulei.lsp' and
+ * allows direct access to the functions in `ordrules.c'.
+ *
+ * Revision 1.1 1996/03/26 17:31:00 kehr
+ * First check-in of the rx-support for clisp.
+ *
+ * Revision 1.8 1991/12/16 14:47:04 schrod
+ * updated documentation
+ *
+ * Revision 1.7 1991/12/10 20:25:53 schrod
+ * Changed all function declarations to ANSI prototypes using ARGS().
+ *
+ * Revision 1.6 1991/12/10 20:10:02 schrod
+ * Reject-rules (*merge_rule and *sort_rule) implemented.
+ *
+ * Revision 1.5 1991/12/10 19:59:57 schrod
+ * Fixed bug in ordrules. Inserting a new group rule at the beginning of
+ * a rule list works not with groups, that have the same prefix:
+ *
+ * group_rule "ae" 1
+ * group_rule "a" 2
+ *
+ * would put 'aexxx' in group 2.
+ *
+ * Revision 1.4 1991/12/10 19:50:03 schrod
+ * Optimized group-rule handling.
+ *
+ * Revision 1.3 1991/12/10 19:43:42 schrod
+ * Optimized module 'ordrules':
+ * - all three types of rules (chr,str,regexp) now allowed for both sort
+ * and merge keys
+ *
+ * Revision 1.2 1991/12/10 19:20:35 schrod
+ * Changed the group merging algorithm to create the group-id of an index key
+ * using user defined rules (specified in the style file with commands:
+ * `sort_group' and `group_head') instead of the sortkey's first character.
+ *
+ * Revision 1.1 1991/12/10 17:15:58 schrod
+ * Initial revision
+ *
+ */
diff --git a/Build/source/utils/xindy/rte/ordrules/rxsub.c b/Build/source/utils/xindy/rte/ordrules/rxsub.c
new file mode 100644
index 00000000000..904b9613c72
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/rxsub.c
@@ -0,0 +1,173 @@
+/* $Id: rxsub.c,v 1.4 2005/05/02 21:39:53 jschrod Exp $
+ *------------------------------------------------------------
+
+ This piece of code was inspired from the regsub implementation of
+ Henry Spencer. I modified it to make it compatible with the GNU Rx
+ library.
+
+ */
+
+#include "rxsub.h"
+
+#include <string.h>
+
+/*
+ nrxsub - perform substitutions after a regexp match
+
+ substpat : a string consisting of ordinary characters and subexpression
+ specifiers like `&' and `\0'..`\9'.
+ pmatch[] : the vector of subexpression specifiers into `source'
+ source : the string that was used in the regexec call yielding `pmatch'
+ dest : where to store the result
+ nsize : buffer length
+
+ Returns one of the error codes.
+ */
+
+#define chkbuf( x ) if ( x ) return RXSUB_ESPACE;
+
+rxsub_errcode_t
+nrxsub (char *substpat,
+ regmatch_t pmatch[],
+ char *source,
+ char *dest,
+ size_t nsize)
+{
+ register char *sub;
+ register char *dst;
+ register char c;
+ register int no;
+ register size_t len;
+ register char* bufend;
+
+ if ( pmatch == NULL || source == NULL ||
+ dest == NULL || substpat == NULL ||
+ nsize <= 0 ) {
+ return RXSUB_INVAL;
+ }
+
+ sub = substpat;
+ dst = dest;
+
+ bufend = dst + nsize; /* compute pointer to bufend */
+
+ while ((c = *sub++) != '\0') {
+ if (c == '&')
+ no = 0;
+ else if (c == '\\' && '0' <= *sub && *sub <= '9')
+ no = *sub++ - '0';
+ else
+ no = -1;
+
+ if (no < 0) { /* Ordinary character. */
+ if (c == '\\' && (*sub == '\\' || *sub == '&'))
+ c = *sub++;
+ chkbuf( dst >= bufend );
+ *dst++ = c;
+ } else { /* we found a subexpr specifier */
+ if ( pmatch[no].rm_so >= 0 && pmatch[no].rm_eo >= 0 ) {
+ len = pmatch[no].rm_eo - pmatch[no].rm_so;
+ chkbuf(dst + len >= bufend);
+ (void) strncpy( dst, source + pmatch[no].rm_so, len );
+ dst += len;
+ if (len != 0 && *(dst-1) == '\0') { /* strncpy hit NULL */
+ return RXSUB_DAMAGE;
+ }
+ }
+ }
+ }
+ chkbuf( dst >= bufend );
+ *dst++ = '\0';
+ return RXSUB_NOERROR;
+}
+
+
+/*
+ rxsub - perform substitutions after a regexp match
+
+ substpat : a string consisting of ordinary characters and subexpression
+ specifiers like `&' and `\0'..`\9'.
+ pmatch[] : the vector of subexpression specifiers into `source'
+ source : the string that was used in the regexec call yielding `pmatch'
+ dest : pointer to a char*, which is used to store the pointer of the
+ result string
+
+ Returns one of the error codes.
+ */
+
+rxsub_errcode_t
+rxsub (char *substpat,
+ regmatch_t pmatch[],
+ char *source,
+ char **dest)
+{
+ register size_t len;
+
+ if ( pmatch == NULL || source == NULL ||
+ dest == NULL || substpat == NULL ) {
+ return RXSUB_INVAL;
+ }
+
+ *dest = (char*)malloc( len = rxsub_len( substpat, pmatch ));
+
+ return nrxsub( substpat, pmatch, source, *dest, len );
+}
+
+
+
+/*
+ rxsub_len - calculate the neccessary space to hold the result of the
+ rxsub-call.
+
+ substpat : a string consisting of ordinary characters and subexpression
+ specifiers like `&' and `\0'..`\9'.
+ pmatch[] : the vector of subexpression specifiers into `source'
+
+ Returns the length of the string neccessary to hold the substituted
+ result with the final '\0' character included, or 0 of a fatal error occured.
+ */
+
+extern size_t
+rxsub_len (char *substpat,
+ regmatch_t pmatch[])
+{
+ register char *sub;
+ register char c;
+ register int no;
+ register size_t len;
+ register size_t totlen = 0;
+
+ if ( substpat == NULL || pmatch == NULL )
+ return 0;
+
+ sub = substpat;
+
+ while ((c = *sub++) != '\0') {
+ if (c == '&')
+ no = 0;
+ else if (c == '\\' && '0' <= *sub && *sub <= '9')
+ no = *sub++ - '0';
+ else
+ no = -1;
+
+ if (no < 0) { /* Ordinary character. */
+ if (c == '\\' && (*sub == '\\' || *sub == '&'))
+ c = *sub++;
+ totlen++;
+ } else { /* we found a subexpr specifier */
+ if ( pmatch[no].rm_so >= 0 && pmatch[no].rm_eo >= 0 ) {
+ len = pmatch[no].rm_eo - pmatch[no].rm_so;
+ totlen += len;
+ }
+ }
+ }
+ return ++totlen;
+}
+
+/*======================================================================
+
+ $Log: rxsub.c,v $
+ Revision 1.4 2005/05/02 21:39:53 jschrod
+ xindy run time engine 3.0; as used for CLISP 2.33.2.
+
+*/
diff --git a/Build/source/utils/xindy/rte/ordrules/rxsub.h b/Build/source/utils/xindy/rte/ordrules/rxsub.h
new file mode 100644
index 00000000000..03c22edfb7c
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/rxsub.h
@@ -0,0 +1,102 @@
+/* $Id: rxsub.h,v 1.3 2005/05/02 21:39:53 jschrod Exp $
+ *------------------------------------------------------------
+
+ This piece of code was inspired from the regsub implementation of
+ Henry Spencer. I modified it to make it compatible with the GNU Rx
+ library.
+
+ I added a more flexible interface that also allows dynamic
+ allocation of the string buffer and a function that computes the
+ length of the resulting string.
+
+*/
+
+#ifndef RXSUB_H
+#define RXSUB_H
+
+#include "mkind.h"
+#include "regex.h"
+
+/* The error codes used by the rxsub-library */
+
+typedef enum
+{
+ RXSUB_NOERROR = 0, /* Success. */
+ RXSUB_INVAL, /* Invalid arguments */
+ RXSUB_ESPACE, /* The given buffer is too small */
+ RXSUB_DAMAGE /* Damaged source string */
+} rxsub_errcode_t;
+
+/*
+ nrxsub - perform substitutions after a regexp match
+
+ substpat : a string consisting of ordinary characters and subexpression
+ specifiers like `&' and `\0'..`\9'.
+ pmatch[] : the vector of subexpression specifiers into `source'
+ source : the string that was used in the regexec call yielding `pmatch'
+ dest : where to store the result
+ nsize : buffer length
+
+ Returns one of the error codes.
+ */
+
+
+extern rxsub_errcode_t nrxsub
+PROTO( (char *substpat,
+ regmatch_t pmatch[],
+ char *source,
+ char *dest,
+ size_t nsize) );
+
+/*
+ rxsub - perform substitutions after a regexp match
+
+ substpat : a string consisting of ordinary characters and subexpression
+ specifiers like `&' and `\0'..`\9'.
+ pmatch[] : the vector of subexpression specifiers into `source'
+ source : the string that was used in the regexec call yielding `pmatch'
+ dest : pointer to a char*, which is used to store the pointer of the
+ result string. The neccessary space for the result is allocated
+ dynamically.
+
+ Returns one of the error codes.
+ */
+
+rxsub_errcode_t rxsub
+PROTO( (char *substpat,
+ regmatch_t pmatch[],
+ char *source,
+ char **dest) );
+
+/*
+ rxsub_len - calculate the neccessary space to hold the result of the
+ rxsub-call.
+
+ substpat : a string consisting of ordinary characters and subexpression
+ specifiers like `&' and `\0'..`\9'.
+ pmatch[] : the vector of subexpression specifiers into `source'
+
+ Returns the length of the string neccessary to hold the substituted
+ result with the final '\0' character included, or 0 of a fatal error occured.
+ */
+
+extern size_t rxsub_len
+PROTO( (char *substpat,
+ regmatch_t pmatch[]) );
+
+#endif /* RXSUB_H */
+
+
+/*======================================================================
+
+ $Log: rxsub.h,v $
+ Revision 1.3 2005/05/02 21:39:53 jschrod
+ xindy run time engine 3.0; as used for CLISP 2.33.2.
+
+ Revision 1.2 1999/07/30 08:37:09 kehr
+ Intermediate checkin.
+
+ Revision 1.1 1996/03/26 17:31:04 kehr
+ First check-in of the rx-support for clisp.
+
+*/
diff --git a/Build/source/utils/xindy/rte/ordrules/version.lisp.in b/Build/source/utils/xindy/rte/ordrules/version.lisp.in
new file mode 100644
index 00000000000..d2e580157d0
--- /dev/null
+++ b/Build/source/utils/xindy/rte/ordrules/version.lisp.in
@@ -0,0 +1,13 @@
+;; $Id: version.lisp.in,v 1.1 2005/06/14 01:41:58 jschrod Exp $ -*- Lisp -*-
+;;------------------------------------------------------------
+
+;;;
+;;; xindy run time engine version number
+;;;
+
+(defpackage :xindy-version
+ (:export "*XINDY-RTE-VERSION*" "*XINDY-PLATFORM*"))
+(in-package :xindy-version)
+
+(defparameter *xindy-rte-version* "2.2")
+(defparameter *xindy-platform* "@host_cpu@-@host_os@")