Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# cstring - Changes <!-- omit in toc -->


## 4.1.0-beta2 - 27th October 2026

* Defined `HAS_shwild` / `HAS_SHWILD` and `HAS_p99` / `HAS_P99` when those packages are detected;
* Unit tests **test.unit.insert-replace** and **test.unit.status-codes** include **shwild** under `CSTRING_HAS_SHWILD`, and **test.scratch.versions** prints **shwild** under `HAS_shwild`;


## 4.1.0-beta1 - 21st October 2026

* Brought the tip CMake runners up to **misc-dev-scripts** 0.6.2 and merged that gold into **prepare_cmake.sh**, keeping the cstring `-D` flags and `--gap-groups`;
Expand Down
27 changes: 23 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Purpose: Top-level CMake lists file for cstring
#
# Created: 21st December 2023
# Updated: 4th October 2026
# Updated: 27th October 2026
#
# ######################################################################## #

Expand Down Expand Up @@ -179,9 +179,12 @@ if(BUILD_TESTING)
message("-- CMake package STLSoft found (version ${STLSoft_VERSION}; ${STLSoft_REQUIRED_VERSION_} requested)")
endif()

if(DEFINED STLSOFT_INCLUDE_DIR OR DEFINED STLSoft_FOUND)
if(DEFINED STLSOFT_INCLUDE_DIR)

include_directories(${STLSOFT_INCLUDE_DIR})
endif()

if(DEFINED STLSOFT_INCLUDE_DIR OR DEFINED STLSoft_FOUND)

add_compile_definitions(HAS_STLSOFT)
add_compile_definitions(HAS_STLSoft)
Expand All @@ -204,7 +207,13 @@ if(BUILD_TESTING)

message("-- CMake package shwild found (version ${shwild_VERSION})")

add_compile_definitions(XTESTS_HAS_SHWILD)
add_compile_definitions(
HAS_shwild
HAS_SHWILD
)

add_compile_definitions(CSTRING_HAS_SHWILD)
add_compile_definitions(XTESTS_HAS_SHWILD) # Legacy form, and should be removed later
endif(shwild_FOUND)
endif(BUILD_TESTING)
endif()
Expand All @@ -216,11 +225,16 @@ endif(BUILD_TESTING)

if(BUILD_TESTING)

set(xTests_REQUIRED_VERSION_ 0.26.5)
set(xTests_REQUIRED_VERSION_ 0.28)

find_package(xTests ${xTests_REQUIRED_VERSION_} REQUIRED)

message("-- CMake package xTests found (version ${xTests_VERSION}; ${xTests_REQUIRED_VERSION_} requested)")

add_compile_definitions(
HAS_xTests
HAS_XTESTS
)
endif(BUILD_TESTING)


Expand All @@ -236,6 +250,11 @@ if(BUILD_TESTING)
if(p99_FOUND)

message("-- CMake package p99 found (version ${p99_VERSION})")

add_compile_definitions(
HAS_p99
HAS_P99
)
else()

