Skip to content
Open
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
39 changes: 31 additions & 8 deletions .github/workflows/ci-cell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
if: runner.os == 'Linux' && inputs.c-compiler == 'clang'
run: sudo apt-get update && sudo apt-get install -y clang

- name: Install TCC (Ubuntu)
if: runner.os == 'Linux' && inputs.c-compiler == 'tcc'
run: sudo apt-get update && sudo apt-get install -y tcc

- name: Setup MSYS2 MinGW
if: runner.os == 'Windows' && inputs.c-compiler == 'mingw'
uses: msys2/setup-msys2@v2
Expand All @@ -58,6 +62,14 @@ jobs:

mkdir -p "$DEPS"

# TinyCC is for the cstring C path only; build deps with GCC/G++.
dep_c="${{ inputs.c-compiler }}"
dep_cxx="${{ inputs.cpp-compiler }}"
if [ "$dep_c" = "tcc" ]; then
dep_c=gcc
dep_cxx=g++
fi

# 1. STLSoft
git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC"
if [ "${{ inputs.c-compiler }}" = "cl" ]; then
Expand All @@ -80,8 +92,8 @@ jobs:
else
cmake -S "$STLSRC" -B "$STLBUILD" \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
-DCMAKE_C_COMPILER="$dep_c" \
-DCMAKE_CXX_COMPILER="$dep_cxx" \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
Expand Down Expand Up @@ -113,8 +125,8 @@ jobs:
else
cmake -S "$SHWSRC" -B "$SHWBUILD" \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
-DCMAKE_C_COMPILER="$dep_c" \
-DCMAKE_CXX_COMPILER="$dep_cxx" \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
Expand Down Expand Up @@ -147,8 +159,8 @@ jobs:
else
cmake -S "$XTSRC" -B "$XTBUILD" \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
-DCMAKE_C_COMPILER="$dep_c" \
-DCMAKE_CXX_COMPILER="$dep_cxx" \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
Expand Down Expand Up @@ -177,13 +189,21 @@ jobs:
-DBUILD_EXAMPLES=ON \
-DBUILD_TESTING=ON
else
# TinyCC: C library + C unit-tests only (deps built with GCC above).
build_examples=ON
no_cpp_api=OFF
if [ "${{ inputs.c-compiler }}" = "tcc" ]; then
build_examples=OFF
no_cpp_api=ON
fi
cmake -B build -S . \
-DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \
-DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \
-DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \
-DBUILD_EXAMPLES=ON \
-DBUILD_TESTING=ON
-DBUILD_EXAMPLES=${build_examples} \
-DBUILD_TESTING=ON \
-DNO_CSTRING_CPP_API:BOOL=${no_cpp_api}
fi

- name: Build
Expand All @@ -209,6 +229,7 @@ jobs:
run-examples:
name: Examples (${{ inputs.cell-id }})
needs: build
if: inputs.c-compiler != 'tcc'
runs-on: ${{ inputs.os }}

steps:
Expand Down Expand Up @@ -271,6 +292,7 @@ jobs:
test-component:
name: Component tests (${{ inputs.cell-id }})
needs: build
if: inputs.c-compiler != 'tcc'
runs-on: ${{ inputs.os }}

steps:
Expand Down Expand Up @@ -302,6 +324,7 @@ jobs:
test-scratch:
name: Scratch tests (${{ inputs.cell-id }})
needs: build
if: inputs.c-compiler != 'tcc'
continue-on-error: true
runs-on: ${{ inputs.os }}

Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ name: CI
on:
push:
branches:
- master
- dev
- boilerplate
- dev
- idiomatic
- master
- rc1
- rc2
- rc3
- rc4
- rc5
- update
pull_request:

