Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
5f2e901
Checkpoint: Switching to DM UI project.
Oct 13, 2025
994e99f
Checkpoint: Switching to DM project.
Oct 14, 2025
ea6430f
Checkpoing: Switching to DM project.
Oct 16, 2025
cf0dbb5
Finish implementing major features for the cluster driver.
Oct 27, 2025
a861fb4
Upgrade memory handling in the cluster driver.
Oct 28, 2025
b4634f3
Begin adding query files to search for duplicates.
Oct 30, 2025
63a4dc2
Add warning for providing an invalid parameter.
Nov 7, 2025
22e55a3
Merge branch 'master' into dups
Nov 7, 2025
4b656a4
Improve exp_functions() to use central schema verification.
Nov 13, 2025
fa28afa
Add ClusterDriverRequirements (forgot to commit them before).
Nov 14, 2025
81a1d2f
Clean up unintended usage of glyph.h
Nov 14, 2025
e624d40
Attempt to reduce issues from ambiguously signed chars.
Nov 14, 2025
b0e000b
All tests now pass.
Nov 17, 2025
0874365
Re-apply reduced weight for duplicate pairs (temporarily turned off l…
Nov 17, 2025
01d918a
Clean up.
Nov 17, 2025
42a65f1
Update licences.
Nov 17, 2025
b281037
Clean up.
Nov 17, 2025
ee0bca7
Add "show_less" option to the cache method (skips printing uncomputed…
Nov 19, 2025
0c9eb2c
Update cluster library to use dynamic memory for any data over a coup…
Nov 19, 2025
394764e
Remove necessary requests for the driver name in objQueryFetch().
Nov 19, 2025
9b8cc19
Fix bugs that caused regressions after the updates to the cluster lib…
Nov 20, 2025
17156b7
Fix an invalid free (nmFree used instead of nmSysFree()).
Nov 20, 2025
648e30a
Merge branch 'master' into dups
Nov 20, 2025
29640a1
Minor improvements and clean up.
Nov 20, 2025
0fa62d3
Correct minor mistakes.
Nov 20, 2025
d3b571c
Merge branch 'master' into dups
Nov 22, 2025
06bae81
Implement a more extendable schema verification system.
Nov 21, 2025
13fd4b7
Replace old schema verification with the new system.
Nov 21, 2025
e83c15f
Expand the new schema verification system with extra data validation …
Nov 21, 2025
070cfe3
Clean up, bug fixes, and naming convention updates.
Nov 21, 2025
8795aaf
Add tests for log and power functions.
Nov 22, 2025
2e948d8
Add exp_fn_i_get_number().
Nov 22, 2025
4c347be
Add exp_fn_i_do_math() to bring the power of schema verification to l…
Nov 22, 2025
d177522
Minor clean up.
Lightning11wins Nov 25, 2025
7b49a5b
Address Greg's comments
Lightning11wins Dec 11, 2025
e9c10a5
Merge branch 'exp-schema' into dups
Lightning11wins Dec 11, 2025
b6abca7
Finish exp_functions.c work.
Lightning11wins Dec 11, 2025
8c86b5f
Organize docs.
Lightning11wins Dec 12, 2025
63fa5ba
Fix wrong stAddValue() info caused by reading old code.
Lightning11wins Dec 12, 2025
d0d4f54
Clean up stale TOODs.
Lightning11wins Dec 12, 2025
3b86627
Fix more styling mistakes.
Lightning11wins Dec 12, 2025
6b83c67
Fix indentation mistakes (thanks Centrallix Indent extension).
Lightning11wins Dec 15, 2025
66029f5
Rename functions to use the proper prefix everywhere.
Lightning11wins Jan 8, 2026
fce7a2c
Update magic.h to prepare for implementing magic on all cluster drive…
Lightning11wins Jan 8, 2026
b9defb8
Refactor some cluster driver code to make it cleaner.
Lightning11wins Jan 8, 2026
636814e
Add magic.h to all major cluster driver structs.
Lightning11wins Jan 8, 2026
495597e
Fix a broken test by increasing the tolerance for reasonable deviations.
Lightning11wins Jan 8, 2026
ab71333
Compile tests with -lm to prevent sporadic linker errors.
Lightning11wins Jan 28, 2026
65e4458
Fix a critical driver bug causing levenshtein to be executed on the c…
Lightning11wins Jan 28, 2026
68d1c68
Merge branch 'refs/heads/master' into dups
Lightning11wins Jan 28, 2026
8ba449e
Fix a major bug where punctuation and whitespace was not properly ign…
Lightning11wins Jan 28, 2026
2be1d22
Remove a broken link in clusters.h.
Lightning11wins Jan 30, 2026
814fcfa
Fix code that assumed DateTime->Value was seconds since the epoch (it…
Lightning11wins Mar 16, 2026
8917ae2
Clean up code and comments.
Lightning11wins Mar 16, 2026
6eeeb2d
Add seed attribute to cluster driver.
Lightning11wins Mar 17, 2026
c561728
Improve support for IntVec and StringVec attribute types.
Lightning11wins Mar 18, 2026
ee9c410
Rename NameAttr to DataAttr in SourceData struct to match KeyAttr.
Lightning11wins Mar 18, 2026
f8aa100
Fix clusterGetAttrValue() asserting MGK_CL_CLUSTER_DATA on SearchData…
Lightning11wins Mar 18, 2026
7dfc69b
Switch stats struct to use compile-time initialization (for consisten…
Lightning11wins Mar 18, 2026
d1c2185
Improve error messages in ci_ComputeSourceData().
Lightning11wins Mar 18, 2026
fd289ff
Refactor clusters to store an array of indexes into the SourceData st…
Lightning11wins Mar 18, 2026
dbc01f2
Fix spelling errors and improve comments.
Lightning11wins Mar 18, 2026
4e96440
Add a test case for the cluster driver.
Lightning11wins Mar 18, 2026
c7c6fcb
Fix the keys field in the SourceData struct not being properly freed …
Lightning11wins Mar 18, 2026
b411968
Update sizeof functions to return size_t instead of unsigned int.
Lightning11wins Mar 18, 2026
0fcf5e5
Update generated HTML by running make in centrallix-doc/Widgets.
Lightning11wins Mar 18, 2026
f47c678
Update copyright notices to use correct dates.
Lightning11wins Mar 18, 2026
e799efa
Fix typo that stated the signed int max was 2147483629.
Lightning11wins Mar 18, 2026
b9a9d36
Update macros.
Lightning11wins Mar 18, 2026
c9241cf
Fix error handling.
Lightning11wins Mar 18, 2026
5fd3d96
Reimplement some code in ca_build_vector() so we don't need to use a …
Lightning11wins Mar 18, 2026
3e57fa6
Fix spelling mistakes and clean up comments.
Lightning11wins Mar 18, 2026
32ef9e0
Use ca_parse_vector_token() to abstract sparse vector parsing logic.
Lightning11wins Mar 18, 2026
00bdc0e
Rename params for ca_parse_vector_token() to improve readability.
Lightning11wins Mar 18, 2026
118e22b
Fix an incorrect doc comment.
Lightning11wins Mar 18, 2026
19cd50b
Fix vector function bugs.
Lightning11wins Mar 18, 2026
ebb9585
Implement improved workaround for mssError() not supporting %c.
Lightning11wins Mar 18, 2026
6544e4e
Update doc comments.
Lightning11wins Mar 19, 2026
9de3d40
Update attribute lists.
Lightning11wins Mar 19, 2026
9cac9b8
Add `README.md` to explain the new datasets directory.
Lightning11wins Mar 19, 2026
98d8a11
Update `README.md` with knowledge learned from testing updates to fil…
Lightning11wins Mar 19, 2026
a0936d6
Improve OSDriver_Authoring.md with Noah's comments.
Lightning11wins Mar 19, 2026
f8572ad
Rewrite mssError() with lessons learned from mssErrorf().
Lightning11wins Mar 19, 2026
ddd99f6
Replace ci_xaToTrimmedArray() with xaToArray().
Lightning11wins Mar 19, 2026
d17c043
Fix a bug in exp_fn_compare() any correct use of the function to fals…
Lightning11wins Mar 19, 2026
8d5364e
Add detail to the description in the copyright notice for the cluster…
Lightning11wins Mar 19, 2026
7e2979b
Improve how enums are implemented in objdrv_cluster.c.
Lightning11wins Mar 19, 2026
59eda46
Re-add typecasts that I removed because I thought they were optional.
Lightning11wins Mar 19, 2026
cf26c09
Fix a memory error.
Lightning11wins Mar 19, 2026
f447c19
Move file name and file path macros to obj.h to promote future reuse.
Lightning11wins Mar 19, 2026
9449178
Refactor attribute name lists to improve reusability and extendability.
Lightning11wins Mar 19, 2026
fd84d79
Revisit attributes offered by the cluster driver.
Lightning11wins Mar 19, 2026
00c07f1
Improve the cluster driver testcase to test the default attribute lists.
Lightning11wins Mar 19, 2026
b540a38
Improve driver with testing.
Lightning11wins Mar 20, 2026
e27308e
Update an example on OSDriver_Authoring.md because the sybase driver …
Lightning11wins Mar 20, 2026
bda9eac
Improve structs.
Lightning11wins Mar 20, 2026
62eebee
Modify min_improvement field in the driver schema to only accept doub…
Lightning11wins Mar 20, 2026
d6e9d98
Fix a bug in the new mssError() implementation.
Lightning11wins Mar 20, 2026
71b3c60
Clean up.
Lightning11wins Mar 20, 2026
fa048eb
Rename Key fields to CacheKey to reduce confusion with the Keys fetch…
Lightning11wins Mar 20, 2026
99f0a29
Clean up and updates.
Lightning11wins Mar 20, 2026
33d6150
Fix bugs and clean up.
Lightning11wins Mar 20, 2026
b2e0f35
Address Greptile comments.
Lightning11wins Mar 23, 2026
326a475
Update error handling in exp_fn_metaphone().
Lightning11wins Mar 23, 2026
06f07b9
Modify check function syntax.
Lightning11wins Mar 23, 2026
0c8f5cc
Overhaul error checking in double_metaphone.c.
Lightning11wins Mar 23, 2026
011d952
Fix cluster driver not setting freed computed data to NULL.
Lightning11wins Mar 23, 2026
8506a39
Clean up some typos and bugs.
Lightning11wins Mar 23, 2026
f1e6bfe
Fix bug from Greptile.
Lightning11wins Mar 24, 2026
e705a68
Improve string buffer handling in exp_functions.c.
Lightning11wins Mar 24, 2026
9a88787
Expand cluster driver test case.
Lightning11wins Mar 24, 2026
dfbd6c4
Merge branch 'refs/heads/master' into dups
Lightning11wins Mar 24, 2026
cc85e7b
Merge branch 'refs/heads/fix-expect' into dups
Lightning11wins Mar 26, 2026
b369ee4
Add code to use expect.h features.
Lightning11wins Mar 26, 2026
5ea6848
Fix Greptile comments.
Lightning11wins Mar 26, 2026
0a96f95
Fix Greptile comments.
Lightning11wins Mar 26, 2026
a041dca
Merge branch 'refs/heads/fix-expect' into dups
Lightning11wins Mar 26, 2026
ef1107b
Update and reduce returns in the cluster driver.
Lightning11wins Mar 26, 2026
de74a99
Add recursion checks and update recursion error messages.
Lightning11wins Mar 27, 2026
96f1f49
Merge branch 'include-msserror' into log-mysql-errors
Lightning11wins May 13, 2026
3f3c219
Improve error handling in the MySQL driver.
Lightning11wins May 13, 2026
fc098bf
Fix issues caught by Greptile.
Lightning11wins May 13, 2026
d0eee37
Fix overzealous error handling from before.
Lightning11wins May 13, 2026
f2e08f4
Remove error messages that might include passwords.
Lightning11wins May 13, 2026
73183ea
Remove more error messages that might contain credentials.
Lightning11wins May 13, 2026
c5b0607
Add line numbers to mssError().
Lightning11wins May 14, 2026
e9a166b
Merge branch 'include-msserror' into dups
Lightning11wins May 14, 2026
11d6b77
Merge branch 'include-msserror' into dups
Lightning11wins May 14, 2026
f9edd74
Merge branch 'master' into log-mysql-errors
Lightning11wins Jun 8, 2026
4eb0e77
Merge branch 'master' into dups
Lightning11wins Jun 8, 2026
0731633
Add several new utilities to util.h.
Lightning11wins Jun 26, 2026
b586f75
Refactor the timer utility into its own library.
Lightning11wins Jun 26, 2026
f0e0106
Refactor the error checker utility into its own library.
Lightning11wins Jun 26, 2026
f0558d4
Add temporary stub.
Lightning11wins Jun 26, 2026
659b81c
Refactor the range utilities into their own library.
Lightning11wins Jun 26, 2026
02a7dc0
Fix up includes.
Lightning11wins Jun 26, 2026
479af4f
Improve code style for how error printing is handled.
Lightning11wins Jun 26, 2026
f48c0e6
Clean up doc comments.
Lightning11wins Jun 26, 2026
d1c4b83
Add clamp() to range.h.
Lightning11wins Jun 26, 2026
a223016
Fix types that I broke by mistake.
Lightning11wins Jun 26, 2026
30ab165
Fix bugs from Greptile.
Lightning11wins Jun 26, 2026
2d63a43
Update snprint_bytes() to handle values up to Exabyte with unsigned l…
Lightning11wins Jun 26, 2026
90d4051
Update the timer library with much more intuitive functionality.
Lightning11wins Jun 26, 2026
dfe3e00
Fix typos.
Lightning11wins Jun 26, 2026
365796f
Update how error messages are displayed.
Lightning11wins Jun 26, 2026
72b0cfc
Fix incorrect type format specifier.
Lightning11wins Jun 26, 2026
37da71f
Modify errors to ignore error code -1.
Lightning11wins Aug 17, 2026
8ec0353
Rename library functions to use camelCase instead of snake_case.
Lightning11wins Aug 17, 2026
836fefc
Rewrite printErrInternal() error message generation to support combin…
Lightning11wins Aug 18, 2026
7a9cb9f
Improve comment clarity.
Lightning11wins Aug 21, 2026
84b6e1f
Guard clamp.
Lightning11wins Aug 21, 2026
9bdd14a
Fix math library not being included at compile time.
Lightning11wins Aug 21, 2026
85d55db
Update generated files.
Lightning11wins Aug 21, 2026
b6b946f
Add strtcatf() for formatted truncating writes to a buffer.
Lightning11wins Aug 21, 2026
bfe1ccd
Add strtcatf_va() variation of strtcatf().
Lightning11wins Aug 21, 2026
9edbd60
Rewrite printErrInternal() using strtcatf(), fixing multiple known is…
Lightning11wins Aug 21, 2026
a44a923
Merge branch 'master' into add-utils
Lightning11wins Aug 21, 2026
84f7d99
Merge branch 'master' into add-utils
Lightning11wins Aug 21, 2026
a492cc2
Reduce error buffer size.
Lightning11wins Aug 21, 2026
3c71698
Update generated files after rebuild.
Lightning11wins Aug 21, 2026
04cb855
Improve comments and code clarity around the strtcatf function family.
Lightning11wins Aug 21, 2026
eb61ac8
Fix out-of-bounds write.
Lightning11wins Aug 21, 2026
a441552
Add tests for the strtcatf function family.
Lightning11wins Aug 21, 2026
527c4a9
Improve testcase variability.
Lightning11wins Aug 21, 2026
20af5c0
Merge branch 'master' into add-utils
Lightning11wins Aug 24, 2026
1b084f7
Fix getTime() failure poisoning total.
Lightning11wins Aug 24, 2026
b9c9f6d
Merge branch 'master' into add-utils
Lightning11wins Aug 31, 2026
57e6914
Fix typos found by reviews.
Lightning11wins Sep 2, 2026
bc8627b
Fix macros.
Lightning11wins Sep 2, 2026
b4c99fd
Fix typos found by Claude.
Lightning11wins Sep 2, 2026
a8541df
Fix doc links.
Lightning11wins Sep 2, 2026
40c3780
Merge branch 'master' into dups
Lightning11wins Sep 2, 2026
cbd6b3b
Fix doc links.
Lightning11wins Sep 2, 2026
db6d70e
Merge branch 'add-utils' into dups
Lightning11wins Sep 2, 2026
3cbcdc1
Update code to handle differences on add-utils.
Lightning11wins Sep 2, 2026
e4fc626
Add calls to strtcatf() for safer printing.
Lightning11wins Sep 3, 2026
55afe3b
Fix macro in if/else structures.
Lightning11wins Sep 3, 2026
306aa6d
Merge branch 'master' into add-utils
Lightning11wins Sep 4, 2026
e719255
Update doc comment.
Lightning11wins Sep 4, 2026
505d221
Merge branch 'master' into dups
Lightning11wins Sep 4, 2026
63123cf
Merge branch 'add-utils' into dups
Lightning11wins Sep 4, 2026
81c15fe
Merge branch 'dups' into log-mysql-errors
Lightning11wins Sep 4, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ perf.data.old
.idea/
.vscode/
centrallix-os/tmp/*
centrallix-os/datasets/
2 changes: 1 addition & 1 deletion centrallix-doc/Widgets/onepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -5976,7 +5976,7 @@ <h3 class="childproperties">Child Properties:</h3>
<tr>
<td class="name">type</td>
<td class="type">string</td>
<td class="description">The type of the column: "text", "check", or "image". "text" is a normal column, and displays the textual value of the data element. "check" displays a checkmark if the data is non-zero (integers) or for strings if the value is non-empty and not "N" or "No". "image" displays the image referred to by the pathname contained in the data value.</td>
<td class="description">The type of the column: "text", "check", "image", or "progress". "text" is a normal column, and displays the textual value of the data element. "check" displays a checkmark if the data is non-zero (integers) or for strings if the value is non-empty and not "N" or "No". "image" displays the image referred to by the pathname contained in the data value. "progress" displays a progress bar, with additional fields such as bar_color, bar_textcollor, and bar_padding.</td>
</tr>
<tr>
<td class="name">width</td>
Expand Down
2 changes: 1 addition & 1 deletion centrallix-doc/Widgets/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ <h3 class="childproperties">Child Properties:</h3>
<tr>
<td class="name">type</td>
<td class="type">string</td>
<td class="description">The type of the column: "text", "check", or "image". "text" is a normal column, and displays the textual value of the data element. "check" displays a checkmark if the data is non-zero (integers) or for strings if the value is non-empty and not "N" or "No". "image" displays the image referred to by the pathname contained in the data value.</td>
<td class="description">The type of the column: "text", "check", "image", or "progress". "text" is a normal column, and displays the textual value of the data element. "check" displays a checkmark if the data is non-zero (integers) or for strings if the value is non-empty and not "N" or "No". "image" displays the image referred to by the pathname contained in the data value. "progress" displays a progress bar, with additional fields such as bar_color, bar_textcollor, and bar_padding.</td>
</tr>
<tr>
<td class="name">width</td>
Expand Down
2 changes: 1 addition & 1 deletion centrallix-doc/Widgets/widgets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3735,7 +3735,7 @@ myTabControl "widget/tab"

<childproperty name="title" type="string">The title of the column to be displayed in the header row.</childproperty>

<childproperty name="type" type="string">The type of the column: "text", "check", or "image". "text" is a normal column, and displays the textual value of the data element. "check" displays a checkmark if the data is non-zero (integers) or for strings if the value is non-empty and not "N" or "No". "image" displays the image referred to by the pathname contained in the data value.</childproperty>
<childproperty name="type" type="string">The type of the column: "text", "check", "image", or "progress". "text" is a normal column, and displays the textual value of the data element. "check" displays a checkmark if the data is non-zero (integers) or for strings if the value is non-empty and not "N" or "No". "image" displays the image referred to by the pathname contained in the data value. "progress" displays a progress bar, with additional fields such as bar_color, bar_textcollor, and bar_padding.</childproperty>

<childproperty name="width" type="integer">width of the column.</childproperty>

Expand Down
6 changes: 3 additions & 3 deletions centrallix-lib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ LIBS = @LIBS@ -lm
##
PROFILE=@PROFILE@
COVERAGE=@COVERAGE@
CFLAGS=@CFLAGS@ @DEFS@ -Iinclude -DCXLIB_INTERNAL -DNM_USE_SYSMALLOC -Wall $(PROFILE) $(COVERAGE) -g
CFLAGS=@CFLAGS@ @DEFS@ -Iinclude -DCXLIB_INTERNAL -DNM_USE_SYSMALLOC -Wall $(PROFILE) $(COVERAGE) -g -lm
MTCFLAGS=@CFLAGS@ @DEFS@ -Iinclude -DCXLIB_INTERNAL -DNM_USE_SYSMALLOC -Wall $(PROFILE) $(COVERAGE) -g -O0
TCFLAGS=$(patsubst -DNDEBUG,,$(CFLAGS))

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
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 check.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
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 check.lo range.lo
DYNAMICFILES=$(patsubst %,src/%,$(XDYNAMICFILES))

INCLUDEFILES:=$(wildcard include/*.h)
Expand Down
39 changes: 39 additions & 0 deletions centrallix-lib/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3355,6 +3355,45 @@ _ACEOF

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
$as_echo_n "checking for main in -lm... " >&6; }
if ${ac_cv_lib_m_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */


int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_m_main=yes
else
ac_cv_lib_m_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
$as_echo "$ac_cv_lib_m_main" >&6; }
if test "x$ac_cv_lib_m_main" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF

LIBS="-lm $LIBS"

fi


ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
Expand Down
1 change: 1 addition & 0 deletions centrallix-lib/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dnl Checks for libraries.
dnl Replace `main' with a function in -lz:
AC_CHECK_LIB(z, main)
AC_CHECK_LIB(crypt, main)
AC_CHECK_LIB(m, main)

dnl Checks for header files.
AC_HEADER_STDC
Expand Down
100 changes: 100 additions & 0 deletions centrallix-lib/include/check.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#ifndef CHECK_H
#define CHECK_H

/************************************************************************/
/* Centrallix Application Server System */
/* Centrallix Base Library */
/* */
/* Copyright (C) 1998-2026 LightSys Technology Services, Inc. */
/* */
/* You may use these files and this library under the terms of the */
/* GNU Lesser General Public License, Version 2.1, contained in the */
/* included file "COPYING". */
/* */
/* Module: check.c, check.h */
/* Author: Israel Fuller */
/* Date: October 13, 2025 */
/* Description: A utility to help with error checking on function */
/* return values, especially for library functions. */
/************************************************************************/

#include <errno.h>
#include <math.h>
#include <string.h>

#include "expect.h"

/** File name macro, expanding functionality like __FILE__ and __LINE__. **/
#define __FILENAME__ \
({ \
const char* last_directory = strrchr(__FILE__, '/'); \
((last_directory != NULL) ? last_directory + 1 : __FILE__); \
})

/** Internal error printer (forward declaration). **/
void printErrInternal(const int error_code, const char* c_str, const char* file_name, const int line_number);

#define printErr(error_code, c_str) printErrInternal(error_code, (c_str), __FILE__, __LINE__)
#define printFail(c_str) do { errno = 0; printErr(-1, (c_str)); } while (0)

/*** Ensures that developer diagnostics are printed if the result of the
*** passed function call is not zero. Not intended for user errors.
***
*** @param result The expression to check. The text of this expression is
*** included in the error message if an error occurs.
*** @returns The result of the checked expression.
***/
#define check(result) \
({ \
errno = 0; /* Reset errno to prevent confusion. */ \
int _r = (result); \
if (UNLIKELY(_r != 0)) printErr(_r, #result" failed"); \
_r; \
})

/*** Ensures that developer diagnostics are printed if the result of the
*** passed function call is negative. Not intended for user errors.
***
*** @param result The expression to check. The text of this expression is
*** included in the error message if an error occurs.
*** @returns The result of the checked expression.
***/
#define checkNeg(result) \
({ \
errno = 0; /* Reset errno to prevent confusion. */ \
int _r = (result); \
if (UNLIKELY(_r < 0)) printErr(_r, #result" failed"); \
_r; \
})

/*** Ensures that developer diagnostics are printed if the result of the
*** passed function call is a NAN double. Not intended for user errors.
***
*** @param result The expression to check. The text of this expression is
*** included in the error message if an error occurs.
*** @returns The result of the checked expression.
***/
#define checkDouble(result) \
({ \
errno = 0; /* Reset errno to prevent confusion. */ \
double _r = (result); \
if (UNLIKELY(isnan(_r))) printErr(-1, #result" failed"); \
_r; \
})

/*** Ensures that developer diagnostics are printed if the result of the
*** passed function call is a NULL pointer. Not intended for user errors.
***
*** @param result The expression to check. The text of this expression is
*** included in the error message if an error occurs.
*** @returns The result of the checked expression.
***/
#define checkPtr(result) \
({ \
errno = 0; /* Reset errno to prevent confusion. */ \
void* _r = (result); \
if (UNLIKELY(_r == NULL)) printErr(-1, #result" failed"); \
_r; \
})

#endif /* CHECK_H */
161 changes: 161 additions & 0 deletions centrallix-lib/include/clusters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#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: lib_cluster.c, lib_cluster.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
*** kmeans algorithm creates densely allocated centroids with
*** `CA_NUM_DIMS` dimensions, so a large number causes it to fail.
*** This, 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 pairs are.
***/
typedef struct
{
unsigned int i, j;
double similarity;
}
Pair, *pPair;


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

/** Vector functions. **/
pVector ca_build_vector(const char* str);
unsigned int ca_sparse_len(const pVector vector);
void ca_print_vector(const pVector vector);
void ca_free_vector(pVector sparse_vector);

/** k-means function. **/
int ca_kmeans(
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 ca_is_empty(vector) (vector[0] == -CA_NUM_DIMS)
/*** Note: Given that CA_NUM_DIMS == 251, ca_build_vector("") will give the
*** vector we check for in the ca_has_no_pairs() 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 ca_has_no_pairs(vector) \
({ \
__typeof__ (vector) _v = (vector); \
_v[0] == -172 && _v[1] == 11 && _v[2] == -78; \
})
#endif

/** Comparison functions (see ca_search()). **/
double ca_cos_compare(void* v1, void* v2);
double ca_lev_compare(void* str1, void* str2);
bool ca_eql(pVector v1, pVector v2);

/** Similarity search functions. **/
void* ca_most_similar(
void* target,
void** data,
const unsigned int num_data,
double (*similarity)(void*, void*),
const double threshold);
pXArray ca_sliding_search(
void** data,
const unsigned int num_data,
const unsigned int window_size,
double (*similarity)(void*, void*),
const double threshold,
pXArray maybe_pairs);
pXArray ca_complete_search(
void** data,
const unsigned int num_data,
double (*similarity)(void*, void*),
const double threshold,
pXArray maybe_pairs);

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

#endif /* End of .h file. */
3 changes: 3 additions & 0 deletions centrallix-lib/include/cxlibconfig-all.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
/* Define to 1 if you have the `crypt' library (-lcrypt). */
#undef HAVE_LIBCRYPT

/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM

/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ

Expand Down
Loading