Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
430 commits
Select commit Hold shift + click to select a range
374465b
Add tests for the xhash module.
Lightning11wins Sep 9, 2026
ce94e00
Revert changes to mssError() which are better done elsewhere.
Lightning11wins Sep 9, 2026
89d7080
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 9, 2026
01aa69a
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 9, 2026
3232247
Merge branch 'add-utils' into dups
Lightning11wins Sep 9, 2026
5817820
Add new test util functions.
Lightning11wins Sep 9, 2026
fd58f4c
Fix a warning.
Lightning11wins Sep 9, 2026
d80339e
Merge branch 'master' into add-lib-tests
Lightning11wins Sep 9, 2026
e00bb47
Merge branch 'refs/heads/add-lib-tests' into dups
Lightning11wins Sep 11, 2026
76e5ddd
Add old cluster tests that I haven't finished fixing yet.
Lightning11wins Sep 11, 2026
821e3fa
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 11, 2026
44d9218
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 11, 2026
07331c4
Fix test op count.
Lightning11wins Sep 11, 2026
ee216a8
Reduce number of edits in test_clusters_01.c to a sane number.
Lightning11wins Sep 11, 2026
237ed02
Fix naming conventions and error handling.
Lightning11wins Sep 11, 2026
be8a28e
Fix incorrect expected values and memory leaks.
Lightning11wins Sep 11, 2026
a75d28e
Fix edge cases in clusters.c.
Lightning11wins Sep 11, 2026
50129f8
Remove bad registrations.
Lightning11wins Sep 11, 2026
d686af8
Remove redundant markdown lines about licensing.
Lightning11wins Sep 11, 2026
ac02573
Fix outdated info in the docs.
Lightning11wins Sep 11, 2026
d1e8458
Fix xaTrim() on size-0 XArrays.
Lightning11wins Sep 11, 2026
95265a8
Add a #define to explicitly denote the magic number null marker.
Lightning11wins Sep 11, 2026
e74e856
Update copyright headers.
Lightning11wins Sep 11, 2026
bd35642
Fix markdown links.
Lightning11wins Sep 11, 2026
d14403d
Remove glyph.h.
Lightning11wins Sep 11, 2026
3b5e620
Improve doc comment clarity.
Lightning11wins Sep 11, 2026
b7eb044
Remove unused requirements file.
Lightning11wins Sep 11, 2026
53b726f
Fix typos and mistakes.
Lightning11wins Sep 11, 2026
1a8780a
Fix a ca_most_similar() guard case blocking a correct value.
Lightning11wins Sep 11, 2026
66bed29
Improve error handling in exp_fn_trim().
Lightning11wins Sep 11, 2026
3814676
Add detail to mlxStringVal() comment.
Lightning11wins Sep 11, 2026
ec7bb6d
Add explicit void marker to functions that don't take parameters.
Lightning11wins Sep 11, 2026
de53acb
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 11, 2026
d950f3c
Merge branch 'add-utils' into dups
Lightning11wins Sep 11, 2026
beec7f3
Rename checkNeg() to checkPos().
Lightning11wins Sep 11, 2026
212ed3f
Fix EXPECT_STR_EQL_N() improperly logging null values.
Lightning11wins Sep 11, 2026
3bd80bd
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 11, 2026
3afbd2a
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 11, 2026
c75c69f
Fix a test that used the wrong macro name.
Lightning11wins Sep 11, 2026
cbcefd2
Merge branch 'add-utils' into dups
Lightning11wins Sep 11, 2026
d30a2f7
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 11, 2026
df9b864
Fix exp_fn_metaphone() clobbering it's return value variable.
Lightning11wins Sep 11, 2026
c39de70
Fix typos in xarray.md.
Lightning11wins Sep 11, 2026
7896a30
Fix typos and outdated info in mtsession.md.
Lightning11wins Sep 11, 2026
437b511
Add docs for xaAddItemSortedInt32().
Lightning11wins Sep 11, 2026
e595d6f
Fix more typos.
Lightning11wins Sep 11, 2026
2f3ef2e
Rename internal functions.
Lightning11wins Sep 11, 2026
05d3fa1
Merge branch 'add-utils' into dups
Lightning11wins Sep 11, 2026
b5f329f
Rename incorrectly named functions to follow the style.
Lightning11wins Sep 12, 2026
cea1cfc
Drop a bad test case.
Lightning11wins Sep 12, 2026
46686ab
Fix memory leak in tests.
Lightning11wins Sep 12, 2026
276252d
Add tests for null-terminated list detection in caMostSimilar().
Lightning11wins Sep 12, 2026
aa2fc76
Improve the clarity of a warning.
Lightning11wins Sep 14, 2026
2860ff8
Trim comment.
Lightning11wins Sep 15, 2026
b6bbdd0
Simplify xhash.c code that was confusing to read.
Lightning11wins Sep 15, 2026
991a581
Remove confusing unused functionality from the cacheFree functions in…
Lightning11wins Sep 15, 2026
96b69ff
Refactor xhForEach() using variable arguments.
Lightning11wins Sep 15, 2026
dcb605b
Fix tests requiring an old, buggy behavior.
Lightning11wins Sep 15, 2026
f65b919
Fix mistakes in xstring.md.
Lightning11wins Sep 15, 2026
c171287
Added a description for %X and %llX.
Lightning11wins Sep 15, 2026
3079d00
Trim example.
Lightning11wins Sep 15, 2026
d38f436
Add detail to docs.
Lightning11wins Sep 15, 2026
55c0c32
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 16, 2026
b98a4a2
Update the test driver to handle the new snprintBytes() and snprintC…
Lightning11wins Sep 16, 2026
c40b5a8
Update the tests to handle and test the new snprintBytes() and snprin…
Lightning11wins Sep 16, 2026
71e19db
Fix mistakes from my attempt to handle an earlier merge conflict.
Lightning11wins Sep 16, 2026
d8804a2
Improve test readability.
Lightning11wins Sep 16, 2026
5d18d7a
Fix EXPECT_STR_EQL_N() writing "(null)" into a buffer that might be t…
Lightning11wins Sep 16, 2026
0d5aa2a
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 16, 2026
8d370c3
Fix mistakes and make improvements in objdrv_cluster.c.
Lightning11wins Sep 16, 2026
f17c311
Improve code quality in the "Unknown provided parameter" code.
Lightning11wins Sep 16, 2026
6c9942c
Remove redundant expect.h calls on check.h macros.
Lightning11wins Sep 16, 2026
5e6460b
Remove an inaccurate expect.h call.
Lightning11wins Sep 16, 2026
1ad7686
Improve cluster_i_printEntry() value passing.
Lightning11wins Sep 16, 2026
c5c2dae
Add a new enum to handle when an unknown data struct is passed.
Lightning11wins Sep 16, 2026
e6ede1e
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 16, 2026
d431de5
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 16, 2026
0511a3a
Replace magic values in objdrv_cluster.c with constants.
Lightning11wins Sep 16, 2026
de2d402
Improve code readability.
Lightning11wins Sep 16, 2026
2a35dcf
Fix mistakes and stale info.
Lightning11wins Sep 16, 2026
0690dfb
Fix printing formats.
Lightning11wins Sep 16, 2026
5a19737
Fix memory clean up when kmeans clustering fails.
Lightning11wins Sep 16, 2026
f26a9bb
Fix memory clean up during source data fetching.
Lightning11wins Sep 16, 2026
6477d93
Fix a possible failure caused by using nmSysMalloc(0).
Lightning11wins Sep 16, 2026
d54c5f5
Fix missing deallocation.
Lightning11wins Sep 16, 2026
ef42916
Fix comments claiming to know that the provided data source was a dat…
Lightning11wins Sep 16, 2026
3453f0d
Add null checks for data from objGetAttrValue().
Lightning11wins Sep 16, 2026
33c4786
Fix misleading wording in driver authoring docs.
Lightning11wins Sep 16, 2026
dde2afd
Improve styling and readability.
Lightning11wins Sep 17, 2026
d5ce6a8
Improve the error message when kmeans() fails.
Lightning11wins Sep 17, 2026
16031f2
Hoist logic to simplify code.
Lightning11wins Sep 17, 2026
a36e503
Add info for the sys_type parameter of clusterOpen().
Lightning11wins Sep 17, 2026
ea82a10
Reduce code complexity caused by gotos in clusterGetAttrValue().
Lightning11wins Sep 17, 2026
eeaa3f1
Reduce goto complexity in clusterGetAttrValue().
Lightning11wins Sep 17, 2026
6cfbffa
Modify cluster_i_getParamType() to return -1 if the parameter doesn't…
Lightning11wins Sep 17, 2026
63a66f8
Fix ignored failures that would cause immediate faults.
Lightning11wins Sep 17, 2026
7562d86
Add checkPtr() warnings expCompileExpression() fails when calculating…
Lightning11wins Sep 17, 2026
5a797bc
Fix incorrect presentation hint.
Lightning11wins Sep 17, 2026
0c8db7f
Reduce code complexity caused by gotos.
Lightning11wins Sep 17, 2026
8628a96
Trim unused code.
Lightning11wins Sep 17, 2026
6b901d4
Fix typo.
Lightning11wins Sep 17, 2026
cb21976
Improve style of to string functions.
Lightning11wins Sep 17, 2026
ede3d9c
Add cluster_i_targetTypeToString().
Lightning11wins Sep 17, 2026
35ff5b0
Add an error message.
Lightning11wins Sep 17, 2026
270eccc
Add a comment to explain why the "unnecessary scope block" is necessary.
Lightning11wins Sep 17, 2026
c2bfde2
Fix crash on clusterOpen(NULL, ...).
Lightning11wins Sep 17, 2026
1ce204a
Reduce code complexity caused by gotos.
Lightning11wins Sep 17, 2026
b19fa4f
Improve spacing.
Lightning11wins Sep 17, 2026
683ffe0
Clean up.
Lightning11wins Sep 17, 2026
baa0131
Add binding support to stGetAttrValueOSML().
Lightning11wins Sep 18, 2026
adbdeb2
Update the cluster driver to call stGetAttrValueOSML() with a domain …
Lightning11wins Sep 18, 2026
71e2b44
Fix a type in a function signature.
Lightning11wins Sep 18, 2026
64eab12
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 18, 2026
4e7f324
Replace check.h uses in tests with EXPECT() calls.
Lightning11wins Sep 18, 2026
7d13072
Modify tests to fail immediately when they are about to crash.
Lightning11wins Sep 18, 2026
47b16f9
Rename EXPECT macros to ASSERT.
Lightning11wins Sep 18, 2026
5695672
Increase min test time because some tests blocked enough to not meet …
Lightning11wins Sep 18, 2026
31a477f
Update error handling in stparse.c.
Lightning11wins Sep 18, 2026
56af74a
Fix stGetAttrValueOSML() domain and coverage mask handling.
Lightning11wins Sep 18, 2026
3169947
Implement stGetObjAttrValueOSML().
Lightning11wins Sep 18, 2026
2df11c6
Update the cluster driver to use stGetObjAttrValueOSML().
Lightning11wins Sep 18, 2026
433f992
Use consistent default attribute handling style.
Lightning11wins Sep 19, 2026
5879266
Drop noisy error message.
Lightning11wins Sep 19, 2026
ce9c3a4
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 21, 2026
6309582
Rename EXPECT macros to ASSERT.
Lightning11wins Sep 21, 2026
f791c31
Improve spacing in test_clusters_04.c.
Lightning11wins Sep 21, 2026
7551021
Remove check.h usage in tests.
Lightning11wins Sep 21, 2026
28e2f1e
Remove check.h usage in xarray.c.
Lightning11wins Sep 21, 2026
9770c54
Update error handling in clusters.c.
Lightning11wins Sep 21, 2026
144217e
Add xsCharAt() to xstring.
Lightning11wins Sep 21, 2026
032a05e
Add xsConcatenateLiteral() to xstring.
Lightning11wins Sep 21, 2026
f4b2c2b
Replace meta strings with XStrings in double_metaphone.c.
Lightning11wins Sep 21, 2026
79f0e66
Update my explanation comment.
Lightning11wins Sep 21, 2026
0927f75
Improve metaphone code style.
Lightning11wins Sep 21, 2026
08730a8
Improve metaphone comments.
Lightning11wins Sep 21, 2026
75526a2
Remove pointer address printing from errors.
Lightning11wins Sep 21, 2026
3947616
Update error handling in stparse.c.
Lightning11wins Sep 21, 2026
fbeac7f
Update error handling in exp_functions.c.
Lightning11wins Sep 21, 2026
77e564d
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 22, 2026
fab5b19
Merge branch 'add-utils' into dups
Lightning11wins Sep 22, 2026
4968989
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 22, 2026
eed6117
Merge branch 'add-utils' into dups
Lightning11wins Sep 22, 2026
a1ae63b
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 22, 2026
074f6be
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 22, 2026
9730ef4
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 22, 2026
508a408
Disable warnings in cluster tests that spam them.
Lightning11wins Sep 22, 2026
3e8244d
Overhaul error handling in objdrv_cluster.c.
Lightning11wins Sep 22, 2026
5f272f0
Remove code that frees clusters owned by the cluster cache.
Lightning11wins Sep 22, 2026
6010f51
Merge branch 'add-utils' into dups
Lightning11wins Sep 22, 2026
ec9454f
Improve comments.
Lightning11wins Sep 22, 2026
1a29da8
Add error checking for strtcpy().
Lightning11wins Sep 22, 2026
ad15ebf
Update to use unsigned long instead of unsigned long long for cluster…
Lightning11wins Sep 22, 2026
1eb0532
Add the pSimilarityFn type.
Lightning11wins Sep 22, 2026
6d0cc6e
Fix queries from node targets incrementing the index even if no entry…
Lightning11wins Sep 22, 2026
de22409
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 22, 2026
3836241
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 22, 2026
bdef7f9
Merge branch 'master' into dups
Lightning11wins Sep 23, 2026
6cb4b8d
Merge branch 'add-utils' into dups
Lightning11wins Sep 23, 2026
05ac6ef
Modify date_computed to be null on the target node instead of undefined.
Lightning11wins Sep 23, 2026
ee3086c
Restructure confusing last_modification code.
Lightning11wins Sep 23, 2026
d411e84
Fix an off-by-one when fetching objects from the cluster driver root …
Lightning11wins Sep 23, 2026
a69e620
Improve confusing logic for skipping uncomputed caches.
Lightning11wins Sep 23, 2026
5a00454
Fix typos and mistakes (thanks Opus 5.5).
Lightning11wins Sep 23, 2026
f582bbf
Fix cmp_Pairs() comparing pointers instead of the pointed data in tes…
Lightning11wins Sep 23, 2026
a1b1057
Update a comment about how caCosCompare()'s function signature needs …
Lightning11wins Sep 23, 2026
bd76d70
Improve money format printing in 2 errors.
Lightning11wins Sep 23, 2026
d1e5325
Remove an extra -lm that was being added to the makefile.
Lightning11wins Sep 23, 2026
f6b28de
Update test performance multiplier.
Lightning11wins Sep 23, 2026
bb40fa6
Fix all remaining stale mentions of ca_search().
Lightning11wins Sep 23, 2026
5d22dcc
Reorder caEql() to a more intuitive location in the clusters module.
Lightning11wins Sep 23, 2026
8163bab
Replace _PC_PATH_MAX with OBJSYS_MAX_PATH, the actual max path length…
Lightning11wins Sep 23, 2026
0f650fc
Fix a memory leak when xaAddItem() fails.
Lightning11wins Sep 23, 2026
cf43c1b
Fix clusterCommit() returning a successful error code despite calling…
Lightning11wins Sep 23, 2026
00c214f
Remove mentions of cluster entry similarities, which were scrapped an…
Lightning11wins Sep 23, 2026
48bbede
Add a memset() for ClusterQuery even though each field is initialized…
Lightning11wins Sep 23, 2026
ff9b869
Fix a confusing error message.
Lightning11wins Sep 23, 2026
a9942a0
Improve some wording in string_similarity.md.
Lightning11wins Sep 23, 2026
69c0c73
Improve spacing in test_expfn_log_00.to.
Lightning11wins Sep 23, 2026
53d75d4
Fix more typos and mistakes.
Lightning11wins Sep 23, 2026
2503820
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 23, 2026
e0fa24f
Add tests for the snprintBytes() bug that was recently fixed.
Lightning11wins Sep 23, 2026
ecabce3
Fix obvious mistakes and typos.
Lightning11wins Sep 23, 2026
c0491db
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 23, 2026
3930af0
Document the possible memory leak if excessive recursion occurs.
Lightning11wins Sep 23, 2026
d303e42
Revert changes that are not in scope for this work.
Lightning11wins Sep 24, 2026
ec6b61d
Fix more typos and mistakes.
Lightning11wins Sep 24, 2026
dbbcab0
Merge branch 'master' into add-lib-tests
Lightning11wins Sep 24, 2026
8c1b59f
Improve readability.
Lightning11wins Sep 24, 2026
be3fae9
Remove an assert function that should have stayed on the dups branch.
Lightning11wins Sep 24, 2026
4833d29
Update test asserts to use bools.
Lightning11wins Sep 24, 2026
51aff7d
Improve performance of testing functions.
Lightning11wins Sep 24, 2026
f7f3b48
Fix ASSERT_STR_EQL() and ASSERT_STR_EQL_N() comparing heap and stack …
Lightning11wins Sep 24, 2026
0126ea6
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 24, 2026
44c5bb8
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 24, 2026
2452ff9
Fix mistakes and typos.
Lightning11wins Sep 24, 2026
40ca017
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 24, 2026
fef1f58
Fix mistakes and typos.
Lightning11wins Sep 24, 2026
670e2af
Fix mistakes and typos.
Lightning11wins Sep 24, 2026
24ca1e0
Fix mistakes and typos.
Lightning11wins Sep 24, 2026
3210288
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Sep 24, 2026
5312047
Merge branch 'master' into dups
Lightning11wins Sep 25, 2026
51df641
Merge branch 'add-lib-tests' into dups
Lightning11wins Sep 25, 2026
8945cbb
Move objTypeFromStr() and objTypeToStr() to the add-driver-functions …
Lightning11wins Sep 25, 2026
5d49f16
Move objFileName(), objFilePath(), and DRIVER_ATTRIBUTE_NAMES to the …
Lightning11wins Sep 25, 2026
e9ffe15
Merge branch 'add-driver-functions' into dups
Lightning11wins Sep 25, 2026
aedd7c1
Merge branch 'add-driver-functions' into dups
Lightning11wins Sep 25, 2026
40ed5f8
Merge branch 'add-driver-functions' into dups
Lightning11wins Sep 25, 2026
1efe38a
Fix an error that misused obj_internal_PathPart().
Lightning11wins Sep 25, 2026
0907aad
Merge branch 'add-utils' into add-lib-tests
Lightning11wins Oct 2, 2026
944ba53
Fix mistakes in comments and spacing.
Lightning11wins Oct 2, 2026
45d989b
Merge branch 'master' into add-lib-tests
Lightning11wins Oct 8, 2026
5158f3f
Update tests from master that weren't reformatted yet.
Lightning11wins Oct 8, 2026
227cf87
Fix mistakes, typos, and memory leaks.
Lightning11wins Oct 8, 2026
81a9f07
Fix test operation counting.
Lightning11wins Oct 8, 2026
1d4c9bd
Fix a type mistakes.
Lightning11wins Oct 8, 2026
6096a22
Fix memory leaks in failing valgrind tests.
Lightning11wins Oct 8, 2026
63eedfc
Fix the new malloc test's mockErrorFn() function allocating an error …
Lightning11wins Oct 8, 2026
1c459eb
Remove partial sweeping in some tests to increase coverage.
Lightning11wins Oct 8, 2026
f096e09
Fix the Makefile not rebuilding when test_utils.h was updated.
Lightning11wins Oct 8, 2026
d2486c4
Fix optimization optimizing out the entire baseline pass test.
Lightning11wins Oct 8, 2026
ff8eddd
Shorten the names of tests (test_newmalloc_00's name was too long to …
Lightning11wins Oct 8, 2026
c0dd2dc
Improve coverage of nmClear() when caching is enabled..
Lightning11wins Oct 8, 2026
395337a
Drop checkChain() in an xhash test because it asserted internals not …
Lightning11wins Oct 8, 2026
f35aa5f
Update op counts.
Lightning11wins Oct 8, 2026
ff2a6d7
Handle ctrl+c during tests.
Lightning11wins Oct 8, 2026
98976bc
Fix an overflow in test_mtlexer_13.
Lightning11wins Oct 8, 2026
3885ca4
Fix flakiness in xhash_05.
Lightning11wins Oct 8, 2026
33de0fe
Clean up includes.
Lightning11wins Oct 8, 2026
106da3c
Add the ability for tests to skip themselves.
Lightning11wins Oct 9, 2026
07833f0
Modify test_newmalloc_02.c to skip itself when nmStats() is disabled,…
Lightning11wins Oct 9, 2026
749dddf
Add tests for test_utils.h.
Lightning11wins Oct 14, 2026
45db80a
Rename test_utils.h to t_utils.h.
Lightning11wins Oct 14, 2026
0062ae8
Add comments to reduce confusion.
Lightning11wins Oct 16, 2026
fb302b0
Improve spacing.
Lightning11wins Oct 16, 2026
ff98431
Refactor t_utils.h macros into functions with t_utils.c for readability.
Lightning11wins Oct 16, 2026
5d36a42
Reorder ASSERT_NOT_NULL() higher up in the file.
Lightning11wins Oct 16, 2026
c704341
Fix typos in comments and docs.
Lightning11wins Oct 23, 2026
e719764
Fix issues caused by merging master.
Lightning11wins Oct 23, 2026
ee0a791
Fix memory correctness issues.
Lightning11wins Oct 23, 2026
69ad2d0
Fix the log expression function's handling of null parameters.
Lightning11wins Oct 23, 2026
8f11bb2
Fix nan being treated as a valid positive or negative double.
Lightning11wins Oct 23, 2026
ae6e684
Fix and improve error messages.
Lightning11wins Oct 23, 2026
d53bf73
Fix a type in test_utils.h.
Lightning11wins Oct 23, 2026
db0dac3
Merge branch 'master' into dups
Lightning11wins Oct 23, 2026
0267e89
Merge remote-tracking branch 'origin/add-lib-tests' into dups
Lightning11wins Oct 23, 2026
73e7b53
Update lib tests because of changes on add-lib-tests.
Lightning11wins Oct 23, 2026
6cf563f
Merge branch 'master' into dups
Lightning11wins Oct 30, 2026
7b28e30
Join dups and apos_autoscale9-slim5 history at master.
Lightning11wins Oct 30, 2026
09f738e
Merge commit '7b28e30d0c3abf4ff908c5f545d3bc9fae17ece8' into dups
Lightning11wins Oct 30, 2026
ef0eecb
Clarify a detail about Upserts that caused bugs in my code.
Lightning11wins Nov 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 105 additions & 15 deletions centrallix-lib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## This library is made available under the GNU Lesser General Public
## License, version 2.1.
##
## Copyright (C) 1998-2001 LightSys Technology Services, Inc.
## Copyright (C) 1998-2026 LightSys Technology Services, Inc.
##

@SET_MAKE@
Expand Down Expand Up @@ -63,10 +63,10 @@ CFLAGS=@CFLAGS@ @DEFS@ -Iinclude -DCXLIB_INTERNAL -DNM_USE_SYSMALLOC -Wall -Wfor
MTCFLAGS=@CFLAGS@ @DEFS@ -Iinclude -DCXLIB_INTERNAL -DNM_USE_SYSMALLOC -Wall -Wformat-nonliteral $(PROFILE) $(COVERAGE) -g -O0
TCFLAGS=$(patsubst -DNDEBUG,,$(CFLAGS)) -DCX_TESTING

XSTATICFILES=mtask.o mtlexer.o memstr.o xarray.o xhash.o xstring.o mtsession.o newmalloc.o xhashqueue.o bdqs_transport.o xhandle.o xringqueue.o cxsec.o smmalloc.o qprintf.o strtcpy.o util.o timer.o warn.o range.o
XSTATICFILES=mtask.o mtlexer.o memstr.o xarray.o xhash.o xstring.o mtsession.o newmalloc.o xhashqueue.o bdqs_transport.o xhandle.o xringqueue.o cxsec.o smmalloc.o clusters.o qprintf.o strtcpy.o util.o timer.o warn.o range.o
STATICFILES=$(patsubst %,src/%,$(XSTATICFILES))

XDYNAMICFILES=mtask.lo mtlexer.lo memstr.lo xarray.lo xhash.lo xstring.lo mtsession.lo newmalloc.lo xhashqueue.lo bdqs_transport.lo xhandle.lo xringqueue.lo cxsec.lo smmalloc.lo qprintf.lo strtcpy.lo util.lo timer.lo warn.lo range.lo
XDYNAMICFILES=mtask.lo mtlexer.lo memstr.lo xarray.lo xhash.lo xstring.lo mtsession.lo newmalloc.lo xhashqueue.lo bdqs_transport.lo xhandle.lo xringqueue.lo cxsec.lo smmalloc.lo clusters.lo qprintf.lo strtcpy.lo util.lo timer.lo warn.lo range.lo
DYNAMICFILES=$(patsubst %,src/%,$(XDYNAMICFILES))

INCLUDEFILES:=$(wildcard include/*.h)
Expand All @@ -76,6 +76,19 @@ INCLUDEFILES:=$(patsubst include/cxlibconfig-all.h,,$(INCLUDEFILES))
TESTFILES:=$(wildcard tests/test_$(TONLY)*.c)
TESTPROGS:=$(patsubst %.c,%.bin,$(TESTFILES))

## Valgrind setup for "make valtest". Override VALGRINDFLAGS to change the
## checks performed, and set VALGRINDLOG to a directory to get one valgrind
## log per test instead of the errors being printed with the test results.
VALGRIND?=valgrind
VALGRINDFLAGS?=-q
VALGRINDLOG?=

## How many tests "make test" and "make valtest" run at once (1 for one at a
## time). Each test is a single-threaded process, so this scales with the core
## count; the driver's lockup timeout is wall clock, so going well past the
## core count risks reporting LOCKUP for a test that was only waiting for one.
TESTJOBS?=$(shell nproc 2>/dev/null || echo 1)

.SUFFIXES: .c .o .lo

.PHONY: all
Expand Down Expand Up @@ -157,29 +170,106 @@ install: all
@echo "***************************************************************"
@echo ""

%.bin: %.c tests/t_driver.c libCentrallix.a
$(CC) $(TCFLAGS) tests/t_driver.c $< libCentrallix.a -o $@ ${LIBS}
%.bin: %.c tests/t_driver.c tests/t_utils.c tests/t_utils.h libCentrallix.a
$(CC) $(TCFLAGS) tests/t_driver.c tests/t_utils.c $< libCentrallix.a -o $@ ${LIBS}

## Runs the selected tests $(TESTJOBS) at a time. Output is captured per test
## rather than written straight to the terminal, then printed in listing order
## as each test finishes, so parallel tests cannot interleave.
##
## TESTCMD runs once per test with the binary as "$$1" and its capture file as
## "$$2". It writes to "$$2.part" and renames that to "$$2" when done so that
## the rename is what marks the test as finished, then it exits with the test's
## status. The driver exits 0 even when reporting FAIL or CRASH (see
## tests/t_driver.c), so a nonzero status means the test did not complete
## normally and must fail the target; only valgrind's --error-exitcode is
## dropped. A test whose output never appears is reported and also fails.
##
## On SIGINT or SIGTERM, the shell stops the tests, removes the captured
## output without printing it, and then dies from the same signal. xargs
## runs in its own process group so that the whole group can be killed:
## a background job ignores SIGINT, so Ctrl+C never reaches the tests.
RUN_TESTS = \
RESULTS=$$(mktemp -d) || exit 1; \
XARGS=; \
stop() { \
trap - EXIT INT TERM; \
if [ -n "$$XARGS" ]; then \
kill -s TERM -- -"$$XARGS" 2>/dev/null; \
wait "$$XARGS" 2>/dev/null; \
fi; \
rm -rf "$$RESULTS"; \
kill -s "$$1" $$$$; \
}; \
trap 'rm -rf "$$RESULTS"' EXIT; \
trap 'stop INT' INT; \
trap 'stop TERM' TERM; \
N=0; \
for PROG in $$( ls $(TESTPROGS) ); do \
case "$$PROG" in tests/test_$$TONLY*) \
N=$$((N+1)); \
printf '%s\n%s/%04d.out\n' "$$PROG" "$$RESULTS" "$$N";; \
esac; \
done > "$$RESULTS/list"; \
if [ "$$N" -eq 0 ]; then exit 0; fi; \
setsid xargs -r -n 2 -P $(TESTJOBS) sh -c "$$TESTCMD" sh \
< "$$RESULTS/list" 2> "$$RESULTS/stderr" & \
XARGS=$$!; \
RC=0; \
I=0; \
while [ "$$I" -lt "$$N" ]; do \
I=$$((I+1)); \
OUT=$$(printf '%s/%04d.out' "$$RESULTS" "$$I"); \
while [ ! -e "$$OUT" ]; do \
kill -0 "$$XARGS" 2>/dev/null || break; \
sleep 0.05; \
done; \
if [ -e "$$OUT" ]; then \
cat "$$OUT"; \
else \
printf '%-62.62s FAIL (produced no result)\n' \
"$$(sed -n "$$((2 * I - 1))p" "$$RESULTS/list")"; \
RC=1; \
fi; \
done; \
wait "$$XARGS" || RC=$$?; \
cat "$$RESULTS/stderr" >&2; \
exit "$$RC"

.PHONY: test
test: $(TESTPROGS)
@printf "%-62.62s %s\n" "Test Name" "Stat Ops/sec"
@printf "%-62.62s %s\n" "----------------------------------------------------------------" "--------------"
@for PROG in $$( ls $(TESTPROGS) ); do \
if [ "$$TONLY" = "" -o "$${PROG#tests/test_$$TONLY}" != "$$PROG" ]; then \
$$PROG; \
fi \
done
@TESTCMD='"$$1" > "$$2.part" 2>&1; \
S=$$?; \
mv "$$2.part" "$$2"; \
exit $$S'; \
$(RUN_TESTS)

.PHONY: valtest
valtest: $(TESTPROGS)
@printf "Running Regression Tests Under Valgrind...\n"
@printf "%-62.62s %s\n" "Test Name" "Stat Ops/sec"
@printf "%-62.62s %s\n" "----------------------------------------------------------------" "--------------"
@for PROG in $$( ls $(TESTPROGS) ); do \
if [ "$$TONLY" = "" -o "$${PROG#tests/test_$$TONLY}" != "$$PROG" ]; then \
valgrind -q $$PROG; \
fi \
done
@if [ "$(VALGRINDLOG)" != "" ]; then mkdir -p "$(VALGRINDLOG)"; fi
@if [ "$(VALGRINDLOG)" = "" ]; then \
TESTCMD='$(VALGRIND) $(VALGRINDFLAGS) "$$1" > "$$2.part" 2>&1; \
S=$$?; \
mv "$$2.part" "$$2"; \
exit $$S'; \
else \
TESTCMD='NAME=$${1##*/}; \
LOG="$(VALGRINDLOG)/$${NAME%.bin}.log"; \
$(VALGRIND) $(VALGRINDFLAGS) --error-exitcode=125 --log-file="$$LOG" "$$1" > "$$2.part" 2>&1; \
S=$$?; \
if [ "$$S" = "125" ]; then \
printf " valgrind: errors reported -- %s\n" "$$LOG" >> "$$2.part"; \
S=0; \
fi; \
mv "$$2.part" "$$2"; \
exit $$S'; \
fi; \
$(RUN_TESTS)

.PHONY: cov-clean
cov-clean:
Expand Down
166 changes: 166 additions & 0 deletions centrallix-lib/include/clusters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
#ifndef CLUSTERS_H
#define CLUSTERS_H

/************************************************************************/
/* Centrallix Application Server System */
/* Centrallix Core */
/* */
/* Copyright (C) 1998-2026 LightSys Technology Services, Inc. */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */
/* 02111-1307 USA */
/* */
/* A copy of the GNU General Public License has been included in this */
/* distribution in the file "COPYING". */
/* */
/* Module: clusters.c, clusters.h */
/* Author: Israel Fuller */
/* Creation: September 29, 2025 */
/* Description: Clustering library used to cluster and search data with */
/* cosine or Levenshtein (aka. edit distance) similarity */
/* measures. Used by the "clustering driver". */
/* For more information on how to use this library, see */
/* string_similarity.md in the centrallix-sysdoc folder. */
/************************************************************************/

#include <stdlib.h>
#include <stdbool.h>

#ifdef CXLIB_INTERNAL
#include "xarray.h"
#else
#include "cxlib/xarray.h"
#endif

/** This file has additional documentation in string_similarity.md. **/


/*** This value defines the number of dimensions used for a sparse
*** vector. The higher the number, the fewer collisions will be
*** encountered when using these vectors for cosine comparisons.
*** This is also called the vector table size, if viewing the
*** vector as a hash table of character pairs.
***
*** 2147483647 is the signed int max, and is also a prime number.
*** Using this value ensures that the longest run of 0s will not
*** cause an int underflow with the current encoding scheme.
***
*** Unfortunately, we can't use a number this large yet because
*** the kmeans algorithm creates densely allocated centroids with
*** `CA_NUM_DIMS` dimensions, so a large number causes it to fail.
*** Thus, we use 251 as the largest prime number less than 256,
*** giving us a decent balance between collision reduction and
*** kmeans centroid performance/memory overhead.
***/
#define CA_NUM_DIMS 251

/*** The character used to create a pair with the first and last characters
*** of a string. Currently set to 96, the character just before 'a' (97)
*** in the ASCII table.
***/
#define CA_BOUNDARY_CHAR ((unsigned char)('a' - 1))

/** Types. **/
typedef int* pVector; /* Sparse vector. */
typedef double* pCentroid; /* Dense centroid. */
#define CENTROID_SIZE (CA_NUM_DIMS * sizeof(double))

/*** Information about detected matching pairs.
***
*** @param i The index into the provided data for the first element of the pair.
*** @param j The index into the provided data for the second element of the pair.
*** @param similarity A number from 0 to 1, from a similarity function, showing
*** how similar the pair is.
***/
typedef struct
{
unsigned int i, j;
double similarity;
}
Pair, *pPair;


/** Edit distance function. **/
int caEditDist(const char* str1, const char* str2, const size_t str1_length, const size_t str2_length);

/** Vector functions. **/
pVector caBuildVector(const char* str);
bool caEql(pVector v1, pVector v2);
unsigned int caSparseLen(const pVector vector);
void caPrintVector(const pVector vector);
void caFreeVector(pVector sparse_vector);

/** k-means function. **/
int caKmeans(
pVector* vectors,
const unsigned int num_vectors,
const unsigned int num_clusters,
const unsigned int max_iter,
const double min_improvement,
unsigned int* labels,
double* vector_sims,
bool auto_seed);

/** Vector helper macros. **/
#define caIsEmpty(vector) (vector[0] == -CA_NUM_DIMS)
/*** Note: Given that CA_NUM_DIMS == 251, caBuildVector("") will give the
*** vector we check for in the caHasNoPairs() macro, [-172, 11, -78],
*** which has a single pair of boundary characters.
*** If CA_NUM_DIMS is modified, this macro will need to be updated, hence the
*** compiler directive causing it to be undefined in this case, likely leading
*** to a lot of compiler or linker issues to remind the developer about this.
***/
#if CA_NUM_DIMS == 251
#define caHasNoPairs(vector) \
({ \
__typeof__ (vector) _v = (vector); \
_v[0] == -172 && _v[1] == 11 && _v[2] == -78; \
Comment thread
nboard marked this conversation as resolved.
Resolved
})
#endif

/*** A function which takes two data items and returns their similarity, a
*** value between `0.0` (completely different) and `1.0` (identical).
***/
typedef double (*pSimilarityFn)(void*, void*);

/** Comparison functions (matching the pSimilarityFn signature). **/
double caCosCompare(void* v1, void* v2);
double caLevCompare(void* str1, void* str2);

/** Similarity search functions. **/
void* caMostSimilar(
void* target,
void** data,
const unsigned int num_data,
pSimilarityFn similarity,
const double threshold);
pXArray caSlidingSearch(
void** data,
const unsigned int num_data,
const unsigned int window_size,
pSimilarityFn similarity,
const double threshold,
pXArray maybe_pairs);
pXArray caCompleteSearch(
void** data,
const unsigned int num_data,
pSimilarityFn similarity,
const double threshold,
pXArray maybe_pairs);

/** Module management functions. **/
void caInit(void);

#endif /* End of .h file. */
Loading