summaryrefslogtreecommitdiff
path: root/archived/ptlibzippy/contrib/blast
diff options
context:
space:
mode:
Diffstat (limited to 'archived/ptlibzippy/contrib/blast')
-rw-r--r--archived/ptlibzippy/contrib/blast/CMakeLists.txt166
-rw-r--r--archived/ptlibzippy/contrib/blast/README4
-rw-r--r--archived/ptlibzippy/contrib/blast/blast-test.c42
-rw-r--r--archived/ptlibzippy/contrib/blast/blast.c423
-rw-r--r--archived/ptlibzippy/contrib/blast/blast.h85
-rw-r--r--archived/ptlibzippy/contrib/blast/blastConfig.cmake.in18
-rw-r--r--archived/ptlibzippy/contrib/blast/test.pkbin0 -> 8 bytes
-rw-r--r--archived/ptlibzippy/contrib/blast/test.txt1
-rw-r--r--archived/ptlibzippy/contrib/blast/test/CMakeLists.txt202
-rw-r--r--archived/ptlibzippy/contrib/blast/test/add_subdirectory_exclude_test.cmake.in27
-rw-r--r--archived/ptlibzippy/contrib/blast/test/add_subdirectory_test.cmake.in25
-rw-r--r--archived/ptlibzippy/contrib/blast/test/find_package_no_components_test.cmake.in24
-rw-r--r--archived/ptlibzippy/contrib/blast/test/find_package_test.cmake.in24
-rw-r--r--archived/ptlibzippy/contrib/blast/test/find_package_wrong_components_test.cmake.in24
-rw-r--r--archived/ptlibzippy/contrib/blast/tester.cmake28
15 files changed, 1093 insertions, 0 deletions
diff --git a/archived/ptlibzippy/contrib/blast/CMakeLists.txt b/archived/ptlibzippy/contrib/blast/CMakeLists.txt
new file mode 100644
index 0000000000..80d7805ddf
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/CMakeLists.txt
@@ -0,0 +1,166 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+project(
+ blast
+ VERSION 1.3.0
+ LANGUAGES C
+ DESCRIPTION "A library for creating zipfiles based in PTlibzippy"
+ HOMEPAGE_URL "http://projecttick.org/p/zlib")
+
+option(PTLIBZIPPY_BLAST_BUILD_SHARED "Enable building blast shared library" ON)
+option(PTLIBZIPPY_BLAST_BUILD_STATIC "Enable building blast static library" ON)
+option(PTLIBZIPPY_BLAST_BUILD_TESTING "Enable building tests for blast" ON)
+option(PTLIBZIPPY_BLAST_INSTALL "Enable installation of blast" ON)
+
+include(GNUInstallDirs)
+include(CMakePackageConfigHelpers)
+
+if(WIN32 OR CYGWIN)
+ set(ptlibzippyblast_static_suffix "s")
+ set(CMAKE_DEBUG_POSTFIX "d")
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+endif(WIN32 OR CYGWIN)
+
+function(blast_findTestEnv testName)
+ set(testEnv "PATH=")
+
+ if(MSVC OR MINGW)
+ set(separator "\\\;")
+ else()
+ set(separator ":")
+ endif()
+
+ string(APPEND testEnv "$<TARGET_FILE_DIR:BLAST::BLAST>${separator}")
+ string(APPEND testEnv "$ENV{PATH}")
+
+ set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
+endfunction(blast_findTestEnv testName)
+
+if(PTLIBZIPPY_BLAST_BUILD_SHARED)
+ add_library(ptlibzippy_blast_blast SHARED
+ blast.c
+ blast.h)
+
+ add_library(BLAST::BLAST ALIAS ptlibzippy_blast_blast)
+
+ if(NOT CYGWIN)
+ set_target_properties(ptlibzippy_blast_blast
+ PROPERTIES
+ SOVERSION ${blast_VERSION_MAJOR}
+ VERSION ${blast_VERSION})
+ endif(NOT CYGWIN)
+
+ set_target_properties(ptlibzippy_blast_blast
+ PROPERTIES
+ EXPORT_NAME BLAST
+ OUTPUT_NAME blast)
+
+ if(PTLIBZIPPY_BLAST_BUILD_TESTING)
+ enable_testing()
+ add_executable(ptlibzippy_blast_blast-test blast-test.c)
+ target_link_libraries(ptlibzippy_blast_blast-test PRIVATE ptlibzippy_blast_blast)
+
+ add_test(NAME ptlibzippy_blast_blast-test
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
+ "$<TARGET_FILE:ptlibzippy_blast_blast-test>"
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}")
+
+ if(MSVC
+ OR MSYS
+ OR MINGW
+ OR CYGWIN)
+ blast_findtestenv(ptlibzippy_blast_blast-test)
+ endif(
+ MSVC
+ OR MSYS
+ OR MINGW
+ OR CYGWIN)
+ endif(PTLIBZIPPY_BLAST_BUILD_TESTING)
+endif(PTLIBZIPPY_BLAST_BUILD_SHARED)
+
+if(PTLIBZIPPY_BLAST_BUILD_STATIC)
+ add_library(ptlibzippy_blast_blastStatic STATIC
+ blast.c
+ blast.h)
+
+ add_library(BLAST::BLASTSTATIC ALIAS ptlibzippy_blast_blastStatic)
+
+ set_target_properties(ptlibzippy_blast_blastStatic
+ PROPERTIES
+ EXPORT_NAME BLASTSTATIC
+ OUTPUT_NAME blast${ptlibzippyblast_static_suffix})
+
+ if(PTLIBZIPPY_BLAST_BUILD_TESTING)
+ enable_testing()
+ add_executable(ptlibzippy_blast_testStatic blast-test.c)
+ target_link_libraries(ptlibzippy_blast_testStatic
+ PRIVATE ptlibzippy_blast_blastStatic)
+
+ add_test(NAME ptlibzippy_blast_testStatic
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
+ "$<TARGET_FILE:ptlibzippy_blast_testStatic>"
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}")
+ endif(PTLIBZIPPY_BLAST_BUILD_TESTING)
+endif(PTLIBZIPPY_BLAST_BUILD_STATIC)
+
+if(PTLIBZIPPY_BLAST_BUILD_TESTING)
+ add_subdirectory(test)
+endif(PTLIBZIPPY_BLAST_BUILD_TESTING)
+
+if(PTLIBZIPPY_BLAST_INSTALL)
+ if(PTLIBZIPPY_BLAST_BUILD_SHARED)
+ install(
+ TARGETS ptlibzippy_blast_blast
+ COMPONENT Runtime
+ EXPORT ptlibzippyBlastSharedExport
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ install(
+ EXPORT ptlibzippyBlastSharedExport
+ FILE blast-shared.cmake
+ NAMESPACE BLAST::
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
+
+ if(MSVC)
+ install(
+ FILES $<TARGET_PDB_FILE:ptlibzippy_blast_blast>
+ COMPONENT Development
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ CONFIGURATIONS Debug OR RelWithDebInfo
+ OPTIONAL)
+ endif(MSVC)
+ endif(PTLIBZIPPY_BLAST_BUILD_SHARED)
+
+ if(PTLIBZIPPY_BLAST_BUILD_STATIC)
+ install(
+ TARGETS ptlibzippy_blast_blastStatic
+ COMPONENT Development
+ EXPORT ptlibzippyBlastStaticExport
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ install(
+ EXPORT ptlibzippyBlastStaticExport
+ FILE blast-static.cmake
+ NAMESPACE BLAST::
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
+ endif(PTLIBZIPPY_BLAST_BUILD_STATIC)
+
+ configure_package_config_file(
+ ${blast_SOURCE_DIR}/blastConfig.cmake.in
+ ${blast_BINARY_DIR}/blastConfig.cmake
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
+
+ write_basic_package_version_file(
+ "${blast_BINARY_DIR}/blastConfigVersion.cmake"
+ VERSION "${blast_VERSION}"
+ COMPATIBILITY AnyNewerVersion)
+
+ install(FILES ${blast_BINARY_DIR}/blastConfig.cmake
+ ${blast_BINARY_DIR}/blastConfigVersion.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
+ install(
+ FILES blast.h
+ COMPONENT Development
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+endif(PTLIBZIPPY_BLAST_INSTALL)
diff --git a/archived/ptlibzippy/contrib/blast/README b/archived/ptlibzippy/contrib/blast/README
new file mode 100644
index 0000000000..e3a60b3f5c
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/README
@@ -0,0 +1,4 @@
+Read blast.h for purpose and usage.
+
+Mark Adler
+madler@alumni.caltech.edu
diff --git a/archived/ptlibzippy/contrib/blast/blast-test.c b/archived/ptlibzippy/contrib/blast/blast-test.c
new file mode 100644
index 0000000000..471dfd6d82
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/blast-test.c
@@ -0,0 +1,42 @@
+#include "blast.h" /* prototype for blast() */
+
+/* Example of how to use blast() */
+#include <stdio.h>
+#include <stdlib.h>
+
+#define CHUNK 16384
+
+local unsigned inf(void *how, unsigned char **buf)
+{
+ static unsigned char hold[CHUNK];
+
+ *buf = hold;
+ return fread(hold, 1, CHUNK, (FILE *)how);
+}
+
+local int outf(void *how, unsigned char *buf, unsigned len)
+{
+ return fwrite(buf, 1, len, (FILE *)how) != len;
+}
+
+/* Decompress a PKWare Compression Library stream from stdin to stdout */
+int main(void)
+{
+ int ret;
+ unsigned left;
+
+ /* decompress to stdout */
+ left = 0;
+ ret = blast(inf, stdin, outf, stdout, &left, NULL);
+ if (ret != 0)
+ fprintf(stderr, "blast error: %d\n", ret);
+
+ /* count any leftover bytes */
+ while (getchar() != EOF)
+ left++;
+ if (left)
+ fprintf(stderr, "blast warning: %u unused bytes of input\n", left);
+
+ /* return blast() error code */
+ return ret;
+}
diff --git a/archived/ptlibzippy/contrib/blast/blast.c b/archived/ptlibzippy/contrib/blast/blast.c
new file mode 100644
index 0000000000..f105b32816
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/blast.c
@@ -0,0 +1,423 @@
+/* blast.c
+ * Copyright (C) 2003, 2012, 2013 Mark Adler
+ * Copyright (C) 2026 Project Tick
+ * For conditions of distribution and use, see copyright notice in blast.h
+ * version 1.3, 24 Aug 2013
+ *
+ * blast.c decompresses data compressed by the PKWare Compression Library.
+ * This function provides functionality similar to the explode() function of
+ * the PKWare library, hence the name "blast".
+ *
+ * This decompressor is based on the excellent format description provided by
+ * Ben Rudiak-Gould in comp.compression on August 13, 2001. Interestingly, the
+ * example Ben provided in the post is incorrect. The distance 110001 should
+ * instead be 111000. When corrected, the example byte stream becomes:
+ *
+ * 00 04 82 24 25 8f 80 7f
+ *
+ * which decompresses to "AIAIAIAIAIAIA" (without the quotes).
+ */
+
+/*
+ * Change history:
+ *
+ * 1.0 12 Feb 2003 - First version
+ * 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data
+ * 1.2 24 Oct 2012 - Add note about using binary mode in stdio
+ * - Fix comparisons of differently signed integers
+ * 1.3 24 Aug 2013 - Return unused input from blast()
+ * - Fix test code to correctly report unused input
+ * - Enable the provision of initial input to blast()
+ */
+
+#include <stddef.h> /* for NULL */
+#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
+#include "blast.h" /* prototype for blast() */
+
+#define MAXBITS 13 /* maximum code length */
+#define MAXWIN 4096 /* maximum window size */
+
+/* input and output state */
+struct state {
+ /* input state */
+ blast_in infun; /* input function provided by user */
+ void *inhow; /* opaque information passed to infun() */
+ unsigned char *in; /* next input location */
+ unsigned left; /* available input at in */
+ int bitbuf; /* bit buffer */
+ int bitcnt; /* number of bits in bit buffer */
+
+ /* input limit error return state for bits() and decode() */
+ jmp_buf env;
+
+ /* output state */
+ blast_out outfun; /* output function provided by user */
+ void *outhow; /* opaque information passed to outfun() */
+ unsigned next; /* index of next write location in out[] */
+ int first; /* true to check distances (for first 4K) */
+ unsigned char out[MAXWIN]; /* output buffer and sliding window */
+};
+
+/*
+ * Return need bits from the input stream. This always leaves less than
+ * eight bits in the buffer. bits() works properly for need == 0.
+ *
+ * Format notes:
+ *
+ * - Bits are stored in bytes from the least significant bit to the most
+ * significant bit. Therefore bits are dropped from the bottom of the bit
+ * buffer, using shift right, and new bytes are appended to the top of the
+ * bit buffer, using shift left.
+ */
+local int bits(struct state *s, int need)
+{
+ int val; /* bit accumulator */
+
+ /* load at least need bits into val */
+ val = s->bitbuf;
+ while (s->bitcnt < need) {
+ if (s->left == 0) {
+ s->left = s->infun(s->inhow, &(s->in));
+ if (s->left == 0) longjmp(s->env, 1); /* out of input */
+ }
+ val |= (int)(*(s->in)++) << s->bitcnt; /* load eight bits */
+ s->left--;
+ s->bitcnt += 8;
+ }
+
+ /* drop need bits and update buffer, always zero to seven bits left */
+ s->bitbuf = val >> need;
+ s->bitcnt -= need;
+
+ /* return need bits, zeroing the bits above that */
+ return val & ((1 << need) - 1);
+}
+
+/*
+ * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of
+ * each length, which for a canonical code are stepped through in order.
+ * symbol[] are the symbol values in canonical order, where the number of
+ * entries is the sum of the counts in count[]. The decoding process can be
+ * seen in the function decode() below.
+ */
+struct huffman {
+ short *count; /* number of symbols of each length */
+ short *symbol; /* canonically ordered symbols */
+};
+
+/*
+ * Decode a code from the stream s using huffman table h. Return the symbol or
+ * a negative value if there is an error. If all of the lengths are zero, i.e.
+ * an empty code, or if the code is incomplete and an invalid code is received,
+ * then -9 is returned after reading MAXBITS bits.
+ *
+ * Format notes:
+ *
+ * - The codes as stored in the compressed data are bit-reversed relative to
+ * a simple integer ordering of codes of the same lengths. Hence below the
+ * bits are pulled from the compressed data one at a time and used to
+ * build the code value reversed from what is in the stream in order to
+ * permit simple integer comparisons for decoding.
+ *
+ * - The first code for the shortest length is all ones. Subsequent codes of
+ * the same length are simply integer decrements of the previous code. When
+ * moving up a length, a one bit is appended to the code. For a complete
+ * code, the last code of the longest length will be all zeros. To support
+ * this ordering, the bits pulled during decoding are inverted to apply the
+ * more "natural" ordering starting with all zeros and incrementing.
+ */
+local int decode(struct state *s, struct huffman *h)
+{
+ int len; /* current number of bits in code */
+ int code; /* len bits being decoded */
+ int first; /* first code of length len */
+ int count; /* number of codes of length len */
+ int index; /* index of first code of length len in symbol table */
+ int bitbuf; /* bits from stream */
+ int left; /* bits left in next or left to process */
+ short *next; /* next number of codes */
+
+ bitbuf = s->bitbuf;
+ left = s->bitcnt;
+ code = first = index = 0;
+ len = 1;
+ next = h->count + 1;
+ while (1) {
+ while (left--) {
+ code |= (bitbuf & 1) ^ 1; /* invert code */
+ bitbuf >>= 1;
+ count = *next++;
+ if (code < first + count) { /* if length len, return symbol */
+ s->bitbuf = bitbuf;
+ s->bitcnt = (s->bitcnt - len) & 7;
+ return h->symbol[index + (code - first)];
+ }
+ index += count; /* else update for next length */
+ first += count;
+ first <<= 1;
+ code <<= 1;
+ len++;
+ }
+ left = (MAXBITS+1) - len;
+ if (left == 0) break;
+ if (s->left == 0) {
+ s->left = s->infun(s->inhow, &(s->in));
+ if (s->left == 0) longjmp(s->env, 1); /* out of input */
+ }
+ bitbuf = *(s->in)++;
+ s->left--;
+ if (left > 8) left = 8;
+ }
+ return -9; /* ran out of codes */
+}
+
+/*
+ * Given a list of repeated code lengths rep[0..n-1], where each byte is a
+ * count (high four bits + 1) and a code length (low four bits), generate the
+ * list of code lengths. This compaction reduces the size of the object code.
+ * Then given the list of code lengths length[0..n-1] representing a canonical
+ * Huffman code for n symbols, construct the tables required to decode those
+ * codes. Those tables are the number of codes of each length, and the symbols
+ * sorted by length, retaining their original order within each length. The
+ * return value is zero for a complete code set, negative for an over-
+ * subscribed code set, and positive for an incomplete code set. The tables
+ * can be used if the return value is zero or positive, but they cannot be used
+ * if the return value is negative. If the return value is zero, it is not
+ * possible for decode() using that table to return an error--any stream of
+ * enough bits will resolve to a symbol. If the return value is positive, then
+ * it is possible for decode() using that table to return an error for received
+ * codes past the end of the incomplete lengths.
+ */
+local int construct(struct huffman *h, const unsigned char *rep, int n)
+{
+ int symbol; /* current symbol when stepping through length[] */
+ int len; /* current length when stepping through h->count[] */
+ int left; /* number of possible codes left of current length */
+ short offs[MAXBITS+1]; /* offsets in symbol table for each length */
+ short length[256]; /* code lengths */
+
+ /* convert compact repeat counts into symbol bit length list */
+ symbol = 0;
+ do {
+ len = *rep++;
+ left = (len >> 4) + 1;
+ len &= 15;
+ do {
+ length[symbol++] = len;
+ } while (--left);
+ } while (--n);
+ n = symbol;
+
+ /* count number of codes of each length */
+ for (len = 0; len <= MAXBITS; len++)
+ h->count[len] = 0;
+ for (symbol = 0; symbol < n; symbol++)
+ (h->count[length[symbol]])++; /* assumes lengths are within bounds */
+ if (h->count[0] == n) /* no codes! */
+ return 0; /* complete, but decode() will fail */
+
+ /* check for an over-subscribed or incomplete set of lengths */
+ left = 1; /* one possible code of zero length */
+ for (len = 1; len <= MAXBITS; len++) {
+ left <<= 1; /* one more bit, double codes left */
+ left -= h->count[len]; /* deduct count from possible codes */
+ if (left < 0) return left; /* over-subscribed--return negative */
+ } /* left > 0 means incomplete */
+
+ /* generate offsets into symbol table for each length for sorting */
+ offs[1] = 0;
+ for (len = 1; len < MAXBITS; len++)
+ offs[len + 1] = offs[len] + h->count[len];
+
+ /*
+ * put symbols in table sorted by length, by symbol order within each
+ * length
+ */
+ for (symbol = 0; symbol < n; symbol++)
+ if (length[symbol] != 0)
+ h->symbol[offs[length[symbol]]++] = symbol;
+
+ /* return zero for complete set, positive for incomplete set */
+ return left;
+}
+
+/*
+ * Decode PKWare Compression Library stream.
+ *
+ * Format notes:
+ *
+ * - First byte is 0 if literals are uncoded or 1 if they are coded. Second
+ * byte is 4, 5, or 6 for the number of extra bits in the distance code.
+ * This is the base-2 logarithm of the dictionary size minus six.
+ *
+ * - Compressed data is a combination of literals and length/distance pairs
+ * terminated by an end code. Literals are either Huffman coded or
+ * uncoded bytes. A length/distance pair is a coded length followed by a
+ * coded distance to represent a string that occurs earlier in the
+ * uncompressed data that occurs again at the current location.
+ *
+ * - A bit preceding a literal or length/distance pair indicates which comes
+ * next, 0 for literals, 1 for length/distance.
+ *
+ * - If literals are uncoded, then the next eight bits are the literal, in the
+ * normal bit order in the stream, i.e. no bit-reversal is needed. Similarly,
+ * no bit reversal is needed for either the length extra bits or the distance
+ * extra bits.
+ *
+ * - Literal bytes are simply written to the output. A length/distance pair is
+ * an instruction to copy previously uncompressed bytes to the output. The
+ * copy is from distance bytes back in the output stream, copying for length
+ * bytes.
+ *
+ * - Distances pointing before the beginning of the output data are not
+ * permitted.
+ *
+ * - Overlapped copies, where the length is greater than the distance, are
+ * allowed and common. For example, a distance of one and a length of 518
+ * simply copies the last byte 518 times. A distance of four and a length of
+ * twelve copies the last four bytes three times. A simple forward copy
+ * ignoring whether the length is greater than the distance or not implements
+ * this correctly.
+ */
+local int decomp(struct state *s)
+{
+ int lit; /* true if literals are coded */
+ int dict; /* log2(dictionary size) - 6 */
+ int symbol; /* decoded symbol, extra bits for distance */
+ int len; /* length for copy */
+ unsigned dist; /* distance for copy */
+ int copy; /* copy counter */
+ unsigned char *from, *to; /* copy pointers */
+ static int virgin = 1; /* build tables once */
+ static short litcnt[MAXBITS+1], litsym[256]; /* litcode memory */
+ static short lencnt[MAXBITS+1], lensym[16]; /* lencode memory */
+ static short distcnt[MAXBITS+1], distsym[64]; /* distcode memory */
+ static struct huffman litcode = {litcnt, litsym}; /* length code */
+ static struct huffman lencode = {lencnt, lensym}; /* length code */
+ static struct huffman distcode = {distcnt, distsym};/* distance code */
+ /* bit lengths of literal codes */
+ static const unsigned char litlen[] = {
+ 11, 124, 8, 7, 28, 7, 188, 13, 76, 4, 10, 8, 12, 10, 12, 10, 8, 23, 8,
+ 9, 7, 6, 7, 8, 7, 6, 55, 8, 23, 24, 12, 11, 7, 9, 11, 12, 6, 7, 22, 5,
+ 7, 24, 6, 11, 9, 6, 7, 22, 7, 11, 38, 7, 9, 8, 25, 11, 8, 11, 9, 12,
+ 8, 12, 5, 38, 5, 38, 5, 11, 7, 5, 6, 21, 6, 10, 53, 8, 7, 24, 10, 27,
+ 44, 253, 253, 253, 252, 252, 252, 13, 12, 45, 12, 45, 12, 61, 12, 45,
+ 44, 173};
+ /* bit lengths of length codes 0..15 */
+ static const unsigned char lenlen[] = {2, 35, 36, 53, 38, 23};
+ /* bit lengths of distance codes 0..63 */
+ static const unsigned char distlen[] = {2, 20, 53, 230, 247, 151, 248};
+ static const short base[16] = { /* base for length codes */
+ 3, 2, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24, 40, 72, 136, 264};
+ static const char extra[16] = { /* extra bits for length codes */
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8};
+
+ /* set up decoding tables (once--might not be thread-safe) */
+ if (virgin) {
+ construct(&litcode, litlen, sizeof(litlen));
+ construct(&lencode, lenlen, sizeof(lenlen));
+ construct(&distcode, distlen, sizeof(distlen));
+ virgin = 0;
+ }
+
+ /* read header */
+ lit = bits(s, 8);
+ if (lit > 1) return -1;
+ dict = bits(s, 8);
+ if (dict < 4 || dict > 6) return -2;
+
+ /* decode literals and length/distance pairs */
+ do {
+ if (bits(s, 1)) {
+ /* get length */
+ symbol = decode(s, &lencode);
+ len = base[symbol] + bits(s, extra[symbol]);
+ if (len == 519) break; /* end code */
+
+ /* get distance */
+ symbol = len == 2 ? 2 : dict;
+ dist = decode(s, &distcode) << symbol;
+ dist += bits(s, symbol);
+ dist++;
+ if (s->first && dist > s->next)
+ return -3; /* distance too far back */
+
+ /* copy length bytes from distance bytes back */
+ do {
+ to = s->out + s->next;
+ from = to - dist;
+ copy = MAXWIN;
+ if (s->next < dist) {
+ from += copy;
+ copy = dist;
+ }
+ copy -= s->next;
+ if (copy > len) copy = len;
+ len -= copy;
+ s->next += copy;
+ do {
+ *to++ = *from++;
+ } while (--copy);
+ if (s->next == MAXWIN) {
+ if (s->outfun(s->outhow, s->out, s->next)) return 1;
+ s->next = 0;
+ s->first = 0;
+ }
+ } while (len != 0);
+ }
+ else {
+ /* get literal and write it */
+ symbol = lit ? decode(s, &litcode) : bits(s, 8);
+ s->out[s->next++] = symbol;
+ if (s->next == MAXWIN) {
+ if (s->outfun(s->outhow, s->out, s->next)) return 1;
+ s->next = 0;
+ s->first = 0;
+ }
+ }
+ } while (1);
+ return 0;
+}
+
+/* See comments in blast.h */
+int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
+ unsigned *left, unsigned char **in)
+{
+ struct state s; /* input/output state */
+ int err; /* return value */
+
+ /* initialize input state */
+ s.infun = infun;
+ s.inhow = inhow;
+ if (left != NULL && *left) {
+ s.left = *left;
+ s.in = *in;
+ }
+ else
+ s.left = 0;
+ s.bitbuf = 0;
+ s.bitcnt = 0;
+
+ /* initialize output state */
+ s.outfun = outfun;
+ s.outhow = outhow;
+ s.next = 0;
+ s.first = 1;
+
+ /* return if bits() or decode() tries to read past available input */
+ if (setjmp(s.env) != 0) /* if came back here via longjmp(), */
+ err = 2; /* then skip decomp(), return error */
+ else
+ err = decomp(&s); /* decompress */
+
+ /* return unused input */
+ if (left != NULL)
+ *left = s.left;
+ if (in != NULL)
+ *in = s.left ? s.in : NULL;
+
+ /* write any leftover output and update the error code if needed */
+ if (err != 1 && s.next && s.outfun(s.outhow, s.out, s.next) && err == 0)
+ err = 1;
+ return err;
+}
diff --git a/archived/ptlibzippy/contrib/blast/blast.h b/archived/ptlibzippy/contrib/blast/blast.h
new file mode 100644
index 0000000000..560b1ad0a4
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/blast.h
@@ -0,0 +1,85 @@
+/* blast.h -- interface for blast.c
+ Copyright (C) 2003, 2012, 2013 Mark Adler
+ Copyright (C) 2026 Project Tick
+ version 1.3, 24 Aug 2013
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the author be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Mark Adler madler@alumni.caltech.edu
+ */
+
+#define local static /* for local function definitions */
+
+/*
+ * blast() decompresses the PKWare Data Compression Library (DCL) compressed
+ * format. It provides the same functionality as the explode() function in
+ * that library. (Note: PKWare overused the "implode" verb, and the format
+ * used by their library implode() function is completely different and
+ * incompatible with the implode compression method supported by PKZIP.)
+ *
+ * The binary mode for stdio functions should be used to assure that the
+ * compressed data is not corrupted when read or written. For example:
+ * fopen(..., "rb") and fopen(..., "wb").
+ */
+
+
+typedef unsigned (*blast_in)(void *how, unsigned char **buf);
+typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len);
+/* Definitions for input/output functions passed to blast(). See below for
+ * what the provided functions need to do.
+ */
+
+
+int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
+ unsigned *left, unsigned char **in);
+/* Decompress input to output using the provided infun() and outfun() calls.
+ * On success, the return value of blast() is zero. If there is an error in
+ * the source data, i.e. it is not in the proper format, then a negative value
+ * is returned. If there is not enough input available or there is not enough
+ * output space, then a positive error is returned.
+ *
+ * The input function is invoked: len = infun(how, &buf), where buf is set by
+ * infun() to point to the input buffer, and infun() returns the number of
+ * available bytes there. If infun() returns zero, then blast() returns with
+ * an input error. (blast() only asks for input if it needs it.) inhow is for
+ * use by the application to pass an input descriptor to infun(), if desired.
+ *
+ * If left and in are not NULL and *left is not zero when blast() is called,
+ * then the *left bytes at *in are consumed for input before infun() is used.
+ *
+ * The output function is invoked: err = outfun(how, buf, len), where the bytes
+ * to be written are buf[0..len-1]. If err is not zero, then blast() returns
+ * with an output error. outfun() is always called with len <= 4096. outhow
+ * is for use by the application to pass an output descriptor to outfun(), if
+ * desired.
+ *
+ * If there is any unused input, *left is set to the number of bytes that were
+ * read and *in points to them. Otherwise *left is set to zero and *in is set
+ * to NULL. If left or in are NULL, then they are not set.
+ *
+ * The return codes are:
+ *
+ * 2: ran out of input before completing decompression
+ * 1: output error before completing decompression
+ * 0: successful decompression
+ * -1: literal flag not zero or one
+ * -2: dictionary size not in 4..6
+ * -3: distance is too far back
+ *
+ * At the bottom of blast.c is an example program that uses blast() that can be
+ * compiled to produce a command-line decompression filter by defining TEST.
+ */
diff --git a/archived/ptlibzippy/contrib/blast/blastConfig.cmake.in b/archived/ptlibzippy/contrib/blast/blastConfig.cmake.in
new file mode 100644
index 0000000000..5909ac4f58
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/blastConfig.cmake.in
@@ -0,0 +1,18 @@
+@PACKAGE_INIT@
+
+set(_blast_supported_components "shared" "static")
+
+if(blast_FIND_COMPONENTS)
+ foreach(_comp ${blast_FIND_COMPONENTS})
+ if(NOT _comp IN_LIST _blast_supported_components)
+ set(blast_FOUND False)
+ set(blast_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
+ endif(NOT _comp IN_LIST _blast_supported_components)
+
+ include("${CMAKE_CURRENT_LIST_DIR}/blast-${_comp}.cmake")
+ endforeach(_comp ${blast_FIND_COMPONENTS})
+else(blast_FIND_COMPONENTS)
+ foreach(_component_config IN LISTS _blast_supported_components)
+ include("${CMAKE_CURRENT_LIST_DIR}/blast-${_component_config}.cmake")
+ endforeach(_component_config IN LISTS _blast_supported_components)
+endif(blast_FIND_COMPONENTS)
diff --git a/archived/ptlibzippy/contrib/blast/test.pk b/archived/ptlibzippy/contrib/blast/test.pk
new file mode 100644
index 0000000000..be10b2bbb2
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test.pk
Binary files differ
diff --git a/archived/ptlibzippy/contrib/blast/test.txt b/archived/ptlibzippy/contrib/blast/test.txt
new file mode 100644
index 0000000000..bfdf1c5dca
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test.txt
@@ -0,0 +1 @@
+AIAIAIAIAIAIA \ No newline at end of file
diff --git a/archived/ptlibzippy/contrib/blast/test/CMakeLists.txt b/archived/ptlibzippy/contrib/blast/test/CMakeLists.txt
new file mode 100644
index 0000000000..d8dc209be6
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test/CMakeLists.txt
@@ -0,0 +1,202 @@
+# if we are built from with PTlibzippy, use this path's)
+if(DEFINED PTLIBZIPPY_BUILD_BLAST)
+ set(WORK_DIR ${PTlibzippy_BINARY_DIR})
+ set(inst_setup ptlibzippy_install)
+else(DEFINED PTLIBZIPPY_BUILD_BLAST)
+ set(WORK_DIR ${blast_BINARY_DIR})
+ set(inst_setup ptlibzippy_blast_install)
+
+ add_test(
+ NAME ptlibzippy_blast_install
+ COMMAND ${CMAKE_COMMAND} --install ${blast_BINARY_DIR} --prefix
+ ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
+ WORKING_DIRECTORY ${blast_BINARY_DIR})
+
+ set_tests_properties(ptlibzippy_blast_install
+ PROPERTIES
+ FIXTURES_SETUP ptlibzippy_blast_install)
+endif(DEFINED PTLIBZIPPY_BUILD_BLAST)
+
+set(BLAST_TEST_INSTALL_DIR "${WORK_DIR}/test/test_install")
+set(BLAST_TEST_PACKAGE_DIR
+ "${BLAST_TEST_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/blast")
+set(BLAST_FIND_PACKAGE_ARGS
+ "-Dblast_DIR=${BLAST_TEST_PACKAGE_DIR}")
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
+ @ONLY)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
+ @ONLY)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
+ @ONLY)
+
+# CMAKE_GENERATOR_PLATFORM doesn't work in the if
+set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
+
+if(GENERATOR)
+ set(PLATFORM "-A ${GENERATOR}")
+endif(GENERATOR)
+
+#
+# findpackage_test
+#
+add_test(
+ NAME ptlibzippy_blast_find_package_configure
+ COMMAND
+ ${CMAKE_COMMAND} ${PLATFORM}
+ -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_INSTALL_PREFIX=${BLAST_TEST_INSTALL_DIR}
+ ${BLAST_FIND_PACKAGE_ARGS}
+ --fresh
+ -G "${CMAKE_GENERATOR}"
+ -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
+
+add_test(
+ NAME ptlibzippy_blast_find_package_build
+ COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
+
+set_tests_properties(
+ ptlibzippy_blast_find_package_configure
+ PROPERTIES
+ FIXTURES_REQUIRED ${inst_setup}
+ FIXTURES_SETUP blast_fp_config)
+
+set_tests_properties(ptlibzippy_blast_find_package_build
+ PROPERTIES
+ FIXTURES_REQUIRED blast_fp_config)
+
+#
+# add_subdirectory_test
+#
+add_test(
+ NAME ptlibzippy_blast_add_subdirectory_configure
+ COMMAND
+ ${CMAKE_COMMAND} ${PLATFORM}
+ -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_INSTALL_PREFIX=${BLAST_TEST_INSTALL_DIR}
+ ${BLAST_FIND_PACKAGE_ARGS}
+ --fresh
+ -G "${CMAKE_GENERATOR}"
+ -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
+
+add_test(
+ NAME ptlibzippy_blast_add_subdirectory_build
+ COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
+
+set_tests_properties(
+ ptlibzippy_blast_add_subdirectory_configure
+ PROPERTIES
+ FIXTURES_REQUIRED ${inst_setup}
+ FIXTURES_SETUP blast_as_config)
+
+set_tests_properties(ptlibzippy_blast_add_subdirectory_build
+ PROPERTIES
+ FIXTURES_REQUIRED blast_as_config)
+
+#
+# add_subdirectory_exclude_test
+#
+add_test(
+ NAME ptlibzippy_blast_add_subdirectory_exclude_configure
+ COMMAND
+ ${CMAKE_COMMAND} ${PLATFORM}
+ -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_INSTALL_PREFIX=${BLAST_TEST_INSTALL_DIR}
+ ${BLAST_FIND_PACKAGE_ARGS}
+ --fresh
+ -G "${CMAKE_GENERATOR}"
+ -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
+
+add_test(
+ NAME ptlibzippy_blast_add_subdirectory_exclude_build
+ COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
+ WORKING_DIRECTORY
+ ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
+
+set_tests_properties(ptlibzippy_blast_add_subdirectory_exclude_configure
+ PROPERTIES
+ FIXTURES_REQUIRED ${inst_setup}
+ FIXTURES_SETUP blast_asx_config)
+
+set_tests_properties(ptlibzippy_blast_add_subdirectory_exclude_build
+ PROPERTIES
+ FIXTURES_REQUIRED blast_asx_config)
+
+#
+# findpackage_no_components_test
+#
+add_test(
+ NAME ptlibzippy_blast_find_package_no_components_configure
+ COMMAND
+ ${CMAKE_COMMAND} ${PLATFORM}
+ -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
+ -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_INSTALL_PREFIX=${BLAST_TEST_INSTALL_DIR}
+ ${BLAST_FIND_PACKAGE_ARGS}
+ --fresh
+ -G "${CMAKE_GENERATOR}"
+ -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
+
+set_tests_properties(
+ ptlibzippy_blast_find_package_no_components_configure
+ PROPERTIES
+ FIXTURES_REQUIRED ${inst_setup})
+
+if(NOT PTLIBZIPPY_BLAST_BUILD_SHARED OR NOT PTLIBZIPPY_BLAST_BUILD_STATIC)
+ set_tests_properties(ptlibzippy_blast_find_package_no_components_configure
+ PROPERTIES
+ WILL_FAIL TRUE)
+endif(NOT PTLIBZIPPY_BLAST_BUILD_SHARED OR NOT PTLIBZIPPY_BLAST_BUILD_STATIC)
+
+#
+# findpackage_wrong_components_test
+#
+add_test(
+ NAME ptlibzippy_blast_find_package_wrong_components_configure
+ COMMAND
+ ${CMAKE_COMMAND} ${PLATFORM}
+ -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
+ -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_INSTALL_PREFIX=${BLAST_TEST_INSTALL_DIR}
+ ${BLAST_FIND_PACKAGE_ARGS}
+ --fresh
+ -G "${CMAKE_GENERATOR}"
+ -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
+
+set_tests_properties(ptlibzippy_blast_find_package_wrong_components_configure
+ PROPERTIES
+ FIXTURES_REQUIRED ${inst_setup}
+ WILL_FAIL TRUE)
diff --git a/archived/ptlibzippy/contrib/blast/test/add_subdirectory_exclude_test.cmake.in b/archived/ptlibzippy/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
new file mode 100644
index 0000000000..8d225a6fc7
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+project(
+ blast_find_package
+ LANGUAGES C
+ VERSION @blast_VERSION@)
+
+option(PTLIBZIPPY_BLAST_BUILD_SHARED "" @PTLIBZIPPY_BLAST_BUILD_SHARED@)
+option(PTLIBZIPPY_BLAST_BUILD_STATIC "" @PTLIBZIPPY_BLAST_BUILD_STATIC@)
+option(PTLIBZIPPY_BLAST_BUILD_TESTING "" @PTLIBZIPPY_BLAST_BUILD_TESTING@)
+
+add_subdirectory(@blast_SOURCE_DIR@
+ ${CMAKE_CURRENT_BINARY_DIR}/blast
+ EXCLUDE_FROM_ALL)
+
+set(BLAST_SRCS
+ @blast_SOURCE_DIR@/blast-test.c)
+
+if(PTLIBZIPPY_BLAST_BUILD_SHARED)
+ add_executable(test_example ${BLAST_SRCS})
+ target_link_libraries(test_example BLAST::BLAST)
+endif(PTLIBZIPPY_BLAST_BUILD_SHARED)
+
+if(PTLIBZIPPY_BLAST_BUILD_STATIC)
+ add_executable(test_example_static ${BLAST_SRCS})
+ target_link_libraries(test_example_static BLAST::BLASTSTATIC)
+endif(PTLIBZIPPY_BLAST_BUILD_STATIC)
diff --git a/archived/ptlibzippy/contrib/blast/test/add_subdirectory_test.cmake.in b/archived/ptlibzippy/contrib/blast/test/add_subdirectory_test.cmake.in
new file mode 100644
index 0000000000..f1f4aed1dc
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test/add_subdirectory_test.cmake.in
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+project(
+ blast_find_package
+ LANGUAGES C
+ VERSION @blast_VERSION@)
+
+option(PTLIBZIPPY_BLAST_BUILD_SHARED "" @PTLIBZIPPY_BLAST_BUILD_SHARED@)
+option(PTLIBZIPPY_BLAST_BUILD_STATIC "" @PTLIBZIPPY_BLAST_BUILD_STATIC@)
+option(PTLIBZIPPY_BLAST_BUILD_TESTING "" @PTLIBZIPPY_BLAST_BUILD_TESTING@)
+
+add_subdirectory(@blast_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/blast)
+
+set(BLAST_SRCS
+ @blast_SOURCE_DIR@/blast-test.c)
+
+if(PTLIBZIPPY_BLAST_BUILD_SHARED)
+ add_executable(test_example ${BLAST_SRCS})
+ target_link_libraries(test_example BLAST::BLAST)
+endif(PTLIBZIPPY_BLAST_BUILD_SHARED)
+
+if(PTLIBZIPPY_BLAST_BUILD_STATIC)
+ add_executable(test_example_static ${BLAST_SRCS})
+ target_link_libraries(test_example_static BLAST::BLASTSTATIC)
+endif(PTLIBZIPPY_BLAST_BUILD_STATIC)
diff --git a/archived/ptlibzippy/contrib/blast/test/find_package_no_components_test.cmake.in b/archived/ptlibzippy/contrib/blast/test/find_package_no_components_test.cmake.in
new file mode 100644
index 0000000000..bea059ebf5
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test/find_package_no_components_test.cmake.in
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+project(
+ blast_find_package
+ LANGUAGES C
+ VERSION @blast_VERSION@)
+
+option(PTLIBZIPPY_BLAST_BUILD_SHARED "" @PTLIBZIPPY_BLAST_BUILD_SHARED@)
+option(PTLIBZIPPY_BLAST_BUILD_STATIC "" @PTLIBZIPPY_BLAST_BUILD_STATIC@)
+
+find_package(blast REQUIRED CONFIG)
+
+set(BLAST_SRCS
+ @blast_SOURCE_DIR@/blast-test.c)
+
+if(PTLIBZIPPY_BLAST_BUILD_SHARED)
+ add_executable(test_example ${BLAST_SRCS})
+ target_link_libraries(test_example BLAST::BLAST)
+endif(PTLIBZIPPY_BLAST_BUILD_SHARED)
+
+if(PTLIBZIPPY_BLAST_BUILD_STATIC)
+ add_executable(test_example_static ${BLAST_SRCS})
+ target_link_libraries(test_example_static BLAST::BLASTSTATIC)
+endif(PTLIBZIPPY_BLAST_BUILD_STATIC)
diff --git a/archived/ptlibzippy/contrib/blast/test/find_package_test.cmake.in b/archived/ptlibzippy/contrib/blast/test/find_package_test.cmake.in
new file mode 100644
index 0000000000..f140c88766
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test/find_package_test.cmake.in
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+project(
+ blast_find_package
+ LANGUAGES C
+ VERSION @blast_VERSION@)
+
+option(PTLIBZIPPY_BLAST_BUILD_SHARED "" @PTLIBZIPPY_BLAST_BUILD_SHARED@)
+option(PTLIBZIPPY_BLAST_BUILD_STATIC "" @PTLIBZIPPY_BLAST_BUILD_STATIC@)
+
+set(BLAST_SRCS
+ @blast_SOURCE_DIR@/blast-test.c)
+
+if(PTLIBZIPPY_BLAST_BUILD_SHARED)
+ find_package(blast REQUIRED COMPONENTS shared CONFIG)
+ add_executable(test_example ${BLAST_SRCS})
+ target_link_libraries(test_example BLAST::BLAST)
+endif(PTLIBZIPPY_BLAST_BUILD_SHARED)
+
+if(PTLIBZIPPY_BLAST_BUILD_STATIC)
+ find_package(blast REQUIRED COMPONENTS static CONFIG)
+ add_executable(test_example_static ${BLAST_SRCS})
+ target_link_libraries(test_example_static BLAST::BLASTSTATIC)
+endif(PTLIBZIPPY_BLAST_BUILD_STATIC)
diff --git a/archived/ptlibzippy/contrib/blast/test/find_package_wrong_components_test.cmake.in b/archived/ptlibzippy/contrib/blast/test/find_package_wrong_components_test.cmake.in
new file mode 100644
index 0000000000..604ebc96f6
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/test/find_package_wrong_components_test.cmake.in
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+project(
+ blast_find_package
+ LANGUAGES C
+ VERSION @blast_VERSION@)
+
+option(PTLIBZIPPY_BLAST_BUILD_SHARED "" @PTLIBZIPPY_BLAST_BUILD_SHARED@)
+option(PTLIBZIPPY_BLAST_BUILD_STATIC "" @PTLIBZIPPY_BLAST_BUILD_STATIC@)
+
+find_package(blast REQUIRED COMPONENTS wrong CONFIG)
+
+set(BLAST_SRCS
+ @blast_SOURCE_DIR@/blast-test.c)
+
+if(PTLIBZIPPY_BLAST_BUILD_SHARED)
+ add_executable(test_example ${BLAST_SRCS})
+ target_link_libraries(test_example BLAST::BLAST)
+endif(PTLIBZIPPY_BLAST_BUILD_SHARED)
+
+if(PTLIBZIPPY_BLAST_BUILD_STATIC)
+ add_executable(test_example_static ${BLAST_SRCS})
+ target_link_libraries(test_example_static BLAST::BLASTSTATIC)
+endif(PTLIBZIPPY_BLAST_BUILD_STATIC)
diff --git a/archived/ptlibzippy/contrib/blast/tester.cmake b/archived/ptlibzippy/contrib/blast/tester.cmake
new file mode 100644
index 0000000000..14e69fca50
--- /dev/null
+++ b/archived/ptlibzippy/contrib/blast/tester.cmake
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.12...3.31)
+
+#CMAKE_ARGV0 = ${CMAKE_COMMAND}
+#CMAKE_ARGV1 = -P
+#CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
+#CMAKE_ARGV3 = "$<TARGET_FILE:blast-test>"
+#CMAKE_ARGV4 = "${CMAKE_CURRENT_SOURCE_DIR}"
+#CMAKE_ARGV5 = "${CMAKE_CURRENT_BINARY_DIR}")
+
+execute_process(COMMAND ${CMAKE_ARGV3}
+ INPUT_FILE "${CMAKE_ARGV4}/test.pk"
+ OUTPUT_FILE "${CMAKE_ARGV5}/output.txt"
+ RESULT_VARIABLE RESULT)
+
+if(RESULT)
+ message(FATAL_ERROR "Command exitited with: ${RESULT}")
+endif(RESULT)
+
+execute_process(COMMAND ${CMAKE_ARGV0} -E compare_files
+ "${CMAKE_ARGV4}/test.txt"
+ "${CMAKE_ARGV5}/output.txt"
+ RESULT_VARIABLE RESULT)
+
+file(REMOVE "${CMAKE_ARGV5}/output.txt")
+
+if(RESULT)
+ message(FATAL_ERROR "Files differ")
+endif(RESULT)