chiark / gitweb /
Replace build system with Autotools, and Debianize. 0.99.0
authorMark Wooding <mdw@distorted.org.uk>
Sun, 30 Mar 2025 02:39:15 +0000 (03:39 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 30 Mar 2025 12:05:51 +0000 (13:05 +0100)
44 files changed:
.gitignore
COPYING.LIB [new symlink]
INSTALL [new symlink]
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
config/auto-version [new symlink]
config/autotest.am [new symlink]
config/confsubst [new symlink]
config/testsuite.at [new symlink]
configure.ac [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/libxyla-dev.install [new file with mode: 0644]
debian/libxyla0.install [new file with mode: 0644]
debian/libxyla0.shlibs [new file with mode: 0644]
debian/libxyla0.symbols [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]
m4/mdw-auto-version.m4 [new symlink]
m4/mdw-libtool-version-info.m4 [new symlink]
m4/mdw-silent-rules.m4 [new symlink]
t/Makefile.am [new file with mode: 0644]
t/atlocal.in [new file with mode: 0644]
t/autotest.am [new symlink]
t/avl-avlregress.ref [moved from avl-avlregress.ref with 100% similarity]
t/avl-avltest.ref [moved from avl-avltest.ref with 100% similarity]
t/avl-commontest.ref [moved from avl-commontest.ref with 100% similarity]
t/avlregress.in [moved from avlregress.in with 100% similarity]
t/avltest.in [moved from avltest.in with 100% similarity]
t/commontest.in [moved from commontest.in with 100% similarity]
t/dump-to-assgn [moved from dump-to-assgn with 100% similarity]
t/rb-commontest.ref [moved from rb-commontest.ref with 100% similarity]
t/rb-rbregress.ref [moved from rb-rbregress.ref with 100% similarity]
t/rb-rbtest.ref [moved from rb-rbtest.ref with 100% similarity]
t/rbregress.in [moved from rbregress.in with 100% similarity]
t/rbtest.in [moved from rbtest.in with 100% similarity]
t/soak [moved from soak with 100% similarity]
t/tests.at [new file with mode: 0644]
t/testsuite.at [new symlink]
t/treetest.c [moved from treetest.c with 100% similarity]
vars.am [new file with mode: 0644]
xyla.pc.in [new file with mode: 0644]

index f6848b7e15350d750f8437afcb8f8cd30817a0b1..4c72fd02d4ed235b1a9c81f51c734fe8a7f1cc69 100644 (file)
@@ -1,7 +1,27 @@
-*.o
-*.d
-*.a
-*.out
-/soak.ckpt
-/avltest
-/rbtest
+## Pervasive build machinery.
+Makefile.in
+
+## Top-level generated files.
+/aclocal.m4
+/autom4te.cache/
+/configure
+
+## GNU build system machinery installed by `autoreconf'.
+/config/compile
+/config/config.guess
+/config/config.sub
+/config/depcomp
+/config/install-sh
+/config/ltmain.sh
+/config/missing
+/config/test-driver
+/m4/libtool.m4
+/m4/ltoptions.m4
+/m4/ltsugar.m4
+/m4/ltversion.m4
+/m4/lt~obsolete.m4
+
+## Test machinery.
+/t/package.m4
+/t/testsuite
+/t/tests.m4
diff --git a/COPYING.LIB b/COPYING.LIB
new file mode 120000 (symlink)
index 0000000..610fc52
--- /dev/null
@@ -0,0 +1 @@
+.ext/cfd/licence/LGPL-3
\ No newline at end of file
diff --git a/INSTALL b/INSTALL
new file mode 120000 (symlink)
index 0000000..1483568
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1 @@
+.ext/cfd/doc/INSTALL
\ No newline at end of file
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index a3369b3..0000000
--- a/Makefile
+++ /dev/null
@@ -1,196 +0,0 @@
-### -*-makefile-*-
-###
-### Build script
-###
-### (c) 2024 Straylight/Edgeware
-###
-
-###----- Licensing notice ---------------------------------------------------
-###
-### This file is part of Xyla, a library of binary trees.
-###
-### Xyla 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.
-###
-### Xyla 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 Xyla.  If not, see <https://www.gnu.org/licenses/>.
-
-###--------------------------------------------------------------------------
-### Preliminaries.
-
-all:
-check:
-clean::
-soak:
-.PHONY: all check clean soak
-
-.SECONDEXPANSION:
-
-###--------------------------------------------------------------------------
-### Configuration tweaks.
-
-CC                      = gcc
-OPTIMIZE                = -Og -g3
-WARNINGS                = -pedantic -Wall
-CFLAGS                  = $(OPTIMIZE) $(WARNINGS) $(CFLAGS.t)
-
-AR                      = ar
-
-VERBOSE                         = nil
-FREESTANDING            = nil
-SOAKSTEPS               = 1000000
-
-###--------------------------------------------------------------------------
-### Machinery.
-
-CFLAGS.t                =
-CFLAGS.nil              =
-
-CFLAGS.$(VERBOSE)      += -DXYLA_VERBOSE
-CFLAGS.$(FREESTANDING) += -DXYLA_FREESTANDING
-
-not                     = $(not.$1)
-not.t                   = nil
-not.nil                         = t
-
-TARGETS                         =
-CLEAN                   =
-
-V                       = 0
-V_AT                    = $(V_AT.$V)
-V_AT.0                  = @
-v-tag                   = $(call v-tag.$V,$1,$2)
-v-tag.0                         = @printf "  %-8s %s\n" $1 $(or $2,$@);
-
-SRCEXT                  =
-objify                  = $(addsuffix .o, \
-                               $(basename \
-                                       $(filter $(addprefix %, $(SRCEXT)), \
-                                               $1)))
-CLEAN                  += *.o
-
-compile                         = $(call v-tag,$1)$(CC) -c $(CFLAGS) $4 \
-                               -MD -MF $(2:.o=.d) -o$2 $3
-DEPOBJS                         =
-CLEAN                  += *.d
-
-SRCEXT                 += .c
-%.o: %.c
-       $(call compile,CC,$@,$<)
-
-all.t all.nil:
-all: all.t
-.PHONY: all.t all.nil
-
-###--------------------------------------------------------------------------
-### Building the library.
-
-all: libxyla.a
-CLEAN                  += libxyla.a
-LIBSRCS                         = $(LIBSRCS.t)
-LIBSRCS.t               =
-LIBOBJS                         = $(call objify, $(LIBSRCS))
-DEPOBJS                        += $(LIBOBJS)
-
-LIBSRCS                        += base.c
-LIBSRCS                        += diag.c
-
-LIBSRCS.$(call not,$(FREESTANDING)) += bt-check.c
-LIBSRCS                        += bt-rm.c
-LIBSRCS                        += bt-set.c
-LIBSRCS                        += bt-sever.c
-
-TREES                   =
-LIBSRCS                        += $(foreach t,$(TREES), \
-                               $($t_LIBSRCS) $($t_LIBSRCS.t))
-
-COMMON_TESTS            = commontest
-
-TREES                  += avl
-avl_LIBSRCS             =
-avl_LIBSRCS.t           =
-avl_LIBSRCS.nil                 =
-avl_LIBSRCS            += avl-addrm.c
-avl_LIBSRCS.$(call not,$(FREESTANDING)) += avl-check.c
-avl_LIBSRCS            += avl-iter.c
-avl_LIBSRCS            += avl-misc.c
-avl_LIBSRCS            += avl-path.c
-avl_LIBSRCS            += avl-search.c
-avl_LIBSRCS            += avl-set.c
-avl_LIBSRCS            += avl-splitjoin.c
-avl_DEFINES             = -DTREE=AVL
-avl_TESTS               = avltest avlregress
-
-TREES                  += rb
-rb_LIBSRCS              =
-rb_LIBSRCS.t            =
-rb_LIBSRCS.nil          =
-rb_LIBSRCS             += rb-addrm.c
-rb_LIBSRCS.$(call not,$(FREESTANDING)) += rb-check.c
-rb_LIBSRCS             += rb-iter.c
-rb_LIBSRCS             += rb-misc.c
-rb_LIBSRCS             += rb-path.c
-rb_LIBSRCS             += rb-search.c
-rb_LIBSRCS             += rb-set.c
-rb_LIBSRCS             += rb-splitjoin.c
-rb_DEFINES              = -DTREE=RB
-rb_TESTS                = rbtest rbregress
-
-libxyla.a: $(LIBOBJS)
-       $(call v-tag,AR)$(AR) crs $@ $+
-
-###--------------------------------------------------------------------------
-### Testing.
-
-TREE_TESTS              = $(foreach t,$(TREES), $ttest)
-all.$(call not,$(FREESTANDING)): $(TREE_TESTS)
-CLEAN                  += $(TREE_TESTS)
-$(TREE_TESTS): %test: treetest.%.o libxyla.a
-       $(call v-tag,LD)$(CC) -o$@ $+
-
-$(foreach t,$(TREES), treetest.$t.o): treetest.%.o: treetest.c
-       $(call compile,CC,$@,$<, $($*_DEFINES))
-DEPOBJS                        += $(foreach t,$(TREES), treetest.$t.o)
-
-TESTS                   = $(foreach t,$(TREES), check-$t)
-check: $(TESTS)
-
-define tree-tests
-$1_ALLTESTS             = $$(foreach t,$$(COMMON_TESTS) $$($1_TESTS), $1-$$t)
-$1_CHECK                = $$(foreach t,$$($1_ALLTESTS), check-$$t)
-check-$1: $$($1_CHECK)
-$$($1_CHECK): check-$1-%: $1test %.in | $1-%.ref
-       $$(call v-tag,TEST)./$1test -o$1-$$*.out $$*.in && diff -u $1-$$*.out $1-$$*.ref
-$$(foreach t,$$($1_ALLTESTS), $$t.ref): $1-%.ref: | %.in $1test
-       $$(call v-tag,GEN)./$1test -o$$@.new $$*.in && mv $$@.new $$@
-.PHONY: check-$1 $$($1_CHECK)
-endef
-$(foreach t,$(TREES), $(eval $(call tree-tests,$t)))
-CLEAN                  += *.out
-
-ref: $(foreach t,$(TREES), $(foreach i,$($t_ALLTESTS), $i.ref))
-.PHONY: ref
-
-ALL_SOAKS               = $(foreach t,$(TREES), soak-$t)
-soak: $(ALL_SOAKS)
-$(ALL_SOAKS): soak-%: %test
-       $(call v-tag,SOAK)./soak -fsoak-$*.ckpt -n$(SOAKSTEPS) ./$*test
-CLEAN                  += soak-*.ckpt
-.PHONY: $(ALL_SOAKS)
-
-###--------------------------------------------------------------------------
-### Finishing touches.
-
-clean::; rm -f $(CLEAN)
--include $(DEPOBJS:.o=.d)
-
-p:; : $p
-
-###----- That's all, folks --------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..7d4e620
--- /dev/null
@@ -0,0 +1,114 @@
+### -*-makefile-*-
+###
+### Build script for Xyla
+###
+### (c) 2024 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of Xyla, a library of binary trees.
+###
+### Xyla 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.
+###
+### Xyla 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 Xyla.  If not, see <https://www.gnu.org/licenses/>.
+
+include vars.am
+
+ACLOCAL_AMFLAGS                 = -Im4
+
+SUBDIRS                         =
+
+lib_LTLIBRARIES                 =
+pkginclude_HEADERS      =
+
+SUBDIRS                        += .
+
+###--------------------------------------------------------------------------
+### Library.
+
+## The library itself.
+lib_LTLIBRARIES                += libxyla.la
+libxyla_la_LDFLAGS      = -version-info $(LIBTOOL_VERSION_INFO)
+libxyla_la_SOURCES      =
+LDADD                  += libxyla.la
+
+libxyla_la_SOURCES     += lib.h
+libxyla_la_SOURCES     += base.c
+libxyla_la_SOURCES     += diag.c
+
+pkginclude_HEADERS     += bt.h
+libxyla_la_SOURCES     += bt-check.c
+libxyla_la_SOURCES     += bt-rm.c
+libxyla_la_SOURCES     += bt-sever.c
+libxyla_la_SOURCES     += bt-set.c
+
+pkginclude_HEADERS     += avl.h
+libxyla_la_SOURCES     += avl-addrm.c
+libxyla_la_SOURCES     += avl-check.c
+libxyla_la_SOURCES     += avl-iter.c
+libxyla_la_SOURCES     += avl-misc.c
+libxyla_la_SOURCES     += avl-path.c
+libxyla_la_SOURCES     += avl-search.c
+libxyla_la_SOURCES     += avl-set.c
+libxyla_la_SOURCES     += avl-splitjoin.c
+
+pkginclude_HEADERS     += rb.h
+libxyla_la_SOURCES     += rb-addrm.c
+libxyla_la_SOURCES     += rb-check.c
+libxyla_la_SOURCES     += rb-iter.c
+libxyla_la_SOURCES     += rb-misc.c
+libxyla_la_SOURCES     += rb-path.c
+libxyla_la_SOURCES     += rb-search.c
+libxyla_la_SOURCES     += rb-set.c
+libxyla_la_SOURCES     += rb-splitjoin.c
+
+## Package description.
+pkgconf_DATA           += xyla.pc
+CLEANFILES             += xyla.pc
+EXTRA_DIST             += xyla.pc.in
+
+xyla.pc: xyla.pc.in Makefile
+       $(SUBST) $(srcdir)/xyla.pc.in >$@.new $(SUBSTITUTIONS) \
+               && mv $@.new $@
+
+###--------------------------------------------------------------------------
+### Other subdirectories.
+
+## Testing.
+SUBDIRS                        += t
+
+###--------------------------------------------------------------------------
+### Other finishing touches.
+
+## Version stamp.
+dist-hook::
+       echo $(VERSION) >$(distdir)/RELEASE
+
+## Build tools.
+EXTRA_DIST             += config/auto-version
+EXTRA_DIST             += config/confsubst
+
+###--------------------------------------------------------------------------
+### Debian.
+
+## Main stuff.
+EXTRA_DIST             += debian/changelog debian/compat debian/control
+EXTRA_DIST             += debian/copyright debian/rules debian/source/format
+
+## Library.
+EXTRA_DIST             += debian/libxyla0.install
+EXTRA_DIST             += debian/libxyla0.shlibs
+EXTRA_DIST             += debian/libxyla0.symbols
+EXTRA_DIST             += debian/libxyla-dev.install
+
+###----- That's all, folks --------------------------------------------------
diff --git a/config/auto-version b/config/auto-version
new file mode 120000 (symlink)
index 0000000..652e105
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/build/auto-version
\ No newline at end of file
diff --git a/config/autotest.am b/config/autotest.am
new file mode 120000 (symlink)
index 0000000..2309b1e
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/build/autotest.am
\ No newline at end of file
diff --git a/config/confsubst b/config/confsubst
new file mode 120000 (symlink)
index 0000000..8e7de22
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/build/confsubst
\ No newline at end of file
diff --git a/config/testsuite.at b/config/testsuite.at
new file mode 120000 (symlink)
index 0000000..78fa5b5
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/build/testsuite.at
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..955b0b2
--- /dev/null
@@ -0,0 +1,54 @@
+dnl -*-autoconf-*-
+dnl
+dnl Configuration script for Xyla
+dnl
+dnl (c) 2024 Straylight/Edgeware
+dnl
+
+dnl----- Licensing notice ---------------------------------------------------
+dnl
+dnl This file is part of Xyla, a library of binary trees.
+dnl
+dnl Xyla is free software: you can redistribute it and/or modify it under
+dnl the terms of the GNU Lesser General Public License as published by the
+dnl Free Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl Xyla is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with Xyla.  If not, see <https://www.gnu.org/licenses/>.
+
+mdw_AUTO_VERSION
+AC_INIT([xyla], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([bt.h])
+AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_MACRO_DIRS([m4])
+AM_INIT_AUTOMAKE([foreign])
+mdw_SILENT_RULES
+
+AC_CHECK_PROGS([AUTOM4TE], [autom4te])
+AM_PATH_PYTHON([2.7],, [:])
+
+dnl--------------------------------------------------------------------------
+dnl C language environment.
+
+dnl Compiler and tools.
+AC_PROG_CC
+AX_CFLAGS_WARN_ALL
+AM_PROG_LIBTOOL
+mdw_LIBTOOL_VERSION_INFO
+AC_SUBST([AM_CFLAGS])
+
+dnl--------------------------------------------------------------------------
+dnl Output.
+
+AC_CONFIG_TESTDIR([t])
+AC_CONFIG_FILES([Makefile t/Makefile t/atlocal])
+
+AC_OUTPUT
+
+dnl----- That's all, folks --------------------------------------------------
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..f4c9f3c
--- /dev/null
@@ -0,0 +1,6 @@
+libxyla (0.99.0~) unstable; urgency=medium
+
+  * Initial version.
+
+ -- Mark Wooding <mdw@distorted.org.uk>  Mon, 09 Sep 2024 11:04:05 +0100
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..f599e28
--- /dev/null
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..a86e212
--- /dev/null
@@ -0,0 +1,39 @@
+Source: libxyla
+Section: libs
+Priority: optional
+Maintainer: Mark Wooding <mdw@distorted.org.uk>
+Build-Depends:
+       debhelper (>= 10),
+       autoconf, automake, libtool, autoconf-archive,
+       python3 | python
+Standards-Version: 4.3.0
+
+Package: libxyla0
+Architecture: any
+Multi-Arch: same
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
+Description: Library of fast, hard-mode binary tree implementations (run-time)
+ The Xyla library implements AVL trees, red-black trees, splay trees, and
+ treaps.  It provides search, iteration, insertion, deletion, splitting and
+ joining, and set operations.  It supports search, update, and retrieval of
+ user-defined annotations.  Except for the invariant-checking functionality,
+ the library allocates no memory of its own.  The algorithm implementations
+ are nonrecursive.
+ .
+ This package provides the run-time library.
+
+Package: libxyla-dev
+Architecture: any
+Depends: libxyla0 (= ${binary:Version}), libc6-dev, ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
+Description: Library of fast, hard-mode binary tree implementations (development)
+ The Xyla library implements AVL trees, red-black trees, splay trees, and
+ treaps.  It provides search, iteration, insertion, deletion, splitting and
+ joining, and set operations.  It supports search, update, and retrieval of
+ user-defined annotations.  Except for the invariant-checking functionality,
+ the library allocates no memory of its own.  The algorithm implementations
+ are nonrecursive.
+ .
+ This package contains the header files and static libraries needed to
+ compile programs which use Xyla.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..70fda68
--- /dev/null
@@ -0,0 +1,108 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Copyright:
+       1999, 2002--2006, 2008, 2010, 2013, 2017, 2019, 2020, 2024
+         Mark Wooding
+       1996, 1997, 1999, 2000, 2003, 2004, 2008--2010, 2013, 2016, 2019,
+         2020 Straylight/Edgeware
+       1989, 1991, 1994--1996 1999--2002, 2004--2012 Free Software
+         Foundation
+Upstream-Name: libxyla
+Upstream-Contact: Mark Wooding <mdw@distorted.org.uk>
+Source: https://ftp.distorted.org.uk/pub/mdw/
+License: LGPL-3.0+
+
+Files: *
+Copyright: 2024 Straylight/Edgeware
+LIcense: LGPL-3.0+
+
+Files: .ext/cfd/build/*
+Copyright: 2003, 2008--2010, 2013, 2016, 2019, 2020 Straylight/Edgeware
+License: GPL-2.0+
+
+Files: ext/cfd/src/*
+Copyright: 1996, 1997, 1999, 2000, 2004, 2008 Straylight/Edgeware
+License: LGPL-2.0+
+
+Files: ext/cfd/build/auto-version ext/cfd/build/confsubst
+       ext/cfd/doc/texinice.tex ext/cfd/m4/*.m4
+Copyright: 1999, 2002--2006, 2008, 2010, 2013, 2017, 2019, 2020, 2024
+       Mark Wooding
+License: GPL-2.0+
+
+Files: ext/cfd/doc/INSTALL
+Copyright: 1994--1996, 1999--2002, 2004--2012 Free Software Foundation
+License: FSFAP
+       Copying and distribution of this file, with or without modification,
+       are permitted in any medium without royalty provided the copyright
+       notice and this notice are preserved.  This file is offered as-is,
+       without warranty of any kind.
+
+Files: ext/cfd/licence/*
+Copyright: 1989, 1991, 1999, 2007 Free Software Foundation
+License: FSF-meta-licence
+       Everyone is permitted to copy and distribute verbatim copies of this
+       license document, but changing it is not allowed.
+
+Files: ext/cfd/src/getdate.*
+Copyright:
+       (unknown dates) Steven M. Bellovin
+       (unknown dates) `a couple of people on Usenet'
+       1994 Rich Salz
+       1994 Jim Berets
+       1999 Mark Wooding
+License: public-domain
+       This code is in the public domain and has no copyright.
+
+License: GPL-2.0+
+       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 package; if not, see <https://www.gnu.org/licenses/>.
+Comment:
+       On Debian systems, the full text of the GNU General Public License
+       version 2 can be found in the file '/usr/share/common-licenses/GPL-2'.
+
+License: LGPL-2.0+
+       This library is free software; you can redistribute it and/or modify
+       modify it under the terms of the GNU Library 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 Library General Public
+       License along with this package; if not, see
+       <https://www.gnu.org/licenses/>.
+Comment:
+       On Debian systems, the full text of the GNU Library General Public
+       License version 2 can be found in the file
+       '/usr/share/common-licenses/LGPL-2'.
+
+License: LGPL-3.0+
+       Xyla 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.
+       .
+       Xyla 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 Xyla.  If not, see <https://www.gnu.org/licenses/>.
+Comment:
+       On Debian systems, the full text of the GNU Lesser General Public
+       License version 3 can be found in the file
+       '/usr/share/common-licenses/LGPL-3'.
diff --git a/debian/libxyla-dev.install b/debian/libxyla-dev.install
new file mode 100644 (file)
index 0000000..3a9bb3c
--- /dev/null
@@ -0,0 +1,5 @@
+debian/tmp/usr/include
+debian/tmp/usr/lib/*/libxyla.a
+debian/tmp/usr/lib/*/libxyla.la
+debian/tmp/usr/lib/*/libxyla.so
+debian/tmp/usr/lib/*/pkgconfig
diff --git a/debian/libxyla0.install b/debian/libxyla0.install
new file mode 100644 (file)
index 0000000..ee59b44
--- /dev/null
@@ -0,0 +1 @@
+debian/tmp/usr/lib/*/libxyla.so.*
diff --git a/debian/libxyla0.shlibs b/debian/libxyla0.shlibs
new file mode 100644 (file)
index 0000000..086dea5
--- /dev/null
@@ -0,0 +1,2 @@
+### -*-conf-*-
+libxyla 0 libxyla0 (>= 0.99.0~)
diff --git a/debian/libxyla0.symbols b/debian/libxyla0.symbols
new file mode 100644 (file)
index 0000000..c294047
--- /dev/null
@@ -0,0 +1,81 @@
+### -*-conf-*-
+
+libxyla.so.0 libxyla0 #MINVER#
+* Build-Depends-Package: libxyla-dev
+
+## Binary tree basics.
+       xyla_strerror@Base 0.99.0~
+       xyla_bt_check@Base 0.99.0~
+       xyla_bt_bughdr@Base 0.99.0~
+       xyla_bt_printnode@Base 0.99.0~
+       xyla_bt_chkorder@Base 0.99.0~
+       xyla_bt_severfirst@Base 0.99.0~
+       xyla_bt_remove@Base 0.99.0~
+       xyla_bt_unisect@Base 0.99.0~
+       xyla_bt_diffsect@Base 0.99.0~
+
+## AVL trees.
+       xyla_avl_height@Base 0.99.0~
+       xyla_avl_inititer@Base 0.99.0~
+       xyla_avl_next@Base 0.99.0~
+       xyla_avl_initriter@Base 0.99.0~
+       xyla_avl_prev@Base 0.99.0~
+       xyla_avl_current@Base 0.99.0~
+       xyla_avl_copypath@Base 0.99.0~
+       xyla_avl_firstpath@Base 0.99.0~
+       xyla_avl_lastpath@Base 0.99.0~
+       xyla_avl_nextpath@Base 0.99.0~
+       xyla_avl_prevpath@Base 0.99.0~
+       xyla_avl_beforepath@Base 0.99.0~
+       xyla_avl_afterpath@Base 0.99.0~
+       xyla_avl_rootpath@Base 0.99.0~
+       xyla_avl_uppath@Base 0.99.0~
+       xyla_avl_leftpath@Base 0.99.0~
+       xyla_avl_rightpath@Base 0.99.0~
+       xyla_avl_replace@Base 0.99.0~
+       xyla_avl_ripple@Base 0.99.0~
+       xyla_avl_ascend@Base 0.99.0~
+       xyla_avl_lookup@Base 0.99.0~
+       xyla_avl_probe@Base 0.99.0~
+       xyla_avl_insert@Base 0.99.0~
+       xyla_avl_remove@Base 0.99.0~
+       xyla_avl_join@Base 0.99.0~
+       xyla_avl_split@Base 0.99.0~
+       xyla_avl_splitat@Base 0.99.0~
+       xyla_avl_splitroot@Base 0.99.0~
+       xyla_avl_unisect@Base 0.99.0~
+       xyla_avl_diffsect@Base 0.99.0~
+       xyla_avl_check@Base 0.99.0~
+
+## Red-black trees.
+       xyla_rb_height@Base 0.99.0~
+       xyla_rb_inititer@Base 0.99.0~
+       xyla_rb_next@Base 0.99.0~
+       xyla_rb_initriter@Base 0.99.0~
+       xyla_rb_prev@Base 0.99.0~
+       xyla_rb_current@Base 0.99.0~
+       xyla_rb_copypath@Base 0.99.0~
+       xyla_rb_firstpath@Base 0.99.0~
+       xyla_rb_lastpath@Base 0.99.0~
+       xyla_rb_nextpath@Base 0.99.0~
+       xyla_rb_prevpath@Base 0.99.0~
+       xyla_rb_beforepath@Base 0.99.0~
+       xyla_rb_afterpath@Base 0.99.0~
+       xyla_rb_rootpath@Base 0.99.0~
+       xyla_rb_uppath@Base 0.99.0~
+       xyla_rb_leftpath@Base 0.99.0~
+       xyla_rb_rightpath@Base 0.99.0~
+       xyla_rb_replace@Base 0.99.0~
+       xyla_rb_ripple@Base 0.99.0~
+       xyla_rb_ascend@Base 0.99.0~
+       xyla_rb_lookup@Base 0.99.0~
+       xyla_rb_probe@Base 0.99.0~
+       xyla_rb_insert@Base 0.99.0~
+       xyla_rb_remove@Base 0.99.0~
+       xyla_rb_join@Base 0.99.0~
+       xyla_rb_split@Base 0.99.0~
+       xyla_rb_splitat@Base 0.99.0~
+       xyla_rb_splitroot@Base 0.99.0~
+       xyla_rb_unisect@Base 0.99.0~
+       xyla_rb_diffsect@Base 0.99.0~
+       xyla_rb_check@Base 0.99.0~
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..a0a9604
--- /dev/null
@@ -0,0 +1,7 @@
+#! /usr/bin/make -f
+
+DH_OPTIONS = --parallel -Bdebian/build
+%:; dh $@ $(DH_OPTIONS)
+
+override_dh_makeshlibs:
+       dh_makeshlibs -- -c4
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..d3827e7
--- /dev/null
@@ -0,0 +1 @@
+1.0
diff --git a/m4/mdw-auto-version.m4 b/m4/mdw-auto-version.m4
new file mode 120000 (symlink)
index 0000000..db358e4
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/m4/mdw-auto-version.m4
\ No newline at end of file
diff --git a/m4/mdw-libtool-version-info.m4 b/m4/mdw-libtool-version-info.m4
new file mode 120000 (symlink)
index 0000000..3298202
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/m4/mdw-libtool-version-info.m4
\ No newline at end of file
diff --git a/m4/mdw-silent-rules.m4 b/m4/mdw-silent-rules.m4
new file mode 120000 (symlink)
index 0000000..52d11e3
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/m4/mdw-silent-rules.m4
\ No newline at end of file
diff --git a/t/Makefile.am b/t/Makefile.am
new file mode 100644 (file)
index 0000000..264c030
--- /dev/null
@@ -0,0 +1,55 @@
+### -*-makefile-*-
+###
+### Build script for testing
+###
+### (c) 2024 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of Xyla, a library of binary trees.
+###
+### Xyla 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.
+###
+### Xyla 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 Xyla.  If not, see <https://www.gnu.org/licenses/>.
+
+check_PROGRAMS          =
+
+include autotest.am
+autotest_TESTS          =
+TEST_ARGS               = -j8
+
+autotest_TESTS         += ./tests.at
+
+AM_CPPFLAGS             = -I$(top_srcdir)
+LDADD                   = ../libxyla.la
+
+## Common tests.
+EXTRA_DIST             += commontest.in
+
+## AVL trees.
+check_PROGRAMS         += avltest
+avltest_SOURCES                 = treetest.c
+avltest_CFLAGS          = $(AM_CFLAGS) -DTREE=AVL
+EXTRA_DIST             +=                      avl-commontest.ref
+EXTRA_DIST             += avltest.in           avl-avltest.ref
+EXTRA_DIST             += avlregress.in        avl-avlregress.ref
+
+## Red-black trees.
+check_PROGRAMS         += rbtest
+rbtest_SOURCES          = treetest.c
+rbtest_CFLAGS           = $(AM_CFLAGS) -DTREE=RB
+EXTRA_DIST             +=                      rb-commontest.ref
+EXTRA_DIST             += rbtest.in            rb-rbtest.ref
+EXTRA_DIST             += rbregress.in         rb-rbregress.ref
+
+###----- That's all, folks --------------------------------------------------
diff --git a/t/atlocal.in b/t/atlocal.in
new file mode 100644 (file)
index 0000000..2996e4d
--- /dev/null
@@ -0,0 +1,27 @@
+### -*-sh-*-
+###
+### Configuration variables interesting to the test suite
+###
+### (c) 2024 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of Xyla, a library of binary trees.
+###
+### Xyla 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.
+###
+### Xyla 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 Xyla.  If not, see <https://www.gnu.org/licenses/>.
+
+PYTHON=@PYTHON@
+
+###----- That's all, folks --------------------------------------------------
diff --git a/t/autotest.am b/t/autotest.am
new file mode 120000 (symlink)
index 0000000..2309b1e
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/build/autotest.am
\ No newline at end of file
similarity index 100%
rename from avl-avlregress.ref
rename to t/avl-avlregress.ref
similarity index 100%
rename from avl-avltest.ref
rename to t/avl-avltest.ref
similarity index 100%
rename from avl-commontest.ref
rename to t/avl-commontest.ref
similarity index 100%
rename from avlregress.in
rename to t/avlregress.in
similarity index 100%
rename from avltest.in
rename to t/avltest.in
similarity index 100%
rename from commontest.in
rename to t/commontest.in
similarity index 100%
rename from dump-to-assgn
rename to t/dump-to-assgn
similarity index 100%
rename from rb-commontest.ref
rename to t/rb-commontest.ref
similarity index 100%
rename from rb-rbregress.ref
rename to t/rb-rbregress.ref
similarity index 100%
rename from rb-rbtest.ref
rename to t/rb-rbtest.ref
similarity index 100%
rename from rbregress.in
rename to t/rbregress.in
similarity index 100%
rename from rbtest.in
rename to t/rbtest.in
diff --git a/soak b/t/soak
similarity index 100%
rename from soak
rename to t/soak
diff --git a/t/tests.at b/t/tests.at
new file mode 100644 (file)
index 0000000..5025f21
--- /dev/null
@@ -0,0 +1,179 @@
+### -*-autotest-*-
+###
+### Test script
+###
+### (c) 2024 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of Xyla, a library of binary trees.
+###
+### Xyla 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.
+###
+### Xyla 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 Xyla.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_define([TESTINPUT_PATH], [$abs_top_srcdir/t])
+m4_define([TESTPROG_PATH], [$abs_top_builddir/t])
+m4_define([LTRUN], [$abs_top_builddir/libtool --mode=execute])
+
+m4_define([_FOREACH], [dnl
+m4_if([$#], [1], [_foreach_func($1)],
+       [_foreach_func($1)[]_FOREACH(m4_shift($@))])])
+m4_define([FOREACH], [dnl
+m4_pushdef([_foreach_func], [$2])dnl
+_FOREACH($1)[]dnl
+m4_popdef([_foreach_func])])
+
+m4_define([DOL], [$])
+
+m4_define([VALGRIND_DEFAULTS],
+[--leak-check=full --show-leak-kinds=all dnl
+--errors-for-leak-kinds=all --track-origins=yes --error-exitcode=3])
+m4_define([DIRECT_NSTEPS], [1000000])
+m4_define([VALGRIND_NSTEPS], [100000])
+
+m4_define([TREES], [avl, rb])
+m4_define([COMMON_TESTS], [commontest])
+m4_define([avl_TESTS], [avltest, avlregress])
+m4_define([rb_TESTS], [rbtest, rbregress])
+
+###--------------------------------------------------------------------------
+### Option parsing.
+
+AT_ARG_OPTION_ARG([xyla-launder],
+       [AS_HELP_STRING([--xyla-launder=FILTER],
+                       [apply FILTER for test output])],
+       [AS_CASE([$at_optarg],
+         [nil],
+           [filter=cat],
+         [ignseq],
+           [filter="sed 's/@%:@0x@<:@0-9a-f@:>@*/@%:@0x......../g'"],
+         [AS_ECHO([unknown launder]) >&2; AS_EXIT([2])])],
+       [filter=cat])
+
+AT_ARG_OPTION_ARG([xyla-runner],
+       [AS_HELP_STRING([--xyla-runner=WRAPPER],
+                       [apply WRAPPER around test programs])],
+       [AS_CASE([$at_optarg],
+         [direct],
+           [adverb= dflt_steps=DIRECT_NSTEPS],
+         [valgrind],
+           [adverb="valgrind ${VALGRIND_OPTS-VALGRIND_DEFAULTS} \
+               --log-file=valgrind.out"
+            dflt_steps=VALGRIND_NSTEPS],
+         [vgdb],
+           [adverb="valgrind ${VALGRIND_OPTS-VALGRIND_DEFAULTS} \
+               --vgdb=full --vgdb-error=1 --vgdb-shadow-registers=yes"
+            dflt_steps=VALGRIND_NSTEPS],
+         [AS_ECHO([unknown runner]) >&2; AS_EXIT([2])])],
+       [adverb= dflt_steps=DIRECT_NSTEPS])
+
+AT_ARG_OPTION([xyla-setref],
+       [AS_HELP_STRING([--xyla-setref],
+                       [set reference file from test output])])
+
+AT_ARG_OPTION([xyla-soak],
+       [AS_HELP_STRING([--xyla-soak], [run soak tests])])
+
+AT_ARG_OPTION_ARG([xyla-soak-seed],
+       [AS_HELP_STRING([--xyla-soak-seed=SEED],
+                       [force soak-test seed])],
+       [soak_seed=$at_optarg],
+       [soak_seed=nil])
+
+AT_ARG_OPTION_ARG([xyla-soak-steps],
+       [AS_HELP_STRING([--xyla-soak-steps=NSTEPS],
+                       [run NSTEPS soak steps])],
+       [soak_steps=$at_optarg],
+       [soak_steps=nil])
+
+###--------------------------------------------------------------------------
+m4_define([DEF_KAT1], [AT_SETUP([$1-$2])
+
+AT_KEYWORDS([$1 $2 kat $1-$2])
+
+cp TESTINPUT_PATH/$2.in in
+AT_CHECK([LTRUN $adverb TESTPROG_PATH/$1test -oout in], [0], [], [])
+if test -r TESTINPUT_PATH/$1-$2.ref; then
+  eval $filter <out >out.filtered
+  eval $filter <TESTINPUT_PATH/$1-$2.ref >ref.filtered
+  AT_CHECK([diff -u out.filtered ref.filtered], [0], [], [])
+else
+  AS_CASE([$at_arg_xyla_setref],
+    [:], [cp out TESTINPUT_PATH/$1-$2.ref],
+    [AT_CHECK([echo missing ref file TESTINPUT_PATH/$1-$2.ref; AS_EXIT([99])])])
+fi
+
+AT_CLEANUP])
+
+FOREACH([TREES],
+       [FOREACH([COMMON_TESTS, $1_TESTS],
+                [DEF_KAT1([$1], ]DOL()1[)])])
+
+###--------------------------------------------------------------------------
+### Verify checking is working properly.
+
+AT_SETUP([avl-check])
+AT_KEYWORDS([avl avl-check])
+AT_DATA([in], [= (_ -4 (_ =3 _)) !
+])
+XYLA_REDACT_ADDRESSES=t; export XYLA_REDACT_ADDRESSES
+AT_CHECK([LTRUN TESTPROG_PATH/avltest in], [2],
+[offending tree...
+       @%:@0x00000001 (n =   2)        (-) 4
+       @%:@0x00000000 (n =   1)            (=) 3
+],
+[XYLA-BT @%:@<root @<:@ADDR@:>@> BUG: @%:@<node @%:@0x00000000 3> key not above lower bound
+XYLA-AVL @%:@<root @<:@ADDR@:>@> BUG: @%:@<node @%:@0x00000001 4> incorrect balance annotation `-' /= left 0 - 1 right
+BUG: check failed: tree structure invalid (input pos = 19)
+])
+AT_CLEANUP
+
+AT_SETUP([rb-check])
+AT_KEYWORDS([rb rb-check])
+AT_DATA([in], [= ((_ 2 _) 4 (_ *3 _)) !
+])
+XYLA_REDACT_ADDRESSES=t; export XYLA_REDACT_ADDRESSES
+AT_CHECK([LTRUN TESTPROG_PATH/rbtest in], [2],
+[offending tree...
+       @%:@0x00000000 (n =   1)            ( ) 2
+       @%:@0x00000002 (n =   3)        ( ) 4
+       @%:@0x00000001 (n =   1)                (*) 3
+],
+[XYLA-RB @%:@<root @<:@ADDR@:>@> BUG: root @%:@<node @%:@0x00000002 4> is red
+XYLA-RB @%:@<root @<:@ADDR@:>@> BUG: red @%:@<node @%:@0x00000000 2> has red parent @%:@<node @%:@0x00000002 4>
+XYLA-BT @%:@<root @<:@ADDR@:>@> BUG: @%:@<node @%:@0x00000001 3> key not above lower bound
+XYLA-RB @%:@<root @<:@ADDR@:>@> BUG: @%:@<node @%:@0x00000002 4> left black-height 0 /= 1 right black-height
+BUG: check failed: tree structure invalid (input pos = 24)
+])
+AT_CLEANUP
+
+###--------------------------------------------------------------------------
+m4_define([DEF_SOAK], [AT_SETUP([$1-soak])
+
+AT_KEYWORDS([soak $1 $1-soak])
+AT_SKIP_IF([test $at_arg_xyla_soak != :])
+AT_SKIP_IF([test $PYTHON = :])
+
+args=
+AS_CASE([$soak_steps], [nil], [soak_steps=$dflt_steps])
+args=${args+$args }-n$soak_steps
+AS_CASE([$soak_seed], [nil], [], [args="${args+$args }-s '$soak_seed'"])
+AT_CHECK([$PYTHON TESTINPUT_PATH/soak $args dnl
+        LTRUN $adverb TESTPROG_PATH/$1test], [0], [], [])
+
+AT_CLEANUP])
+
+FOREACH([TREES], [DEF_SOAK([$1])])
+
+###----- That's all, folks --------------------------------------------------
diff --git a/t/testsuite.at b/t/testsuite.at
new file mode 120000 (symlink)
index 0000000..78fa5b5
--- /dev/null
@@ -0,0 +1 @@
+../.ext/cfd/build/testsuite.at
\ No newline at end of file
similarity index 100%
rename from treetest.c
rename to t/treetest.c
diff --git a/vars.am b/vars.am
new file mode 100644 (file)
index 0000000..e6dcb23
--- /dev/null
+++ b/vars.am
@@ -0,0 +1,52 @@
+### -*-makefile-*-
+###
+### Common build-system definitions
+###
+### (c) 2024 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of Xyla, a library of binary trees.
+###
+### Xyla 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.
+###
+### Xyla 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 Xyla.  If not, see <https://www.gnu.org/licenses/>.
+
+###--------------------------------------------------------------------------
+### Initial values for common variables.
+
+CLEANFILES              =
+EXTRA_DIST              =
+
+LDADD                   =
+
+pkgconfdir              = $(libdir)/pkgconfig
+pkgconf_DATA            =
+
+###--------------------------------------------------------------------------
+### Standard configuration substitutions.
+
+## Substitute tags in files.
+confsubst               = $(top_srcdir)/config/confsubst
+
+SUBSTITUTIONS = \
+       prefix=$(prefix) exec_prefix=$(exec_prefix) \
+       libdir=$(libdir) includedir=$(includedir) \
+       PACKAGE=$(PACKAGE) VERSION=$(VERSION)
+
+v_subst                         = $(v_subst_@AM_V@)
+v_subst_                = $(v_subst_@AM_DEFAULT_V@)
+v_subst_0               = @echo "  SUBST    $@";
+SUBST                   = $(v_subst)$(confsubst)
+
+###----- That's all, folks --------------------------------------------------
diff --git a/xyla.pc.in b/xyla.pc.in
new file mode 100644 (file)
index 0000000..049faf1
--- /dev/null
@@ -0,0 +1,8 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libxyla
+Description: Library of binary trees
+Version: @VERSION@