Skip to content

Commit dd09fdf

Browse files
feature: now uses Diagnosticism for version information (#52)
1 parent a452723 commit dd09fdf

5 files changed

Lines changed: 117 additions & 22 deletions

File tree

‎CHANGES.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* examples:
1010
* restored **example.cpp.linking.N_with_stock** (**examples/cpp/linking/N_with_stock/**) linking **be.N** + **bec.stock**, multiplexing console / file / fprintf / null / syslog (Windows Syslog + debugger on Win32); re-enabled the **examples/cpp/linking** CMake subdirectory; listed in **README.md**;
1111
* **example.cpp.linking.N_with_stock**: define `PANTHEIOS_FE_PROCESS_IDENTITY` with `PANTHEIOS_EXTERN` (C++ `const` external linkage) and `PAN_BE_N_BACKEND_LIST` in an `extern "C"` block without `PANTHEIOS_EXTERN` (stock Pantheios C++ form; avoids GCC/MinGW `-Werror` on `extern` + initializer);
12+
* testing:
13+
* (example/test only) now uses **Diagnosticism** for version strings;
1214
* version:
1315
* current composite is `PANTHEIOS_VER_1_0_1_RC4` (`0x010001E4`) in **include/pantheios/pantheios.h**;
1416
* **test.unit.getversion** asserts `PANTHEIOS_VER_1_0_1_RC4`;

‎CMakeLists.txt‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ endif(PANTHEIOS_USE_WIDE_STRINGS)
147147
# optional:
148148
# - ACE - stock ACE backends (be/bec/bel/ber.ACE);
149149
# - b64;
150+
# - Diagnosticism - required for testing only;
150151
# - shwild - required for testing only;
151152
#
152153
# - Threads;
@@ -322,6 +323,27 @@ if(NOT b64_FOUND)
322323
endif()
323324

324325

326+
# ############################
327+
# Diagnosticism
328+
329+
if(NOT NO_DIAGNOSTICISM)
330+
331+
find_package(Diagnosticism QUIET)
332+
333+
if(Diagnosticism_FOUND)
334+
335+
message("-- CMake package Diagnosticism found (version ${Diagnosticism_VERSION})")
336+
337+
add_compile_definitions(HAS_Diagnosticism)
338+
endif(Diagnosticism_FOUND)
339+
endif()
340+
341+
if(NOT b64_FOUND)
342+
343+
add_compile_definitions(PANTHEIOS_NO_B64)
344+
endif()
345+
346+
325347
# ############################
326348
# shwild
327349

‎NEWS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
| Date | News Item | Details |
55
| ------------------- | ------------------------------------------------------------- | ---------- |
6-
| 14th October 2026 | [Pantheios 1.0.1-rc4 released](https://github.com/synesissoftware/Pantheios/releases/tag/1.0.1-rc4) | **bec.stock** / **WithCallback** (no **bec.test**); **example.cpp.linking.N_with_stock**; `PANTHEIOS_VER_1_0_1_RC4` |
6+
| 14th October 2026 | [Pantheios 1.0.1-rc4 released](https://github.com/synesissoftware/Pantheios/releases/tag/1.0.1-rc4) | **bec.stock** / **WithCallback** (no **bec.test**); **example.cpp.linking.N_with_stock**; **Diagnosticism** version strings; `PANTHEIOS_VER_1_0_1_RC4` |
77
| 12th October 2026 | [Pantheios 1.0.1-rc3 released](https://github.com/synesissoftware/Pantheios/releases/tag/1.0.1-rc3) | **bec.AnsiConsole** VT / default sink; optional **ACE**; **CMake** leaf helpers; entry/main + path canonicalisation; headless scratch **`--skip-interactive`**; `_RELSTATUS`; CI refactor; Phase **4c** **test.scratch.versions**; **STLSoft** **1.11.1-rc8** floor |
88
| 6th September 2026 | [Pantheios 1.0.1-rc2 released](https://github.com/synesissoftware/Pantheios/releases/tag/1.0.1-rc2) | transitive link dependencies in **pantheios-config.cmake**; added **.vscode/settings.json** |
99
| 5th August 2026 | [Pantheios 1.0.1-rc1 released](https://github.com/synesissoftware/Pantheios/releases/tag/1.0.1-rc1) | modular GitHub Actions CI; documentation modernisation; **bec.AnsiConsole** back-end; **CMake** package config |

‎test/scratch/versions/CMakeLists.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ if(b64_FOUND)
1818
)
1919
endif(b64_FOUND)
2020

21+
if(Diagnosticism_FOUND)
22+
23+
target_link_libraries(test.scratch.versions
24+
PRIVATE
25+
Diagnosticism::core
26+
)
27+
endif(Diagnosticism_FOUND)
28+
2129
if(shwild_FOUND)
2230

2331
target_link_shwild(test.scratch.versions)

‎test/scratch/versions/main.cpp‎

Lines changed: 84 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
# include <b64/b64.h>
2323
#endif
2424

25+
#ifdef HAS_Diagnosticism
26+
# include <diagnosticism/diagnosticism.h>
27+
# include <diagnosticism/version_string.h>
28+
#endif
29+
2530
#ifdef HAS_shwild
2631
# include <shwild/shwild.h>
2732
#endif
@@ -30,6 +35,10 @@
3035
# include <woad/woad.h>
3136
#endif
3237

38+
#ifdef HAS_xTests
39+
# include <xtests/xtests.h>
40+
#endif
41+
3342
#include <iomanip>
3443
#include <iostream>
3544

@@ -53,26 +62,63 @@ version(
5362
, T_integer libver
5463
)
5564
{
56-
stm
57-
<< prefix
58-
<< libname
59-
<< ": v"
60-
<< ((libver >> 24) & 0xff)
61-
<< '.'
62-
<< ((libver >> 16) & 0xff)
63-
<< '.'
64-
<< ((libver >> 8) & 0xff)
65-
<< '.'
66-
<< ((libver >> 0) & 0xff)
67-
<< " ("
68-
<< macroname
69-
<< " = 0x"
70-
<< std::hex << std::setfill('0') << std::setw(8)
71-
<< static_cast<unsigned>(libver)
72-
<< std::dec
73-
<< ")"
74-
<< std::endl
75-
;
65+
#ifdef HAS_Diagnosticism
66+
67+
char sz[100];
68+
size_t sz_len;
69+
70+
if (0 == diagnosticism_calc_version_string(
71+
sz, sizeof(sz)
72+
, ((libver >> 24) & 0xff)
73+
, ((libver >> 16) & 0xff)
74+
, ((libver >> 8) & 0xff)
75+
, ((libver >> 0) & 0xff)
76+
, &sz_len
77+
))
78+
{
79+
sz[sz_len] = '\0';
80+
81+
stm
82+
<< prefix
83+
<< libname
84+
<< ": v"
85+
<< sz
86+
<< " ("
87+
<< macroname
88+
<< " = 0x"
89+
<< std::hex << std::setfill('0') << std::setw(8)
90+
<< static_cast<unsigned>(libver)
91+
<< std::dec
92+
<< ")"
93+
<< std::endl
94+
;
95+
96+
return;
97+
}
98+
else
99+
#endif /* HAS_Diagnosticism */
100+
{
101+
stm
102+
<< prefix
103+
<< libname
104+
<< ": v"
105+
<< ((libver >> 24) & 0xff)
106+
<< '.'
107+
<< ((libver >> 16) & 0xff)
108+
<< '.'
109+
<< ((libver >> 8) & 0xff)
110+
<< '.'
111+
<< ((libver >> 0) & 0xff)
112+
<< " ("
113+
<< macroname
114+
<< " = 0x"
115+
<< std::hex << std::setfill('0') << std::setw(8)
116+
<< static_cast<unsigned>(libver)
117+
<< std::dec
118+
<< ")"
119+
<< std::endl
120+
;
121+
}
76122
}
77123

78124

@@ -105,6 +151,15 @@ int main(int /* argc */, char* /* argv */[])
105151
}
106152
#endif
107153

154+
#ifdef HAS_Diagnosticism
155+
156+
{
157+
unsigned const libver = DIAGNOSTICISM_VER;
158+
159+
version(std::cout, "\t", "Diagnosticism", "DIAGNOSTICISM_VER", libver);
160+
}
161+
#endif
162+
108163
#ifdef HAS_shwild
109164

110165
{
@@ -123,9 +178,17 @@ int main(int /* argc */, char* /* argv */[])
123178
}
124179
#endif
125180

181+
#ifdef HAS_xTests
182+
183+
{
184+
unsigned const libver = _XTESTS_VER;
185+
186+
version(std::cout, "\t", "xTests", "_XTESTS_VER", libver);
187+
}
188+
#endif
189+
126190
return EXIT_SUCCESS;
127191
}
128192

129193

130194
/* ///////////////////////////// end of file //////////////////////////// */
131-

0 commit comments

Comments
 (0)