concurrency:
Expand All @@ -36,6 +34,10 @@ jobs:
os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- id: linux-tcc
os: ubuntu-latest
c_compiler: tcc
cpp_compiler: g++
- id: macos-clang
os: macos-latest
c_compiler: clang
Expand Down Expand Up @@ -74,6 +76,9 @@ jobs:
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- os: ubuntu-latest
c_compiler: tcc
cpp_compiler: g++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
Expand All @@ -91,6 +96,10 @@ jobs:
if: runner.os == 'Linux' && matrix.c_compiler == 'clang'
run: sudo apt-get update && sudo apt-get install -y clang

- name: Install TCC (Ubuntu)
if: runner.os == 'Linux' && matrix.c_compiler == 'tcc'
run: sudo apt-get update && sudo apt-get install -y tcc

- name: Setup MSYS2 MinGW
if: runner.os == 'Windows' && matrix.c_compiler == 'mingw'
uses: msys2/setup-msys2@v2
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ perf_test/

scripts/internal/

/include/b64/
/include/shwild/
/include/xcontract/
/include/xcover/
/include/xtests/
/src/b64/
/src/shwild/
/src/xcontract/
/src/xcover/
Expand Down
1 change: 1 addition & 0 deletions .sis/project_name.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cstring
6 changes: 3 additions & 3 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# cstring - Authors <!-- omit in toc -->


## Major Contributors
## Major Contributors:

* Matt Wilson ([mwsis](https://github.com/mwsis))
* **Matt Wilson** ([mwsis](https://github.com/mwsis));


## Defect reports, fixes and suggestions (for which we are very grateful)
## Defect reports, fixes and suggestions (for which we are very grateful):

* \<none>

Expand Down
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# cstring - CHANGES <!-- omit in toc -->


## 4.0.14-alpha1 - 7th August 2026

* Aligned project boilerplate with **b64** / **Pantheios** (scripts, markdown, CI branches, `.sis`);
* Added **.sis/project_name.txt**; helper scripts load `ProjectName` for status echoes;
* CI `on.push.branches` set to lexicographic Pantheios set (`boilerplate`, `dev`, `idiomatic`, `master`, `rc1`–`rc3`);
* **CMakeLists.txt** — set `CMP0177` for CMake ≥ 3.31;
* **.gitignore** — removed stray **b64** include/src ignore entries;
* **README.md** — C++ badge; CI badge alt text; **Introduction**; help links; heading fixes;
* **AUTHORS.md**, **NEWS.md**, **FAQ.md**, **KNOWN_ISSUES.md** — peer layout/content alignment;
* Added **HOW_YOU_CAN_HELP.md**;
* **TODO.md** — marked `CMAKE_INSTALL_LIBDIR` complete;
* **run_all_examples.sh**, **run_all_unit_tests.sh**, **run_all_scratch_tests.sh** — coloured list/execute path output (via `tput`);
* Linux **TinyCC** (**tcc**) CI cell and install-smoke row (via `apt-get install tcc`); deps built with **GCC**/**G++**; **`NO_CSTRING_CPP_API`** and examples skipped for the **tcc** cell;
* **CMakeLists.txt** — when `CMAKE_C_COMPILER_ID` is **TinyCC**, use `CMAKE_C_STANDARD` **99** (distro **tcc** lacks ISO C17);


## 4.0.13 - 2nd August 2026

* Modular GitHub Actions CI (**ci.yml** + **ci-cell.yml**), with install-smoke and MinGW cells;
Expand Down
12 changes: 11 additions & 1 deletion 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: 2nd August 2026
# Updated: 7th August 2026
#
# ######################################################################## #

Expand All @@ -14,6 +14,9 @@
# CMake

cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.31")
cmake_policy(SET CMP0177 NEW)
endif()

# require out-of-source builds
file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
Expand Down Expand Up @@ -64,6 +67,13 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

# Distro TinyCC (e.g. Ubuntu `tcc` 0.9.27) does not implement ISO C17; keep
# a portable C99 dialect so the Linux TCC CI cell can exercise the C path.
if(CMAKE_C_COMPILER_ID STREQUAL "TinyCC")

set(CMAKE_C_STANDARD 99)
endif()

if(MSVC)

if(MSVC_VERSION LESS 1800)
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PROJECT_NAME = "cstring"
PROJECT_BRIEF = "Extensible C-style strings and vectors of such, for Unix and Windows"
PROJECT_NUMBER = 4.0.13
PROJECT_NUMBER = 4.0.14-alpha1

# Prefer SIS_CMAKE_BUILD_DIR-aligned output (same convention as Diagnosticism).
# ./dox/ remains gitignored for legacy/local runs that override OUTPUT_DIRECTORY.
Expand Down
55 changes: 49 additions & 6 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ it will be used to create one.
## Table of Contents <!-- omit in toc -->

- [Q1: "How do I build cstring?"](#q1-how-do-i-build-cstring)
- [Q2: "Does cstring have its own unit-tests?"](#q2-does-cstring-have-its-own-unit-tests)
- [Q3: "How do I build without the C++ examples and tests?"](#q3-how-do-i-build-without-the-c-examples-and-tests)
- [Q4: "Where are the examples?"](#q4-where-are-the-examples)
- [Q2: "How do I install cstring?"](#q2-how-do-i-install-cstring)
- [Q3: "How do I use cstring?"](#q3-how-do-i-use-cstring)
- [Q4: "Does cstring have its own unit-tests?"](#q4-does-cstring-have-its-own-unit-tests)
- [Q5: "How do I build without the C++ examples and tests?"](#q5-how-do-i-build-without-the-c-examples-and-tests)
- [Q6: "Where are the examples?"](#q6-where-are-the-examples)


# FAQs: <!-- omit in toc -->
Expand All @@ -37,7 +39,48 @@ $ ./prepare_cmake.sh -m
Execute `$ ./prepare_cmake.sh --help` for the full set of options.


## Q2: "Does cstring have its own unit-tests?"
## Q2: "How do I install cstring?"

See [INSTALL.md](./INSTALL.md) for details of how to install **cstring**.


## Q3: "How do I use cstring?"

Include **cstring/cstring.h** (and **cstring/cstring.vector.h** where needed)
and link against **libcstring** (the **CMake** target is `cstring::core`).
Create and destroy instances with `cstring_create()` / `cstring_destroy()`,
and mutate with `cstring_assign()`, `cstring_append()`, and related APIs.

A minimal sketch:

```c
#include <cstring/cstring.h>

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

int main(void)
{
cstring_t cs;
CSTRING_RC rc = cstring_create(&cs, "Hello");

if (CSTRING_RC_SUCCESS != rc)
{
return EXIT_FAILURE;
}

printf("%s\n", cs.ptr);

cstring_destroy(&cs);

return EXIT_SUCCESS;
}
```

See [INSTALL.md](./INSTALL.md) and the examples under **examples/**.


## Q4: "Does cstring have its own unit-tests?"

Yes. Automated tests live under:

Expand All @@ -50,7 +93,7 @@ and run with **run_all_unit_tests.sh** (and **CTest** where configured). Tests
require **STLSoft** and **xTests** (and may optionally recognise **shwild**).


## Q3: "How do I build without the C++ examples and tests?"
## Q5: "How do I build without the C++ examples and tests?"

Pass `--no-cpp` (or `-C`) to **prepare_cmake.sh**, which sets CMake
`NO_CSTRING_CPP_API=ON`. That omits C++ examples and remaining C++ tests.
Expand All @@ -59,7 +102,7 @@ The **C** unit-tests still require **STLSoft** and **xTests** unless you also
pass `--disable-testing` / `-T`.


## Q4: "Where are the examples?"
## Q6: "Where are the examples?"

Examples live under **examples/** (`c/` and `cpp/`), each with a short
**README.md**. They are built when `BUILD_EXAMPLES` is on (the default); omit
Expand Down
Loading
Loading