message("-- CMake package p99 not found; performance percentiles and filesystem suites disabled")
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
| Date | News Item | Details |
| ------------------- | ------------------------------------ | ------- |
| Available from [**cstring** project on GitHub](https://synesissoftware.com/cstring): |
| 27th October 2026 | Release of [cstring 4.1.0-beta2](https://github.com/synesissoftware/cstring/releases/tag/4.1.0-beta2) | `HAS_shwild` / `HAS_p99`; tests use `CSTRING_HAS_SHWILD` |
| 21st October 2026 | Release of [cstring 4.1.0-beta1](https://github.com/synesissoftware/cstring/releases/tag/4.1.0-beta1) | helper gold 0.6.2; `CSTRING_VER_RELSTATUS` |
| 6th October 2026 | Release of [cstring 4.1.0-alpha1](https://github.com/synesissoftware/cstring/releases/tag/4.1.0-alpha1) | `djb2`, `FNV-1a`, and `SDBM`; `cstring_equal()` / `cstring_compare()`; `--wide-strings`; counted copies stop at `cch` |
| 4th October 2026 | Release of [cstring 4.0.19](https://github.com/synesissoftware/cstring/releases/tag/4.0.19) | lone CR ends a line; `numRead` includes EOL; readonly truncate; zero-size realloc frees; **test.performance.cstring_readline**; shortened test and example directories; **test.unit.cstring**; README usage modes |
Expand Down
7 changes: 4 additions & 3 deletions include/cstring/cstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Purpose: Definition of the cstring.core API.
*
* Created: 16th June 1994
* Updated: 21st October 2026
* Updated: 27th October 2026
*
* Home: http://synesis.com.au/software/
*
Expand Down Expand Up @@ -56,7 +56,7 @@
# define CSTRING_VER_CSTRING_H_CSTRING_MAJOR 3
# define CSTRING_VER_CSTRING_H_CSTRING_MINOR 13
# define CSTRING_VER_CSTRING_H_CSTRING_REVISION 3
# define CSTRING_VER_CSTRING_H_CSTRING_EDIT 103
# define CSTRING_VER_CSTRING_H_CSTRING_EDIT 104
#endif /* !CSTRING_DOCUMENTATION_SKIP_SECTION */


Expand Down Expand Up @@ -107,6 +107,7 @@
# define CSTRING_VER_4_1_0_A1 0x04010041
# define CSTRING_VER_4_1_0_A2 0x04010042
# define CSTRING_VER_4_1_0_B1 0x04010081
# define CSTRING_VER_4_1_0_B2 0x04010082
#endif /* !CSTRING_DOCUMENTATION_SKIP_SECTION */

/** \def CSTRING_VER_MAJOR
Expand All @@ -132,7 +133,7 @@
#define CSTRING_VER_MAJOR 4
#define CSTRING_VER_MINOR 1
#define CSTRING_VER_PATCH 0
#define CSTRING_VER_RELSTATUS 0x81
#define CSTRING_VER_RELSTATUS 0x82

#define CSTRING_VER \
(0\
Expand Down
30 changes: 30 additions & 0 deletions test/scratch/versions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
define_example_program(test.scratch.versions main.c)

if(shwild_FOUND)

target_link_libraries(test.scratch.versions
PRIVATE
shwild::core
)
endif()

if(TARGET xTests::core)

target_link_libraries(test.scratch.versions
PRIVATE
xTests::core
)
endif()

if(TARGET p99::p99)

target_link_libraries(test.scratch.versions
PRIVATE
p99::p99
)
elseif(TARGET p99::p99_static)

target_link_libraries(test.scratch.versions
PRIVATE
p99::p99_static
)
endif()
67 changes: 63 additions & 4 deletions test/scratch/versions/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,29 @@
* Purpose: Prints cstring composite version (and STLSoft when present).
*
* Created: 17th September 2026
* Updated: 17th September 2026
* Updated: 27th October 2026
*
* ////////////////////////////////////////////////////////////////////// */


#include <cstring/cstring.h>

#ifdef HAS_STLSOFT
#ifdef HAS_p99
# include <p99/p99.h>
#endif

#ifdef HAS_shwild
# include <shwild/shwild.h>
#endif

#ifdef HAS_STLSoft
# include <stlsoft/stlsoft.h>
#endif

#ifdef HAS_xTests
# include <xtests/xtests.h>
#endif

#include <stdio.h>
#include <stdlib.h>

Expand Down Expand Up @@ -48,6 +60,8 @@ version(

int main(int argc, char* argv[])
{
size_t efferent_counts = 0;

((void)&argc);
((void)&argv);

Expand All @@ -57,9 +71,40 @@ int main(int argc, char* argv[])
version(stdout, "", "cstring", "CSTRING_VER", libver);
}

#ifdef HAS_STLSOFT
#ifdef HAS_p99

if (0 == efferent_counts++)
{
fputs("\nefferent dependencies:\n", stdout);
}

{
unsigned const libver = (unsigned)P99_VER;

version(stdout, "\t", "p99", "P99_VER", libver);
}
#endif

#ifdef HAS_shwild

if (0 == efferent_counts++)
{
fputs("\nefferent dependencies:\n", stdout);
}

{
unsigned const libver = (unsigned)SHWILD_VER;

fputs("\nefferent dependencies:\n", stdout);
version(stdout, "\t", "shwild", "SHWILD_VER", libver);
}
#endif

#ifdef HAS_STLSoft

if (0 == efferent_counts++)
{
fputs("\nefferent dependencies:\n", stdout);
}

{
unsigned const libver = (unsigned)_STLSOFT_VER;
Expand All @@ -68,6 +113,20 @@ int main(int argc, char* argv[])
}
#endif

#ifdef HAS_xTests

if (0 == efferent_counts++)
{
fputs("\nefferent dependencies:\n", stdout);
}

{
unsigned const libver = (unsigned)_XTESTS_VER;

version(stdout, "\t", "xTests", "_XTESTS_VER", libver);
}
#endif

return EXIT_SUCCESS;
}

Expand Down
10 changes: 6 additions & 4 deletions test/unit/insert-replace/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Purpose: Unit-tests for cstring insert and replace functionality.
*
* Created: 4th June 2009
* Updated: 5th October 2026
* Updated: 27th October 2026
*
* ////////////////////////////////////////////////////////////////////// */

Expand All @@ -25,10 +25,10 @@

#include "../../cstring_testing.h"

#ifdef XTESTS_HAS_SHWILD
#ifdef CSTRING_HAS_SHWILD
/* shwild header files */
# include <shwild/shwild.h>
#endif /* XTESTS_HAS_SHWILD */
#endif /* CSTRING_HAS_SHWILD */

/* xTests header files */
#include <xtests/terse-api.h>
Expand Down Expand Up @@ -141,7 +141,9 @@ static void TEST_cstring_createN(void)
TEST_PTR_NE(NULL, str.ptr);
TEST_INT_GE(str.len, str.capacity);

#if defined(XTESTS_HAS_SHWILD) && !defined(CSTRING_USE_WIDE_STRINGS)
#if 0
#elif defined(CSTRING_HAS_SHWILD) &&\
!defined(CSTRING_USE_WIDE_STRINGS)

/* created string must be entirely '~' */
TEST_MS_DOES_NOT_MATCH("*[a-zA-Z0-9]*", str.ptr);
Expand Down
14 changes: 7 additions & 7 deletions test/unit/status-codes/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Purpose: Unit-tests `cstring_error()`, `cstring_getStatusCodeString()`.
*
* Created: 28th July 2011
* Updated: 4th October 2026
* Updated: 27th October 2026
*
* ////////////////////////////////////////////////////////////////////// */

Expand All @@ -23,10 +23,10 @@
* general includes
*/

#ifdef XTESTS_HAS_SHWILD
#ifdef CSTRING_HAS_SHWILD
/* shwild header files */
# include <shwild/shwild.h>
#endif /* XTESTS_HAS_SHWILD */
#endif /* CSTRING_HAS_SHWILD */

/* xTests header files */
#include <xtests/terse-api.h>
Expand Down Expand Up @@ -149,7 +149,7 @@ static void TEST_cstring_getStatusCodeString_KNOWN_CODES(void)
TEST_MS_NE("<<unknown error>>", cstring_getStatusCodeString(knownCodes[i]));
}}

#ifdef XTESTS_HAS_SHWILD
#ifdef CSTRING_HAS_SHWILD

TEST_MS_MATCHES("operation completed successfully", cstring_getStatusCodeString(CSTRING_RC_SUCCESS));
TEST_MS_MATCHES("out of memory", cstring_getStatusCodeString(CSTRING_RC_OUTOFMEMORY));
Expand All @@ -168,7 +168,7 @@ static void TEST_cstring_getStatusCodeString_KNOWN_CODES(void)
TEST_MS_MATCHES("an I/O error occured", cstring_getStatusCodeString(CSTRING_RC_IOERROR));
TEST_MS_MATCHES("system-specific failure occurred", cstring_getStatusCodeString(CSTRING_RC_SYSTEMSPECIFICFAILURE));
TEST_MS_MATCHES("request exceeded inherent or runtime limit", cstring_getStatusCodeString(CSTRING_RC_REQUESTTOOLARGE));
#endif /* XTESTS_HAS_SHWILD */
#endif /* CSTRING_HAS_SHWILD */
}

static void TEST_cstring_getStatusCodeString_UNKNOWN_CODES(void)
Expand All @@ -195,7 +195,7 @@ static void TEST_cstring_error_KNOWN_CODES(void)
TEST_MS_NE("<<unknown error>>", cstring_error(knownCodes[i]));
}}

#ifdef XTESTS_HAS_SHWILD
#ifdef CSTRING_HAS_SHWILD

TEST_MS_MATCHES("operation completed successfully", cstring_error(CSTRING_RC_SUCCESS));
TEST_MS_MATCHES("out of memory", cstring_error(CSTRING_RC_OUTOFMEMORY));
Expand All @@ -214,7 +214,7 @@ static void TEST_cstring_error_KNOWN_CODES(void)
TEST_MS_MATCHES("an I/O error occured", cstring_error(CSTRING_RC_IOERROR));
TEST_MS_MATCHES("system-specific failure occurred", cstring_error(CSTRING_RC_SYSTEMSPECIFICFAILURE));
TEST_MS_MATCHES("request exceeded inherent or runtime limit", cstring_error(CSTRING_RC_REQUESTTOOLARGE));
#endif /* XTESTS_HAS_SHWILD */
#endif /* CSTRING_HAS_SHWILD */
}

static void TEST_cstring_error_UNKNOWN_CODES(void)
Expand Down
Loading