From ea81e1e5a171712449c4bb05fbea89bb7faf219d Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 13:24:29 +1000 Subject: [PATCH 01/12] .gitattributes --- .gitattributes | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 1f01d95a..e6605d10 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,17 @@ *.c linguist-language=C -*.h linguist-language=C +*.cmake linguist-language=CMake +*.cmd linguist-detectable=false *.cpp linguist-language=C++ +*.cxx linguist-language=C++ +*.dsp linguist-detectable=false +*.dsw linguist-detectable=false +*.h linguist-language=C *.hpp linguist-language=C++ *.html linguist-detectable=false +*.hxx linguist-language=C++ +*.sh linguist-detectable=false +*.sln linguist-detectable=false +*.vcxproj linguist-detectable=false +*.vimrc linguist-detectable=false +CMakeLists.txt linguist-language=CMake makefile linguist-detectable=false - From 70184e45c042c23d3229c03e7400adb295c80fee Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 13:25:27 +1000 Subject: [PATCH 02/12] .vimrc --- .vimrc | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .vimrc diff --git a/.vimrc b/.vimrc new file mode 100644 index 00000000..1d307f94 --- /dev/null +++ b/.vimrc @@ -0,0 +1,69 @@ +" Synesis C/C++ project .vimrc — aligned with .sis/.vscode/c_cxx/settings.json + +set nocompatible +filetype indent plugin on +syntax enable +set autoindent +set backspace=indent,eol,start +set hlsearch +set incsearch +set number + +" files.insertFinalNewline +set eol +set fixeol + +" editor.renderWhitespace: all +set list +set listchars=tab:->,trail:-,extends:>,precedes:<,nbsp:+ + +" editor.detectIndentation: false — global defaults (editor.tabSize: 4, insertSpaces: true) +set colorcolumn=76 +set expandtab +set shiftwidth=4 +set softtabstop=4 +set tabstop=4 + +" colorcolumn draws a full-column tint in Vim (not a VS Code-style 1px line). +" Keep it subtle via the ColorColumn highlight group; reapply after colorscheme changes. +if has('termguicolors') + " set termguicolors +endif + +function! s:ConfigureColorColumn() abort + highlight ColorColumn ctermbg=236 guibg=#2a2a2a cterm=NONE gui=NONE +endfunction + +call s:ConfigureColorColumn() +autocmd ColorScheme * call s:ConfigureColorColumn() + +" files.trimTrailingWhitespace +autocmd BufWritePre * %s/\s\+$//e + +augroup sis_c_cxx + autocmd! + + " [c] / [cpp] + autocmd FileType c,cpp setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,64,68,72,76 + + " [rust] + autocmd FileType rs setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=76 + + " [cmake] + autocmd FileType cmake setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 + + " [shellscript] + autocmd FileType sh,bash,zsh setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 colorcolumn=60,76 + + " [bat] + autocmd FileType bat,dosbatch setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,76 + + " [json] / [markdown] / [yaml] / [ruby] + autocmd FileType json,markdown,yaml,ruby setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 + + " [python] + autocmd FileType python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,76 + + " [toml] + autocmd FileType toml setlocal noexpandtab tabstop=2 shiftwidth=2 softtabstop=2 +augroup END From a02712de1618fdfac50e475e59c2d898c0f40559 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 13:25:33 +1000 Subject: [PATCH 03/12] .gitignore --- .gitignore | 211 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 177 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 777a11f0..0eb8783d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,109 +1,252 @@ +# Synesis Information Systems .gitignore for C/C++ libraries +# +# NOTE (recls 1.9): unlike later lines, this branch retains custom makefiles +# under build/ and Visual C++ project/workspace files (*.dsp / *.dsw). Do not +# add /build/gcc* patterns or a blanket *.dsp ignore. + # directories (by name) -include/b64/ -include/shwild/ -include/xcontract/ -include/xcover/ -include/xtests/ +/.git-old/ +/.vs/ + +.svn/ -src/b64/ -src/shwild/ -src/xcontract/ -src/xcover/ -src/xtests/ +.classpath +/.idea/ +/__pycache__ +/node_modules -_internal/ +/_build/ +/_build-ci/ +/_internal/ +/_analyses/ +/bin/ +/ipch/ +/lib/ bin/ +ipch/ +lib/ + +/doc/ +/docs/ +/dox/ +/dox +/ideas/ +ideas/ +/included/ +/releases/ +/scratch/ +/temp/ -doc/ +/--include +/--src +/-include +/-src -ideas/ +/examples/bin +/examples/c/bin +/examples/cpp/bin + +/examples/lib +/examples/c/lib +/examples/cpp/lib + +projects/util/vc10-generated/ perf_test/ scripts/internal/ +/include/b64/ +/include/shwild/ +/include/xcontract/ +/include/xcover/ +/include/xtests/ +/src/b64/ +/src/shwild/ +/src/xcontract/ +/src/xcover/ +/src/xtests/ + +Debug Multithreaded DLL/ +Debug Multithreaded Dll/ +Debug Multithreaded pseudoUNIX/ +Debug Multithreaded pseudoUnix/ +Debug Multithreaded/ Debug/ -DebugMt/ -DebugDll/ +DebugDLL/ DebugDLLUNIX/ -Debug Multithreaded/ -Debug Multithreaded DLL/ -Unicode Debug/ -Unicode Debug Multithreaded/ -Unicode Debug Multithreaded DLL/ +DebugDll/ +DebugMTDLL/ +DebugMTDll/ +DebugMTUnix/ +DebugMt/ +DebugNox/ +DebugUNIX/ +DebugUnix/ +Release Multithreaded DLL/ +Release Multithreaded Dll/ +Release Multithreaded pseudoUNIX/ +Release Multithreaded pseudoUnix/ +Release Multithreaded/ Release/ -ReleaseMt/ -ReleaseDll/ +ReleaseDLL/ ReleaseDLLUNIX/ -Release Multithreaded/ -Release Multithreaded DLL/ -Unicode Release/ -Unicode Release Multithreaded/ +ReleaseDll/ +ReleaseMTDLL/ +ReleaseMTDll/ +ReleaseMTUnix/ +ReleaseMt/ +ReleaseNox/ +ReleaseUnix/ +UDebug/ +UDebugMt/ +URelease/ +UReleaseMt/ +Unicode Debug Multithreaded DLL/ +Unicode Debug Multithreaded Dll/ +Unicode Debug Multithreaded/ +Unicode Debug/ Unicode Release Multithreaded DLL/ +Unicode Release Multithreaded Dll/ +Unicode Release Multithreaded/ +Unicode Release/ + +Win32/ +x64/ vc71/ vc8/ vc9/ + # directories (by pattern) +# Intentionally omitted for 1.9 (tracked makefile trees live here): +# /build/gcc3* +# /build/gcc4* + +/build/ar* +/build/bc5* +/build/como* +/build/cw* +/build/icl* +/build/vc5* +/build/*.zip + +/include-*/ + + # files (by name) .DS_Store .ruby-version +.ruby-version-exclusions +.svnignore +.svnignore-at-root .update_deps -update_deps.cmd +.env.local +.env.development.local +.env.test.local +.env.production.local list_changes.cmd +logging-bailout.txt prepare.cmd +sh.exe.stackdump +tidydir.cmd +update_deps.cmd build/makefile.tmpl build/makefile.tools.xml +build/shwild.tmplgen +build/CMakeCache.txt +include/fastformat/internal/dos2unix.has.been.performed include/pantheios/internal/dos2unix.has.been.performed +include/stlsoft/dos2unix.has.been.performed +include/stlsoft/internal/dos2unix.has.been.performed + +test/testpatterns.orj +test/tests-plan.txt -# TODO: remove these exclusions when be.loader released -include/pantheios/backends/bec.loader.h -src/backends/be/be.loader.c -src/backends/bec.loader.cpp -src/backends/bel/bel.loader.c -src/backends/ber/ber.loader.c # files (by pattern) *~ +*.*~ +*.???_obj +*.VC.db +*.VC.opendb *.a *.app +*.aps +*.b64 +*.bak *.chm +*.class +*.d +*.diff *.dll *.dylib *.exe *.gch +*.gem +*.idb *.ilk +*.iobj +*.ipch +*.ipdb +*.la +*.lai *.lib +*.lo *.log *.ncb *.o *.obj *.opensdf *.opt +*.org *.out *.pch *.pdb -*.sdf +*.pyc +*.rar +*.res *.sbr *.scc +*.sdf +*.slo *.so *.suo *.swp +*.sw[ponm] +*.test +*.tlog +*.tmp +*.unsuccessfulbuild *.vcproj*.user *.vcxproj*.user +*.csproj*user +*.vcproj*user +*.vcxproj*user +*.xcuserstate +*.zip *.vc71.sln *.vc8.sln *.vc9.sln +RCa0* +RCb0* + +build/*.tmplgen +build/*.tmpl +build/*.tools.xml +npm-debug.log* +yarn-debug.log* +yarn-error.log* From 8c793d10b8825d52cc5bc747ac9369d612406bf6 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 13:27:20 +1000 Subject: [PATCH 04/12] VS Code settings --- .vscode/settings.json | 182 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3fe51d2b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,182 @@ +{ + "[bat]": { + "editor.insertSpaces": true, + "editor.rulers": [ 60, 76 ], + "editor.tabSize": 4, + }, + "[c]": { + "editor.insertSpaces": true, + "editor.rulers": [ 60, 64, 68, 72, 76 ], + "editor.tabSize": 4, + }, + "[cmake]": { + "editor.insertSpaces": false, + "editor.tabSize": 4, + }, + "[cpp]": { + "editor.insertSpaces": true, + "editor.rulers": [ 60, 64, 68, 72, 76 ], + "editor.tabSize": 4, + }, + "[json]": { + "editor.insertSpaces": true, + "editor.tabSize": 2, + }, + "[markdown]": { + "editor.insertSpaces": true, + "editor.tabSize": 2, + }, + "[python]": { + "diffEditor.ignoreTrimWhitespace": false, + "editor.insertSpaces": true, + "editor.rulers": [ 51, 60, 61, 76 ], + "editor.tabSize": 4, + }, + "[ruby]": { + "editor.insertSpaces": true, + "editor.tabSize": 2, + }, + "[shellscript]": { + "editor.insertSpaces": true, + "editor.rulers": [ 60, 76 ], + "editor.tabSize": 2, + }, + "[toml]": { + "editor.insertSpaces": false, + "editor.tabSize": 2, + }, + "[yaml]": { + "editor.insertSpaces": true, + "editor.tabSize": 2, + }, + "cmake.configureOnOpen": false, + "editor.detectIndentation": false, + "editor.insertSpaces": false, + "editor.renderWhitespace": "all", + "editor.rulers": [ 76 ], + "editor.tabSize": 2, + "files.associations": { + "__bit_reference": "cpp", + "__bits": "cpp", + "__config": "cpp", + "__debug": "cpp", + "__errc": "cpp", + "__functional_03": "cpp", + "__functional_base": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__memory": "cpp", + "__mutex_base": "cpp", + "__node_handle": "cpp", + "__nullptr": "cpp", + "__split_buffer": "cpp", + "__string": "cpp", + "__threading_support": "cpp", + "__tree": "cpp", + "__tuple": "cpp", + "__verbose_abort": "cpp", + "algorithm": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "charconv": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "console_functions.h": "c", + "corecrt.h": "c", + "crtdefs.h": "c", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "exception": "cpp", + "execution": "cpp", + "fcntl.h": "c", + "format": "cpp", + "forward_list": "cpp", + "functional": "cpp", + "implicit_link.h": "c", + "initializer_list": "cpp", + "io.h": "c", + "iomanip": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "map": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "numeric": "cpp", + "optional": "cpp", + "ostream": "cpp", + "queue": "cpp", + "random": "cpp", + "ranges": "cpp", + "ratio": "cpp", + "semaphore": "cpp", + "set": "cpp", + "setenv.h": "c", + "shwild.h": "c", + "span": "cpp", + "sstream": "cpp", + "stack": "cpp", + "stdexcept": "cpp", + "stdio.h": "c", + "stop_token": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "terse-api.h": "c", + "text_encoding": "cpp", + "thread": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "uio.h": "c", + "unixem.h": "c", + "unordered_map": "cpp", + "util.h": "c", + "utility": "cpp", + "variant": "cpp", + "vector": "cpp", + "xfacet": "cpp", + "xhash": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocbuf": "cpp", + "xlocinfo": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xstring": "cpp", + "xtests.internal.string.c": "cpp", + "xtr1common": "cpp", + "xtree": "cpp", + "xutility": "cpp", + }, + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true, + "git.mergeEditor": false, +} From 16949d4606a6aac2f2c55b6f1d1f50d5ed653942 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 13:41:57 +1000 Subject: [PATCH 05/12] chore: build helpers --- .sis/project_name.txt | 1 + .sis/script_info_lines.txt | 3 + build_cmake.sh | 125 +++++++++++++++++++ clean_cmake.sh | 87 +++++++++++++ prepare_cmake.sh | 244 +++++++++++++++++++++++++++++++++++++ remove_cmake_artefacts.sh | 153 +++++++++++++++++++++++ run_all_examples.sh | 132 ++++++++++++++++++++ run_all_scratch_tests.sh | 152 +++++++++++++++++++++++ run_all_unit_tests.sh | 200 ++++++++++++++++++++++++++++++ 9 files changed, 1097 insertions(+) create mode 100644 .sis/project_name.txt create mode 100644 .sis/script_info_lines.txt create mode 100755 build_cmake.sh create mode 100755 clean_cmake.sh create mode 100755 prepare_cmake.sh create mode 100755 remove_cmake_artefacts.sh create mode 100755 run_all_examples.sh create mode 100755 run_all_scratch_tests.sh create mode 100755 run_all_unit_tests.sh diff --git a/.sis/project_name.txt b/.sis/project_name.txt new file mode 100644 index 00000000..a6e3440c --- /dev/null +++ b/.sis/project_name.txt @@ -0,0 +1 @@ +recls \ No newline at end of file diff --git a/.sis/script_info_lines.txt b/.sis/script_info_lines.txt new file mode 100644 index 00000000..aa0efb94 --- /dev/null +++ b/.sis/script_info_lines.txt @@ -0,0 +1,3 @@ +recls is a platform-independent recursive file-system search library +Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems +Copyright (c) 2003-2019, Matthew Wilson and Synesis Software diff --git a/build_cmake.sh b/build_cmake.sh new file mode 100755 index 00000000..f575833c --- /dev/null +++ b/build_cmake.sh @@ -0,0 +1,125 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +IgnoreRemainingFlagsAndOptions=0 +Targets=() + + +# ########################################################## +# functions + +function join_by { local IFS="$1"; shift; echo "$*"; } + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + if [ $IgnoreRemainingFlagsAndOptions -ne 0 ]; then + + Targets+=($1) + + shift + + continue + else + + if [ ! ${1:0:1} = '-' ]; then + + Targets+=($1) + + shift + + continue + fi + fi + + case $1 in + --) + + IgnoreRemainingFlagsAndOptions=1 + ;; + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Executes CMake-generated artefacts to (re)build project + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +if [ ! -d "$CMakeDir" ]; then + + >&2 echo "$ScriptPath: CMake build directory '$CMakeDir' not found so nothing to do; use script 'prepare_cmake.sh' if you wish to prepare CMake artefacts" + + exit 1 +else + + cd $CMakeDir + + if [ ! -f "$CMakeDir/Makefile" ]; then + + >&2 echo "$ScriptPath: CMake build directory '$CMakeDir' does not contain expected file 'Makefile', so a clean cannot be performed. It is recommended that you remove all CMake artefacts using script 'remove_cmake_artefacts.sh' followed by regeneration via 'prepare_cmake.sh'" + + cd ->/dev/null + + exit 1 + else + + if [ -z "$Targets" ]; then + + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`)" + else + + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`) with specific target(s) $(join_by , "${Targets[@]}")" + fi + + $MakeCmd ${Targets[*]} + status=$? + + cd ->/dev/null + + exit $status + fi +fi + + +# ############################## end of file ############################# # + diff --git a/clean_cmake.sh b/clean_cmake.sh new file mode 100755 index 00000000..ead9c205 --- /dev/null +++ b/clean_cmake.sh @@ -0,0 +1,87 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Executes CMake-generated artefacts to clean project + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +if [ ! -d "$CMakeDir" ]; then + + >&2 echo "$ScriptPath: CMake build directory '$CMakeDir' not found so nothing to do; use script 'prepare_cmake.sh' if you wish to prepare CMake artefacts" + + exit 1 +else + + cd $CMakeDir + + if [ ! -f "$CMakeDir/Makefile" ]; then + + >&2 echo "$ScriptPath: CMake build directory '$CMakeDir' does not contain expected file 'Makefile', so a clean cannot be performed. It is recommended that you remove all CMake artefacts using script 'remove_cmake_artefacts.sh' followed by regeneration via 'prepare_cmake.sh'" + + cd ->/dev/null + + exit 1 + else + + echo "Cleaning ${ProjectName} build (via command \`$MakeCmd clean\`)" + + $MakeCmd clean + status=$? + + cd ->/dev/null + + exit $status + fi +fi + + +# ############################## end of file ############################# # + diff --git a/prepare_cmake.sh b/prepare_cmake.sh new file mode 100755 index 00000000..dc3ce7b0 --- /dev/null +++ b/prepare_cmake.sh @@ -0,0 +1,244 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +Configuration=Release +ExamplesDisabled=0 +MSVC_MT=0 +MinGW=0 +NO_b64=0 +NO_Pantheios=0 +NO_shwild=0 +RunMake=0 +STLSoftDirGiven= +TestingDisabled=0 +USE_UNIXem=0 +VerboseMakefile=0 + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --cmake-verbose-makefile|-v) + + VerboseMakefile=1 + ;; + --debug-configuration|-d) + + Configuration=Debug + + ;; + --disable-examples|-E) + + ExamplesDisabled=1 + ;; + --disable-testing|-T) + + TestingDisabled=1 + ;; + --mingw) + + MinGW=1 + ;; + --msvc-mt) + + MSVC_MT=1 + ;; + --no-b64) + + NO_b64=1 + ;; + --no-pantheios|--no-pan) + + NO_Pantheios=1 + NO_b64=1 + ;; + --no-shwild) + + NO_shwild=1 + ;; + --run-make|-m) + + RunMake=1 + ;; + --stlsoft-root-dir|-s) + + shift + STLSoftDirGiven=$1 + ;; + --use-unixem) + + USE_UNIXem=1 + ;; + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Creates/reinitialises the CMake build script(s) + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + -v + --cmake-verbose-makefile + configures CMake to run verbosely (by setting CMAKE_VERBOSE_MAKEFILE + to be ON) + + -d + --debug-configuration + use Debug configuration (by setting CMAKE_BUILD_TYPE=Debug). Default + is to use Release + + -E + --disable-examples + disables building of examples (by setting BUILD_EXAMPLES=OFF) + + -T + --disable-testing + disables building of tests (by setting BUILD_TESTING=OFF) + + --mingw + uses explicitly the "MinGW Makefiles" generator, and defaults the + make-command to "mingw32-make.exe" + + --msvc-mt + when using Visual C++ (MSVC), the static runtime library will be + selected; the default is the dynamic runtime library + + --no-b64 + suppresses discovery of b64 package + + --no-pan + --no-pantheios + suppresses discovery of Pantheios package (and of the b64 package + also) + + --no-shwild + suppresses discovery of shwild package + + -m + --run-make + executes make after a successful running of CMake + + -s + --stlsoft-root-dir + specifies the STLSoft root-directory, which will be passed to CMake + as the variable STLSOFT, and which will override the environment + variable STLSOFT (if present) + + --use-unixem + when building on Windows, use the UNIXem library and define the + preprocessor symbol _STLSOFT_FORCE_ANY_COMPILER so as to emulate and + exercise UNIXSTL, not WinSTL (or COMSTL, etc.). Has no effect when + not executing on Windows + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +mkdir -p $CMakeDir || exit 1 + +cd $CMakeDir + +echo "Executing CMake for ${ProjectName} (in ${CMakeDir})" + +if [ $ExamplesDisabled -eq 0 ]; then CMakeBuildExamplesFlag="ON" ; else CMakeBuildExamplesFlag="OFF" ; fi +if [ $MSVC_MT -eq 0 ]; then CMakeMsvcMtFlag="OFF" ; else CMakeMsvcMtFlag="ON" ; fi +if [ $NO_b64 -eq 0 ]; then CMakeNoB64="OFF" ; else CMakeNoB64="ON" ; fi +if [ $NO_Pantheios -eq 0 ]; then CMakeNoPantheios="OFF" ; else CMakeNoPantheios="ON" ; fi +if [ $NO_shwild -eq 0 ]; then CMakeNoShwild="OFF" ; else CMakeNoShwild="ON" ; fi +if [ -z $STLSoftDirGiven ]; then CMakeSTLSoftVariable="" ; else CMakeSTLSoftVariable="-DSTLSOFT=$STLSoftDirGiven/" ; fi +if [ $TestingDisabled -eq 0 ]; then CMakeBuildTestingFlag="ON" ; else CMakeBuildTestingFlag="OFF" ; fi +if [ $USE_UNIXem -ne 0 ]; then CMakeUSE_UNIXem="ON" ; else CMakeUSE_UNIXem="OFF" ; fi +if [ $VerboseMakefile -eq 0 ]; then CMakeVerboseMakefileFlag="OFF" ; else CMakeVerboseMakefileFlag="ON" ; fi + +if [ $MinGW -ne 0 ]; then + + cmake \ + $CMakeSTLSoftVariable \ + -DBUILD_EXAMPLES:BOOL=$CMakeBuildExamplesFlag \ + -DBUILD_TESTING:BOOL=$CMakeBuildTestingFlag \ + -DCMAKE_BUILD_TYPE=$Configuration \ + -DCMAKE_NO_B64:BOOL=$CMakeNoB64 \ + -DCMAKE_NO_PANTHEIOS:BOOL=$CMakeNoPantheios \ + -DCMAKE_NO_SHWILD:BOOL=$CMakeNoShwild \ + -DUSE_UNIXEM:BOOL=$CMakeUSE_UNIXem \ + -G "MinGW Makefiles" \ + -S $Dir \ + -B $CMakeDir \ + || (cd ->/dev/null ; exit 1) +else + + cmake \ + $CMakeSTLSoftVariable \ + -DBUILD_EXAMPLES:BOOL=$CMakeBuildExamplesFlag \ + -DBUILD_TESTING:BOOL=$CMakeBuildTestingFlag \ + -DCMAKE_BUILD_TYPE=$Configuration \ + -DCMAKE_NO_B64:BOOL=$CMakeNoB64 \ + -DCMAKE_NO_PANTHEIOS:BOOL=$CMakeNoPantheios \ + -DCMAKE_NO_SHWILD:BOOL=$CMakeNoShwild \ + -DCMAKE_VERBOSE_MAKEFILE:BOOL=$CMakeVerboseMakefileFlag \ + -DMSVC_USE_MT:BOOL=$CMakeMsvcMtFlag \ + -DUSE_UNIXEM:BOOL=$CMakeUSE_UNIXem \ + -S $Dir \ + -B $CMakeDir \ + || (cd ->/dev/null ; exit 1) +fi + +status=0 + +if [ $RunMake -ne 0 ]; then + + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`)" + + $MakeCmd + status=$? +fi + +cd ->/dev/null + +if [ $VerboseMakefile -ne 0 ]; then + + echo -e "contents of $CMakeDir:" + ls -al $CMakeDir +fi + +exit $status + + +# ############################## end of file ############################# # + diff --git a/remove_cmake_artefacts.sh b/remove_cmake_artefacts.sh new file mode 100755 index 00000000..e09e895a --- /dev/null +++ b/remove_cmake_artefacts.sh @@ -0,0 +1,153 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +Directories=( + CMakeFiles + Testing + cmake + examples + projects + src + test +) +Files=( + CMakeCache.txt + CTestTestfile.cmake + DartConfiguration.tcl + Makefile + cmake_install.cmake + install_manifest.txt +) + + +# ########################################################## +# operating environment detection + +OsName="$(uname -s)" +case "${OsName}" in + CYGWIN*|MINGW*|MSYS_NT*) + + Directories+=( + ARM64 + Win32 + x64 + ) + Files+=( + "*.filters" + "*.sln" + "*.vcxproj" + ) + ;; + *) + + ;; +esac + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Removes all known CMake artefacts + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +if [ ! -d "$CMakeDir" ]; then + + echo "$ScriptPath: CMake build directory '$CMakeDir' not found so nothing to do; use script 'prepare_cmake.sh' if you wish to prepare CMake artefacts" + + exit 0 +else + + echo "Removing all ${ProjectName} cmake artefacts in '$CMakeDir'" + + num_dirs_removed=0 + num_files_removed=0 + + for d in ${Directories[@]} + do + + fq_dir_path="$CMakeDir/$d" + + [ -d "$fq_dir_path" ] || continue + + echo "removing directory '$d'" + + rm -dfr "$fq_dir_path" + + num_dirs_removed=$((num_dirs_removed+1)) + done + + cd "$CMakeDir" + + for f in ${Files[@]} + do + + for fq_file_path in $f + do + + [ -f "$fq_file_path" ] || continue + + echo "removing file '$fq_file_path'" + + rm -f "$fq_file_path" + + num_files_removed=$((num_files_removed+1)) + done + done + + cd ->/dev/null + + if [ 0 -eq $num_dirs_removed ] && [ 0 -eq $num_files_removed ]; then + + echo "nothing to do" + else + + echo "removed $num_dirs_removed directories and $num_files_removed files" + fi +fi + + +# ############################## end of file ############################# # + diff --git a/run_all_examples.sh b/run_all_examples.sh new file mode 100755 index 00000000..218cd845 --- /dev/null +++ b/run_all_examples.sh @@ -0,0 +1,132 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +ListOnly=0 +RunMake=1 + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --list-only|-l) + + ListOnly=1 + ;; + --no-make|-M) + + RunMake=0 + ;; + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Runs all (matching) example programs + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + -l + --list-only + lists the target programs but does not execute them + + -M + --no-make + does not execute CMake and make before running tests + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +status=0 + +if [ $RunMake -ne 0 ]; then + + if [ $ListOnly -eq 0 ]; then + + echo "Executing build (via command \`$MakeCmd\`) and then running all ${ProjectName} example programs" + + mkdir -p $CMakeDir || exit 1 + + cd $CMakeDir + + $MakeCmd + status=$? + + cd ->/dev/null + fi +else + + if [ ! -d "$CMakeDir" ] || [ ! -f "$CMakeDir/CMakeCache.txt" ] || [ ! -d "$CMakeDir/CMakeFiles" ]; then + + >&2 echo "$ScriptPath: cannot run in '--no-make' mode without a previous successful build step" + fi +fi + +if [ $status -eq 0 ]; then + + if [ $ListOnly -ne 0 ]; then + + echo "Listing all ${ProjectName} example programs" + else + + echo "Running all ${ProjectName} example programs" + fi + + for f in $(find $CMakeDir -type f '(' -name 'example?c*' -o -name 'example?cpp*' ')' -exec test -x {} \; -print) + do + + if [ $ListOnly -ne 0 ]; then + + echo "would execute $f:" + + continue + fi + + echo + echo "executing $f:" + + # NOTE: we do not break on fail because these tests are not always intended to succeed + $f + done +fi + +exit $status + + +# ############################## end of file ############################# # + diff --git a/run_all_scratch_tests.sh b/run_all_scratch_tests.sh new file mode 100755 index 00000000..ef097e20 --- /dev/null +++ b/run_all_scratch_tests.sh @@ -0,0 +1,152 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +ListOnly=0 +RunMake=1 +Verbosity=${XTESTS_VERBOSITY:-${TEST_VERBOSITY:-3}} + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --list-only|-l) + + ListOnly=1 + ;; + --no-make|-M) + + RunMake=0 + ;; + --verbosity) + + shift + Verbosity=$1 + ;; + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Runs all (matching) scratch test programs + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + -l + --list-only + lists the target programs but does not execute them + + -M + --no-make + does not execute CMake and make before running tests + + --verbosity + specifies an explicit verbosity for the unit-test(s) + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +status=0 + +if [ $RunMake -ne 0 ]; then + + if [ $ListOnly -eq 0 ]; then + + echo "Executing build (via command \`$MakeCmd\`) and then running all ${ProjectName} scratch (and performance) test programs" + + mkdir -p $CMakeDir || exit 1 + + cd $CMakeDir + + $MakeCmd + status=$? + + cd ->/dev/null + fi +else + + if [ ! -d "$CMakeDir" ] || [ ! -f "$CMakeDir/CMakeCache.txt" ] || [ ! -d "$CMakeDir/CMakeFiles" ]; then + + >&2 echo "$ScriptPath: cannot run in '--no-make' mode without a previous successful build step" + fi +fi + +if [ $status -eq 0 ]; then + + if [ $ListOnly -ne 0 ]; then + + echo "Listing all ${ProjectName} scratch (and performance) test programs" + else + + echo "Running all ${ProjectName} scratch (and performance) test programs" + fi + + for f in $(find $CMakeDir -type f '(' -name 'test_scratch*' -o -name 'test.scratch.*' -o -name 'test_performance*' -o -name 'test.performance.*' ')' -exec test -x {} \; -print) + do + + if [ $ListOnly -ne 0 ]; then + + echo "would execute $f:" + + continue + fi + + if [ $Verbosity -ge 3 ]; then + + echo + fi + if [ $Verbosity -ge 2 ]; then + + echo "executing $f:" + fi + + if $f; then + + : + else + + status=$? + fi + done +fi + +exit $status + + +# ############################## end of file ############################# # + diff --git a/run_all_unit_tests.sh b/run_all_unit_tests.sh new file mode 100755 index 00000000..b7e4b3b9 --- /dev/null +++ b/run_all_unit_tests.sh @@ -0,0 +1,200 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +ListOnly=0 +RunMake=1 +UnitOnly=0 +ComponentOnly=0 +Verbosity=${XTESTS_VERBOSITY:-${TEST_VERBOSITY:-3}} + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --list-only|-l) + + ListOnly=1 + ;; + --no-make|-M) + + RunMake=0 + ;; + --unit-only) + + UnitOnly=1 + ;; + --component-only) + + ComponentOnly=1 + ;; + --verbosity) + + shift + Verbosity=$1 + ;; + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Runs all (matching) unit-test and/or component-test programs + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + -l + --list-only + lists the target programs but does not execute them + + -M + --no-make + does not execute CMake and make before running tests + + --unit-only + runs only unit-test programs (test.unit.* / test_unit*) + + --component-only + runs only component-test programs (test.component.* / test_component*) + + --verbosity + specifies an explicit verbosity for the unit-test(s) + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + +if [ $UnitOnly -ne 0 ] && [ $ComponentOnly -ne 0 ]; then + + >&2 echo "$ScriptPath: --unit-only and --component-only are mutually exclusive" + + exit 1 +fi + + +# ########################################################## +# main() + +status=0 + +if [ $UnitOnly -ne 0 ]; then + + TestKindDescription='unit test' +elif [ $ComponentOnly -ne 0 ]; then + + TestKindDescription='component test' +else + + TestKindDescription='component and unit test' +fi + +if [ $RunMake -ne 0 ]; then + + if [ $ListOnly -eq 0 ]; then + + echo "Executing build (via command \`$MakeCmd\`) and then running all ${ProjectName} ${TestKindDescription} programs" + + mkdir -p $CMakeDir || exit 1 + + cd $CMakeDir + + $MakeCmd + status=$? + + cd ->/dev/null + fi +else + + if [ ! -d "$CMakeDir" ] || [ ! -f "$CMakeDir/CMakeCache.txt" ] || [ ! -d "$CMakeDir/CMakeFiles" ]; then + + >&2 echo "$ScriptPath: cannot run in '--no-make' mode without a previous successful build step" + + exit 1 + fi +fi + +if [ $status -eq 0 ]; then + + if [ $ListOnly -ne 0 ]; then + + echo "Listing all ${ProjectName} ${TestKindDescription} programs" + else + + echo "Running all ${ProjectName} ${TestKindDescription} programs" + fi + + if [ $UnitOnly -ne 0 ]; then + + find_name_expr=( \( -name 'test_unit*' -o -name 'test.unit.*' \) ) + elif [ $ComponentOnly -ne 0 ]; then + + find_name_expr=( \( -name 'test_component*' -o -name 'test.component.*' \) ) + else + + find_name_expr=( \( -name 'test_unit*' -o -name 'test.unit.*' -o -name 'test_component*' -o -name 'test.component.*' \) ) + fi + + for f in $(find "$CMakeDir" -type f "${find_name_expr[@]}" -exec test -x {} \; -print | sort) + do + + if [ $ListOnly -ne 0 ]; then + + echo "would execute $f:" + + continue + fi + + if [ $Verbosity -ge 3 ]; then + + echo + fi + if [ $Verbosity -ge 2 ]; then + + echo "executing $f:" + fi + + if $f --verbosity=$Verbosity; then + + : + else + + status=$? + + break 1 + fi + done +fi + +exit $status + + +# ############################## end of file ############################# # From 712b8a2f2a2468d886a9cc1b508ded87d0b2f378 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 14:03:58 +1000 Subject: [PATCH 06/12] feature: CMake build --- CMakeLists.txt | 404 ++++++++++++++++++ cmake/BuildType.cmake | 59 +++ cmake/LanguageFullVersion.cmake | 36 ++ cmake/TargetMacros.cmake | 98 +++++ cmake/recls-config.cmake.in | 3 + examples/CMakeLists.txt | 37 ++ examples/c/CMakeLists.txt | 9 + examples/c/example_c_1/CMakeLists.txt | 2 + examples/c/example_c_1/example_c_1.c | 4 +- examples/c/example_c_2/CMakeLists.txt | 2 + examples/c/example_c_2/example_c_2.c | 4 +- examples/c/example_c_3/CMakeLists.txt | 2 + examples/c/example_c_3/example_c_3.c | 4 +- examples/c/example_c_4/CMakeLists.txt | 2 + examples/c/example_c_4/example_c_4.c | 4 +- examples/c/example_c_5/CMakeLists.txt | 2 + examples/c/example_c_5/example_c_5.c | 4 +- examples/c/example_c_6/CMakeLists.txt | 2 + examples/c/example_c_6/example_c_6.c | 4 +- examples/c/example_c_7/CMakeLists.txt | 2 + examples/c/example_c_7/example_c_7.c | 4 +- examples/c/example_c_8/CMakeLists.txt | 2 + examples/c/example_c_8/example_c_8.c | 4 +- examples/cpp/CMakeLists.txt | 4 + examples/cpp/example_cpp_1/CMakeLists.txt | 2 + examples/cpp/example_cpp_2/CMakeLists.txt | 2 + examples/cpp/example_cpp_3/CMakeLists.txt | 2 + include/recls/cpp/root_sequence.hpp | 13 +- include/recls/recls.h | 16 +- src/CMakeLists.txt | 164 +++++++ src/api.util.create_directory.cpp | 18 +- src/api.util.remove_directory.cpp | 18 +- test/CMakeLists.txt | 38 ++ test/component/CMakeLists.txt | 5 + .../CMakeLists.txt | 2 + .../CMakeLists.txt | 2 + test/scratch/CMakeLists.txt | 8 + .../test.scratch.cpp_api/CMakeLists.txt | 2 + .../test.scratch.cpp_api.cpp | 2 +- .../scratch/test.scratch.links/CMakeLists.txt | 2 + .../test.scratch.links/test.scratch.links.cpp | 2 +- .../test.scratch.search.1/CMakeLists.txt | 2 + .../CMakeLists.txt | 10 + test/scratch/test_c_1/CMakeLists.txt | 2 + test/scratch/test_c_1/test_c_1.c | 7 +- test/unit/CMakeLists.txt | 10 + .../CMakeLists.txt | 2 + .../test.unit.api.combine_paths.c | 42 +- .../CMakeLists.txt | 2 + .../test.unit.api.createdirectory.c | 134 +++--- .../test.unit.api.squeeze_path/CMakeLists.txt | 2 + .../test.unit.api.squeeze_path.c | 42 +- test/unit/test.unit.api.stat/CMakeLists.txt | 2 + .../test.unit.api.stat/test.unit.api.stat.c | 58 ++- test/unit/test.unit.c.retcodes/CMakeLists.txt | 2 + .../test.unit.c.retcodes.c | 42 +- .../CMakeLists.txt | 2 + .../CMakeLists.txt | 2 + .../test.unit.cpp.retcodes/CMakeLists.txt | 2 + .../test.unit.cpp.squeeze_path/CMakeLists.txt | 2 + 60 files changed, 1174 insertions(+), 189 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 cmake/BuildType.cmake create mode 100644 cmake/LanguageFullVersion.cmake create mode 100644 cmake/TargetMacros.cmake create mode 100644 cmake/recls-config.cmake.in create mode 100644 examples/CMakeLists.txt create mode 100644 examples/c/CMakeLists.txt create mode 100644 examples/c/example_c_1/CMakeLists.txt create mode 100644 examples/c/example_c_2/CMakeLists.txt create mode 100644 examples/c/example_c_3/CMakeLists.txt create mode 100644 examples/c/example_c_4/CMakeLists.txt create mode 100644 examples/c/example_c_5/CMakeLists.txt create mode 100644 examples/c/example_c_6/CMakeLists.txt create mode 100644 examples/c/example_c_7/CMakeLists.txt create mode 100644 examples/c/example_c_8/CMakeLists.txt create mode 100644 examples/cpp/CMakeLists.txt create mode 100644 examples/cpp/example_cpp_1/CMakeLists.txt create mode 100644 examples/cpp/example_cpp_2/CMakeLists.txt create mode 100644 examples/cpp/example_cpp_3/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 test/CMakeLists.txt create mode 100644 test/component/CMakeLists.txt create mode 100644 test/component/test.component.util.cpp.create_directory/CMakeLists.txt create mode 100644 test/component/test.component.util.cpp.remove_directory/CMakeLists.txt create mode 100644 test/scratch/CMakeLists.txt create mode 100644 test/scratch/test.scratch.cpp_api/CMakeLists.txt create mode 100644 test/scratch/test.scratch.links/CMakeLists.txt create mode 100644 test/scratch/test.scratch.search.1/CMakeLists.txt create mode 100644 test/scratch/test.scratch.with_pantheios/CMakeLists.txt create mode 100644 test/scratch/test_c_1/CMakeLists.txt create mode 100644 test/unit/CMakeLists.txt create mode 100644 test/unit/test.unit.api.combine_paths/CMakeLists.txt create mode 100644 test/unit/test.unit.api.createdirectory/CMakeLists.txt create mode 100644 test/unit/test.unit.api.squeeze_path/CMakeLists.txt create mode 100644 test/unit/test.unit.api.stat/CMakeLists.txt create mode 100644 test/unit/test.unit.c.retcodes/CMakeLists.txt create mode 100644 test/unit/test.unit.cpp.combine_paths/CMakeLists.txt create mode 100644 test/unit/test.unit.cpp.derive_relative_path/CMakeLists.txt create mode 100644 test/unit/test.unit.cpp.retcodes/CMakeLists.txt create mode 100644 test/unit/test.unit.cpp.squeeze_path/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..bf5c98c9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,404 @@ + +# ######################################################################## # +# File: /CMakeLists.txt +# +# Purpose: Top-level CMake lists file for recls +# +# Created: 9th October 2019 +# Updated: 3rd August 2026 +# +# ######################################################################## # + + +# ########################################################## +# CMake + +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) + +# require out-of-source builds +file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt" LOC_PATH) +if(EXISTS "${LOC_PATH}") + + message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.") +endif() + +# directory for CMake specific extensions and source files. +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) + + +# ########################################################## +# project + +project(recls + DESCRIPTION "recls is a platform-independent recursive file-system search library implemented in C++ and providing C and C++ APIs." + HOMEPAGE_URL "https://github.com/synesissoftware/recls" + LANGUAGES C CXX +) + +string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) +string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) + +# handle version number +set(RX_PROJ_TAG "${PROJECT_NAME_UPPER}") +set(RX_WS "[ \t]") +file(READ "${CMAKE_SOURCE_DIR}/include/${PROJECT_NAME_LOWER}/${PROJECT_NAME_LOWER}.h" _header_file) +string(REGEX MATCH "#${RX_WS}*define${RX_WS}+_?${RX_PROJ_TAG}_VER_MAJOR${RX_WS}+([0-9]+)" MAJOR_DUMMY ${_header_file}) +set(_VERSION_MAJOR ${CMAKE_MATCH_1}) +string(REGEX MATCH "#${RX_WS}*define${RX_WS}+_?${RX_PROJ_TAG}_VER_MINOR${RX_WS}+([0-9]+)" MINOR_DUMMY ${_header_file}) +set(_VERSION_MINOR ${CMAKE_MATCH_1}) +string(REGEX MATCH "#${RX_WS}*define${RX_WS}+_?${RX_PROJ_TAG}_VER_PATCH${RX_WS}+([0-9]+)" PATCH_DUMMY ${_header_file}) +set(_VERSION_PATCH ${CMAKE_MATCH_1}) + +# set project version number here +set(PROJECT_VERSION_MAJOR ${_VERSION_MAJOR}) +set(PROJECT_VERSION_MINOR ${_VERSION_MINOR}) +set(PROJECT_VERSION_PATCH ${_VERSION_PATCH}) +set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") + +# adhere strictly to C and C++ standards plus extensions. These are actually +# useless since we do not compile anything; they merely state our intention. +set(CMAKE_C_STANDARD 17) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_EXTENSIONS ON) # GNU extensions and POSIX standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS ON) + +if(MSVC) + + if(MSVC_VERSION LESS 1930) + + set(CMAKE_C_STANDARD 90) + set(CMAKE_CXX_STANDARD 98) + endif() + + if(MSVC_USE_MT) + + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif(MSVC_USE_MT) +else(MSVC) + + if(MSVC_USE_MT) + + # this here just to absorb warning about not using `MSVC_USE_MT` (to + # enable **prepare_cmake.sh** to be simple) + endif(MSVC_USE_MT) +endif(MSVC) + + +# ########################################################## +# dependencies, features, includes, and options + +# ################################################ +# includes - 1 + +include(BuildType) +include(LanguageFullVersion) +include(TargetMacros) + + +# ################################################ +# dependencies, features, and options + +# ###################################### +# options + +option(BUILD_EXAMPLES "Build examples" ON) + +option(BUILD_TESTING "Build tests" ON) + + +# ###################################### +# features + + +# ###################################### +# dependencies +# +# required: +# - STLSoft; +# - xTests - required for testing; +# +# optional: +# - b64 - may be needed by Pantheios; +# - Pantheios - ... +# - shwild - required for testing; +# - UNIXem - required for examples/testing on Windows if USE_UNIXEM and WIN32 are defined; + + +# ############################ +# STLSoft +# +# We provide flexibility here, as in: +# 1. if a CMake variable STLSOFT is provided then it is used; otherwise +# 2. if an environment variable STLSOFT is provided then it then it is used; +# otherwise +# 3. if the package STLSoft (via find_package()) is found then it is used; +# otherwise +# 4. we abort + +if(DEFINED STLSOFT) + + message("-- STLSOFT provided as CMake variable with value '${STLSOFT}'") + + set(STLSOFT_INCLUDE_DIR ${STLSOFT}/include) +elseif(DEFINED ENV{STLSOFT}) + + message("-- STLSOFT provided as environment variable with value '$ENV{STLSOFT}'") + + set(STLSOFT_INCLUDE_DIR $ENV{STLSOFT}/include) +else() + + set(STLSoft_REQUIRED_VERSION_ 1.11) + + find_package(STLSoft ${STLSoft_REQUIRED_VERSION_} REQUIRED) + + message("-- CMake package STLSoft found (version ${STLSoft_VERSION}; ${STLSoft_REQUIRED_VERSION_} requested)") +endif() + +if(DEFINED STLSOFT_INCLUDE_DIR) + + if(BUILD_TESTING) + find_package(STLSoft REQUIRED) + + endif(BUILD_TESTING) + + include_directories(${STLSOFT_INCLUDE_DIR}) +endif() + + +# ############################ +# b64 + +if(NOT (CMAKE_NO_B64)) + + if(BUILD_TESTING) + + find_package(b64 QUIET) + + if(b64_FOUND) + + message("-- CMake package b64 found (version ${b64_VERSION})") + + add_compile_definitions(HAS_b64) + else(b64_FOUND) + + add_compile_definitions(PANTHEIOS_NO_B64) + add_compile_definitions(RECLS_NO_B64) + endif(b64_FOUND) + endif(BUILD_TESTING) +endif() + + +# ############################ +# Pantheios + +if(NOT (CMAKE_NO_PANTHEIOS)) + + if(BUILD_TESTING) + + find_package(Pantheios QUIET) + + if(Pantheios_FOUND) + + message("-- CMake package Pantheios found (version ${Pantheios_VERSION})") + + add_compile_definitions(HAS_Pantheios) + endif(Pantheios_FOUND) + endif(BUILD_TESTING) +endif() + + +# ############################ +# shwild + +if(NOT (CMAKE_NO_SHWILD)) + + if(BUILD_TESTING) + + find_package(shwild QUIET) + + if(shwild_FOUND) + + message("-- CMake package shwild found (version ${shwild_VERSION})") + + add_compile_definitions(HAS_shwild) + add_compile_definitions(PANTHEIOS_HAS_SHWILD) + add_compile_definitions(RECLS_HAS_SHWILD) + add_compile_definitions(XTESTS_HAS_SHWILD) + else(shwild_FOUND) + + add_compile_definitions(PANTHEIOS_NO_SHWILD) + add_compile_definitions(RECLS_NO_SHWILD) + add_compile_definitions(XTESTS_NO_SHWILD) + endif(shwild_FOUND) + else(BUILD_TESTING) + + add_compile_definitions(PANTHEIOS_NO_SHWILD) + add_compile_definitions(RECLS_NO_SHWILD) + add_compile_definitions(XTESTS_NO_SHWILD) + endif(BUILD_TESTING) +else() + + add_compile_definitions(PANTHEIOS_NO_SHWILD) + add_compile_definitions(RECLS_NO_SHWILD) + add_compile_definitions(XTESTS_NO_SHWILD) +endif() + + +# ############################ +# UNIXem + +if((USE_UNIXEM) AND (WIN32)) + + set(UNIXem_REQUIRED_VERSION_ 1.12.7) + + find_package(UNIXem ${UNIXem_REQUIRED_VERSION_} REQUIRED) + + message("-- CMake package UNIXem found (version ${UNIXem_VERSION}; ${UNIXem_REQUIRED_VERSION_} requested)") + + add_compile_definitions(_STLSOFT_FORCE_ANY_COMPILER) + add_compile_definitions(EMULATE_UNIX_ON_WINDOWS) + add_compile_definitions(RECLS_HAS_UNIXEM) + add_compile_definitions(STLSOFT_HAS_UNIXEM) +endif() + + +# ############################ +# xTests + +if(BUILD_TESTING) + + set(xTests_REQUIRED_VERSION_ 0.26.3) + + find_package(xTests ${xTests_REQUIRED_VERSION_} REQUIRED) + + message("-- CMake package xTests found (version ${xTests_VERSION}; ${xTests_REQUIRED_VERSION_} requested)") +endif(BUILD_TESTING) + + +# ################################################ +# includes - 2 + +include(CMakePackageConfigHelpers) +if(BUILD_TESTING) + + include(CTest) +endif(BUILD_TESTING) +include(GNUInstallDirs) + + +# ########################################################## +# targets + +# ################################################ +# custom definitions + +if(UNIX) + + set(_BUILD_AS_UNIX 1) + + message("-- Operating system Unix") +else(UNIX) + + if(WIN32) + + if(USE_UNIXEM) + + set(_BUILD_AS_UNIX 1) + + message("-- Operating system Unix (synthesised on Windows)") + else(USE_UNIXEM) + + set(_BUILD_AS_WIN32 1) + + message("-- Operating system Windows") + endif(USE_UNIXEM) + else(WIN32) + + message("-- Operating system unknown") + endif(WIN32) +endif(UNIX) + + +# ################################################ +# main libraries + +add_subdirectory(src) + + +# ################################################ +# examples + +if(BUILD_EXAMPLES) + + message("-- enabled building of examples ...") + + add_subdirectory(examples) +else(BUILD_EXAMPLES) + + message("-- disabled building of examples - define BUILD_EXAMPLES to enable") +endif(BUILD_EXAMPLES) + + +# ################################################ +# tests + +if(BUILD_TESTING) + + message("-- enabled building of tests ...") + + add_subdirectory(test) +else(BUILD_TESTING) + + message("-- disabled building of tests - define BUILD_TESTING to enable") +endif(BUILD_TESTING) + + +# ########################################################## +# install + + +# ########################################################## +# export + +set(EXPORT_NAME ${PROJECT_NAME_LOWER}) + +configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${EXPORT_NAME}-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake/${EXPORT_NAME}-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/${EXPORT_NAME}/cmake +) + +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/cmake/${EXPORT_NAME}-config-version.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion +) + +export(EXPORT project-targets + FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/${EXPORT_NAME}-targets.cmake" + NAMESPACE "${PROJECT_NAME}::" +) + +install(EXPORT project-targets + NAMESPACE "${PROJECT_NAME}::" + FILE "${EXPORT_NAME}-targets.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME} +) + +install( FILES + "${CMAKE_CURRENT_BINARY_DIR}/cmake/${EXPORT_NAME}-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/cmake/${EXPORT_NAME}-config-version.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME} +) + + +# ########################################################## +# completion + +message(NOTICE "Generating CMake build scripts for ${PROJECT_NAME} ${PROJECT_VERSION}, for C${CMAKE_C_STANDARD} C++${CMAKE_CXX_STANDARD}, with build type ${CMAKE_BUILD_TYPE}") + + +# ############################## end of file ############################# # + diff --git a/cmake/BuildType.cmake b/cmake/BuildType.cmake new file mode 100644 index 00000000..57fc0ba8 --- /dev/null +++ b/cmake/BuildType.cmake @@ -0,0 +1,59 @@ + +# ######################################################################## # +# File: /cmake/BuildType.cmake +# +# Purpose: CMake module file (for BuildType) +# +# Created: 16th October 2019 +# Updated: 21st January 2024 +# +# ######################################################################## # + + +# Including this module sets the `CMAKE_BUILD_TYPE` value as follows: +# +# 1. If user specifies on the command line, then `CMAKE_BUILD_TYPE` already +# has a valid, so this is accepted; +# 2. If the top-level .git directory is specified, then "Debug" is used; +# otherwise +# 3. "Release" is used. +# +# Note: +# - `CMAKE_BUILD_TYPE` is the build (configuration) type; +# - `CMAKE_CONFIGURATION_TYPES` is, if specified, a list of valid +# configurations (see +# https://cmake.org/cmake/help/latest/variable/CMAKE_CONFIGURATION_TYPES.html); +# +# Example usage: +# +#[========[ + +# CMakeLists.txt + +include(BuildType) + +]========] + + +if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(default_build_type "Debug") +else() + set(default_build_type "Release") +endif() + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + + message(STATUS "Setting build type to '${default_build_type}' as none was specified.") + + set(CACHE CMAKE_BUILD_TYPE "${default_build_type}" + STRING "Choose the type of build." FORCE + ) + + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo" + ) +endif() + +# ############################## end of file ############################# # + diff --git a/cmake/LanguageFullVersion.cmake b/cmake/LanguageFullVersion.cmake new file mode 100644 index 00000000..e01c4315 --- /dev/null +++ b/cmake/LanguageFullVersion.cmake @@ -0,0 +1,36 @@ + +# ################################################ +# X_CMAKE_CXX_FULLSTANDARD + +set(X_CMAKE_CXX_FULLSTANDARD 0) + +if(FALSE) +elseif(CMAKE_CXX_STANDARD EQUAL 98) + + set(X_CMAKE_CXX_FULLSTANDARD 1998) +elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 26) + + set(X_CMAKE_CXX_FULLSTANDARD 2026) +elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 23) + + set(X_CMAKE_CXX_FULLSTANDARD 2023) +elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + + set(X_CMAKE_CXX_FULLSTANDARD 2020) +elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 17) + + set(X_CMAKE_CXX_FULLSTANDARD 2017) +elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 14) + + set(X_CMAKE_CXX_FULLSTANDARD 2014) +elseif(CMAKE_CXX_STANDARD GREATER_EQUAL 11) + + set(X_CMAKE_CXX_FULLSTANDARD 2011) +else() + + message(FATAL_ERROR "mechanism for discriminating X_CMAKE_CXX_FULLSTANDARD has failed") +endif() + + +# ############################## end of file ############################# # + diff --git a/cmake/TargetMacros.cmake b/cmake/TargetMacros.cmake new file mode 100644 index 00000000..355f230e --- /dev/null +++ b/cmake/TargetMacros.cmake @@ -0,0 +1,98 @@ + +macro(define_target_compile_options target_name) + + set(X_GCC_CUSTOM_WARNINGS_ "") + + if(X_GCC_CUSTOM_WARNINGS_TO_BE_SUPPRESSED) + foreach(warning ${X_GCC_CUSTOM_WARNINGS_TO_BE_SUPPRESSED}) + + list(APPEND X_GCC_CUSTOM_WARNINGS_ "-Wno-${warning}") + endforeach() + endif() + + set(X_MSVC_CUSTOM_WARNINGS_ "") + + if(X_MSVC_CUSTOM_WARNINGS_TO_BE_SUPPRESSED) + foreach(warning ${X_MSVC_CUSTOM_WARNINGS_TO_BE_SUPPRESSED}) + + list(APPEND X_MSVC_CUSTOM_WARNINGS_ "/wd${warning}") + endforeach() + endif() + + target_compile_options(${target_name} + PRIVATE + $<$,$,$>: + -Werror -Wall -Wextra -pedantic + + -Wno-deprecated-declarations + -Wno-\#pragma-messages + ${GCC_WARN_NO_cxx11_long_long} + ${X_GCC_CUSTOM_WARNINGS_} + > + $<$,$>: + -Wno-unused-lambda-capture + > + $<$: + /WX /W4 + + ${X_MSVC_CUSTOM_WARNINGS_} + > + ) +endmacro(define_target_compile_options) + + +function(define_automated_test_program program_name entry_point_source_name) + + add_executable(${program_name} + ${entry_point_source_name} + ) + + target_link_libraries(${program_name} + PRIVATE + core + $<$:shwild::core> + $<$:STLSoft::STLSoft> + $<$:UNIXem::UNIXem> + $,xTests::xTests.core,xTests::core> + ) + + if(WIN32) + + target_link_libraries(${program_name} + PRIVATE + wininet + ) + endif(WIN32) + + define_target_compile_options(${program_name}) +endfunction(define_automated_test_program) + + +function(define_example_program program_name entry_point_source_name) + + add_executable(${program_name} + ${entry_point_source_name} + ) + + target_link_libraries(${program_name} + PRIVATE + core + $<$:shwild::core> + $<$:STLSoft::STLSoft> + $<$:UNIXem::UNIXem> + ) + + if(WIN32) + + target_link_libraries(${program_name} + PRIVATE + wininet + ) + endif(WIN32) + + define_target_compile_options(${program_name}) +endfunction(define_example_program) + + +# ############################## end of file ############################# # + diff --git a/cmake/recls-config.cmake.in b/cmake/recls-config.cmake.in new file mode 100644 index 00000000..82620719 --- /dev/null +++ b/cmake/recls-config.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ +include("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@-targets.cmake") + diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 00000000..3c232fdc --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,37 @@ + +include_directories(${CMAKE_SOURCE_DIR}/include) + +if(_BUILD_AS_UNIX) + + add_definitions(-DUNIX) + add_definitions(-Dunix) +endif(_BUILD_AS_UNIX) + +if(_BUILD_AS_WIN32) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + + message (STATUS "Compiling for 64-bit Windows") + + add_definitions(-DWIN64) + else() + + message (STATUS "Compiling for 32-bit Windows") + + add_definitions(-DWIN32) + endif() + + add_definitions(-DRECLS_API_FTP) +endif(_BUILD_AS_WIN32) + +if((MSVC) AND (MSVC_VERSION GREATER_EQUAL 1914)) + + add_compile_options("/Zc:__cplusplus") + + add_definitions(-D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) +endif() + + +add_subdirectory(c) +add_subdirectory(cpp) + diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt new file mode 100644 index 00000000..0916f6c1 --- /dev/null +++ b/examples/c/CMakeLists.txt @@ -0,0 +1,9 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +add_subdirectory(example_c_1) +add_subdirectory(example_c_2) +add_subdirectory(example_c_3) +add_subdirectory(example_c_4) +add_subdirectory(example_c_5) +add_subdirectory(example_c_6) +add_subdirectory(example_c_7) +add_subdirectory(example_c_8) diff --git a/examples/c/example_c_1/CMakeLists.txt b/examples/c/example_c_1/CMakeLists.txt new file mode 100644 index 00000000..d36dbbae --- /dev/null +++ b/examples/c/example_c_1/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_1 example_c_1.c) diff --git a/examples/c/example_c_1/example_c_1.c b/examples/c/example_c_1/example_c_1.c index f0ec6072..aa133d62 100644 --- a/examples/c/example_c_1/example_c_1.c +++ b/examples/c/example_c_1/example_c_1.c @@ -10,7 +10,7 @@ * - elicitation of entry properties via API function calls * * Created: 29th May 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -33,7 +33,7 @@ /* ////////////////////////////////////////////////////////////////////// */ -int main() +int main(void) { /* Declare a search handle, define the flags (for recursive file search) * and start a search. diff --git a/examples/c/example_c_2/CMakeLists.txt b/examples/c/example_c_2/CMakeLists.txt new file mode 100644 index 00000000..2f600c16 --- /dev/null +++ b/examples/c/example_c_2/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_2 example_c_2.c) diff --git a/examples/c/example_c_2/example_c_2.c b/examples/c/example_c_2/example_c_2.c index 9bf8f5b3..26aa3f7f 100644 --- a/examples/c/example_c_2/example_c_2.c +++ b/examples/c/example_c_2/example_c_2.c @@ -13,7 +13,7 @@ * - display of progress (of each directory traversed) * * Created: 29th May 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -63,7 +63,7 @@ struct feedback_t /* ////////////////////////////////////////////////////////////////////// */ -int main() +int main(void) { const recls_char_t SEARCH_PATTERN[] = RECLS_LITERAL("*.h|*.hpp|*.c|*.cpp|*.cs|*.d|*.java|*.pl|*.py|*.rb"); diff --git a/examples/c/example_c_3/CMakeLists.txt b/examples/c/example_c_3/CMakeLists.txt new file mode 100644 index 00000000..94dc61bc --- /dev/null +++ b/examples/c/example_c_3/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_3 example_c_3.c) diff --git a/examples/c/example_c_3/example_c_3.c b/examples/c/example_c_3/example_c_3.c index 0dacc5a1..afcebeb3 100644 --- a/examples/c/example_c_3/example_c_3.c +++ b/examples/c/example_c_3/example_c_3.c @@ -15,7 +15,7 @@ * - elicitation of entry properties via API function calls * * Created: 29th May 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -38,7 +38,7 @@ /* ////////////////////////////////////////////////////////////////////// */ -int main() +int main(void) { /* stat() the current directory */ recls_info_t current; diff --git a/examples/c/example_c_4/CMakeLists.txt b/examples/c/example_c_4/CMakeLists.txt new file mode 100644 index 00000000..a210d9b9 --- /dev/null +++ b/examples/c/example_c_4/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_4 example_c_4.c) diff --git a/examples/c/example_c_4/example_c_4.c b/examples/c/example_c_4/example_c_4.c index db235296..0a540397 100644 --- a/examples/c/example_c_4/example_c_4.c +++ b/examples/c/example_c_4/example_c_4.c @@ -12,7 +12,7 @@ * - elicitation of entry properties structure members * * Created: 29th May 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -35,7 +35,7 @@ /* ////////////////////////////////////////////////////////////////////// */ -int main() +int main(void) { /* Declare a search handle, define the flags (for recursive file search) * and start a search. diff --git a/examples/c/example_c_5/CMakeLists.txt b/examples/c/example_c_5/CMakeLists.txt new file mode 100644 index 00000000..3561aa84 --- /dev/null +++ b/examples/c/example_c_5/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_5 example_c_5.c) diff --git a/examples/c/example_c_5/example_c_5.c b/examples/c/example_c_5/example_c_5.c index bcdb460e..4639e84e 100644 --- a/examples/c/example_c_5/example_c_5.c +++ b/examples/c/example_c_5/example_c_5.c @@ -13,7 +13,7 @@ * - handling of errors and reporting of error information * * Created: 17th June 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -49,7 +49,7 @@ static int RECLS_CALLCONV_DEFAULT example_c_5_process_fn( recls_info_t } -int main() +int main(void) { /* First, determine the home directory by stat()-ing ~ */ recls_info_t home; diff --git a/examples/c/example_c_6/CMakeLists.txt b/examples/c/example_c_6/CMakeLists.txt new file mode 100644 index 00000000..7f77e622 --- /dev/null +++ b/examples/c/example_c_6/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_6 example_c_6.c) diff --git a/examples/c/example_c_6/example_c_6.c b/examples/c/example_c_6/example_c_6.c index 03dbca01..369c30f2 100644 --- a/examples/c/example_c_6/example_c_6.c +++ b/examples/c/example_c_6/example_c_6.c @@ -11,7 +11,7 @@ * - handling of errors and reporting of error information * * Created: 17th June 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -34,7 +34,7 @@ /* ////////////////////////////////////////////////////////////////////// */ -int main() +int main(void) { /* stat() the current directory */ recls_info_t current; diff --git a/examples/c/example_c_7/CMakeLists.txt b/examples/c/example_c_7/CMakeLists.txt new file mode 100644 index 00000000..4dc0920a --- /dev/null +++ b/examples/c/example_c_7/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_7 example_c_7.c) diff --git a/examples/c/example_c_7/example_c_7.c b/examples/c/example_c_7/example_c_7.c index 1cfa5973..9af930f1 100644 --- a/examples/c/example_c_7/example_c_7.c +++ b/examples/c/example_c_7/example_c_7.c @@ -9,7 +9,7 @@ * - handling of errors and reporting of error information * * Created: 17th June 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -32,7 +32,7 @@ /* ////////////////////////////////////////////////////////////////////// */ -int main() +int main(void) { /* stat() the current directory */ recls_info_t current; diff --git a/examples/c/example_c_8/CMakeLists.txt b/examples/c/example_c_8/CMakeLists.txt new file mode 100644 index 00000000..1cecad83 --- /dev/null +++ b/examples/c/example_c_8/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_c_8 example_c_8.c) diff --git a/examples/c/example_c_8/example_c_8.c b/examples/c/example_c_8/example_c_8.c index e2bd8b05..cfa25a1e 100644 --- a/examples/c/example_c_8/example_c_8.c +++ b/examples/c/example_c_8/example_c_8.c @@ -10,7 +10,7 @@ * Recls_CalcDirectorySize()) * * Created: 17th June 2006 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -33,7 +33,7 @@ /* ////////////////////////////////////////////////////////////////////// */ -int main() +int main(void) { /* Display all the roots on the host system. */ { diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt new file mode 100644 index 00000000..5524daea --- /dev/null +++ b/examples/cpp/CMakeLists.txt @@ -0,0 +1,4 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +add_subdirectory(example_cpp_1) +add_subdirectory(example_cpp_2) +add_subdirectory(example_cpp_3) diff --git a/examples/cpp/example_cpp_1/CMakeLists.txt b/examples/cpp/example_cpp_1/CMakeLists.txt new file mode 100644 index 00000000..4b18b7d8 --- /dev/null +++ b/examples/cpp/example_cpp_1/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_cpp_1 example_cpp_1.cpp) diff --git a/examples/cpp/example_cpp_2/CMakeLists.txt b/examples/cpp/example_cpp_2/CMakeLists.txt new file mode 100644 index 00000000..b91b690b --- /dev/null +++ b/examples/cpp/example_cpp_2/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_cpp_2 example_cpp_2.cpp) diff --git a/examples/cpp/example_cpp_3/CMakeLists.txt b/examples/cpp/example_cpp_3/CMakeLists.txt new file mode 100644 index 00000000..bcc8ff8f --- /dev/null +++ b/examples/cpp/example_cpp_3/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(example_cpp_3 example_cpp_3.cpp) diff --git a/include/recls/cpp/root_sequence.hpp b/include/recls/cpp/root_sequence.hpp index 8ee1fff3..c44c8ec6 100644 --- a/include/recls/cpp/root_sequence.hpp +++ b/include/recls/cpp/root_sequence.hpp @@ -4,7 +4,7 @@ * Purpose: recls C++ mapping - root_sequence class. * * Created: 25th March 2004 - * Updated: 19th December 2023 + * Updated: 3rd August 2026 * * Home: https://github.com/synesissoftware/recls * @@ -52,8 +52,8 @@ #ifndef RECLS_DOCUMENTATION_SKIP_SECTION # define RECLS_VER_RECLS_CPP_HPP_ROOT_SEQUENCE_MAJOR 4 # define RECLS_VER_RECLS_CPP_HPP_ROOT_SEQUENCE_MINOR 1 -# define RECLS_VER_RECLS_CPP_HPP_ROOT_SEQUENCE_REVISION 2 -# define RECLS_VER_RECLS_CPP_HPP_ROOT_SEQUENCE_EDIT 23 +# define RECLS_VER_RECLS_CPP_HPP_ROOT_SEQUENCE_REVISION 3 +# define RECLS_VER_RECLS_CPP_HPP_ROOT_SEQUENCE_EDIT 24 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */ /** \file recls/cpp/root_sequence.hpp @@ -97,8 +97,15 @@ namespace root_sequence_impl { struct make_root_string +#if __cplusplus < 201103L : std::unary_function +#endif { +#if __cplusplus >= 201103L + typedef recls_root_t argument_type; + typedef string_t result_type; +#endif + string_t operator ()(recls_root_t const& root) const { return string_t(root.name); diff --git a/include/recls/recls.h b/include/recls/recls.h index 6679d028..9a61dbdd 100644 --- a/include/recls/recls.h +++ b/include/recls/recls.h @@ -4,11 +4,11 @@ * Purpose: Main header file for the recls API. * * Created: 15th August 2003 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * Home: https://github.com/synesissoftware/recls * - * Copyright (c) 2019-2023, Matthew Wilson and Synesis Information Systems + * Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems * Copyright (c) 2003-2019, Matthew Wilson and Synesis Software * All rights reserved. * @@ -52,7 +52,7 @@ #ifndef RECLS_DOCUMENTATION_SKIP_SECTION # define RECLS_VER_RECLS_H_RECLS_MAJOR 3 # define RECLS_VER_RECLS_H_RECLS_MINOR 21 -# define RECLS_VER_RECLS_H_RECLS_REVISION 9 +# define RECLS_VER_RECLS_H_RECLS_REVISION 10 # define RECLS_VER_RECLS_H_RECLS_EDIT 128 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */ @@ -124,11 +124,13 @@ #define RECLS_VER_1_9_5 0x010905ff #define RECLS_VER_1_9_6 0x010906ff #define RECLS_VER_1_9_7 0x010907ff +#define RECLS_VER_1_9_8 0x010908ff -#define RECLS_VER_MAJOR 1 -#define RECLS_VER_MINOR 9 -#define RECLS_VER_REVISION 7 -#define RECLS_VER RECLS_VER_1_9_7 +#define RECLS_VER_MAJOR 1 +#define RECLS_VER_MINOR 9 +#define RECLS_VER_PATCH 8 +#define RECLS_VER_REVISION RECLS_VER_PATCH +#define RECLS_VER RECLS_VER_1_9_8 /* ///////////////////////////////////////////////////////////////////////// * strictness diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..6ba7c0f2 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,164 @@ + +# ######################################################################## # +# File: /src/CMakeLists.txt +# +# Purpose: CMake lists file for recls core library (1.9 line) +# +# Created: ... +# Updated: 3rd August 2026 +# +# ######################################################################## # + + +if(_BUILD_AS_UNIX) + + add_definitions(-DUNIX) + add_definitions(-Dunix) +endif(_BUILD_AS_UNIX) + +if(_BUILD_AS_WIN32) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + + message (STATUS "Compiling for 64-bit Windows") + + add_definitions(-DWIN64) + else() + + message (STATUS "Compiling for 32-bit Windows") + + add_definitions(-DWIN32) + endif() + + add_definitions(-DRECLS_API_FTP) +endif(_BUILD_AS_WIN32) + +if(MSVC) + if(MSVC_VERSION LESS 1920) + + add_compile_options("/wd4822") + endif() + + if(MSVC_VERSION GREATER_EQUAL 1914) + + add_compile_options("/Zc:__cplusplus") + + add_definitions(-D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) + endif() +endif(MSVC) + + +set(COMMON_IMPLEMENTATION_FILES + + ReclsFileSearch.cpp + ReclsFileSearchDirectoryNode.cpp + ReclsSearch.cpp + + api.entryinfo.cpp + api.error.cpp + api.extended.cpp + api.search.cpp + api.util.combine_paths.cpp + api.util.create_directory.cpp + api.util.derive_relative_path.cpp + api.util.get_file_sizes.cpp + api.util.remove_directory.cpp + api.util.squeeze_path.cpp + api.util.stat.cpp + + impl.entryinfo.cpp + impl.fileinfo.cpp + impl.snprintf.cpp + impl.trace.cpp + impl.util.cpp +) + +set(UNIX_IMPLEMENTATION_FILES + + api.unix.cpp + + impl.fileinfo.unix.cpp + impl.util.unix.cpp +) + +set(WINDOWS_IMPLEMENTATION_FILES + + ReclsFtpSearchDirectoryNode_windows.cpp + ReclsFtpSearch_windows.cpp + + api.ftp.windows.cpp + api.retcodes.windows.cpp + api.windows.cpp + + impl.fileinfo.windows.cpp + impl.util.windows.cpp +) + + +if(_BUILD_AS_UNIX) + + set(COMMON_IMPLEMENTATION_FILES "${COMMON_IMPLEMENTATION_FILES};${UNIX_IMPLEMENTATION_FILES};") +endif(_BUILD_AS_UNIX) + +if(_BUILD_AS_WIN32) + + set(COMMON_IMPLEMENTATION_FILES "${COMMON_IMPLEMENTATION_FILES};${WINDOWS_IMPLEMENTATION_FILES};") +endif(_BUILD_AS_WIN32) + + +add_library(core + ${COMMON_IMPLEMENTATION_FILES} +) + +set_target_properties(core PROPERTIES + OUTPUT_NAME "recls" +) + +target_include_directories(core + PUBLIC + $ + $ +) + +target_link_libraries(core + PRIVATE + $<$:STLSoft::STLSoft> + $<$:UNIXem::UNIXem> +) + +target_compile_options(core + PRIVATE + $<$,$,$>: + -Werror -Wall -Wextra -pedantic + + -Wno-deprecated-copy + -Wno-deprecated-declarations + -Wno-\#pragma-messages + $<$:-Wno-deprecated-volatile> + > + $<$: + /WX /W4 + > +) + + +# ########################################################## +# install + +install(TARGETS core + EXPORT project-targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +# install the include/recls/*/ subdirectories here, as do not (yet) know how to do so via PUBLIC_HEADER property +install( + DIRECTORY ${CMAKE_SOURCE_DIR}/include/${PROJECT_NAME_LOWER}/ + DESTINATION include/${PROJECT_NAME_LOWER} + FILES_MATCHING + PATTERN "*.h*" +) + + +# ############################## end of file ############################# # diff --git a/src/api.util.create_directory.cpp b/src/api.util.create_directory.cpp index e3fe74f1..f37b4e33 100644 --- a/src/api.util.create_directory.cpp +++ b/src/api.util.create_directory.cpp @@ -4,11 +4,11 @@ * Purpose: more recls API extended functions. * * Created: 30th January 2009 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * Home: https://github.com/synesissoftware/recls * - * Copyright (c) 2019-2023, Matthew Wilson and Synesis Information Systems + * Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems * Copyright (c) 2009-2019, Matthew Wilson and Synesis Software * All rights reserved. * @@ -103,9 +103,23 @@ DWORD get_exception_status_code( #if 0 #elif defined(RECLS_PLATFORM_IS_UNIX) + +# if _STLSOFT_VER >= 0x010a0200 + + unixstl::unixstl_exception& x +# else /* ? 1.10.2+ */ + unixstl::unix_exception& x +# endif /* 1.10.2+ */ #elif defined(RECLS_PLATFORM_IS_WINDOWS) + +# if _STLSOFT_VER >= 0x010a0200 + + winstl::winstl_exception& x +# else /* ? 1.10.2+ */ + winstl::windows_exception& x +# endif /* 1.10.2+ */ #endif /* platform */ ) { diff --git a/src/api.util.remove_directory.cpp b/src/api.util.remove_directory.cpp index d9fb22b9..b7881399 100644 --- a/src/api.util.remove_directory.cpp +++ b/src/api.util.remove_directory.cpp @@ -4,11 +4,11 @@ * Purpose: more recls API extended functions. * * Created: 30th January 2009 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * Home: https://github.com/synesissoftware/recls * - * Copyright (c) 2019-2023, Matthew Wilson and Synesis Information Systems + * Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems * Copyright (c) 2009-2019, Matthew Wilson and Synesis Software * All rights reserved. * @@ -102,9 +102,23 @@ DWORD get_exception_status_code( #if 0 #elif defined(RECLS_PLATFORM_IS_UNIX) + +# if _STLSOFT_VER >= 0x010a0200 + + unixstl::unixstl_exception& x +# else /* ? 1.10.2+ */ + unixstl::unix_exception& x +# endif /* 1.10.2+ */ #elif defined(RECLS_PLATFORM_IS_WINDOWS) + +# if _STLSOFT_VER >= 0x010a0200 + + winstl::winstl_exception& x +# else /* ? 1.10.2+ */ + winstl::windows_exception& x +# endif /* 1.10.2+ */ #endif /* platform */ ) { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..9e51dab8 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,38 @@ + +include_directories(${CMAKE_SOURCE_DIR}/include) + +if(_BUILD_AS_UNIX) + + add_definitions(-DUNIX) + add_definitions(-Dunix) +endif(_BUILD_AS_UNIX) + +if(_BUILD_AS_WIN32) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + + message (STATUS "Compiling for 64-bit Windows") + + add_definitions(-DWIN64) + else() + + message (STATUS "Compiling for 32-bit Windows") + + add_definitions(-DWIN32) + endif() + + add_definitions(-DRECLS_API_FTP) +endif(_BUILD_AS_WIN32) + +if((MSVC) AND (MSVC_VERSION GREATER_EQUAL 1914)) + + add_compile_options("/Zc:__cplusplus") + + add_definitions(-D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) +endif() + + +add_subdirectory(component) +add_subdirectory(scratch) +add_subdirectory(unit) + diff --git a/test/component/CMakeLists.txt b/test/component/CMakeLists.txt new file mode 100644 index 00000000..ebbfa193 --- /dev/null +++ b/test/component/CMakeLists.txt @@ -0,0 +1,5 @@ +if(xTests_VERSION VERSION_GREATER_EQUAL 0.20.5) + + add_subdirectory(test.component.util.cpp.create_directory) + add_subdirectory(test.component.util.cpp.remove_directory) +endif(xTests_VERSION VERSION_GREATER_EQUAL 0.20.5) diff --git a/test/component/test.component.util.cpp.create_directory/CMakeLists.txt b/test/component/test.component.util.cpp.create_directory/CMakeLists.txt new file mode 100644 index 00000000..ae43d61f --- /dev/null +++ b/test/component/test.component.util.cpp.create_directory/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.component.util.cpp.create_directory test.component.util.cpp.create_directory.cpp) diff --git a/test/component/test.component.util.cpp.remove_directory/CMakeLists.txt b/test/component/test.component.util.cpp.remove_directory/CMakeLists.txt new file mode 100644 index 00000000..7d66bc86 --- /dev/null +++ b/test/component/test.component.util.cpp.remove_directory/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.component.util.cpp.remove_directory test.component.util.cpp.remove_directory.cpp) diff --git a/test/scratch/CMakeLists.txt b/test/scratch/CMakeLists.txt new file mode 100644 index 00000000..037c4171 --- /dev/null +++ b/test/scratch/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(test.scratch.cpp_api) +add_subdirectory(test.scratch.links) +add_subdirectory(test.scratch.search.1) +if(Pantheios_FOUND) + + add_subdirectory(test.scratch.with_pantheios) +endif(Pantheios_FOUND) +add_subdirectory(test_c_1) diff --git a/test/scratch/test.scratch.cpp_api/CMakeLists.txt b/test/scratch/test.scratch.cpp_api/CMakeLists.txt new file mode 100644 index 00000000..c5109406 --- /dev/null +++ b/test/scratch/test.scratch.cpp_api/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(test.scratch.cpp_api test.scratch.cpp_api.cpp) diff --git a/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp b/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp index bff787f1..cae291a5 100644 --- a/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp +++ b/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp @@ -193,7 +193,7 @@ static void display_entry(recls::entry const& e); /* ////////////////////////////////////////////////////////////////////// */ -static int main_(int argc, char** argv) +static int main_(int /* argc */, char** argv) { using namespace recls; diff --git a/test/scratch/test.scratch.links/CMakeLists.txt b/test/scratch/test.scratch.links/CMakeLists.txt new file mode 100644 index 00000000..41d8f87f --- /dev/null +++ b/test/scratch/test.scratch.links/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(test.scratch.links test.scratch.links.cpp) diff --git a/test/scratch/test.scratch.links/test.scratch.links.cpp b/test/scratch/test.scratch.links/test.scratch.links.cpp index 1bb1fa14..31a5b4bc 100644 --- a/test/scratch/test.scratch.links/test.scratch.links.cpp +++ b/test/scratch/test.scratch.links/test.scratch.links.cpp @@ -59,7 +59,7 @@ typedef std::basic_string string_t; * main() */ -static int main_(int argc, char** argv) +static int main_(int /* argc */, char** /* argv */) { recls::search_sequence files(NULL, NULL, recls::RECURSIVE | recls::LINK_COUNT); diff --git a/test/scratch/test.scratch.search.1/CMakeLists.txt b/test/scratch/test.scratch.search.1/CMakeLists.txt new file mode 100644 index 00000000..7c5317c1 --- /dev/null +++ b/test/scratch/test.scratch.search.1/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(test.scratch.search.1 test.scratch.search.1.c) diff --git a/test/scratch/test.scratch.with_pantheios/CMakeLists.txt b/test/scratch/test.scratch.with_pantheios/CMakeLists.txt new file mode 100644 index 00000000..c1a425ba --- /dev/null +++ b/test/scratch/test.scratch.with_pantheios/CMakeLists.txt @@ -0,0 +1,10 @@ +define_example_program(test.scratch.with_pantheios test.scratch.with_pantheios.cpp) + +target_link_libraries(test.scratch.with_pantheios + PRIVATE + Pantheios::Pantheios.core + Pantheios::Pantheios.fe.all + Pantheios::Pantheios.be.AnsiConsole + Pantheios::Pantheios.bec.AnsiConsole + Pantheios::Pantheios.util +) diff --git a/test/scratch/test_c_1/CMakeLists.txt b/test/scratch/test_c_1/CMakeLists.txt new file mode 100644 index 00000000..94859b9f --- /dev/null +++ b/test/scratch/test_c_1/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_example_program(test_c_1 test_c_1.c) diff --git a/test/scratch/test_c_1/test_c_1.c b/test/scratch/test_c_1/test_c_1.c index 6c924ea2..05c53a21 100644 --- a/test/scratch/test_c_1/test_c_1.c +++ b/test/scratch/test_c_1/test_c_1.c @@ -4,7 +4,7 @@ * Purpose: Implementation file for the test_c_1 project. * * Created: 28th February 2007 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -175,13 +175,12 @@ static void process_search(hrecls_t hSrch) { recls_char_t buff[256]; recls_info_t info; - recls_filesize_t size; rc = Recls_GetDetails(hSrch, &info); if (RECLS_SUCCEEDED(rc)) { - printf("\t%.*s\n", info->path.end - info->path.begin, info->path.begin); + printf("\t%.*s\n", (int)(info->path.end - info->path.begin), info->path.begin); { size_t i; for(i = 0; i < STLSOFT_NUM_ELEMENTS(fns); ++i) { @@ -199,7 +198,7 @@ static void process_search(hrecls_t hSrch) Recls_DoesEntryExist(info); Recls_IsFileUNC(info); - Recls_GetSizeProperty(info, &size); + (void)Recls_GetSizeProperty(info); Recls_GetCreationTime(info); Recls_GetModificationTime(info); Recls_GetLastAccessTime(info); diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 00000000..4f73a7eb --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,10 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +add_subdirectory(test.unit.api.combine_paths) +add_subdirectory(test.unit.api.createdirectory) +add_subdirectory(test.unit.api.squeeze_path) +add_subdirectory(test.unit.api.stat) +add_subdirectory(test.unit.c.retcodes) +add_subdirectory(test.unit.cpp.combine_paths) +add_subdirectory(test.unit.cpp.derive_relative_path) +add_subdirectory(test.unit.cpp.retcodes) +add_subdirectory(test.unit.cpp.squeeze_path) diff --git a/test/unit/test.unit.api.combine_paths/CMakeLists.txt b/test/unit/test.unit.api.combine_paths/CMakeLists.txt new file mode 100644 index 00000000..c0a42382 --- /dev/null +++ b/test/unit/test.unit.api.combine_paths/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.api.combine_paths test.unit.api.combine_paths.c) diff --git a/test/unit/test.unit.api.combine_paths/test.unit.api.combine_paths.c b/test/unit/test.unit.api.combine_paths/test.unit.api.combine_paths.c index dc5b561f..57593492 100644 --- a/test/unit/test.unit.api.combine_paths/test.unit.api.combine_paths.c +++ b/test/unit/test.unit.api.combine_paths/test.unit.api.combine_paths.c @@ -4,7 +4,7 @@ * Purpose: Implementation file for the test.unit.api.combine_paths project. * * Created: 13th December 2008 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -146,7 +146,7 @@ static int main_xc(int argc, char** argv) * test function implementations */ -static void test_measure_0() +static void test_measure_0(void) { { size_t cch = Recls_CombinePaths(RECLS_LITERAL(""), NULL, NULL, 0); @@ -173,7 +173,7 @@ static void test_measure_0() } } -static void test_measure_1() +static void test_measure_1(void) { recls_char_t result[101]; size_t cch = Recls_CombinePaths(NULL, RECLS_LITERAL(""), &result[0], STLSOFT_NUM_ELEMENTS(result)); @@ -183,7 +183,7 @@ static void test_measure_1() XTESTS_TEST_INTEGER_EQUAL(0u, cch); } -static void test_1_2() +static void test_1_2(void) { { recls_char_t result[101]; @@ -206,7 +206,7 @@ static void test_1_2() } } -static void test_1_3() +static void test_1_3(void) { recls_char_t result[101]; size_t cch = Recls_CombinePaths(RECLS_LITERAL("abc"), RECLS_LITERAL("def"), &result[0], STLSOFT_NUM_ELEMENTS(result)); @@ -221,67 +221,67 @@ static void test_1_3() #endif } -static void test_1_4() +static void test_1_4(void) { } -static void test_1_5() +static void test_1_5(void) { } -static void test_1_6() +static void test_1_6(void) { } -static void test_1_7() +static void test_1_7(void) { } -static void test_1_8() +static void test_1_8(void) { } -static void test_1_9() +static void test_1_9(void) { } -static void test_1_10() +static void test_1_10(void) { } -static void test_1_11() +static void test_1_11(void) { } -static void test_1_12() +static void test_1_12(void) { } -static void test_1_13() +static void test_1_13(void) { } -static void test_1_14() +static void test_1_14(void) { } -static void test_1_15() +static void test_1_15(void) { } -static void test_1_16() +static void test_1_16(void) { } -static void test_1_17() +static void test_1_17(void) { } -static void test_1_18() +static void test_1_18(void) { } -static void test_1_19() +static void test_1_19(void) { } diff --git a/test/unit/test.unit.api.createdirectory/CMakeLists.txt b/test/unit/test.unit.api.createdirectory/CMakeLists.txt new file mode 100644 index 00000000..a6d9f988 --- /dev/null +++ b/test/unit/test.unit.api.createdirectory/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.api.createdirectory test.unit.api.createdirectory.c) diff --git a/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c b/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c index 669b8c18..8e37fd1f 100644 --- a/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c +++ b/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c @@ -4,7 +4,7 @@ * Purpose: Implementation file for the test.unit.api.createdirectory project. * * Created: 29th January 2009 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -27,7 +27,9 @@ #include /* Standard C Header Files */ +#include #include +#include #if defined(PLATFORMSTL_OS_IS_UNIX) # include #elif defined(PLATFORMSTL_OS_IS_WINDOWS) @@ -88,16 +90,11 @@ static void test_1_19(void); recls_char_t* s_cwd; size_t s_cwdLen; recls_char_t* s_home; +recls_char_t* s_testRoot; +size_t s_testRootLen; size_t path_max; -static void finish_off_directory(recls_char_t* s) -{ - size_t n = strlen(s); - - if (n > 0) - { - } -} +#define RECLS_TEST_DIR_LEAF "recls_test_dir_root_D01441CA_A1CD_4916_B095_B2D65B15E517" int main(int argc, char **argv) { @@ -118,14 +115,20 @@ int main(int argc, char **argv) #else # error platform not discriminated #endif - s_cwd = (recls_char_t*)malloc(sizeof(recls_char_t) * (1 + path_max)); - s_home = (recls_char_t*)malloc(sizeof(recls_char_t) * (1 + path_max)); + s_cwd = (recls_char_t*)malloc(sizeof(recls_char_t) * (1 + path_max)); + s_home = (recls_char_t*)malloc(sizeof(recls_char_t) * (1 + path_max)); + s_testRoot = (recls_char_t*)malloc(sizeof(recls_char_t) * (1 + path_max)); if (NULL == s_cwd || - NULL == s_home) + NULL == s_home || + NULL == s_testRoot) { fprintf(stderr, "Cannot allocate enough memory to run tests!\n"); + free(s_cwd); + free(s_home); + free(s_testRoot); + return EXIT_FAILURE; } @@ -162,6 +165,16 @@ int main(int argc, char **argv) s_cwdLen = strlen(s_cwd); + /* Place under $HOME (1.10 uses "~/..."; 1.9 has no tilde expansion). */ + strcpy(s_testRoot, s_home); +#if defined(PLATFORMSTL_OS_IS_WINDOWS) && \ + !defined(PLATFORMSTL_OS_IS_UNIX) + strcat(s_testRoot, "\\" RECLS_TEST_DIR_LEAF); +#else + strcat(s_testRoot, "/" RECLS_TEST_DIR_LEAF); +#endif + s_testRootLen = strlen(s_testRoot); + if (XTESTS_START_RUNNER("test.unit.api.createdirectory", verbosity)) { XTESTS_RUN_CASE(test_1_0); @@ -192,6 +205,7 @@ int main(int argc, char **argv) free(s_cwd); free(s_home); + free(s_testRoot); return retCode; } @@ -200,150 +214,156 @@ int main(int argc, char **argv) * test function implementations */ -#define RECLS_TEST_DIR_ROOT "/recls_test_dir_root_D01441CA_A1CD_4916_B095_B2D65B15E517" -#define RECLS_TEST_DIR_ROOT_LEN_ ((STLSOFT_NUM_ELEMENTS(RECLS_TEST_DIR_ROOT) - 1)) -#if defined(PLATFORMSTL_OS_IS_WINDOWS) -# define RECLS_TEST_DIR_ROOT_LEN (2u + RECLS_TEST_DIR_ROOT_LEN_) -#else -# define RECLS_TEST_DIR_ROOT_LEN RECLS_TEST_DIR_ROOT_LEN_ -#endif - - -static void test_1_0() +static void test_1_0(void) { { recls_directoryResults_t results; recls_rc_t rc = Recls_CreateDirectory("", &results); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_INVALID_NAME, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_INVALID_NAME, rc); } { recls_rc_t rc = Recls_CreateDirectory("", NULL); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_INVALID_NAME, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_INVALID_NAME, rc); } } -static void test_1_1() +static void test_1_1(void) { { recls_directoryResults_t results; recls_rc_t rc = Recls_CreateDirectory(".", &results); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); XTESTS_TEST_INTEGER_EQUAL(s_cwdLen, results.resultingLength); } { recls_rc_t rc = Recls_CreateDirectory(".", NULL); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); } } -static void test_1_2() +static void test_1_2(void) { { recls_directoryResults_t results; - recls_rc_t rc = Recls_CreateDirectory(RECLS_TEST_DIR_ROOT, &results); + recls_rc_t rc = Recls_CreateDirectory(s_testRoot, &results); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_OK, rc); - XTESTS_TEST_INTEGER_EQUAL(RECLS_TEST_DIR_ROOT_LEN, results.resultingLength); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_INTEGER_EQUAL(s_testRootLen, results.resultingLength); } { - recls_rc_t rc = Recls_CreateDirectory(RECLS_TEST_DIR_ROOT, NULL); + recls_rc_t rc = Recls_CreateDirectory(s_testRoot, NULL); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); } - Recls_RemoveDirectory(RECLS_TEST_DIR_ROOT, RECLS_REMDIR_F_REMOVE_FILES, NULL); + Recls_RemoveDirectory(s_testRoot, RECLS_REMDIR_F_REMOVE_FILES, NULL); } -static void test_1_3() +static void test_1_3(void) { #define TEST_1_3_SUBDIR "/abc/def/ghi/jkl/mno" #define TEST_1_3_SUBDIR_LEN (STLSOFT_NUM_ELEMENTS(TEST_1_3_SUBDIR) - 1) + recls_char_t* const path = (recls_char_t*)malloc(sizeof(recls_char_t) * (1 + s_testRootLen + TEST_1_3_SUBDIR_LEN)); + size_t const pathLen = s_testRootLen + TEST_1_3_SUBDIR_LEN; + + if (NULL == path) + { + XTESTS_TEST_FAIL("could not allocate path buffer"); + + return; + } + + strcpy(path, s_testRoot); + strcat(path, TEST_1_3_SUBDIR); + { recls_directoryResults_t results; - recls_rc_t rc = Recls_CreateDirectory(RECLS_TEST_DIR_ROOT TEST_1_3_SUBDIR, &results); + recls_rc_t rc = Recls_CreateDirectory(path, &results); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_OK, rc); - XTESTS_TEST_INTEGER_EQUAL(RECLS_TEST_DIR_ROOT_LEN + TEST_1_3_SUBDIR_LEN, results.resultingLength); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_INTEGER_EQUAL(pathLen, results.resultingLength); } { - recls_rc_t rc = Recls_CreateDirectory(RECLS_TEST_DIR_ROOT TEST_1_3_SUBDIR, NULL); + recls_rc_t rc = Recls_CreateDirectory(path, NULL); - XTESTS_TEST_ENUM_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); } - Recls_RemoveDirectory(RECLS_TEST_DIR_ROOT, RECLS_REMDIR_F_REMOVE_FILES | RECLS_REMDIR_F_REMOVE_READONLY, NULL); + Recls_RemoveDirectory(s_testRoot, RECLS_REMDIR_F_REMOVE_FILES | RECLS_REMDIR_F_REMOVE_READONLY, NULL); + + free(path); } -static void test_1_4() +static void test_1_4(void) { } -static void test_1_5() +static void test_1_5(void) { } -static void test_1_6() +static void test_1_6(void) { } -static void test_1_7() +static void test_1_7(void) { } -static void test_1_8() +static void test_1_8(void) { } -static void test_1_9() +static void test_1_9(void) { } -static void test_1_10() +static void test_1_10(void) { } -static void test_1_11() +static void test_1_11(void) { } -static void test_1_12() +static void test_1_12(void) { } -static void test_1_13() +static void test_1_13(void) { } -static void test_1_14() +static void test_1_14(void) { } -static void test_1_15() +static void test_1_15(void) { } -static void test_1_16() +static void test_1_16(void) { } -static void test_1_17() +static void test_1_17(void) { } -static void test_1_18() +static void test_1_18(void) { } -static void test_1_19() +static void test_1_19(void) { } diff --git a/test/unit/test.unit.api.squeeze_path/CMakeLists.txt b/test/unit/test.unit.api.squeeze_path/CMakeLists.txt new file mode 100644 index 00000000..e857efea --- /dev/null +++ b/test/unit/test.unit.api.squeeze_path/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.api.squeeze_path test.unit.api.squeeze_path.c) diff --git a/test/unit/test.unit.api.squeeze_path/test.unit.api.squeeze_path.c b/test/unit/test.unit.api.squeeze_path/test.unit.api.squeeze_path.c index 856aeaf3..e7c50663 100644 --- a/test/unit/test.unit.api.squeeze_path/test.unit.api.squeeze_path.c +++ b/test/unit/test.unit.api.squeeze_path/test.unit.api.squeeze_path.c @@ -4,7 +4,7 @@ * Purpose: Implementation file for the test.unit.api.squeeze_path project. * * Created: 13th December 2008 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -146,7 +146,7 @@ static int main_xc(int argc, char** argv) * test function implementations */ -static void test_1_0() +static void test_1_0(void) { recls_char_t result[1]; size_t cch = Recls_SqueezePath(RECLS_LITERAL(""), NULL, 0); @@ -157,7 +157,7 @@ static void test_1_0() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL(""), result); } -static void test_1_1() +static void test_1_1(void) { recls_char_t result[1]; size_t cch = Recls_SqueezePath(RECLS_LITERAL(""), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -168,7 +168,7 @@ static void test_1_1() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL(""), result); } -static void test_1_2() +static void test_1_2(void) { recls_char_t result[11]; size_t cch = Recls_SqueezePath(RECLS_LITERAL(""), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -179,7 +179,7 @@ static void test_1_2() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL(""), result); } -static void test_1_3() +static void test_1_3(void) { recls_char_t result[12]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -190,7 +190,7 @@ static void test_1_3() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("abc/def/ghi"), result); } -static void test_1_4() +static void test_1_4(void) { recls_char_t result[11]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -201,7 +201,7 @@ static void test_1_4() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("abc.../ghi"), result); } -static void test_1_5() +static void test_1_5(void) { recls_char_t result[10]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -212,7 +212,7 @@ static void test_1_5() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("ab.../ghi"), result); } -static void test_1_6() +static void test_1_6(void) { recls_char_t result[9]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -223,7 +223,7 @@ static void test_1_6() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("a.../ghi"), result); } -static void test_1_7() +static void test_1_7(void) { recls_char_t result[8]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -234,7 +234,7 @@ static void test_1_7() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL(".../ghi"), result); } -static void test_1_8() +static void test_1_8(void) { recls_char_t result[7]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -245,7 +245,7 @@ static void test_1_8() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("ghi"), result); } -static void test_1_9() +static void test_1_9(void) { recls_char_t result[6]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -256,7 +256,7 @@ static void test_1_9() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("ghi"), result); } -static void test_1_10() +static void test_1_10(void) { recls_char_t result[5]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -267,7 +267,7 @@ static void test_1_10() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("ghi"), result); } -static void test_1_11() +static void test_1_11(void) { recls_char_t result[4]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -278,7 +278,7 @@ static void test_1_11() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("ghi"), result); } -static void test_1_12() +static void test_1_12(void) { recls_char_t result[3]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -289,7 +289,7 @@ static void test_1_12() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("gh"), result); } -static void test_1_13() +static void test_1_13(void) { recls_char_t result[2]; size_t cch = Recls_SqueezePath(RECLS_LITERAL("abc/def/ghi"), &result[0], STLSOFT_NUM_ELEMENTS(result) - 1); @@ -300,27 +300,27 @@ static void test_1_13() XTESTS_TEST_STRING_EQUAL(RECLS_LITERAL("g"), result); } -static void test_1_14() +static void test_1_14(void) { } -static void test_1_15() +static void test_1_15(void) { } -static void test_1_16() +static void test_1_16(void) { } -static void test_1_17() +static void test_1_17(void) { } -static void test_1_18() +static void test_1_18(void) { } -static void test_1_19() +static void test_1_19(void) { } diff --git a/test/unit/test.unit.api.stat/CMakeLists.txt b/test/unit/test.unit.api.stat/CMakeLists.txt new file mode 100644 index 00000000..78a1f9d3 --- /dev/null +++ b/test/unit/test.unit.api.stat/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.api.stat test.unit.api.stat.c) diff --git a/test/unit/test.unit.api.stat/test.unit.api.stat.c b/test/unit/test.unit.api.stat/test.unit.api.stat.c index 35377376..72f4584d 100644 --- a/test/unit/test.unit.api.stat/test.unit.api.stat.c +++ b/test/unit/test.unit.api.stat/test.unit.api.stat.c @@ -4,7 +4,7 @@ * Purpose: Implementation file for the test.unit.api.stat project. * * Created: 13th December 2008 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -89,14 +89,6 @@ recls_char_t* s_cwd; recls_char_t* s_home; size_t path_max; -static void finish_off_directory(recls_char_t* s) -{ - size_t n = strlen(s); - - if (n > 0) - { - } -} int main(int argc, char **argv) { @@ -198,15 +190,15 @@ int main(int argc, char **argv) * test function implementations */ -static void test_1_0() +static void test_1_0(void) { recls_info_t entry; recls_rc_t rc = Recls_Stat("", 0, &entry); - XTESTS_TEST_INTEGER_EQUAL(RECLS_RC_INVALID_NAME, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_INVALID_NAME, rc); } -static void test_1_1() +static void test_1_1(void) { recls_info_t entry; recls_rc_t rc = Recls_Stat(".", 0, &entry); @@ -233,11 +225,11 @@ static void test_1_1() } else { - XTESTS_TEST_INTEGER_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); } } -static void test_1_2() +static void test_1_2(void) { recls_info_t entry; recls_rc_t rc = Recls_Stat("~", 0, &entry); @@ -264,11 +256,11 @@ static void test_1_2() } else { - XTESTS_TEST_INTEGER_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); } } -static void test_1_3() +static void test_1_3(void) { recls_info_t entry; recls_rc_t rc = Recls_Stat("~", RECLS_F_MARK_DIRS, &entry); @@ -295,71 +287,71 @@ static void test_1_3() } else { - XTESTS_TEST_INTEGER_EQUAL(RECLS_RC_OK, rc); + XTESTS_TEST_POINTER_EQUAL(RECLS_RC_OK, rc); } } -static void test_1_4() +static void test_1_4(void) { } -static void test_1_5() +static void test_1_5(void) { } -static void test_1_6() +static void test_1_6(void) { } -static void test_1_7() +static void test_1_7(void) { } -static void test_1_8() +static void test_1_8(void) { } -static void test_1_9() +static void test_1_9(void) { } -static void test_1_10() +static void test_1_10(void) { } -static void test_1_11() +static void test_1_11(void) { } -static void test_1_12() +static void test_1_12(void) { } -static void test_1_13() +static void test_1_13(void) { } -static void test_1_14() +static void test_1_14(void) { } -static void test_1_15() +static void test_1_15(void) { } -static void test_1_16() +static void test_1_16(void) { } -static void test_1_17() +static void test_1_17(void) { } -static void test_1_18() +static void test_1_18(void) { } -static void test_1_19() +static void test_1_19(void) { } diff --git a/test/unit/test.unit.c.retcodes/CMakeLists.txt b/test/unit/test.unit.c.retcodes/CMakeLists.txt new file mode 100644 index 00000000..27d922b3 --- /dev/null +++ b/test/unit/test.unit.c.retcodes/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.c.retcodes test.unit.c.retcodes.c) diff --git a/test/unit/test.unit.c.retcodes/test.unit.c.retcodes.c b/test/unit/test.unit.c.retcodes/test.unit.c.retcodes.c index cf8d9eb6..7277c2d7 100644 --- a/test/unit/test.unit.c.retcodes/test.unit.c.retcodes.c +++ b/test/unit/test.unit.c.retcodes/test.unit.c.retcodes.c @@ -4,7 +4,7 @@ * Purpose: Implementation file for the test.unit.c.retcodes project. * * Created: 13th December 2008 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -159,19 +159,19 @@ static recls_rc_t const s_FAILURE_CODES[] = -static void test_1_0() +static void test_1_0(void) { XTESTS_TEST_BOOLEAN_TRUE(RECLS_SUCCEEDED(RECLS_RC_OK)); XTESTS_TEST_BOOLEAN_FALSE(RECLS_FAILED(RECLS_RC_OK)); } -static void test_1_1() +static void test_1_1(void) { XTESTS_TEST_BOOLEAN_TRUE(RECLS_FAILED(RECLS_RC_FAIL)); XTESTS_TEST_BOOLEAN_FALSE(RECLS_SUCCEEDED(RECLS_RC_FAIL)); } -static void test_1_2() +static void test_1_2(void) { { size_t i; for(i = 0; i != STLSOFT_NUM_ELEMENTS(s_FAILURE_CODES); ++i) { @@ -182,7 +182,7 @@ static void test_1_2() }} } -static void test_1_3() +static void test_1_3(void) { { size_t i; for(i = 0; i != 10000000; ++i) { @@ -202,67 +202,67 @@ static void test_1_3() }} } -static void test_1_4() +static void test_1_4(void) { } -static void test_1_5() +static void test_1_5(void) { } -static void test_1_6() +static void test_1_6(void) { } -static void test_1_7() +static void test_1_7(void) { } -static void test_1_8() +static void test_1_8(void) { } -static void test_1_9() +static void test_1_9(void) { } -static void test_1_10() +static void test_1_10(void) { } -static void test_1_11() +static void test_1_11(void) { } -static void test_1_12() +static void test_1_12(void) { } -static void test_1_13() +static void test_1_13(void) { } -static void test_1_14() +static void test_1_14(void) { } -static void test_1_15() +static void test_1_15(void) { } -static void test_1_16() +static void test_1_16(void) { } -static void test_1_17() +static void test_1_17(void) { } -static void test_1_18() +static void test_1_18(void) { } -static void test_1_19() +static void test_1_19(void) { } diff --git a/test/unit/test.unit.cpp.combine_paths/CMakeLists.txt b/test/unit/test.unit.cpp.combine_paths/CMakeLists.txt new file mode 100644 index 00000000..5449e3b5 --- /dev/null +++ b/test/unit/test.unit.cpp.combine_paths/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.cpp.combine_paths test.unit.cpp.combine_paths.cpp) diff --git a/test/unit/test.unit.cpp.derive_relative_path/CMakeLists.txt b/test/unit/test.unit.cpp.derive_relative_path/CMakeLists.txt new file mode 100644 index 00000000..e15dd6ce --- /dev/null +++ b/test/unit/test.unit.cpp.derive_relative_path/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.cpp.derive_relative_path test.unit.cpp.derive_relative_path.cpp) diff --git a/test/unit/test.unit.cpp.retcodes/CMakeLists.txt b/test/unit/test.unit.cpp.retcodes/CMakeLists.txt new file mode 100644 index 00000000..376b8b72 --- /dev/null +++ b/test/unit/test.unit.cpp.retcodes/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.cpp.retcodes test.unit.cpp.retcodes.cpp) diff --git a/test/unit/test.unit.cpp.squeeze_path/CMakeLists.txt b/test/unit/test.unit.cpp.squeeze_path/CMakeLists.txt new file mode 100644 index 00000000..f0a8ec7a --- /dev/null +++ b/test/unit/test.unit.cpp.squeeze_path/CMakeLists.txt @@ -0,0 +1,2 @@ +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +define_automated_test_program(test.unit.cpp.squeeze_path test.unit.cpp.squeeze_path.cpp) From 03a35d87056540b0b1befef6e38909fb165b7742 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 14:06:14 +1000 Subject: [PATCH 07/12] feature: GitHub Actions CI --- .github/workflows/ci-cell.yml | 368 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 252 +++++++++++++++++++++++ README.md | 2 + 3 files changed, 622 insertions(+) create mode 100644 .github/workflows/ci-cell.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci-cell.yml b/.github/workflows/ci-cell.yml new file mode 100644 index 00000000..67eb0fc8 --- /dev/null +++ b/.github/workflows/ci-cell.yml @@ -0,0 +1,368 @@ +name: CI cell + +on: + workflow_call: + inputs: + cell-id: + required: true + type: string + os: + required: true + type: string + c-compiler: + required: true + type: string + cpp-compiler: + required: true + type: string + build-type: + required: false + type: string + default: Release + +jobs: + build: + name: Build (${{ inputs.cell-id }}) + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Clang (Ubuntu) + if: runner.os == 'Linux' && inputs.c-compiler == 'clang' + run: sudo apt-get update && sudo apt-get install -y clang + + - name: Setup MSYS2 MinGW + if: runner.os == 'Windows' && inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + mingw-w64-x86_64-make + + - name: Install test dependencies (STLSoft + shwild + xTests + b64) + shell: bash + run: | + set -euxo pipefail + + DEPS="${RUNNER_TEMP}/sis-deps" + STLSRC="${RUNNER_TEMP}/stlsoft-src" + STLBUILD="${RUNNER_TEMP}/stlsoft-build" + SHWSRC="${RUNNER_TEMP}/shwild-src" + SHWBUILD="${RUNNER_TEMP}/shwild-build" + XTSRC="${RUNNER_TEMP}/xtests-src" + XTBUILD="${RUNNER_TEMP}/xtests-build" + + mkdir -p "$DEPS" + + # 1. STLSoft + git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC" + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -S "$STLSRC" -B "$STLBUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --config "${{ inputs.build-type }}" --parallel + cmake --install "$STLBUILD" --config "${{ inputs.build-type }}" + elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -S "$STLSRC" -B "$STLBUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --parallel 2 + cmake --install "$STLBUILD" + 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_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --parallel + cmake --install "$STLBUILD" + fi + + # 2. shwild + git clone --depth 1 https://github.com/synesissoftware/shwild "$SHWSRC" + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -S "$SHWSRC" -B "$SHWBUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$SHWBUILD" --config "${{ inputs.build-type }}" --parallel + cmake --install "$SHWBUILD" --config "${{ inputs.build-type }}" + elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -S "$SHWSRC" -B "$SHWBUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$SHWBUILD" --parallel 2 + cmake --install "$SHWBUILD" + 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_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$SHWBUILD" --parallel + cmake --install "$SHWBUILD" + fi + + # 3. xTests + git clone --depth 1 https://github.com/synesissoftware/xTests "$XTSRC" + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -S "$XTSRC" -B "$XTBUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$XTBUILD" --config "${{ inputs.build-type }}" --parallel + cmake --install "$XTBUILD" --config "${{ inputs.build-type }}" + elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -S "$XTSRC" -B "$XTBUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$XTBUILD" --parallel 2 + cmake --install "$XTBUILD" + 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_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$XTBUILD" --parallel + cmake --install "$XTBUILD" + fi + + # 4. b64 + B64SRC="${RUNNER_TEMP}/b64-src" + B64BUILD="${RUNNER_TEMP}/b64-build" + git clone --depth 1 https://github.com/synesissoftware/b64 "$B64SRC" + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -S "$B64SRC" -B "$B64BUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$B64BUILD" --config "${{ inputs.build-type }}" --parallel + cmake --install "$B64BUILD" --config "${{ inputs.build-type }}" + elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -S "$B64SRC" -B "$B64BUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$B64BUILD" --parallel 2 + cmake --install "$B64BUILD" + else + cmake -S "$B64SRC" -B "$B64BUILD" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_C_COMPILER="${{ inputs.c-compiler }}" \ + -DCMAKE_CXX_COMPILER="${{ inputs.cpp-compiler }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$B64BUILD" --parallel + cmake --install "$B64BUILD" + fi + + - name: Configure + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -B build -S . \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \ + -DBUILD_EXAMPLES=ON \ + -DBUILD_TESTING=ON + elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -B build -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_COMPILER=g++ \ + -DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \ + -DBUILD_EXAMPLES=ON \ + -DBUILD_TESTING=ON + else + 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 + fi + + - name: Build + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake --build build --config "${{ inputs.build-type }}" --parallel + elif [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake --build build --parallel 2 + else + cmake --build build --parallel + fi + + - name: Upload build tree + uses: actions/upload-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + retention-days: 1 + + run-examples: + name: Examples (${{ inputs.cell-id }}) + needs: build + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: runner.os == 'Windows' && inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run examples + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_examples.sh -M + + test-unit: + name: Unit tests (${{ inputs.cell-id }}) + needs: build + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: runner.os == 'Windows' && inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run unit tests + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_unit_tests.sh -M --unit-only + + test-component: + name: Component tests (${{ inputs.cell-id }}) + needs: build + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: runner.os == 'Windows' && inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run component tests + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_unit_tests.sh -M --component-only + + test-scratch: + name: Scratch tests (${{ inputs.cell-id }}) + needs: build + continue-on-error: true + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: runner.os == 'Windows' && inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run scratch tests + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_scratch_tests.sh -M diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..31ad34cd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,252 @@ +name: CI + +on: + push: + branches: + - master + - master-1.9 + - master-1.10 + - dev + - dev-1.9 + - dev-1.9-boilerplate + - rc1 + - rc2 + - rc3 + - rc4 + - rc5 + - update + - boilerplate + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + BUILD_TYPE: Release + +jobs: + cell: + name: CI (${{ matrix.id }}) + strategy: + fail-fast: false + matrix: + include: + - id: linux-clang + os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + - id: linux-gcc + os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - id: macos-clang + os: macos-latest + c_compiler: clang + cpp_compiler: clang++ + - id: macos-gcc + os: macos-latest + c_compiler: gcc + cpp_compiler: g++ + - id: windows-cl + os: windows-latest + c_compiler: cl + cpp_compiler: cl + - id: windows-mingw + os: windows-latest + c_compiler: mingw + cpp_compiler: g++ + uses: ./.github/workflows/ci-cell.yml + with: + cell-id: ${{ matrix.id }} + os: ${{ matrix.os }} + c-compiler: ${{ matrix.c_compiler }} + cpp-compiler: ${{ matrix.cpp_compiler }} + build-type: Release + secrets: inherit + + install-smoke: + name: Install smoke (${{ matrix.os }}, ${{ matrix.c_compiler }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + - os: macos-latest + c_compiler: clang + cpp_compiler: clang++ + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: windows-latest + c_compiler: mingw + cpp_compiler: g++ + + steps: + - uses: actions/checkout@v4 + + - name: Install Clang (Ubuntu) + if: runner.os == 'Linux' && matrix.c_compiler == 'clang' + run: sudo apt-get update && sudo apt-get install -y clang + + - name: Setup MSYS2 MinGW + if: runner.os == 'Windows' && matrix.c_compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + mingw-w64-x86_64-make + + - name: Install STLSoft dependency + shell: bash + run: | + set -euo pipefail + DEPS="${RUNNER_TEMP}/sis-deps" + STLSRC="${RUNNER_TEMP}/stlsoft-src" + STLBUILD="${RUNNER_TEMP}/stlsoft-build" + mkdir -p "$DEPS" + git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC" + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake -S "$STLSRC" -B "$STLBUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --config "${{ env.BUILD_TYPE }}" --parallel + cmake --install "$STLBUILD" --config "${{ env.BUILD_TYPE }}" + elif [ "${{ matrix.c_compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -S "$STLSRC" -B "$STLBUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --parallel 2 + cmake --install "$STLBUILD" + else + cmake -S "$STLSRC" -B "$STLBUILD" \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \ + -DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --parallel + cmake --install "$STLBUILD" + fi + echo "SIS_DEPS=$DEPS" >> "$GITHUB_ENV" + + - name: Configure + shell: bash + run: | + set -euo pipefail + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake -B build -S . \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + elif [ "${{ matrix.c_compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -B build -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_COMPILER=g++ \ + -DCMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + else + cmake -B build -S . \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \ + -DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \ + -DCMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + fi + + - name: Build + shell: bash + run: | + set -euo pipefail + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake --build build --config "${{ env.BUILD_TYPE }}" --parallel + elif [ "${{ matrix.c_compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake --build build --parallel 2 + else + cmake --build build --parallel + fi + + - name: Install + shell: bash + run: | + set -euo pipefail + PREFIX="${RUNNER_TEMP}/install-prefix" + echo "INSTALL_PREFIX=$PREFIX" >> "$GITHUB_ENV" + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake --install build --config "${{ env.BUILD_TYPE }}" --prefix "$PREFIX" + else + cmake --install build --prefix "$PREFIX" + fi + + - name: Verify install tree + shell: bash + run: | + set -euo pipefail + test -f "${INSTALL_PREFIX}/include/recls/recls.h" + test -f "${INSTALL_PREFIX}/lib/cmake/recls/recls-config.cmake" + + - name: Configure and run install smoke consumer + shell: bash + run: | + set -euo pipefail + CONSUMER="${RUNNER_TEMP}/consumer" + mkdir -p "$CONSUMER" + cat > "$CONSUMER/CMakeLists.txt" <<'EOF' + cmake_minimum_required(VERSION 3.13) + project(recls_install_smoke C) + find_package(STLSoft REQUIRED) + find_package(recls REQUIRED) + add_executable(consumer consumer.c) + if(WIN32) + target_compile_definitions(consumer PRIVATE WIN32) + else() + target_compile_definitions(consumer PRIVATE UNIX) + endif() + target_link_libraries(consumer PRIVATE recls::core) + EOF + cat > "$CONSUMER/consumer.c" <<'EOF' + #include + int main(void) { return 0; } + EOF + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake -S "$CONSUMER" -B consumer-build \ + -DCMAKE_PREFIX_PATH="${INSTALL_PREFIX};${{ env.SIS_DEPS }}" + cmake --build consumer-build --config "${{ env.BUILD_TYPE }}" --parallel + consumer-build/${{ env.BUILD_TYPE }}/consumer.exe + elif [ "${{ matrix.c_compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + cmake -S "$CONSUMER" -B consumer-build -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_PREFIX_PATH="${INSTALL_PREFIX};${{ env.SIS_DEPS }}" + cmake --build consumer-build --parallel 2 + consumer-build/consumer.exe + else + cmake -S "$CONSUMER" -B consumer-build \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \ + -DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \ + -DCMAKE_PREFIX_PATH="${INSTALL_PREFIX};${{ env.SIS_DEPS }}" + cmake --build consumer-build --parallel + consumer-build/consumer + fi diff --git a/README.md b/README.md index 6a8931e6..978fd02c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![CMake on multiple platforms](https://github.com/synesissoftware/recls/actions/workflows/ci.yml/badge.svg)](https://github.com/synesissoftware/recls/actions/workflows/ci.yml) + # recls The platform-independent recursive search library From b022cf07481cb84eb2c2d2b94fd27d1076c43b4c Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 14:14:14 +1000 Subject: [PATCH 08/12] fix --- cmake/TargetMacros.cmake | 1 + include/recls/cpp/root_sequence.hpp | 2 +- src/CMakeLists.txt | 2 ++ .../test.unit.api.createdirectory.c | 14 +++++++++++++- test/unit/test.unit.api.stat/test.unit.api.stat.c | 13 ++++++++++++- 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/cmake/TargetMacros.cmake b/cmake/TargetMacros.cmake index 355f230e..c99103c5 100644 --- a/cmake/TargetMacros.cmake +++ b/cmake/TargetMacros.cmake @@ -35,6 +35,7 @@ macro(define_target_compile_options target_name) $<$: /WX /W4 + /wd4996 ${X_MSVC_CUSTOM_WARNINGS_} > ) diff --git a/include/recls/cpp/root_sequence.hpp b/include/recls/cpp/root_sequence.hpp index c44c8ec6..642b3aaa 100644 --- a/include/recls/cpp/root_sequence.hpp +++ b/include/recls/cpp/root_sequence.hpp @@ -164,7 +164,7 @@ class root_sequence /// The reference type typedef void reference; /// The non-mutable (const) reference type - typedef value_type const const_reference; + typedef value_type const_reference; /// The size type typedef size_t size_type; /// @} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ba7c0f2..7874b95f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -138,6 +138,8 @@ target_compile_options(core > $<$: /WX /W4 + + /wd4996 > ) diff --git a/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c b/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c index 8e37fd1f..7fabdeb3 100644 --- a/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c +++ b/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c @@ -27,6 +27,7 @@ #include /* Standard C Header Files */ +#include #include #include #include @@ -132,7 +133,18 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - getcwd(s_cwd, 1 + path_max); + if (NULL == getcwd(s_cwd, 1 + path_max)) + { + int const e = errno; + + fprintf(stderr, "failed to obtain current directory: %d / %s\n", e, strerror(e)); + + free(s_cwd); + free(s_home); + free(s_testRoot); + + return EXIT_FAILURE; + } #if defined(PLATFORMSTL_OS_IS_WINDOWS) || \ ( defined(PLATFORMSTL_OS_IS_UNIX) && \ defined(_WIN32)) diff --git a/test/unit/test.unit.api.stat/test.unit.api.stat.c b/test/unit/test.unit.api.stat/test.unit.api.stat.c index 72f4584d..c7222e0b 100644 --- a/test/unit/test.unit.api.stat/test.unit.api.stat.c +++ b/test/unit/test.unit.api.stat/test.unit.api.stat.c @@ -27,7 +27,10 @@ #include /* Standard C Header Files */ +#include +#include #include +#include #if defined(PLATFORMSTL_OS_IS_UNIX) # include #elif defined(PLATFORMSTL_OS_IS_WINDOWS) @@ -120,7 +123,14 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - getcwd(s_cwd, 1 + path_max); + if (NULL == getcwd(s_cwd, 1 + path_max)) + { + int const e = errno; + + fprintf(stderr, "failed to obtain current directory: %d / %s\n", e, strerror(e)); + + return EXIT_FAILURE; + } #if defined(PLATFORMSTL_OS_IS_WINDOWS) || \ ( defined(PLATFORMSTL_OS_IS_UNIX) && \ defined(_WIN32)) @@ -152,6 +162,7 @@ int main(int argc, char **argv) #endif + if (XTESTS_START_RUNNER("test.unit.api.stat", verbosity)) { XTESTS_RUN_CASE(test_1_0); From 40879bae5d3f0f933448f9aabfd5c34cb3afa10b Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 14:24:47 +1000 Subject: [PATCH 09/12] fix --- examples/c/example_c_2/example_c_2.c | 14 ++------------ src/ReclsFtpSearchDirectoryNode_windows.cpp | 6 +++--- .../test.scratch.cpp_api/test.scratch.cpp_api.cpp | 9 +++------ .../test.unit.api.createdirectory.c | 2 +- test/unit/test.unit.api.stat/test.unit.api.stat.c | 2 +- 5 files changed, 10 insertions(+), 23 deletions(-) diff --git a/examples/c/example_c_2/example_c_2.c b/examples/c/example_c_2/example_c_2.c index 26aa3f7f..6a12852f 100644 --- a/examples/c/example_c_2/example_c_2.c +++ b/examples/c/example_c_2/example_c_2.c @@ -22,9 +22,7 @@ #include /* STLSoft Header Files */ -#ifdef RECLS_PLATFORM_API_WINDOWS -# include -#endif /* RECLS_PLATFORM_API_WINDOWS */ +#include /* Standard C Library Files */ #include /* for printf() / fprintf() */ @@ -160,15 +158,7 @@ static void write_blank_line(FILE* stm, size_t n) static size_t get_console_width_(void) { - /* In reality, this should evaluate as appropriate to the operating - * system. - */ - -#ifdef RECLS_PLATFORM_API_WINDOWS - return winstl__get_console_width(); -#else /* ? RECLS_PLATFORM_API_??? */ - return 48; -#endif /* RECLS_PLATFORM_API_??? */ + return platformstl_C_get_console_width(); } static size_t get_console_width(void) diff --git a/src/ReclsFtpSearchDirectoryNode_windows.cpp b/src/ReclsFtpSearchDirectoryNode_windows.cpp index 50186414..e9d68abc 100644 --- a/src/ReclsFtpSearchDirectoryNode_windows.cpp +++ b/src/ReclsFtpSearchDirectoryNode_windows.cpp @@ -5,11 +5,11 @@ * Windows. * * Created: 1st June 2004 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * Home: https://github.com/synesissoftware/recls * - * Copyright (c) 2019-2023, Matthew Wilson and Synesis Information Systems + * Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems * Copyright (c) 2004-2019, Matthew Wilson and Synesis Software * All rights reserved. * @@ -371,7 +371,7 @@ ReclsFtpSearchDirectoryNode::ReclsFtpSearchDirectoryNode( size_t cch = types::traits_type::get_full_path_name(m_connection, stlsoft::c_str_ptr(temp), 0, NULL); string_type temp2(cch, ' '); - recls_char_t* file; + recls_char_t* file = NULL; // GCC requires this be initialised types::traits_type::get_full_path_name(m_connection, stlsoft::c_str_ptr(temp), 1 + temp2.length(), &temp2[0], &file); diff --git a/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp b/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp index cae291a5..9c287821 100644 --- a/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp +++ b/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp @@ -4,7 +4,7 @@ * Purpose: Implementation file for the test.scratch.cpp_api project. * * Created: 4th January 2010 - * Updated: 30th December 2023 + * Updated: 3rd August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -14,12 +14,9 @@ /* STLSoft Header Files */ #include - -/* UNIXem Header Files */ -#if defined(_WIN32) || \ - defined(_WIN64) +#ifdef RECLS_PLATFORM_IS_UNIX_EMULATED_ON_WINDOWS # include -#endif /* Win32 || Win64 */ +#endif /* Standard C++ Header Files */ #include diff --git a/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c b/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c index 7fabdeb3..7e306ea2 100644 --- a/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c +++ b/test/unit/test.unit.api.createdirectory/test.unit.api.createdirectory.c @@ -133,7 +133,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - if (NULL == getcwd(s_cwd, 1 + path_max)) + if (NULL == getcwd(s_cwd, (int)(1 + path_max))) { int const e = errno; diff --git a/test/unit/test.unit.api.stat/test.unit.api.stat.c b/test/unit/test.unit.api.stat/test.unit.api.stat.c index c7222e0b..b26d7d6f 100644 --- a/test/unit/test.unit.api.stat/test.unit.api.stat.c +++ b/test/unit/test.unit.api.stat/test.unit.api.stat.c @@ -123,7 +123,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - if (NULL == getcwd(s_cwd, 1 + path_max)) + if (NULL == getcwd(s_cwd, (int)(1 + path_max))) { int const e = errno; From 33861c13e0be904fd0702b7551c87e983eac9c74 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 15:45:08 +1000 Subject: [PATCH 10/12] fix --- .../test.scratch.cpp_api.cpp | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp b/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp index 9c287821..b6b224c7 100644 --- a/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp +++ b/test/scratch/test.scratch.cpp_api/test.scratch.cpp_api.cpp @@ -186,7 +186,7 @@ typedef std::string string_t; * forward declarations */ -static void display_entry(recls::entry const& e); +static void display_entry(recls::entry const& fe); /* ////////////////////////////////////////////////////////////////////// */ @@ -243,37 +243,37 @@ static int main_(int /* argc */, char** argv) return EXIT_SUCCESS; } -static void display_entry(recls::entry const& e) +static void display_entry(recls::entry const& fe) { using namespace recls; - unsigned width = 25; + size_t width = 25; #ifdef RECLS_CPP_METHOD_PROPERTY_SUPPORT - std::cout << std::setw(width) << "Path:" << " " << e.Path << std::endl; - std::cout << std::setw(width) << "DirectoryPath:" << " " << e.DirectoryPath << std::endl; - std::cout << std::setw(width) << "Drive:" << " " << e.Drive << std::endl; - std::cout << std::setw(width) << "Directory:" << " " << std::setw(e.get_drive().length()) << "" << e.Directory << std::endl; - std::cout << std::setw(width) << "File:" << " " << std::setw(e.get_directory_path().length()) << "" << e.File << std::endl; - std::cout << std::setw(width) << "FileName:" << " " << std::setw(e.get_directory_path().length()) << "" << e.FileName << std::endl; - std::cout << std::setw(width) << "FileExtension:" << " " << std::setw(e.get_directory_path().length() + e.get_file_name().length()) << "" << e.FileExtension << std::endl; + std::cout << std::setw(width) << "Path:" << " " << fe.Path << std::endl; + std::cout << std::setw(width) << "DirectoryPath:" << " " << fe.DirectoryPath << std::endl; + std::cout << std::setw(width) << "Drive:" << " " << fe.Drive << std::endl; + std::cout << std::setw(width) << "Directory:" << " " << std::setw(fe.get_drive().length()) << "" << fe.Directory << std::endl; + std::cout << std::setw(width) << "File:" << " " << std::setw(fe.get_directory_path().length()) << "" << fe.File << std::endl; + std::cout << std::setw(width) << "FileName:" << " " << std::setw(fe.get_directory_path().length()) << "" << fe.FileName << std::endl; + std::cout << std::setw(width) << "FileExtension:" << " " << std::setw(fe.get_directory_path().length() + fe.get_file_name().length()) << "" << fe.FileExtension << std::endl; #else /* ? RECLS_CPP_METHOD_PROPERTY_SUPPORT */ - std::cout << std::setw(width) << "path:" << " " << e.get_path() << std::endl; - std::cout << std::setw(width) << "directory_path:" << " " << e.get_directory_path() << std::endl; - std::cout << std::setw(width) << "drive:" << " " << e.get_drive() << std::endl; - std::cout << std::setw(width) << "directory:" << " " << std::setw(e.get_drive().length()) << "" << e.get_directory() << std::endl; - std::cout << std::setw(width) << "file:" << " " << std::setw(e.get_directory_path().length()) << "" << e.get_file() << std::endl; - std::cout << std::setw(width) << "file name:" << " " << std::setw(e.get_directory_path().length()) << "" << e.get_file_name() << std::endl; - std::cout << std::setw(width) << "file extension:" << " " << std::setw(e.get_directory_path().length() + e.get_file_name().length()) << "" << e.get_file_extension() << std::endl; + std::cout << std::setw(width) << "path:" << " " << fe.get_path() << std::endl; + std::cout << std::setw(width) << "directory_path:" << " " << fe.get_directory_path() << std::endl; + std::cout << std::setw(width) << "drive:" << " " << fe.get_drive() << std::endl; + std::cout << std::setw(width) << "directory:" << " " << std::setw(fe.get_drive().length()) << "" << fe.get_directory() << std::endl; + std::cout << std::setw(width) << "file:" << " " << std::setw(fe.get_directory_path().length()) << "" << fe.get_file() << std::endl; + std::cout << std::setw(width) << "file name:" << " " << std::setw(fe.get_directory_path().length()) << "" << fe.get_file_name() << std::endl; + std::cout << std::setw(width) << "file extension:" << " " << std::setw(fe.get_directory_path().length() + fe.get_file_name().length()) << "" << fe.get_file_extension() << std::endl; #endif /* RECLS_CPP_METHOD_PROPERTY_SUPPORT */ std::cout << std::setw(width) << "directory parts:" << std::endl; #ifdef RECLS_CPP_METHOD_PROPERTY_SUPPORT - directory_parts parts = e.DirectoryParts; + directory_parts parts = fe.DirectoryParts; #else /* ? RECLS_CPP_METHOD_PROPERTY_SUPPORT */ - directory_parts parts = e.get_directory_parts(); + directory_parts parts = fe.get_directory_parts(); #endif /* RECLS_CPP_METHOD_PROPERTY_SUPPORT */ - unsigned partWidth = width + e.get_drive().length(); + size_t partWidth = width + fe.get_drive().length(); size_t numParts = parts.end() - parts.begin(); STLSOFT_ASSERT(parts.size() == numParts); #if 0 @@ -296,28 +296,28 @@ static void display_entry(recls::entry const& e) }} #ifdef RECLS_CPP_METHOD_PROPERTY_SUPPORT - std::cout << std::setw(width) << "Attributes:" << " " << "0x" << std::setw(8) << std::setfill('0') << std::setbase(16) << static_cast(e.Attributes) << std::setfill(' ') << std::endl; + std::cout << std::setw(width) << "Attributes:" << " " << "0x" << std::setw(8) << std::setfill('0') << std::setbase(16) << static_cast(fe.Attributes) << std::setfill(' ') << std::endl; - std::cout << std::setw(width) << "Size:" << " " << static_cast(e.Size) << std::endl; + std::cout << std::setw(width) << "Size:" << " " << static_cast(fe.Size) << std::endl; #else /* ? RECLS_CPP_METHOD_PROPERTY_SUPPORT */ - std::cout << std::setw(width) << "attributes:" << " " << "0x" << std::setw(8) << std::setfill('0') << std::setbase(16) << static_cast(e.get_attributes()) << std::setfill(' ') << std::endl; + std::cout << std::setw(width) << "attributes:" << " " << "0x" << std::setw(8) << std::setfill('0') << std::setbase(16) << static_cast(fe.get_attributes()) << std::setfill(' ') << std::endl; - std::cout << std::setw(width) << "size:" << " " << static_cast(e.get_size()) << std::endl; + std::cout << std::setw(width) << "size:" << " " << static_cast(fe.get_size()) << std::endl; #endif /* RECLS_CPP_METHOD_PROPERTY_SUPPORT */ -// std::cout << std::setw(width) << "creation time:" << " " << e.get_creation_time() << std::endl; -// std::cout << std::setw(width) << "last access time:" << " " << e.get_creation_time() << std::endl; -// std::cout << std::setw(width) << "last status change time:" << " " << e.get_creation_time() << std::endl; -// std::cout << std::setw(width) << "modification time:" << " " << e.get_creation_time() << std::endl; +// std::cout << std::setw(width) << "creation time:" << " " << fe.get_creation_time() << std::endl; +// std::cout << std::setw(width) << "last access time:" << " " << fe.get_creation_time() << std::endl; +// std::cout << std::setw(width) << "last status change time:" << " " << fe.get_creation_time() << std::endl; +// std::cout << std::setw(width) << "modification time:" << " " << fe.get_creation_time() << std::endl; #ifdef RECLS_CPP_METHOD_PROPERTY_SUPPORT - std::cout << std::setw(width) << "IsDirectory:" << " " << (e.IsDirectory ? "true" : "false") << std::endl; - std::cout << std::setw(width) << "IsReadOnly:" << " " << (e.IsReadOnly ? "true" : "false") << std::endl; - std::cout << std::setw(width) << "IsUnc:" << " " << (e.IsUnc ? "true" : "false") << std::endl; + std::cout << std::setw(width) << "IsDirectory:" << " " << (fe.IsDirectory ? "true" : "false") << std::endl; + std::cout << std::setw(width) << "IsReadOnly:" << " " << (fe.IsReadOnly ? "true" : "false") << std::endl; + std::cout << std::setw(width) << "IsUnc:" << " " << (fe.IsUnc ? "true" : "false") << std::endl; #else /* ? RECLS_CPP_METHOD_PROPERTY_SUPPORT */ - std::cout << std::setw(width) << "is_directory:" << " " << (e.is_directory() ? "true" : "false") << std::endl; - std::cout << std::setw(width) << "is_readonly:" << " " << (e.is_readonly() ? "true" : "false") << std::endl; - std::cout << std::setw(width) << "is_unc:" << " " << (e.is_unc() ? "true" : "false") << std::endl; + std::cout << std::setw(width) << "is_directory:" << " " << (fe.is_directory() ? "true" : "false") << std::endl; + std::cout << std::setw(width) << "is_readonly:" << " " << (fe.is_readonly() ? "true" : "false") << std::endl; + std::cout << std::setw(width) << "is_unc:" << " " << (fe.is_unc() ? "true" : "false") << std::endl; #endif /* RECLS_CPP_METHOD_PROPERTY_SUPPORT */ } From 4057291d217e431e8b43d492c37c2179e7d91a14 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 15:45:20 +1000 Subject: [PATCH 11/12] badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 978fd02c..725ba2ee 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![CMake on multiple platforms](https://github.com/synesissoftware/recls/actions/workflows/ci.yml/badge.svg)](https://github.com/synesissoftware/recls/actions/workflows/ci.yml) +[![CMake on multiple platforms](https://github.com/synesissoftware/recls/actions/workflows/ci.yml/badge.svg?branch=dev-1.9)](https://github.com/synesissoftware/recls/actions/workflows/ci.yml?query=branch%3Adev-1.9) # recls From 57e10dcfc417cff1b41c57ba681cd078df95e953 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 3 Aug 2026 16:13:27 +1000 Subject: [PATCH 12/12] chore: release information --- CHANGES.md | 21 +++++++++++++++++++++ CHANGES.txt | 42 +++++++++++++++++++++++++++++++++++++++++- NEWS.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS.txt | 6 +++++- 4 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 CHANGES.md create mode 100644 NEWS.md diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 00000000..ab1bdfe8 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,21 @@ +# recls - CHANGES + + +## 1.9.8 - 3rd August 2026 + +* Added CMake build (**CMakeLists.txt**, **cmake/**, examples and tests) for the 1.9 line, alongside retained **build/** makefiles and Visual C++ projects; +* Added modular GitHub Actions CI (**ci.yml** / **ci-cell.yml**) with multi-platform matrix and install-smoke coverage; +* Added CMake helper scripts (**prepare_cmake.sh**, **build_cmake.sh**, **clean_cmake.sh**, **remove_cmake_artefacts.sh**, **run_all_examples.sh**, **run_all_unit_tests.sh**, **run_all_scratch_tests.sh**) and **.sis** project metadata; +* Added editor/meta boilerplate (**.vimrc**, **.vscode/settings.json**; expanded **.gitattributes** / **.gitignore**, preserving 1.9 makefile and **.dsp** trees); +* README CI badge targets **ci.yml** on branch **dev-1.9**; +* Added **RECLS_VER_PATCH** (aliased as **RECLS_VER_REVISION**) and set version to **1.9.8**; +* Compatibility with modern **STLSoft**: `unixstl_exception` / `winstl_exception` gating in **api.util.create_directory.cpp** / **api.util.remove_directory.cpp**; C++11+ **root_sequence** without `std::unary_function`; MSVC **/wd4996** for deprecated **file_path_buffer**; +* Build/CI hygiene across examples and tests (strict C prototypes, `getcwd` checks, unused-parameter silencing, MinGW FTP node init, **platformstl_C_get_console_width**, create-directory unit tests under **$HOME**); + + +## 1.9.7 - 30th December 2023 + +* Version bump to **1.9.7**; copyright years updated in **recls.h**; + + + diff --git a/CHANGES.txt b/CHANGES.txt index 956f8609..4ba96939 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -3,7 +3,7 @@ recls - Changes --------------- ; Created: 28th May 2006 -; Updated: 29th January 2017 +; Updated: 3rd August 2026 ============================================================================ @@ -17,6 +17,46 @@ recls - Changes ******************************************************************* +recls 1.9.8 released - 3rd August 2026 +====================================== + +Summary: +-------- + + * added CMake build (CMakeLists.txt, cmake/, examples and tests) for the + 1.9 line, alongside retained build/ makefiles and Visual C++ projects + * added modular GitHub Actions CI (ci.yml / ci-cell.yml) with + multi-platform matrix and install-smoke coverage + * added CMake helper scripts (prepare_cmake.sh, build_cmake.sh, + clean_cmake.sh, remove_cmake_artefacts.sh, run_all_examples.sh, + run_all_unit_tests.sh, run_all_scratch_tests.sh) and .sis project + metadata + * added editor/meta boilerplate (.vimrc, .vscode/settings.json; expanded + .gitattributes / .gitignore, preserving 1.9 makefile and .dsp trees) + * README CI badge targets ci.yml on branch dev-1.9 + * added RECLS_VER_PATCH (aliased as RECLS_VER_REVISION); version 1.9.8 + * compatibility with modern STLSoft (unixstl_exception / + winstl_exception; C++11+ root_sequence without std::unary_function; + MSVC /wd4996 for deprecated file_path_buffer) + * build/CI hygiene across examples and tests (strict C prototypes, + getcwd checks, unused-parameter silencing, MinGW FTP node init, + platformstl_C_get_console_width, create-directory unit tests under + $HOME) + +NOTE: see also CHANGES.md for the canonical Markdown form of this and +later 1.9.x entries. + + +recls 1.9.7 released - 30th December 2023 +========================================= + +Summary: +-------- + + * version bump to 1.9.7 + * copyright years updated in include/recls/recls.h + + recls 1.9.6 released - 29th January 2017 ======================================== diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 00000000..87da0fd7 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,50 @@ +# recls - News + + +| Date | News Item | +| --------------------- | ---------------------------------- | +| 3rd August 2026 | recls 1.9.8 released | +| 30th December 2023 | recls 1.9.7 released | +| 29th January 2017 | recls 1.9.6 released | +| 9th October 2015 | recls 1.9.4 released | +| 7th October 2015 | recls 1.9.2 released | +| 29th September 2015 | recls 1.9.1 released | +| 4th June 2012 | recls 1.9.1 (alpha 8) released | +| 30th November 2011 | recls 1.9.1 (alpha 7) released | +| 18th October 2010 | recls 1.9.1 (alpha 6) released | +| 7th June 2010 | recls 1.9.1 (alpha 5) released | +| 4th April 2010 | recls 1.9.1 (alpha 4) released | +| 10th March 2010 | recls 1.9.1 (alpha 3) released | +| 11th February 2010 | recls 1.9.1 (alpha 2) released | +| 9th February 2010 | recls 1.9.1 (alpha 1) released | +| 8th June 2008 | recls 1.8.13 released | +| 8th June 2008 | recls 1.8.12 released | +| 7th October 2007 | recls 1.8.11 released | +| 2nd June 2007 | recls 1.8.10 released | +| 19th May 2007 | recls 1.8.9 released | +| 30th April 2007 | recls 1.8.8 released | +| 16th April 2007 | recls 1.8.7 released | +| 6th April 2007 | recls 1.8.6 released | +| 27th February 2007 | recls 1.8.5 released | +| 8th September 2006 | recls 1.8.4 released | +| 16th August 2006 | recls 1.8.3 released | +| 26th July 2006 | recls 1.8.2 released | +| 17th June 2006 | recls 1.8.1 released | +| 31st December 2005 | recls 1.7.2 released | +| 27th December 2005 | recls 1.7.1 released | +| 17th July 2005 | recls 1.6.4 released | +| 28th June 2005 | recls 1.6.3 released | +| 23rd May 2005 | recls 1.6.2 released | +| 18th March 2005 | recls 1.6.1 released | +| 6th March 2005 | recls 1.5.3 released | +| 13th June 2004 | recls 1.5.2 released | +| 9th June 2004 | recls 1.5.1 released | +| 24th April 2004 | recls 1.4.1 released | +| 24th February 2004 | recls 1.3.1 released | +| 23rd January 2004 | recls 1.2.1 released | +| 24th November 2003 | recls 1.1.1 released | +| 5th October 2003 | recls 1.0.2 released | +| 23rd September 2003 | recls 1.0.1 released | + + + diff --git a/NEWS.txt b/NEWS.txt index 714de012..5a3e61a9 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -3,12 +3,16 @@ recls - News ------------ ; Created: 28th May 2006 -; Updated: 29th January 2017 +; Updated: 3rd August 2026 ============================================================================ News: + 3rd August 2026 - recls 1.9.8 released + + 30th December 2023 - recls 1.9.7 released + 29th January 2017 - recls 1.9.6 released 9th October 2015 - recls 1.9.4 released