From 4f6a4092e70d21d1d25b28d7cee8d03e3d8b631a Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Wed, 7 Oct 2026 14:09:15 +0000 Subject: [PATCH 01/36] Rearrange deck chairs for better view of the next stages --- .../{linux-ci.yml => linux-tcl8-build-install-test.yaml} | 2 +- .github/workflows/{mac-ci.yml => mac-tcl8-build-install.yaml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{linux-ci.yml => linux-tcl8-build-install-test.yaml} (96%) rename .github/workflows/{mac-ci.yml => mac-tcl8-build-install.yaml} (96%) diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-tcl8-build-install-test.yaml similarity index 96% rename from .github/workflows/linux-ci.yml rename to .github/workflows/linux-tcl8-build-install-test.yaml index f1d3956d..e4ef8207 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-tcl8-build-install-test.yaml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: Linux CI +name: Linux tcl8 build-install-test # Controls when the action will run. on: diff --git a/.github/workflows/mac-ci.yml b/.github/workflows/mac-tcl8-build-install.yaml similarity index 96% rename from .github/workflows/mac-ci.yml rename to .github/workflows/mac-tcl8-build-install.yaml index 8afdbe58..7f659c52 100644 --- a/.github/workflows/mac-ci.yml +++ b/.github/workflows/mac-tcl8-build-install.yaml @@ -1,4 +1,4 @@ -name: Mac CI +name: Mac tcl8 build-install on: push: From 68b17b8d5e710e670d26b5ceda867f24eb54571e Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Wed, 7 Oct 2026 16:27:46 +0000 Subject: [PATCH 02/36] Bring CI up to the current world. --- .../workflows/linux-tcl8-build-install-test.yaml | 4 ++-- .github/workflows/mac-tcl8-build-install.yaml | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/linux-tcl8-build-install-test.yaml b/.github/workflows/linux-tcl8-build-install-test.yaml index e4ef8207..19a94956 100644 --- a/.github/workflows/linux-tcl8-build-install-test.yaml +++ b/.github/workflows/linux-tcl8-build-install-test.yaml @@ -21,8 +21,8 @@ jobs: run: | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update -qq - sudo apt-get install -y gcc-7 g++-7 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 + sudo apt-get install -y gcc-11 g++-11 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 sudo apt-get install -y tcl8.6-dev tcllib tclx libboost-all-dev - name: configure run: | diff --git a/.github/workflows/mac-tcl8-build-install.yaml b/.github/workflows/mac-tcl8-build-install.yaml index 7f659c52..0d1711cc 100644 --- a/.github/workflows/mac-tcl8-build-install.yaml +++ b/.github/workflows/mac-tcl8-build-install.yaml @@ -12,23 +12,18 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependencies run: | set -x brew update - brew install tcl-tk || true - brew install boost || true - sudo mkdir -p /usr/local - sudo rm -f /usr/local/lib/libtcl* || true - sudo ln -sf /usr/local/opt/tcl-tk/include /usr/local/include/tcl8.6 - sudo cp /usr/local/opt/tcl-tk/lib/libtcl* /usr/local/lib - sudo ln -sf /usr/local/opt/tcl-tk/bin/tclsh8.6 /usr/local/bin/tclsh - sudo ln -sf /usr/local/opt/tcl-tk/bin/tclsh8.6 /usr/local/bin/tclsh8.6 + brew reinstall tcl-tk@8 + brew install boost - name: configure run: | autoreconf -vi - ./configure --with-tcl=/usr/local/opt/tcl-tk/lib --prefix=/usr/local + PREFIX=/opt/homebrew/opt/tcl-tk@8 + ./configure --with-tcl=$PREFIX/lib --prefix=$PREFIX - name: make run: make - name: install From 43cb953329c85aeb23b11d1e9193e48384dc1208 Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Wed, 7 Oct 2026 16:30:55 +0000 Subject: [PATCH 03/36] Mac CI needs autoconf --- .github/workflows/mac-tcl8-build-install.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/mac-tcl8-build-install.yaml b/.github/workflows/mac-tcl8-build-install.yaml index 0d1711cc..6d1d5196 100644 --- a/.github/workflows/mac-tcl8-build-install.yaml +++ b/.github/workflows/mac-tcl8-build-install.yaml @@ -18,6 +18,8 @@ jobs: set -x brew update brew reinstall tcl-tk@8 + brew install autoconf + brew install automake brew install boost - name: configure run: | From 9c4bff7cc10b41bc612b417e62efa0ba4aad3b3c Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Wed, 7 Oct 2026 19:08:51 +0000 Subject: [PATCH 04/36] Adding boost-build --- .github/workflows/mac-tcl8-build-install.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac-tcl8-build-install.yaml b/.github/workflows/mac-tcl8-build-install.yaml index 6d1d5196..c20d7ff2 100644 --- a/.github/workflows/mac-tcl8-build-install.yaml +++ b/.github/workflows/mac-tcl8-build-install.yaml @@ -20,7 +20,7 @@ jobs: brew reinstall tcl-tk@8 brew install autoconf brew install automake - brew install boost + brew install boost boost-build - name: configure run: | autoreconf -vi From d2cf14a673c032e5a72c6697ca2f116336a0cce4 Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Wed, 7 Oct 2026 21:19:35 +0000 Subject: [PATCH 05/36] Explicitly give it the path to boost. --- .github/workflows/mac-tcl8-build-install.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mac-tcl8-build-install.yaml b/.github/workflows/mac-tcl8-build-install.yaml index c20d7ff2..9ad5bc33 100644 --- a/.github/workflows/mac-tcl8-build-install.yaml +++ b/.github/workflows/mac-tcl8-build-install.yaml @@ -24,8 +24,10 @@ jobs: - name: configure run: | autoreconf -vi - PREFIX=/opt/homebrew/opt/tcl-tk@8 - ./configure --with-tcl=$PREFIX/lib --prefix=$PREFIX + PREFIX=/opt/homebrew/opt + TCL=$PREFIX/tcl-tk@8 + BOOST=$PREFIX/boost + ./configure --with-tcl=$TCL/lib --prefix=$TCL --with-boost=$BOOST - name: make run: make - name: install From a7f39e0d800da271ea052445b116486e3cf946dc Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Thu, 8 Oct 2026 13:10:08 +0000 Subject: [PATCH 06/36] Add tcl9 CI for Linux --- .../linux-tcl9-build-install-test.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/linux-tcl9-build-install-test.yaml diff --git a/.github/workflows/linux-tcl9-build-install-test.yaml b/.github/workflows/linux-tcl9-build-install-test.yaml new file mode 100644 index 00000000..745407c9 --- /dev/null +++ b/.github/workflows/linux-tcl9-build-install-test.yaml @@ -0,0 +1,36 @@ +# This is a basic workflow to help you get started with Actions + +name: Linux tcl9 build-install-test + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-26.04 + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo apt-get update -qq + sudo apt-get install -y gcc-11 g++-11 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 + sudo apt-get install -y tcl9.0-dev tcllib tclx libboost-all-dev + - name: configure + run: | + autoreconf -vi + ./configure --with-tcl=/usr/lib/tcl9.0 + - name: make + run: make + - name: install + run: sudo make install + - name: test + run: make -C ctables test From e29f59605d725534ff2bfae43d8b7609b7bdf8e4 Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Thu, 8 Oct 2026 13:18:19 +0000 Subject: [PATCH 07/36] Convert CONST to const --- ctables/command-body.c-subst | 34 +++++++++--------- ctables/ctable.h | 24 ++++++------- ctables/ctable_io.c | 12 +++---- ctables/ctable_lists.c | 2 +- ctables/ctable_search.c | 20 +++++------ ctables/demos/speedtables.html | 6 ++-- ctables/docs/doc.txt | 4 +-- ctables/docs/manual/ch11.html | 6 ++-- ctables/gentable.tcl | 66 +++++++++++++++++----------------- ctables/hash/speedtableHash.c | 16 ++++----- ctables/init-exten.c-subst | 4 +-- ctables/shared/shared.c | 12 +++---- ctables/shared/shared.h | 10 +++--- ctables/template.c-subst | 4 +-- 14 files changed, 110 insertions(+), 110 deletions(-) diff --git a/ctables/command-body.c-subst b/ctables/command-body.c-subst index 855fb3cc..62dcf70a 100644 --- a/ctables/command-body.c-subst +++ b/ctables/command-body.c-subst @@ -1,8 +1,8 @@ // $Id$ #ifdef WITH_PGTCL -extern "C" PGresult *PgGetResultId (Tcl_Interp *interp, CONST char *id, void **resultidPtr); -extern "C" PGconn *PgGetConnectionId (Tcl_Interp *interp, CONST char *id, void **resultidPtr); +extern "C" PGresult *PgGetResultId (Tcl_Interp *interp, const char *id, void **resultidPtr); +extern "C" PGconn *PgGetConnectionId (Tcl_Interp *interp, const char *id, void **resultidPtr); #endif // ctable table-specific function to delete all rows @@ -138,10 +138,10 @@ void ${table}_cmdDeleteProc (ClientData clientData) } // Forward definitions -int ${table}MetaObjCmd(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); -int ${table}CursorCommand(Tcl_Interp *interp, CTable *ctable, Tcl_Obj *CONST objv[], int objc); +int ${table}MetaObjCmd(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +int ${table}CursorCommand(Tcl_Interp *interp, CTable *ctable, Tcl_Obj *const objv[], int objc); -int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) +int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { CTable *ctable = (CTable *)cData; struct $table *row; @@ -151,7 +151,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON int indexCtl; int commandStatus = TCL_OK; - static CONST char *options[] = {"get", "set", "store", "incr", "array_get", "array_get_with_nulls", "exists", "delete", "count", "batch", "search", "search+", "type", "import_postgres_result", "import_cassandra_future", "fields", "field", "fieldtype", "needs_quoting", "names", "reset", "destroy", "statistics", "read_tabsep", "write_tabsep", "index", "foreach", "key", "makekey", "methods", "attach", "getprop", "share", "null", "isnull", "verify", "performance_callback", "clean", "cursors", (char *)NULL}; + static const char *options[] = {"get", "set", "store", "incr", "array_get", "array_get_with_nulls", "exists", "delete", "count", "batch", "search", "search+", "type", "import_postgres_result", "import_cassandra_future", "fields", "field", "fieldtype", "needs_quoting", "names", "reset", "destroy", "statistics", "read_tabsep", "write_tabsep", "index", "foreach", "key", "makekey", "methods", "attach", "getprop", "share", "null", "isnull", "verify", "performance_callback", "clean", "cursors", (char *)NULL}; enum options {OPT_GET, OPT_SET, OPT_STORE, OPT_INCR, OPT_ARRAY_GET, OPT_ARRAY_GET_WITH_NULLS, OPT_EXISTS, OPT_DELETE, OPT_COUNT, OPT_BATCH, OPT_SEARCH, OPT_SEARCHPLUS, OPT_TYPE, OPT_IMPORT_POSTGRES_RESULT, OPT_IMPORT_CASSANDRA_FUTURE, OPT_FIELDS, OPT_FIELD, OPT_FIELDTYPE, OPT_NEEDSQUOTING, OPT_NAMES, OPT_RESET, OPT_DESTROY, OPT_STATISTICS, OPT_READ_TABSEP, OPT_WRITE_TABSEP, OPT_INDEX, OPT_FOREACH, OPT_KEY, OPT_MAKEKEY, OPT_METHODS, OPT_ATTACH, OPT_GETPROP, OPT_SHARE, OPT_NULL, OPT_ISNULL, OPT_VERIFY, OPT_PERFORMANCE_CALLBACK, OPT_CLEAN, OPT_CURSORS, NUM_OPTIONS }; @@ -303,7 +303,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON case OPT_GETPROP: { Tcl_Obj *list = Tcl_NewObj(); Tcl_Obj *tmpobj; - static CONST char *infoStrings[] = { "type", "$table", "extension", "$extension", "key", "$keyFieldName", "quote", "", NULL }; + static const char *infoStrings[] = { "type", "$table", "extension", "$extension", "key", "$keyFieldName", "quote", "", NULL }; int i; int j; @@ -392,7 +392,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON } case OPT_FIELD: { - static CONST char *subOptions[] = {"getprop", "properties", "proplist", (char *)NULL}; + static const char *subOptions[] = {"getprop", "properties", "proplist", (char *)NULL}; int suboptIndex; int fieldNum; int propIndex; @@ -424,7 +424,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON return TCL_ERROR; } - if (Tcl_GetIndexFromObj (interp, objv[4], (CONST char **)f->propKeys, "property", TCL_EXACT, &propIndex) != TCL_OK) { + if (Tcl_GetIndexFromObj (interp, objv[4], (const char **)f->propKeys, "property", TCL_EXACT, &propIndex) != TCL_OK) { return TCL_ERROR; } @@ -541,7 +541,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON } case OPT_STATISTICS: { - CONST char *stats = ctable_HashStats (ctable->keyTablePtr); + const char *stats = ctable_HashStats (ctable->keyTablePtr); Tcl_SetStringObj (Tcl_GetObjResult (interp), stats, -1); ckfree((char *)stats); break; @@ -605,7 +605,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON if (ctable->share_type == CTABLE_SHARED_MASTER) { int pid = -1; Tcl_Obj *resultObj = Tcl_GetObjResult(interp); - CONST char *resultList[4]; + const char *resultList[4]; int i; if (objc != 3) { @@ -706,7 +706,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON Tcl_Obj *keyObj; static char keyString[32]; int nocomplain = 0; - Tcl_Obj *CONST*origObjv = objv; + Tcl_Obj *const *origObjv = objv; while (objc > 2) { char *option = Tcl_GetString (objv[2]); @@ -789,7 +789,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON Tcl_Obj **listObjv; Tcl_Obj *keyObj = objv[2]; int nocomplain = 0; - Tcl_Obj *CONST*origObjv = objv; + Tcl_Obj *const *origObjv = objv; while (objc > 3) { char *option = Tcl_GetString (objv[3]); @@ -1669,7 +1669,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON } case OPT_INDEX: { - static CONST char *subOptions[] = {"span", "count", "create", "drop", "indexable", "indexed", "unique", "list", "dump", (char *)NULL}; + static const char *subOptions[] = {"span", "count", "create", "drop", "indexable", "indexed", "unique", "list", "dump", (char *)NULL}; int suboptIndex; int fieldNum; @@ -2161,9 +2161,9 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CON return commandStatus; } -int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct cursor *cursor, Tcl_Obj *CONST objv[], int objc) +int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct cursor *cursor, Tcl_Obj *const objv[], int objc) { - static CONST char *cursorCommands[] = { "destroy", "reset", "next", "index", "get", "set", "array_get", "array_get_with_nulls", "delete", "count", "at_end", "key", NULL }; + static const char *cursorCommands[] = { "destroy", "reset", "next", "index", "get", "set", "array_get", "array_get_with_nulls", "delete", "count", "at_end", "key", NULL }; enum cursorCommands { CURSOR_DESTROY, CURSOR_RESET, CURSOR_NEXT, CURSOR_INDEX, CURSOR_GET, CURSOR_SET, CURSOR_ARRAY_GET, CURSOR_ARRAY_GET_WITH_NULLS, CURSOR_DELETE, CURSOR_COUNT, CURSOR_AT_END, CURSOR_KEY, NUM_CURSOR_COMMANDS }; int command_id = 0; @@ -2377,7 +2377,7 @@ int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct curso } } -int ${table}CursorObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) +int ${table}CursorObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { struct cursor *cursor = (struct cursor *)cData; CTable *ctable = cursor->ownerTable; diff --git a/ctables/ctable.h b/ctables/ctable.h index 868a2836..18dd7b1e 100644 --- a/ctables/ctable.h +++ b/ctables/ctable.h @@ -402,7 +402,7 @@ struct CTableSearch { Tcl_Channel tabsepChannel; int writingTabsepIncludeFieldNames; - CONST char *sepstr; + const char *sepstr; // count of matches during a search int matchCount; @@ -437,9 +437,9 @@ struct CTableSearch { }; struct ctable_FieldInfo { - CONST char *name; + const char *name; Tcl_Obj *nameObj; - CONST char **propKeys; + const char **propKeys; char **propValues; fieldCompareFunction_t compareFunction; int number; @@ -454,7 +454,7 @@ struct ctable_CreatorTable { Tcl_HashTable *registeredProcTablePtr; long unsigned int nextAutoCounter; - CONST char **fieldNames; + const char **fieldNames; Tcl_Obj **nameObjList; Tcl_Obj **keyObjList; int *fieldList; @@ -469,18 +469,18 @@ struct ctable_CreatorTable { int nPublicFields; int nLinkedLists; - CONST char **filterNames; - CONST filterFunction_t *filterFunctions; + const char **filterNames; + const filterFunction_t *filterFunctions; int nFilters; ctable_BaseRow *(*make_empty_row) (struct CTable *ctable); - ctable_BaseRow *(*find_row) (struct CTable *ctable, CONST char *key); + ctable_BaseRow *(*find_row) (struct CTable *ctable, const char *key); int (*set) (Tcl_Interp *interp, struct CTable *ctable, Tcl_Obj *dataObj, ctable_BaseRow *row, int field, int indexCtl); int (*set_null) (Tcl_Interp *interp, struct CTable *ctable, ctable_BaseRow *row, int field, int indexCtl); Tcl_Obj *(*get) (Tcl_Interp *interp, ctable_BaseRow *row, int field); - CONST char *(*get_string) (const ctable_BaseRow *pointer, int field, int *lengthPtr, Tcl_Obj *utilityObj); + const char *(*get_string) (const ctable_BaseRow *pointer, int field, int *lengthPtr, Tcl_Obj *utilityObj); Tcl_Obj *(*gen_list) (Tcl_Interp *interp, ctable_BaseRow *pointer); Tcl_Obj *(*gen_keyvalue_list) (Tcl_Interp *interp, ctable_BaseRow *pointer); @@ -488,7 +488,7 @@ struct ctable_CreatorTable { int (*lappend_field) (Tcl_Interp *interp, Tcl_Obj *destListObj, ctable_BaseRow *p, int field); int (*lappend_field_and_name) (Tcl_Interp *interp, Tcl_Obj *destListObj, ctable_BaseRow *p, int field); int (*lappend_nonnull_field_and_name) (Tcl_Interp *interp, Tcl_Obj *destListObj, ctable_BaseRow *p, int field); - void (*dstring_append_get_tabsep) (CONST char *key, ctable_BaseRow *pointer, int *fieldNums, int nFields, Tcl_DString *dsPtr, int noKey, CONST char *sepstr, int quoteType, CONST char *nullString); + void (*dstring_append_get_tabsep) (const char *key, ctable_BaseRow *pointer, int *fieldNums, int nFields, Tcl_DString *dsPtr, int noKey, const char *sepstr, int quoteType, const char *nullString); int (*array_set) (Tcl_Interp *interp, Tcl_Obj *arrayNameObj, ctable_BaseRow *row, int field); int (*array_set_with_nulls) (Tcl_Interp *interp, Tcl_Obj *arrayNameObj, ctable_BaseRow *row, int field); @@ -498,11 +498,11 @@ struct ctable_CreatorTable { void (*delete_row) (struct CTable *ctable, ctable_BaseRow *row, int indexCtl); - int (*command) (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); - int (*cursor_command) (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); + int (*command) (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); + int (*cursor_command) (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #ifdef SANITY_CHECKS - void (*sanity_check_pointer)(struct CTable *ctable, void *ptr, int indexCtl, CONST char *where); + void (*sanity_check_pointer)(struct CTable *ctable, void *ptr, int indexCtl, const char *where); #endif CT_LIST_HEAD(instances, CTable) instances; }; diff --git a/ctables/ctable_io.c b/ctables/ctable_io.c index e87a0e21..75781515 100644 --- a/ctables/ctable_io.c +++ b/ctables/ctable_io.c @@ -8,18 +8,18 @@ // string was modified and needs to be freed. // CTABLE_INTERNAL int -ctable_quoteString(CONST char **stringPtr, int *stringLengthPtr, int quoteType, CONST char *quotedChars) +ctable_quoteString(const char **stringPtr, int *stringLengthPtr, int quoteType, const char *quotedChars) { int i, j = 0; - CONST char *string = *stringPtr; + const char *string = *stringPtr; int length = (stringLengthPtr ? *stringLengthPtr : strlen(string)); char *newptr = NULL; int quoteChar = '\0'; // no quote by default int maxExpansion = 4; // worst possible worst case int strict = 0; - static CONST char *special = "\b\f\n\r\t\v\\"; - static CONST char *replace = "bfnrtv\\"; + static const char *special = "\b\f\n\r\t\v\\"; + static const char *replace = "bfnrtv\\"; if(quoteType == CTABLE_QUOTE_STRICT_URI) { quoteType = CTABLE_QUOTE_URI; @@ -93,7 +93,7 @@ ctable_quoteString(CONST char **stringPtr, int *stringLengthPtr, int quoteType, // format error. // CTABLE_INTERNAL int -ctable_copyDequoted(char *dst, CONST char *src, int length, int quoteType) +ctable_copyDequoted(char *dst, const char *src, int length, int quoteType) { int i = 0, j = 0; int strict = 0; @@ -174,7 +174,7 @@ CTABLE_INTERNAL int ctable_dequoteString(char *string, int length, int quoteType return ctable_copyDequoted(string, string, length, quoteType); } -static CONST char *ctable_quote_names[] = { "none", "uri", "escape", "strict_uri", "strict_escape", NULL }; +static const char *ctable_quote_names[] = { "none", "uri", "escape", "strict_uri", "strict_escape", NULL }; static int ctable_quote_types[] = { CTABLE_QUOTE_NONE, CTABLE_QUOTE_URI, CTABLE_QUOTE_ESCAPE, CTABLE_QUOTE_STRICT_URI, CTABLE_QUOTE_STRICT_ESCAPE }; // diff --git a/ctables/ctable_lists.c b/ctables/ctable_lists.c index 7a5cffec..5f207feb 100644 --- a/ctables/ctable_lists.c +++ b/ctables/ctable_lists.c @@ -11,7 +11,7 @@ // ctable_ListInit - initialize a list -- zero out the row pointer from the list. // CTABLE_INTERNAL INLINE void -ctable_ListInit (ctable_BaseRow **listPtr, CONST char *file, int line) +ctable_ListInit (ctable_BaseRow **listPtr, const char *file, int line) { #ifdef LISTDEBUG fprintf(stderr, "ctable_ListInit(0x%lx) at %s:%d\n", (long)listPtr, file, line); diff --git a/ctables/ctable_search.c b/ctables/ctable_search.c index 44fac358..35206f56 100644 --- a/ctables/ctable_search.c +++ b/ctables/ctable_search.c @@ -113,7 +113,7 @@ ctable_verify (Tcl_Interp *interp, CTable *ctable, int verbose) { * */ CTABLE_INTERNAL int -ctable_ParseFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, CONST char **fieldNames, int **fieldListPtr, int *fieldCountPtr) { +ctable_ParseFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, const char **fieldNames, int **fieldListPtr, int *fieldCountPtr) { int nFields; Tcl_Obj **fieldsObjv; int i; @@ -156,7 +156,7 @@ ctable_ParseFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, CONST char **f // // CTABLE_INTERNAL int -ctable_ParseSortFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, CONST char **fieldNames, CTableSort *sort) { +ctable_ParseSortFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, const char **fieldNames, CTableSort *sort) { int nFields; Tcl_Obj **fieldsObjv; Tcl_Obj *fieldNameObj; @@ -318,7 +318,7 @@ CTABLE_INTERNAL void ctable_FreeInRows(CTable *ctable, CTableSearchComponent *co } static int -ctable_ParseSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *componentListObj, CONST char **fieldNames, CTableSearch *search) { +ctable_ParseSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *componentListObj, const char **fieldNames, CTableSearch *search) { Tcl_Obj **componentList; int componentIdx; int componentListCount; @@ -331,7 +331,7 @@ ctable_ParseSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *componentListOb CTableSearchComponent *components; CTableSearchComponent *component; - static CONST char *searchTerms[] = CTABLE_SEARCH_TERMS; + static const char *searchTerms[] = CTABLE_SEARCH_TERMS; if (Tcl_ListObjGetElements (interp, componentListObj, &componentListCount, &componentList) == TCL_ERROR) { return TCL_ERROR; @@ -2011,15 +2011,15 @@ if(num_restarts) fprintf(stderr, "%d: Restarted search %d times\n", getpid(), nu // // static int -ctable_SetupSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *CONST objv[], int objc, CTableSearch *search, int indexField, CTableSearch *previous_search) { +ctable_SetupSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *const objv[], int objc, CTableSearch *search, int indexField, CTableSearch *previous_search) { int i; int searchTerm = 0; - CONST char **fieldNames = ctable->creator->fieldNames; + const char **fieldNames = ctable->creator->fieldNames; int quick_count; static int staticSequence = 0; - static CONST char *searchOptions[] = {"-array", "-array_with_nulls", "-array_get", "-array_get_with_nulls", "-code", "-compare", "-countOnly", "-fields", "-get", "-glob", "-key", "-with_field_names", "-limit", "-nokeys", "-offset", "-sort", "-write_tabsep", "-tab", "-delete", "-update", "-buffer", "-index", "-poll_code", "-poll_interval", "-quote", "-null", "-filter", "-cursor", (char *)NULL}; + static const char *searchOptions[] = {"-array", "-array_with_nulls", "-array_get", "-array_get_with_nulls", "-code", "-compare", "-countOnly", "-fields", "-get", "-glob", "-key", "-with_field_names", "-limit", "-nokeys", "-offset", "-sort", "-write_tabsep", "-tab", "-delete", "-update", "-buffer", "-index", "-poll_code", "-poll_interval", "-quote", "-null", "-filter", "-cursor", (char *)NULL}; enum searchOptions {SEARCH_OPT_ARRAY_NAMEOBJ, SEARCH_OPT_ARRAYWITHNULLS_NAMEOBJ, SEARCH_OPT_ARRAYGET_NAMEOBJ, SEARCH_OPT_ARRAYGETWITHNULLS_NAMEOBJ, SEARCH_OPT_CODE, SEARCH_OPT_COMPARE, SEARCH_OPT_COUNTONLY, SEARCH_OPT_FIELDS, SEARCH_OPT_GET_NAMEOBJ, SEARCH_OPT_GLOB, SEARCH_OPT_KEYVAR_NAMEOBJ, SEARCH_OPT_WITH_FIELD_NAMES, SEARCH_OPT_LIMIT, SEARCH_OPT_DONT_INCLUDE_KEY, SEARCH_OPT_OFFSET, SEARCH_OPT_SORT, SEARCH_OPT_WRITE_TABSEP, SEARCH_OPT_TAB, SEARCH_OPT_DELETE, SEARCH_OPT_UPDATE, SEARCH_OPT_BUFFER, SEARCH_OPT_INDEX, SEARCH_OPT_POLL_CODE, SEARCH_OPT_POLL_INTERVAL, SEARCH_OPT_QUOTE_TYPE, SEARCH_OPT_NULL_STRING, SEARCH_OPT_FILTER, SEARCH_OPT_CURSOR}; if (objc < 2) { @@ -2526,7 +2526,7 @@ ctable_elapsed_time (struct timespec *oldtime, struct timespec *newtime, struct // ctable_performance_callback - callback routine for performance of search calls // void -ctable_performance_callback (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *CONST objv[], int objc, struct timespec *startTimeSpec, int loggingMatchCount) { +ctable_performance_callback (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *const objv[], int objc, struct timespec *startTimeSpec, int loggingMatchCount) { struct timespec endTimeSpec; struct timespec elapsedTimeSpec; Tcl_Obj *cmdObjv[4]; @@ -2642,7 +2642,7 @@ ctable_TeardownSearch (CTableSearch *search) { // // CTABLE_INTERNAL int -ctable_SetupAndPerformSearch (Tcl_Interp *interp, Tcl_Obj *CONST objv[], int objc, CTable *ctable, int indexField) { +ctable_SetupAndPerformSearch (Tcl_Interp *interp, Tcl_Obj *const objv[], int objc, CTable *ctable, int indexField) { CTableSearch search; int result; #ifdef CTABLES_CLOCK @@ -2770,7 +2770,7 @@ ctable_DumpIndex (CTable *ctable, int field) { jsw_skip_t *skip = ctable->skipLists[field]; ctable_BaseRow *row; Tcl_Obj *utilityObj = Tcl_NewObj (); - CONST char *s; + const char *s; if (skip == NULL) { return TCL_OK; diff --git a/ctables/demos/speedtables.html b/ctables/demos/speedtables.html index beb0097c..7a64d246 100644 --- a/ctables/demos/speedtables.html +++ b/ctables/demos/speedtables.html @@ -1243,7 +1243,7 @@

11 - C Code Generated and C Routines Created

long unsigned int nextAutoCounter; int nFields; int nLinkedLists; - CONST char **fieldNames; + const char **fieldNames; Tcl_Obj **nameObjList; int *fieldList; enum ctable_types *fieldTypes; @@ -1280,7 +1280,7 @@

11 - C Code Generated and C Routines Created

Next, the number of fields is defined, the field names as an array of pointers to character strings and an enumerated type definition of the fields:

 #define CABLE_INFO_NFIELDS 10
-static CONST char *cable_info_fields[] = {
+static const char *cable_info_fields[] = {
     "ip",
     "mac",
     "name",
@@ -1357,7 +1357,7 @@ 

11 - C Code Generated and C Routines Created

*_get_string - This is particularly useful for the C coder. It takes a pointer to an instance of the structure, a field number, a pointer to an integer, and a pointer to a Tcl object and returns a string representation of the requested field. The Tcl object is used for certain conversions and hence can be considered a reusable utility object. The length of the string returned is set into the pointed-to integer.

Example:

-CONST char *cable_info_get_string (
+const char *cable_info_get_string (
     struct cable_info *cable_info_ptr,
     int field,
     int *lengthPtr,
diff --git a/ctables/docs/doc.txt b/ctables/docs/doc.txt
index b7938919..37336c7b 100644
--- a/ctables/docs/doc.txt
+++ b/ctables/docs/doc.txt
@@ -890,7 +890,7 @@ to character strings and an enumerated type definition of the fields:
 
 #define CABLE_INFO_NFIELDS 10
 
-static CONST char *cable_info_fields[] = {
+static const char *cable_info_fields[] = {
     "ip",
     "mac",
     "name",
@@ -1037,7 +1037,7 @@ string returned is set into the pointed-to integer.
 
 Example:
 
-    CONST char *cable_info_get_string (struct cable_info *cable_info_ptr, int field, int *lengthPtr, Tcl_Obj *utilityObj) {...}
+    const char *cable_info_get_string (struct cable_info *cable_info_ptr, int field, int *lengthPtr, Tcl_Obj *utilityObj) {...}
 
 For fixed strings and varstrings, no copying is performed.
 
diff --git a/ctables/docs/manual/ch11.html b/ctables/docs/manual/ch11.html
index 687123ea..95cf0b42 100644
--- a/ctables/docs/manual/ch11.html
+++ b/ctables/docs/manual/ch11.html
@@ -56,7 +56,7 @@ 

C Code Generated and C Routines Created

long unsigned int nextAutoCounter; int nFields; int nLinkedLists; - CONST char **fieldNames; + const char **fieldNames; Tcl_Obj **nameObjList; int *fieldList; enum ctable_types *fieldTypes; @@ -93,7 +93,7 @@

C Code Generated and C Routines Created

Next, the number of fields is defined, the field names as an array of pointers to character strings and an enumerated type definition of the fields:

 #define CABLE_INFO_NFIELDS 10
-static CONST char *cable_info_fields[] = {
+static const char *cable_info_fields[] = {
     "ip",
     "mac",
     "name",
@@ -170,7 +170,7 @@ 

C Code Generated and C Routines Created

*_get_string - This is particularly useful for the C coder. It takes a pointer to an instance of the structure, a field number, a pointer to an integer, and a pointer to a Tcl object and returns a string representation of the requested field. The Tcl object is used for certain conversions and hence can be considered a reusable utility object. The length of the string returned is set into the pointed-to integer.

Example:

-CONST char *cable_info_get_string (
+const char *cable_info_get_string (
     struct cable_info *cable_info_ptr,
     int field,
     int *lengthPtr,
diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index 481cc2ba..08f0c3be 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -314,7 +314,7 @@ proc gen_allocate_function {table} {
 }
 
 variable sanitySource {
-void ${table}_sanity_check_pointer(CTable *ctable, void *ptr, int indexCtl, CONST char *where)
+void ${table}_sanity_check_pointer(CTable *ctable, void *ptr, int indexCtl, const char *where)
 {
 #ifdef WITH_SHARED_TABLES
     if(indexCtl != CTABLE_INDEX_NEW) {
@@ -1238,8 +1238,8 @@ variable varstringCompSource {
 	      struct ctableSearchMatchStruct *sm = (struct ctableSearchMatchStruct *)component->clientData;
 
 	      if (sm->type == CTABLE_STRING_MATCH_ANCHORED) {
-		  CONST char *field;
-		  CONST char *match;
+		  const char *field;
+		  const char *match;
 
 		  exclude = !matchMeansKeep;
 		  for (field = row->$fieldName, match = row1->$fieldName; *match != '*' && *match != '\0'; match++, field++) {
@@ -1509,7 +1509,7 @@ variable fieldSetSwitchSource {
 }
 
 variable fieldObjGetSource {
-ctable_BaseRow *${table}_find (CTable *ctable, CONST char *key) {
+ctable_BaseRow *${table}_find (CTable *ctable, const char *key) {
     ctable_HashEntry *hashEntry;
 
     hashEntry = ctable_FindHashEntry (ctable->keyTablePtr, key);
@@ -1686,7 +1686,7 @@ ${table}_get (Tcl_Interp *interp, ctable_BaseRow *vPointer, int field) $leftCurl
 }
 
 variable fieldGetStringSource {
-CONST char *
+const char *
 ${table}_get_string (const ctable_BaseRow *vPointer, int field, int *lengthPtr, Tcl_Obj *utilityObj) $leftCurly
     int length;
     const struct $table *row = (const struct $table*) vPointer;
@@ -1706,7 +1706,7 @@ ${table}_get_string (const ctable_BaseRow *vPointer, int field, int *lengthPtr,
 
 variable tabSepFunctionsSource {
 
-void ${table}_dumpFieldNums(int *fieldNums, int nFields, CONST char *msg)
+void ${table}_dumpFieldNums(int *fieldNums, int nFields, const char *msg)
 {
     int i;
 
@@ -1722,9 +1722,9 @@ void ${table}_dumpFieldNums(int *fieldNums, int nFields, CONST char *msg)
 }
 
 void
-${table}_dstring_append_get_tabsep (CONST char *key, ctable_BaseRow *vPointer, int *fieldNums, int nFields, Tcl_DString *dsPtr, int noKeys, CONST char *sepstr, int quoteType, CONST char *nullString) {
+${table}_dstring_append_get_tabsep (const char *key, ctable_BaseRow *vPointer, int *fieldNums, int nFields, Tcl_DString *dsPtr, int noKeys, const char *sepstr, int quoteType, const char *nullString) {
     int              i;
-    CONST char      *string;
+    const char      *string;
     int              nChars;
     Tcl_Obj         *utilityObj = Tcl_NewObj();
     struct $table *row = (struct $table *) vPointer;
@@ -1769,7 +1769,7 @@ ${table}_dstring_append_get_tabsep (CONST char *key, ctable_BaseRow *vPointer, i
 }
 
 void
-${table}_dstring_append_fieldnames (int *fieldNums, int nFields, Tcl_DString *dsPtr, int noKeys, CONST char *sepstr)
+${table}_dstring_append_fieldnames (int *fieldNums, int nFields, Tcl_DString *dsPtr, int noKeys, const char *sepstr)
 {
     int i;
 
@@ -1787,9 +1787,9 @@ ${table}_dstring_append_fieldnames (int *fieldNums, int nFields, Tcl_DString *ds
     Tcl_DStringAppend (dsPtr, "\n", 1);
 }
 
-// TODO: stringPtr argument should probably be CONST and not modified.
+// TODO: stringPtr argument should probably be const and not modified.
 int
-${table}_get_fields_from_tabsep (Tcl_Interp *interp, char *stringPtr, int *nFieldsPtr, int **fieldNumsPtr, int *noKeysPtr, CONST char *sepstr, int nocomplain)
+${table}_get_fields_from_tabsep (Tcl_Interp *interp, char *stringPtr, int *nFieldsPtr, int **fieldNumsPtr, int *noKeysPtr, const char *sepstr, int nocomplain)
 {
     int    i;
     int    field;
@@ -1862,7 +1862,7 @@ ${table}_get_fields_from_tabsep (Tcl_Interp *interp, char *stringPtr, int *nFiel
 }
 
 int
-${table}_export_tabsep (Tcl_Interp *interp, CTable *ctable, CONST char *channelName, int *fieldNums, int nFields, char *pattern, int noKeys, int withFieldNames, CONST char *sepstr, CONST char *term, int quoteType, CONST char *nullString) {
+${table}_export_tabsep (Tcl_Interp *interp, CTable *ctable, const char *channelName, int *fieldNums, int nFields, char *pattern, int noKeys, int withFieldNames, const char *sepstr, const char *term, int quoteType, const char *nullString) {
     Tcl_Channel             channel;
     int                     mode;
     Tcl_DString             dString;
@@ -1929,7 +1929,7 @@ ${table}_export_tabsep (Tcl_Interp *interp, CTable *ctable, CONST char *channelN
 }
 
 int
-${table}_set_from_tabsep (Tcl_Interp *interp, CTable *ctable, CONST char *stringPtr, int *fieldIds, int nFields, int keyColumn, CONST char *sepstr, CONST char *nullString, int quoteType, int dirty) {
+${table}_set_from_tabsep (Tcl_Interp *interp, CTable *ctable, const char *stringPtr, int *fieldIds, int nFields, int keyColumn, const char *sepstr, const char *nullString, int quoteType, int dirty) {
     struct $table *row;
     const char    *key;
     int            indexCtl;
@@ -1952,7 +1952,7 @@ ${table}_set_from_tabsep (Tcl_Interp *interp, CTable *ctable, CONST char *string
         }
         if (key) {
 			int keyLength;
-			CONST char *keyEnd = strstr(key, sepstr);
+			const char *keyEnd = strstr(key, sepstr);
 			if(keyEnd) {
 				keyLength = keyEnd - key;
 			} else {
@@ -2051,11 +2051,11 @@ ${table}_set_from_tabsep (Tcl_Interp *interp, CTable *ctable, CONST char *string
 }
 
 int
-${table}_import_tabsep (Tcl_Interp *interp, CTable *ctable, CONST char *channelName, int *fieldNums, int nFields, CONST char *pattern, int noKeys, int withFieldNames, CONST char *sepstr, CONST char *skip, CONST char *term, int nocomplain, int withNulls, int quoteType, CONST char *nullString, int poll_interval, Tcl_Obj *poll_code, int poll_foreground, int dirty) {
+${table}_import_tabsep (Tcl_Interp *interp, CTable *ctable, const char *channelName, int *fieldNums, int nFields, const char *pattern, int noKeys, int withFieldNames, const char *sepstr, const char *skip, const char *term, int nocomplain, int withNulls, int quoteType, const char *nullString, int poll_interval, Tcl_Obj *poll_code, int poll_foreground, int dirty) {
     Tcl_Channel      channel;
     int              mode;
     Tcl_Obj         *lineObj = NULL;
-    char            *stringPtr;                  // TODO: should probably be CONST and not modified.
+    char            *stringPtr;                  // TODO: should probably be const and not modified.
     int              recordNumber = 0;
     char             keyNumberString[32];
     int		     keyColumn;
@@ -2445,14 +2445,14 @@ proc gen_filters {} {
     }
 
     # Define filter lookup table
-    emit "static CONST char *${table}_filterNames\[] = $leftCurly"
+    emit "static const char *${table}_filterNames\[] = $leftCurly"
     foreach name $filterList {
 	emit "    \"$name\","
     }
     emit "    (char *) NULL"
     emit "$rightCurly;\n"
 
-    emit "static CONST filterFunction_t ${table}_filterFunctions\[] = $leftCurly"
+    emit "static const filterFunction_t ${table}_filterFunctions\[] = $leftCurly"
     foreach name $filterList {
 	emit "    ${table}_filter_${name},"
     }
@@ -2694,7 +2694,7 @@ proc gen_ctable_type_stuff {} {
     variable leftCurly
     variable rightCurly
 
-    emit "static CONST char *ctableTypes\[\] = $leftCurly"
+    emit "static const char *ctableTypes\[\] = $leftCurly"
     foreach type $ctableTypes {
         emit "    \"$type\","
     }
@@ -3708,14 +3708,14 @@ proc put_init_extension_source {extension extensionVersion} {
 }
 
 variable noCleanDirtyTableSource {
-CONST int
+const int
 ${table}_clean(Tcl_Interp *interp, CTable *ctable)
 {
     Tcl_AppendResult(interp, "Dirty bits not implemented.", NULL);
     return TCL_ERROR;
 }
 
-CONST int
+const int
 ${table}_dirty(Tcl_Interp *interp, CTable *ctable)
 {
     Tcl_AppendResult(interp, "Dirty bits not implemented.", NULL);
@@ -3724,7 +3724,7 @@ ${table}_dirty(Tcl_Interp *interp, CTable *ctable)
 }
 
 variable cleanDirtyTableSource {
-CONST int
+const int
 ${table}_clean(Tcl_Interp *interp, CTable *ctable)
 {
     ctable_BaseRow *row = NULL;
@@ -3744,7 +3744,7 @@ ${table}_clean(Tcl_Interp *interp, CTable *ctable)
     return TCL_OK;
 }
 
-CONST int
+const int
 ${table}_dirty(Tcl_Interp *interp, CTable *ctable, ctable_BaseRow *row)
 {
 #ifdef WITH_SHARED_TABLES
@@ -4451,7 +4451,7 @@ proc gen_field_names {} {
 
     emit "int      ${table}_keyField = $keyField;"
 
-    emit "static CONST char *${table}_fields\[] = $leftCurly"
+    emit "static const char *${table}_fields\[] = $leftCurly"
     foreach fieldName $fieldList {
 	emit "    \"$fieldName\","
     }
@@ -4513,16 +4513,16 @@ proc gen_field_names {} {
     foreach fieldName $fieldList {
 	upvar ::ctable::fields::$fieldName field
 
-	set propstring "static CONST char *[field_to_var $table $fieldName propkeys]\[] = $leftCurly"
+	set propstring "static const char *[field_to_var $table $fieldName propkeys]\[] = $leftCurly"
 
 	foreach fieldName [lsort [array names field]] {
 	    append propstring "\"$fieldName\", "
 	}
-	emit "${propstring}(CONST char *)NULL$rightCurly;"
+	emit "${propstring}(const char *)NULL$rightCurly;"
     }
     emit ""
 
-    set propstring "static CONST char **${table}_propKeys\[] = $leftCurly"
+    set propstring "static const char **${table}_propKeys\[] = $leftCurly"
     foreach fieldName $fieldList {
         append propstring "[field_to_var $table $fieldName propkeys],"
     }
@@ -4534,16 +4534,16 @@ proc gen_field_names {} {
     foreach fieldName $fieldList {
 	upvar ::ctable::fields::$fieldName field
 
-	set propstring "static CONST char *[field_to_var $table $fieldName propvalues]\[] = $leftCurly"
+	set propstring "static const char *[field_to_var $table $fieldName propvalues]\[] = $leftCurly"
 
 	foreach fieldName [lsort [array names field]] {
 	    append propstring "\"$field($fieldName)\", "
 	}
-	emit "${propstring}(CONST char *)NULL$rightCurly;"
+	emit "${propstring}(const char *)NULL$rightCurly;"
     }
     emit ""
 
-    set propstring "static CONST char **${table}_propValues\[] = $leftCurly"
+    set propstring "static const char **${table}_propValues\[] = $leftCurly"
     foreach fieldName $fieldList {
         append propstring "[field_to_var $table $fieldName propvalues],"
     }
@@ -4594,7 +4594,7 @@ proc gen_field_names {} {
         }
 
         emit "// define default string list"
-        emit "static CONST char *${table}_defaultStrings\[] = $leftCurly"
+        emit "static const char *${table}_defaultStrings\[] = $leftCurly"
         emit "    \"[join $defaultStrings {", "}]\""
         emit "$rightCurly;"
         emit ""
@@ -6018,10 +6018,10 @@ proc start_codegen {} {
 
     ::ctable::emit "#include \"ctable_search.c\""
 
-    ::ctable::emit "static CONST char *sourceCode = \"[::ctable::cquote "CExtension $::ctable::extension $::ctable::extensionVersion { $::ctable::sourceCode }"]\";"
+    ::ctable::emit "static const char *sourceCode = \"[::ctable::cquote "CExtension $::ctable::extension $::ctable::extensionVersion { $::ctable::sourceCode }"]\";"
     ::ctable::emit ""
 
-    ::ctable::emit "static CONST char *ctablePackageVersion = \"$::ctable::ctablePackageVersion\";"
+    ::ctable::emit "static const char *ctablePackageVersion = \"$::ctable::ctablePackageVersion\";"
 
     if [info exists ::ctable::rawCode] {
 	::ctable::emit "// BEGIN imported C Code"
diff --git a/ctables/hash/speedtableHash.c b/ctables/hash/speedtableHash.c
index 0b1cbe03..9ad91fea 100644
--- a/ctables/hash/speedtableHash.c
+++ b/ctables/hash/speedtableHash.c
@@ -130,7 +130,7 @@ inline
 ctable_HashEntry *
 ctable_InitOrStoreHashEntry(
     ctable_HashTable *tablePtr,	/* Table in which to lookup entry. */
-    CONST char *key,		/* Key to use to find or create matching
+    const char *key,		/* Key to use to find or create matching
 				 * entry. */
     ctable_HashEntry *newEntry,	/* if not null, use this entry */
     int flags,			/* options */
@@ -226,7 +226,7 @@ inline
 ctable_HashEntry *
 ctable_InitHashEntry(
     ctable_HashTable *tablePtr,	/* Table in which to lookup entry. */
-    CONST char *key,		/* Key to use to find or create matching
+    const char *key,		/* Key to use to find or create matching
 				 * entry. */
     int *newPtr)		/* Store info here telling whether a new entry
 				 * was created. */
@@ -261,7 +261,7 @@ inline
 ctable_HashEntry *
 ctable_StoreHashEntry(
     ctable_HashTable *tablePtr,	/* Table in which to lookup entry. */
-    CONST char *key,		/* Key to use to find or create matching
+    const char *key,		/* Key to use to find or create matching
 				 * entry. */
     ctable_HashEntry *newEntry,	/* if not null, use this entry */
     int flags,			/* options */
@@ -293,7 +293,7 @@ inline
 ctable_HashEntry *
 ctable_FindHashEntry(
     ctable_HashTable *tablePtr,	/* Table in which to lookup entry. */
-    CONST char *key)		/* Key to use to find matching entry. */
+    const char *key)		/* Key to use to find matching entry. */
 {
     return ctable_InitHashEntry (tablePtr, key, NULL);
 }
@@ -468,7 +468,7 @@ ctable_NextHashEntry(ctable_HashSearch *searchPtr)
  *----------------------------------------------------------------------
  */
 
-CONST char *
+const char *
 ctable_HashStats(
     ctable_HashTable *tablePtr)	/* Table for which to produce stats. */
 {
@@ -547,8 +547,8 @@ CompareStringKeys(
     VOID *keyPtr,		/* New key to compare. */
     ctable_HashEntry *hPtr)	/* Existing key to compare. */
 {
-    CONST char *p1 = (CONST char *) keyPtr;
-    CONST char *p2 = (CONST char *) hPtr->key;
+    const char *p1 = (const char *) keyPtr;
+    const char *p2 = (const char *) hPtr->key;
 
 #ifdef CTABLE_COMPARE_HASHES_WITH_STRCMP
     return strcmp(p1, p2);
@@ -593,7 +593,7 @@ HashStringKey(
     ctable_HashTable *tablePtr,	/* Hash table. */
     VOID *keyPtr)		/* Key from which to compute hash value. */
 {
-    CONST char *string = (CONST char *) keyPtr;
+    const char *string = (const char *) keyPtr;
     unsigned int result;
     int c;
 
diff --git a/ctables/init-exten.c-subst b/ctables/init-exten.c-subst
index f9035264..4fc10793 100644
--- a/ctables/init-exten.c-subst
+++ b/ctables/init-exten.c-subst
@@ -15,11 +15,11 @@ CTABLE_EXTERNAL int
 ${extension}_Init(Tcl_Interp *interp);
 
 static int
-cExtensionObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+cExtensionObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 {    int      optIndex;
  
  
-    static CONST char *options[] = {
+    static const char *options[] = {
         "definition", "builder_version", "tables", (char *)NULL
     };
  
diff --git a/ctables/shared/shared.c b/ctables/shared/shared.c
index 7bae6ea0..7eb4a5c5 100644
--- a/ctables/shared/shared.c
+++ b/ctables/shared/shared.c
@@ -534,7 +534,7 @@ cell_t oldest_reader_cycle(shm_t   *shm)
 // removed from the list) and the list is never updated with an incomplete
 // entry, so no locking is necessary.
 
-int add_symbol(shm_t   *shm, CONST char *name, char *value, int type)
+int add_symbol(shm_t   *shm, const char *name, char *value, int type)
 {
     int namelen = strlen(name);
     volatile mapheader_t *map = shm->map;
@@ -570,7 +570,7 @@ int add_symbol(shm_t   *shm, CONST char *name, char *value, int type)
 // freed, because we don't know what they're used for and we don't want to
 // lock the garbage collector for long-term symbol use. It's up to the
 // caller to determine if the value can be freed and to do it.
-int set_symbol(shm_t *shm, CONST char *name, char *value, int type)
+int set_symbol(shm_t *shm, const char *name, char *value, int type)
 {
     volatile mapheader_t *map = shm->map;
     volatile symbol_t *s = map->namelist;
@@ -596,7 +596,7 @@ int set_symbol(shm_t *shm, CONST char *name, char *value, int type)
 }
 
 // Get a symbol back.
-char *get_symbol(shm_t *shm, CONST char *name, int wanted)
+char *get_symbol(shm_t *shm, const char *name, int wanted)
 {
     volatile mapheader_t *map = shm->map;
     volatile symbol_t *s = map->namelist;
@@ -832,16 +832,16 @@ int doDetach(Tcl_Interp *interp, shm_t *share)
     return TCL_OK;
 }
 
-int shareCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+int shareCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 {
     int          cmdIndex  = -1;
     char        *sharename = NULL;
     shm_t       *share     = NULL;
 
-    static CONST char *commands[] = {"create", "attach", "list", "detach", "names", "get", "multiget", "set", "info", "free", (char *)NULL};
+    static const char *commands[] = {"create", "attach", "list", "detach", "names", "get", "multiget", "set", "info", "free", (char *)NULL};
     enum commands {CMD_CREATE, CMD_ATTACH, CMD_LIST, CMD_DETACH, CMD_NAMES, CMD_GET, CMD_MULTIGET, CMD_SET, CMD_INFO, CMD_FREE };
 
-    static CONST struct {
+    static const struct {
         int need_share;         // if a missing share is an error
         int nargs;              // >0 number args, <0 -minimum number
         const char *args;             // String for Tcl_WrongNumArgs
diff --git a/ctables/shared/shared.h b/ctables/shared/shared.h
index 5faea450..67838355 100644
--- a/ctables/shared/shared.h
+++ b/ctables/shared/shared.h
@@ -43,7 +43,7 @@ using namespace boost::container;
 #endif
 
 #ifndef WITH_TCL
-#define CONST const
+#define const const
 #endif
 
 // TUNING
@@ -158,9 +158,9 @@ cell_t oldest_reader_cycle(shm_t *shm);
 void shared_perror(const char *text);
 void shmpanic(const char *message);
 #ifdef WITH_SHMEM_SYMBOL_LIST
-int add_symbol(shm_t *shm, CONST char *name, char *value, int type);
-int set_symbol(shm_t *shm, CONST char *name, char *value, int type);
-char *get_symbol(shm_t *shm, CONST char *name, int wanted);
+int add_symbol(shm_t *shm, const char *name, char *value, int type);
+int set_symbol(shm_t *shm, const char *name, char *value, int type);
+char *get_symbol(shm_t *shm, const char *name, int wanted);
 #endif
 int use_name(shm_t *share, const char *symbol);
 void release_name(shm_t *share, const char *symbol);
@@ -184,7 +184,7 @@ int TclGetSizeFromObj(Tcl_Interp *interp, Tcl_Obj *obj, size_t *ptr);
 void TclShmError(Tcl_Interp *interp, const char *name);
 int doCreateOrAttach(Tcl_Interp *interp, const char *sharename, const char *filename, size_t size, int flags, shm_t **sharePtr);
 int doDetach(Tcl_Interp *interp, shm_t *share);
-int shareCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
+int shareCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
 #endif
 
 
diff --git a/ctables/template.c-subst b/ctables/template.c-subst
index 3e045b07..b0c25953 100644
--- a/ctables/template.c-subst
+++ b/ctables/template.c-subst
@@ -21,11 +21,11 @@
  */
 
 int
-${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 {
     int      optIndex;
 
-    static CONST char *options[] = {
+    static const char *options[] = {
         "create", "info", "null_value", "method", "package", "instances",
 	(char *)NULL
     };

From 662938a9bd1184599a2a318461e3b7832ae6879d Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 13:39:20 +0000
Subject: [PATCH 08/36] First pass at Tcl_Size patching

---
 ctables/configure.in |  2 +-
 ctables/ctable.h     |  2 ++
 ctables/gentable.tcl | 20 ++++++++++----------
 ctables/tclsize.h    | 12 ++++++++++++
 4 files changed, 25 insertions(+), 11 deletions(-)
 create mode 100644 ctables/tclsize.h

diff --git a/ctables/configure.in b/ctables/configure.in
index 153ef32f..63543bbd 100755
--- a/ctables/configure.in
+++ b/ctables/configure.in
@@ -79,7 +79,7 @@ TEA_ADD_CFLAGS([])
 TEA_ADD_STUB_SOURCES([])
 TEA_ADD_TCL_SOURCES([config.tcl gentable.tcl
      command-body.c-subst exten-frag.c-subst init-exten.c-subst template.c-subst 
-     ctable.h boyer_moore.c ctable_batch.c ctable_io.c ctable_lists.c ctable_qsort.c ctable_search.c ethers.c
+     ctable.h tclsize.h boyer_moore.c ctable_batch.c ctable_io.c ctable_lists.c ctable_qsort.c ctable_search.c ethers.c
      skiplists/jsw_rand.h skiplists/jsw_slib.h skiplists/jsw_rand.c skiplists/jsw_slib.c
      hash/speedtables.h hash/speedtableHash.c shared/shared.c shared/shared.h])
 
diff --git a/ctables/ctable.h b/ctables/ctable.h
index 18dd7b1e..d2db9616 100644
--- a/ctables/ctable.h
+++ b/ctables/ctable.h
@@ -44,6 +44,8 @@
 
 #include "speedtables.h"
 
+#include "tclsize.h"
+
 #ifdef WITH_SHARED_TABLES
 #include "shared.c"
 
diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index 08f0c3be..d16c9a3a 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -694,7 +694,7 @@ variable keySetSource {
 variable varstringSetSource {
       case $optname: {
 	const char *stringPtr = NULL;
-	int   length;
+	Tcl_Size   length;
 [gen_null_check_during_set_source $table $fieldName]
 
 	stringPtr = Tcl_GetStringFromObj (obj, &length);
@@ -766,7 +766,7 @@ variable charSetSource {
 variable fixedstringSetSource {
       case $optname: {
 	const char *stringPtr;
-	int   len;
+	Tcl_Size   len;
 [gen_null_check_during_set_source $table $fieldName]
 	stringPtr = Tcl_GetStringFromObj (obj, &len);
 [gen_unset_null_during_set_source $table $fieldName "
@@ -1484,7 +1484,7 @@ struct $table *${table}_find_or_create (Tcl_Interp *interp, CTable *ctable, cons
 int
 ${table}_set_fieldobj (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *obj, struct $table *row, Tcl_Obj *fieldObj, int indexCtl, int nocomplain)
 {
-    int field;
+    Tcl_Size field;
 
     if (Tcl_GetIndexFromObj (interp, fieldObj, ${table}_fields, "field", TCL_EXACT, &field) != TCL_OK) {
 	if (nocomplain) {
@@ -1523,7 +1523,7 @@ ctable_BaseRow *${table}_find (CTable *ctable, const char *key) {
 Tcl_Obj *
 ${table}_get_fieldobj (Tcl_Interp *interp, struct $table *row, Tcl_Obj *fieldObj)
 {
-    int field;
+    Tcl_Size field;
 
     if (Tcl_GetIndexFromObj (interp, fieldObj, ${table}_fields, "field", TCL_EXACT, &field) != TCL_OK) {
         return (Tcl_Obj *)NULL;
@@ -1586,7 +1586,7 @@ ${table}_lappend_field_and_name (Tcl_Interp *interp, Tcl_Obj *destListObj, ctabl
 int
 ${table}_lappend_field_and_nameobj (Tcl_Interp *interp, ctable_BaseRow *vPointer, Tcl_Obj *fieldObj)
 {
-    int        field;
+    Tcl_Size        field;
 
     if (Tcl_GetIndexFromObj (interp, fieldObj, ${table}_fields, "field", TCL_EXACT, &field) != TCL_OK) {
         return TCL_ERROR;
@@ -1623,7 +1623,7 @@ ${table}_lappend_nonnull_field_and_name (Tcl_Interp *interp, Tcl_Obj *destListOb
 int
 ${table}_lappend_nonnull_field_and_nameobj (Tcl_Interp *interp, ctable_BaseRow *vPointer, Tcl_Obj *fieldObj)
 {
-    int        field;
+    Tcl_Size        field;
 
     if (Tcl_GetIndexFromObj (interp, fieldObj, ${table}_fields, "field", TCL_EXACT, &field) != TCL_OK) {
         return TCL_ERROR;
@@ -1687,8 +1687,8 @@ ${table}_get (Tcl_Interp *interp, ctable_BaseRow *vPointer, int field) $leftCurl
 
 variable fieldGetStringSource {
 const char *
-${table}_get_string (const ctable_BaseRow *vPointer, int field, int *lengthPtr, Tcl_Obj *utilityObj) $leftCurly
-    int length;
+${table}_get_string (const ctable_BaseRow *vPointer, int field, Tcl_Size *lengthPtr, Tcl_Obj *utilityObj) $leftCurly
+    Tcl_Size length;
     const struct $table *row = (const struct $table*) vPointer;
 
     if (lengthPtr == (int *) NULL) {
@@ -3392,7 +3392,7 @@ variable incrFieldObjSource {
 int
 ${table}_incr_fieldobj (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *obj, struct $table *row, Tcl_Obj *fieldObj, int indexCtl)
 {
-    int field;
+    Tcl_Size field;
 
     if (Tcl_GetIndexFromObj (interp, fieldObj, ${table}_fields, "field", TCL_EXACT, &field) != TCL_OK) {
         return TCL_ERROR;
@@ -5879,7 +5879,7 @@ proc install_ch_files {includeDir} {
     lappend subdirs skiplists hash
 
     set copyFiles {
-	ctable.h ctable_search.c ctable_lists.c ctable_batch.c
+	ctable.h tclsize.h ctable_search.c ctable_lists.c ctable_batch.c
 	boyer_moore.c jsw_rand.c jsw_rand.h jsw_slib.c jsw_slib.h
 	speedtables.h speedtableHash.c ctable_io.c ctable_qsort.c
 	ethers.c
diff --git a/ctables/tclsize.h b/ctables/tclsize.h
new file mode 100644
index 00000000..1a61e8a6
--- /dev/null
+++ b/ctables/tclsize.h
@@ -0,0 +1,12 @@
+/*
+ * Tcl_Size was introduced in Tcl 9.  speedables still supports building against
+ * Tcl 8.6, where Tcl object and list sizes are int-sized.
+ */
+#ifndef TCL_SIZE_MAX
+# define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj
+# define TCL_SIZE_MAX      INT_MAX
+# ifndef Tcl_Size
+    typedef int Tcl_Size;
+# endif
+# define TCL_SIZE_MODIFIER ""
+#endif

From 0df82caba60589e46b7f8499b963bc41ed1a8181 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 13:53:01 +0000
Subject: [PATCH 09/36] Make tcl_platform a global reference explicitly

---
 ctables/config.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/config.tcl b/ctables/config.tcl
index 6696eed6..adaef9ca 100644
--- a/ctables/config.tcl
+++ b/ctables/config.tcl
@@ -33,7 +33,7 @@
     set sharedTraceFile -none
     #set sharedTraceFile -stderr
 
-    if {$tcl_platform(pointerSize) == 8} {
+    if {$::tcl_platform(pointerSize) == 8} {
 		# 64-bit platform
 		set sharedBase 0xA0000000000;
 	} else {

From a47de83945b23be465695a061c9ab78b5480c997 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 13:57:27 +0000
Subject: [PATCH 10/36] avoid VOID

---
 ctables/hash/speedtableHash.c | 12 ++++++------
 ctables/hash/speedtables.h    |  6 +++---
 ctables/shared/dumper.h       |  1 -
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/ctables/hash/speedtableHash.c b/ctables/hash/speedtableHash.c
index 9ad91fea..854fbd62 100644
--- a/ctables/hash/speedtableHash.c
+++ b/ctables/hash/speedtableHash.c
@@ -36,8 +36,8 @@
  * Prototypes for the string hash key methods.
  */
 
-static int		CompareStringKeys(ctable_HashTable *tablePtr, VOID *keyPtr, ctable_HashEntry *hPtr);
-static unsigned int	HashStringKey(ctable_HashTable *tablePtr, VOID *keyPtr);
+static int		CompareStringKeys(ctable_HashTable *tablePtr, void *keyPtr, ctable_HashEntry *hPtr);
+static unsigned int	HashStringKey(ctable_HashTable *tablePtr, void *keyPtr);
 
 /*
  * Function prototypes for static functions in this file:
@@ -141,7 +141,7 @@ ctable_InitOrStoreHashEntry(
     unsigned int hash;
     int index;
 
-    hash = HashStringKey (tablePtr, (VOID *) key);
+    hash = HashStringKey (tablePtr, (void *) key);
     index = RANDOM_INDEX (tablePtr, hash);
 
     /*
@@ -155,7 +155,7 @@ ctable_InitOrStoreHashEntry(
 	    continue;
 	}
 
-	if (!CompareStringKeys(tablePtr, (VOID *) key, hPtr)) {
+	if (!CompareStringKeys(tablePtr, (void *) key, hPtr)) {
 	    if (newPtr)
 		*newPtr = 0;
 	    return hPtr;
@@ -544,7 +544,7 @@ ctable_HashStats(
 static int
 CompareStringKeys(
     ctable_HashTable *tablePtr,
-    VOID *keyPtr,		/* New key to compare. */
+    void *keyPtr,		/* New key to compare. */
     ctable_HashEntry *hPtr)	/* Existing key to compare. */
 {
     const char *p1 = (const char *) keyPtr;
@@ -591,7 +591,7 @@ CompareStringKeys(
 static unsigned int
 HashStringKey(
     ctable_HashTable *tablePtr,	/* Hash table. */
-    VOID *keyPtr)		/* Key from which to compute hash value. */
+    void *keyPtr)		/* Key from which to compute hash value. */
 {
     const char *string = (const char *) keyPtr;
     unsigned int result;
diff --git a/ctables/hash/speedtables.h b/ctables/hash/speedtables.h
index 47ba3abe..849b8e91 100644
--- a/ctables/hash/speedtables.h
+++ b/ctables/hash/speedtables.h
@@ -35,15 +35,15 @@ typedef struct ctable_HashEntry ctable_HashEntry;
 
 typedef unsigned int (ctable_HashKeyProc) (
         ctable_HashTable *tablePtr,
-	VOID *keyPtr);
+	void *keyPtr);
 
 typedef int (ctable_CompareHashKeysProc) (
         ctable_HashTable *tablePtr, 
-	VOID *keyPtr,
+	void *keyPtr,
 	ctable_HashEntry *hPtr);
 
 typedef ctable_HashEntry *(ctable_AllocHashEntryProc) (
-	ctable_HashTable *tablePtr, VOID *keyPtr);
+	ctable_HashTable *tablePtr, void *keyPtr);
 
 typedef void (ctable_FreeHashEntryProc) (ctable_HashEntry *hPtr);
 
diff --git a/ctables/shared/dumper.h b/ctables/shared/dumper.h
index 9d36112a..4ae12edd 100644
--- a/ctables/shared/dumper.h
+++ b/ctables/shared/dumper.h
@@ -1,6 +1,5 @@
 // A stripped down ctable.h
 #define WITH_SHARED_TABLES 1
-#define VOID void
 
 // Dummy out types we're not going to use
 typedef void *Tcl_Command;

From 266ee4b6ba351f20d2c783fa2adc7b9cbabab871 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 15:49:38 +0000
Subject: [PATCH 11/36] More Tcl_Size fixes, renaming some identifiers to clear
 bogus "shadowed" warnings.

---
 ctables/ctable_batch.c       |  4 ++--
 ctables/ctable_search.c      | 24 ++++++++++++------------
 ctables/gentable.tcl         |  2 +-
 ctables/shared/shared.c      |  4 ++--
 ctables/skiplists/jsw_rand.c | 26 +++++++++++++-------------
 5 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ctables/ctable_batch.c b/ctables/ctable_batch.c
index 3e5c7343..3b1d7802 100644
--- a/ctables/ctable_batch.c
+++ b/ctables/ctable_batch.c
@@ -21,7 +21,7 @@
 //
 static int
 ctable_RunBatch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *tableCmdObj, Tcl_Obj *batchListObj) {
-    int          listObjc;
+    Tcl_Size     listObjc;
     Tcl_Obj    **listObjv;
 
     int          i;
@@ -45,7 +45,7 @@ ctable_RunBatch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *tableCmdObj, Tcl_O
     }
 
     for (i = 0; i < listObjc; i++) {
-        int          cmdObjc;
+        Tcl_Size     cmdObjc;
         Tcl_Obj    **cmdObjv;
 
 	Tcl_Obj     *batchCmdObj;
diff --git a/ctables/ctable_search.c b/ctables/ctable_search.c
index 35206f56..ce28c58d 100644
--- a/ctables/ctable_search.c
+++ b/ctables/ctable_search.c
@@ -114,7 +114,7 @@ ctable_verify (Tcl_Interp *interp, CTable *ctable, int verbose) {
  */
 CTABLE_INTERNAL int
 ctable_ParseFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, const char **fieldNames, int **fieldListPtr, int *fieldCountPtr) {
-    int             nFields;
+    Tcl_Size        nFields;
     Tcl_Obj       **fieldsObjv;
     int             i;
     int            *fieldList;
@@ -157,7 +157,7 @@ ctable_ParseFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, const char **f
 //
 CTABLE_INTERNAL int
 ctable_ParseSortFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, const char **fieldNames, CTableSort *sort) {
-    int             nFields;
+    Tcl_Size             nFields;
     Tcl_Obj       **fieldsObjv;
     Tcl_Obj        *fieldNameObj;
     int             i;
@@ -321,10 +321,10 @@ static int
 ctable_ParseSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *componentListObj, const char **fieldNames, CTableSearch *search) {
     Tcl_Obj    **componentList;
     int          componentIdx;
-    int          componentListCount;
+    Tcl_Size     componentListCount;
 
     Tcl_Obj    **termList;
-    int          termListCount;
+    Tcl_Size     termListCount;
 
     int          field;
 
@@ -444,12 +444,12 @@ ctable_ParseSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *componentListOb
 
 		if (sm->type == CTABLE_STRING_MATCH_UNANCHORED) {
 		    char *needle;
-		    int len;
+		    Tcl_Size len;
 
 		    needle = Tcl_GetStringFromObj (termList[2], &len);
 		    boyer_moore_setup (sm, (unsigned char *)needle + 1, len - 2, sm->nocase);
 		} else if(sm->type == CTABLE_STRING_MATCH_ANCHORED && term == CTABLE_COMP_MATCH_CASE) {
-		    int len;
+		    Tcl_Size len;
 		    char *needle = Tcl_GetStringFromObj (termList[2], &len);
 		    char *prefix = (char *) ckalloc(len+1);
 		    int i;
@@ -510,7 +510,7 @@ ctable_ParseSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *componentListOb
 static int
 ctable_ParseFilters (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *filterListObj, CTableSearch *search) {
     Tcl_Obj               **filterList;
-    int                     filterListCount;
+    Tcl_Size                filterListCount;
 
     CTableSearchFilter     *filters = NULL;
 
@@ -537,7 +537,7 @@ ctable_ParseFilters (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *filterListObj,
     // step through list, looking for filter names and filling in the structs
     for (i = 0; i < filterListCount; i++) {
         Tcl_Obj    **termList;
-        int          termListCount;
+        Tcl_Size     termListCount;
         int item;
 
         if (Tcl_ListObjGetElements (interp, filterList[i], &termListCount, &termList) == TCL_ERROR || termListCount != 2) {
@@ -848,7 +848,7 @@ ctable_PerformTransaction (Tcl_Interp *interp, CTable *ctable, CTableSearch *sea
 
     if(search->tranType == CTABLE_SEARCH_TRAN_UPDATE) {
 
-	int objc;
+	Tcl_Size objc;
 	Tcl_Obj **objv;
 	int *updateFields;
 
@@ -1327,7 +1327,7 @@ ctable_PerformSearch (Tcl_Interp *interp, CTable *ctable, CTableSearch *search)
     int			   inIndex = 0;
     Tcl_Obj		 **inListObj = NULL;
     ctable_BaseRow	 **inListRows = NULL;
-    int			   inCount = 0;
+    Tcl_Size		   inCount = 0;
 
     int			   canUseHash = 1;
 
@@ -2021,7 +2021,7 @@ ctable_SetupSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *const objv[], i
 
     static const char *searchOptions[] = {"-array", "-array_with_nulls", "-array_get", "-array_get_with_nulls", "-code", "-compare", "-countOnly", "-fields", "-get", "-glob", "-key", "-with_field_names", "-limit", "-nokeys", "-offset", "-sort", "-write_tabsep", "-tab", "-delete", "-update", "-buffer", "-index", "-poll_code", "-poll_interval", "-quote", "-null", "-filter", "-cursor", (char *)NULL};
 
-    enum searchOptions {SEARCH_OPT_ARRAY_NAMEOBJ, SEARCH_OPT_ARRAYWITHNULLS_NAMEOBJ, SEARCH_OPT_ARRAYGET_NAMEOBJ, SEARCH_OPT_ARRAYGETWITHNULLS_NAMEOBJ, SEARCH_OPT_CODE, SEARCH_OPT_COMPARE, SEARCH_OPT_COUNTONLY, SEARCH_OPT_FIELDS, SEARCH_OPT_GET_NAMEOBJ, SEARCH_OPT_GLOB, SEARCH_OPT_KEYVAR_NAMEOBJ, SEARCH_OPT_WITH_FIELD_NAMES, SEARCH_OPT_LIMIT, SEARCH_OPT_DONT_INCLUDE_KEY, SEARCH_OPT_OFFSET, SEARCH_OPT_SORT, SEARCH_OPT_WRITE_TABSEP, SEARCH_OPT_TAB, SEARCH_OPT_DELETE, SEARCH_OPT_UPDATE, SEARCH_OPT_BUFFER, SEARCH_OPT_INDEX, SEARCH_OPT_POLL_CODE, SEARCH_OPT_POLL_INTERVAL, SEARCH_OPT_QUOTE_TYPE, SEARCH_OPT_NULL_STRING, SEARCH_OPT_FILTER, SEARCH_OPT_CURSOR};
+    enum searchOptions_e {SEARCH_OPT_ARRAY_NAMEOBJ, SEARCH_OPT_ARRAYWITHNULLS_NAMEOBJ, SEARCH_OPT_ARRAYGET_NAMEOBJ, SEARCH_OPT_ARRAYGETWITHNULLS_NAMEOBJ, SEARCH_OPT_CODE, SEARCH_OPT_COMPARE, SEARCH_OPT_COUNTONLY, SEARCH_OPT_FIELDS, SEARCH_OPT_GET_NAMEOBJ, SEARCH_OPT_GLOB, SEARCH_OPT_KEYVAR_NAMEOBJ, SEARCH_OPT_WITH_FIELD_NAMES, SEARCH_OPT_LIMIT, SEARCH_OPT_DONT_INCLUDE_KEY, SEARCH_OPT_OFFSET, SEARCH_OPT_SORT, SEARCH_OPT_WRITE_TABSEP, SEARCH_OPT_TAB, SEARCH_OPT_DELETE, SEARCH_OPT_UPDATE, SEARCH_OPT_BUFFER, SEARCH_OPT_INDEX, SEARCH_OPT_POLL_CODE, SEARCH_OPT_POLL_INTERVAL, SEARCH_OPT_QUOTE_TYPE, SEARCH_OPT_NULL_STRING, SEARCH_OPT_FILTER, SEARCH_OPT_CURSOR};
     if (objc < 2) {
       wrong_args:
 	Tcl_WrongNumArgs (interp, 2, objv, "?-array_get varName? ?-array_get_with_nulls varName? ?-code codeBody? ?-compare list? ?-filter list? ?-countOnly 0|1? ?-fields fieldList? ?-get varName? ?-glob pattern? ?-key varName? ?-with_field_names 0|1?  ?-limit limit? ?-nokeys 0|1? ?-offset offset? ?-sort {?-?field1..}? ?-write_tabsep channel? ?-tab value? ?-delete 0|1? ?-update {fields value...}? ?-buffer 0|1? ?-poll_interval interval? ?-poll_code codeBody? ?-quote type?");
@@ -2406,7 +2406,7 @@ ctable_SetupSearch (Tcl_Interp *interp, CTable *ctable, Tcl_Obj *const objv[], i
 
 	    if (strcmp (cursorName, "#auto") == 0) {
 		char *tableName = NULL;
-		int tableNameLength;
+		Tcl_Size tableNameLength;
 		static unsigned long int auto_cursor_id = 0;
 
 		// use command name of the ctable as the base of the cursor name
diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index d16c9a3a..d07d88f2 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -4560,7 +4560,7 @@ proc gen_field_names {} {
     emit "// define the null value object"
     emit "static Tcl_Obj *${table}_NullValueObj;"
     emit "static char *${table}_NullValueString;"
-    emit "static int ${table}_NullValueSize;"
+    emit "static Tcl_Size ${table}_NullValueSize;"
     emit ""
 
     set nullableList {}
diff --git a/ctables/shared/shared.c b/ctables/shared/shared.c
index 7eb4a5c5..4b48e415 100644
--- a/ctables/shared/shared.c
+++ b/ctables/shared/shared.c
@@ -834,12 +834,12 @@ int doDetach(Tcl_Interp *interp, shm_t *share)
 
 int shareCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 {
-    int          cmdIndex  = -1;
+    Tcl_Size     cmdIndex  = -1;
     char        *sharename = NULL;
     shm_t       *share     = NULL;
 
     static const char *commands[] = {"create", "attach", "list", "detach", "names", "get", "multiget", "set", "info", "free", (char *)NULL};
-    enum commands {CMD_CREATE, CMD_ATTACH, CMD_LIST, CMD_DETACH, CMD_NAMES, CMD_GET, CMD_MULTIGET, CMD_SET, CMD_INFO, CMD_FREE };
+    enum commands_e {CMD_CREATE, CMD_ATTACH, CMD_LIST, CMD_DETACH, CMD_NAMES, CMD_GET, CMD_MULTIGET, CMD_SET, CMD_INFO, CMD_FREE };
 
     static const struct {
         int need_share;         // if a missing share is an error
diff --git a/ctables/skiplists/jsw_rand.c b/ctables/skiplists/jsw_rand.c
index 9a72d4f0..739a5e91 100644
--- a/ctables/skiplists/jsw_rand.c
+++ b/ctables/skiplists/jsw_rand.c
@@ -11,20 +11,20 @@
 #define L 0x7fffffffUL
 
 /* Internal state */
-static unsigned long x[N];
-static int next;
+static unsigned long jsw_x[N];
+static int jsw_next = 0;
 
 /* Initialize internal state */
 void jsw_seed ( unsigned long s )
 {
   int i;
 
-  x[0] = s & 0xffffffffUL;
+  jsw_x[0] = s & 0xffffffffUL;
 
   for ( i = 1; i < N; i++ ) {
-    x[i] = ( 1812433253UL 
-      * ( x[i - 1] ^ ( x[i - 1] >> 30 ) ) + i );
-    x[i] &= 0xffffffffUL;
+    jsw_x[i] = ( 1812433253UL 
+      * ( jsw_x[i - 1] ^ ( jsw_x[i - 1] >> 30 ) ) + i );
+    jsw_x[i] &= 0xffffffffUL;
   }
 }
 
@@ -36,21 +36,21 @@ unsigned long jsw_rand ( void )
   int i;
 
   /* Refill x if exhausted */
-  if ( next == N ) {
-    next = 0;
+  if ( jsw_next == N ) {
+    jsw_next = 0;
 
     for ( i = 0; i < N - 1; i++ ) {
-      y = ( x[i] & U ) | (x[i + 1] & L);
+      y = ( jsw_x[i] & U ) | (jsw_x[i + 1] & L);
       a = ( y & 0x1UL ) ? A : 0x0UL;
-      x[i] = x[( i + M ) % N] ^ ( y >> 1 ) ^ a;
+      jsw_x[i] = jsw_x[( i + M ) % N] ^ ( y >> 1 ) ^ a;
     }
 
-    y = ( x[N - 1] & U ) | (x[0] & L);
+    y = ( jsw_x[N - 1] & U ) | (jsw_x[0] & L);
     a = ( y & 0x1UL ) ? A : 0x0UL;
-    x[N - 1] = x[M - 1] ^ ( y >> 1 ) ^ a;
+    jsw_x[N - 1] = jsw_x[M - 1] ^ ( y >> 1 ) ^ a;
   }
 
-  y = x[next++];
+  y = jsw_x[jsw_next++];
 
   /* Improve distribution */
   y ^= (y >> 11);

From 4876ed2953f44260dd5a64307f465063df172373 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 16:04:21 +0000
Subject: [PATCH 12/36] Declare get_string in ctable_CreatorTable correctly.
 Add some case lint fixing.

---
 ctables/ctable.h        | 2 +-
 ctables/shared/shared.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ctables/ctable.h b/ctables/ctable.h
index d2db9616..f4db3b3d 100644
--- a/ctables/ctable.h
+++ b/ctables/ctable.h
@@ -482,7 +482,7 @@ struct ctable_CreatorTable {
     int (*set_null) (Tcl_Interp *interp, struct CTable *ctable, ctable_BaseRow *row, int field, int indexCtl);
 
     Tcl_Obj *(*get) (Tcl_Interp *interp, ctable_BaseRow *row, int field);
-    const char *(*get_string) (const ctable_BaseRow *pointer, int field, int *lengthPtr, Tcl_Obj *utilityObj);
+    const char *(*get_string) (const ctable_BaseRow *pointer, int field, Tcl_Size *lengthPtr, Tcl_Obj *utilityObj);
 
     Tcl_Obj *(*gen_list) (Tcl_Interp *interp, ctable_BaseRow *pointer);
     Tcl_Obj *(*gen_keyvalue_list) (Tcl_Interp *interp, ctable_BaseRow *pointer);
diff --git a/ctables/shared/shared.c b/ctables/shared/shared.c
index 4b48e415..a7c66cc2 100644
--- a/ctables/shared/shared.c
+++ b/ctables/shared/shared.c
@@ -666,8 +666,8 @@ int parse_size(const char *s, size_t *ptr)
         s++;
     }
     switch(toupper((unsigned char)*s)) {
-        case 'G': size *= 1024;
-        case 'M': size *= 1024;
+        case 'G': size *= 1024; // fallthrough
+        case 'M': size *= 1024; // fallthrough
         case 'K': size *= 1024;
             s++;
     }

From d4a05234d35126d521267363bd39e71e6df8a5f1 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 16:20:12 +0000
Subject: [PATCH 13/36] Change all enum names to foo_e from foo. Mark another
 fallthrough. Fix more Tcl_Size cases. Change some variable names to avoid
 bogus masking messages.

---
 ctables/command-body.c-subst | 24 ++++++++++++------------
 ctables/ctable_search.c      |  2 +-
 ctables/template.c-subst     | 34 +++++++++++++++++-----------------
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ctables/command-body.c-subst b/ctables/command-body.c-subst
index 62dcf70a..a244e063 100644
--- a/ctables/command-body.c-subst
+++ b/ctables/command-body.c-subst
@@ -153,25 +153,25 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 
     static const char *options[] = {"get", "set", "store", "incr", "array_get", "array_get_with_nulls", "exists", "delete", "count", "batch", "search", "search+", "type", "import_postgres_result", "import_cassandra_future", "fields", "field", "fieldtype", "needs_quoting", "names", "reset", "destroy", "statistics", "read_tabsep", "write_tabsep", "index", "foreach", "key", "makekey", "methods", "attach", "getprop", "share", "null", "isnull", "verify", "performance_callback", "clean", "cursors", (char *)NULL};
 
-    enum options {OPT_GET, OPT_SET, OPT_STORE, OPT_INCR, OPT_ARRAY_GET, OPT_ARRAY_GET_WITH_NULLS, OPT_EXISTS, OPT_DELETE, OPT_COUNT, OPT_BATCH, OPT_SEARCH, OPT_SEARCHPLUS, OPT_TYPE, OPT_IMPORT_POSTGRES_RESULT, OPT_IMPORT_CASSANDRA_FUTURE, OPT_FIELDS, OPT_FIELD, OPT_FIELDTYPE, OPT_NEEDSQUOTING, OPT_NAMES, OPT_RESET, OPT_DESTROY, OPT_STATISTICS, OPT_READ_TABSEP, OPT_WRITE_TABSEP, OPT_INDEX, OPT_FOREACH, OPT_KEY, OPT_MAKEKEY, OPT_METHODS, OPT_ATTACH, OPT_GETPROP, OPT_SHARE, OPT_NULL, OPT_ISNULL, OPT_VERIFY, OPT_PERFORMANCE_CALLBACK, OPT_CLEAN, OPT_CURSORS, NUM_OPTIONS
+    enum options_e {OPT_GET, OPT_SET, OPT_STORE, OPT_INCR, OPT_ARRAY_GET, OPT_ARRAY_GET_WITH_NULLS, OPT_EXISTS, OPT_DELETE, OPT_COUNT, OPT_BATCH, OPT_SEARCH, OPT_SEARCHPLUS, OPT_TYPE, OPT_IMPORT_POSTGRES_RESULT, OPT_IMPORT_CASSANDRA_FUTURE, OPT_FIELDS, OPT_FIELD, OPT_FIELDTYPE, OPT_NEEDSQUOTING, OPT_NAMES, OPT_RESET, OPT_DESTROY, OPT_STATISTICS, OPT_READ_TABSEP, OPT_WRITE_TABSEP, OPT_INDEX, OPT_FOREACH, OPT_KEY, OPT_MAKEKEY, OPT_METHODS, OPT_ATTACH, OPT_GETPROP, OPT_SHARE, OPT_NULL, OPT_ISNULL, OPT_VERIFY, OPT_PERFORMANCE_CALLBACK, OPT_CLEAN, OPT_CURSORS, NUM_OPTIONS
 		};
 
 #ifdef WITH_SHARED_TABLES
     // Options allowed in shared tables
-    static enum options shared_options[] = { OPT_METHODS, OPT_DESTROY, OPT_NEEDSQUOTING, OPT_FIELDTYPE, OPT_FIELD, OPT_FIELDS, OPT_TYPE, OPT_SEARCHPLUS, OPT_SEARCH, OPT_GETPROP, OPT_SHARE, OPT_PERFORMANCE_CALLBACK, OPT_CURSORS, NUM_OPTIONS };
+    static enum options_e shared_options[] = { OPT_METHODS, OPT_DESTROY, OPT_NEEDSQUOTING, OPT_FIELDTYPE, OPT_FIELD, OPT_FIELDS, OPT_TYPE, OPT_SEARCHPLUS, OPT_SEARCH, OPT_GETPROP, OPT_SHARE, OPT_PERFORMANCE_CALLBACK, OPT_CURSORS, NUM_OPTIONS };
     static int shared_ok[NUM_OPTIONS] = {-1};
 
     // Read_only options
-    static enum options readonly_options[] = { OPT_GET, OPT_ARRAY_GET, OPT_ARRAY_GET_WITH_NULLS, OPT_EXISTS, OPT_COUNT, OPT_SEARCH, OPT_SEARCHPLUS, OPT_TYPE, OPT_FIELDS, OPT_FIELD, OPT_FIELDTYPE, OPT_NEEDSQUOTING, OPT_NAMES, OPT_STATISTICS, OPT_WRITE_TABSEP, OPT_FOREACH, OPT_KEY, OPT_MAKEKEY, OPT_METHODS, OPT_GETPROP, OPT_CURSORS, NUM_OPTIONS };
+    static enum options_e readonly_options[] = { OPT_GET, OPT_ARRAY_GET, OPT_ARRAY_GET_WITH_NULLS, OPT_EXISTS, OPT_COUNT, OPT_SEARCH, OPT_SEARCHPLUS, OPT_TYPE, OPT_FIELDS, OPT_FIELD, OPT_FIELDTYPE, OPT_NEEDSQUOTING, OPT_NAMES, OPT_STATISTICS, OPT_WRITE_TABSEP, OPT_FOREACH, OPT_KEY, OPT_MAKEKEY, OPT_METHODS, OPT_GETPROP, OPT_CURSORS, NUM_OPTIONS };
     static int readonly[NUM_OPTIONS] = {-1};
 
     // Memory_allocating options - except for "index create" which
     // has to be checked for explicitly.
-    static enum options shmcheck_options[] = {OPT_SET, OPT_STORE, OPT_INCR, OPT_BATCH, OPT_SEARCH, OPT_SEARCHPLUS, OPT_IMPORT_POSTGRES_RESULT, OPT_IMPORT_CASSANDRA_FUTURE, OPT_WRITE_TABSEP, NUM_OPTIONS };
+    static enum options_e shmcheck_options[] = {OPT_SET, OPT_STORE, OPT_INCR, OPT_BATCH, OPT_SEARCH, OPT_SEARCHPLUS, OPT_IMPORT_POSTGRES_RESULT, OPT_IMPORT_CASSANDRA_FUTURE, OPT_WRITE_TABSEP, NUM_OPTIONS };
     static int shmcheck[NUM_OPTIONS] = {-1};
 #endif
 
-    static enum options cursor_safe_options[] = { OPT_GET, OPT_ARRAY_GET, OPT_ARRAY_GET_WITH_NULLS, OPT_EXISTS, OPT_COUNT, OPT_SEARCH, OPT_SEARCHPLUS, OPT_TYPE, OPT_FIELDS, OPT_FIELD, OPT_FIELDTYPE, OPT_NEEDSQUOTING, OPT_NAMES, OPT_STATISTICS, OPT_WRITE_TABSEP, OPT_FOREACH, OPT_KEY, OPT_MAKEKEY, OPT_METHODS, OPT_GETPROP, OPT_CURSORS, NUM_OPTIONS };
+    static enum options_e cursor_safe_options[] = { OPT_GET, OPT_ARRAY_GET, OPT_ARRAY_GET_WITH_NULLS, OPT_EXISTS, OPT_COUNT, OPT_SEARCH, OPT_SEARCHPLUS, OPT_TYPE, OPT_FIELDS, OPT_FIELD, OPT_FIELDTYPE, OPT_NEEDSQUOTING, OPT_NAMES, OPT_STATISTICS, OPT_WRITE_TABSEP, OPT_FOREACH, OPT_KEY, OPT_MAKEKEY, OPT_METHODS, OPT_GETPROP, OPT_CURSORS, NUM_OPTIONS };
     static int cursor_ok[NUM_OPTIONS] = {-1};
 
     // First time through, make it a bitmap.
@@ -283,7 +283,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
     }
 #endif
 
-    switch ((enum options) optIndex) {
+    switch ((enum options_e) optIndex) {
       case NUM_OPTIONS: { // Can't happen!
 	  Tcl_AppendResult (interp, "Can't happen.", (char *)NULL);
 	  return TCL_ERROR;
@@ -399,7 +399,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
         ctable_FieldInfo        *f;
       Tcl_Obj                   *resultObj = Tcl_GetObjResult (interp);
 
-	enum suboptions {SUBOPT_GETPROP, SUBOPT_PROPERTIES, SUBOPT_PROPLIST};
+	enum suboptions_e {SUBOPT_GETPROP, SUBOPT_PROPERTIES, SUBOPT_PROPLIST};
 
 	if ((objc < 4) || (objc > 5)) {
 	    Tcl_WrongNumArgs (interp, 2, objv, "fieldName opt ?arg?");
@@ -700,7 +700,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
       case OPT_MAKEKEY:
       case OPT_STORE: {
         int            i;
-	int            listObjc;
+	Tcl_Size       listObjc;
 	Tcl_Obj      **listObjv;
 	char	      *key;
         Tcl_Obj       *keyObj;
@@ -849,7 +849,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 
       case OPT_INCR: {
         int       i;
-	int       listObjc;
+	Tcl_Size  listObjc;
 	Tcl_Obj **listObjv;
 
 	if ((objc < 3) || ((objc != 4) && (objc % 2) != 1)) {
@@ -1673,7 +1673,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 	int                suboptIndex;
 	int                fieldNum;
 
-	enum suboptions {SUBOPT_SPAN, SUBOPT_COUNT, SUBOPT_CREATE, SUBOPT_DROP, SUBOPT_INDEXABLE, SUBOPT_INDEXED, SUBOPT_UNIQUE, SUBOPT_LIST, SUBOPT_DUMP};
+	enum suboptions_e {SUBOPT_SPAN, SUBOPT_COUNT, SUBOPT_CREATE, SUBOPT_DROP, SUBOPT_INDEXABLE, SUBOPT_INDEXED, SUBOPT_UNIQUE, SUBOPT_LIST, SUBOPT_DUMP};
 
 	if (objc < 3) {
 	    Tcl_WrongNumArgs (interp, 2, objv, "option ?args?");
@@ -2164,7 +2164,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct cursor *cursor, Tcl_Obj *const objv[], int objc)
 {
     static const char *cursorCommands[] = { "destroy", "reset", "next", "index", "get", "set", "array_get", "array_get_with_nulls", "delete", "count", "at_end", "key", NULL };
-    enum cursorCommands { CURSOR_DESTROY, CURSOR_RESET, CURSOR_NEXT, CURSOR_INDEX, CURSOR_GET, CURSOR_SET, CURSOR_ARRAY_GET, CURSOR_ARRAY_GET_WITH_NULLS, CURSOR_DELETE, CURSOR_COUNT, CURSOR_AT_END, CURSOR_KEY, NUM_CURSOR_COMMANDS };
+    enum cursorCommands_e { CURSOR_DESTROY, CURSOR_RESET, CURSOR_NEXT, CURSOR_INDEX, CURSOR_GET, CURSOR_SET, CURSOR_ARRAY_GET, CURSOR_ARRAY_GET_WITH_NULLS, CURSOR_DELETE, CURSOR_COUNT, CURSOR_AT_END, CURSOR_KEY, NUM_CURSOR_COMMANDS };
     int command_id = 0;
 
     if (Tcl_GetIndexFromObj (interp, objv[0], cursorCommands, "cursor command", TCL_EXACT, &command_id) != TCL_OK) {
@@ -2243,7 +2243,7 @@ int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct curso
 
 	case CURSOR_SET: {
 	    int              i;
-	    int              listObjc;
+	    Tcl_Size         listObjc;
 	    Tcl_Obj        **listObjv;
 	    struct ${table} *row = (struct ${table} *)cursor->tranTable[cursor->tranIndex];
 	    int              nocomplain = 0;
diff --git a/ctables/ctable_search.c b/ctables/ctable_search.c
index ce28c58d..fa7fd44f 100644
--- a/ctables/ctable_search.c
+++ b/ctables/ctable_search.c
@@ -737,7 +737,7 @@ ctable_SearchAction (Tcl_Interp *interp, CTable *ctable, CTableSearch *search, c
 	  case TCL_OK:
 	  case TCL_CONTINUE:
 	  case TCL_BREAK:
-	    Tcl_ResetResult(interp);
+	    Tcl_ResetResult(interp); // fallthrough
 	  case TCL_RETURN:
 	    return evalResult;
 	}
diff --git a/ctables/template.c-subst b/ctables/template.c-subst
index b0c25953..f1a90992 100644
--- a/ctables/template.c-subst
+++ b/ctables/template.c-subst
@@ -30,7 +30,7 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 	(char *)NULL
     };
 
-    enum options
+    enum options_e
     {
         OPT_CREATE, OPT_INFO, OPT_NULLVALUE, OPT_METHOD, OPT_PACKAGE,
 	OPT_INSTANCES
@@ -39,7 +39,7 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 #ifdef WITH_SHARED_TABLES
     static const char *types[] = { "master", "reader", (char *)NULL };
 
-    enum types { CREATE_MASTER, CREATE_READER };
+    enum types_e { CREATE_MASTER, CREATE_READER };
 
     static int share_types[] = { CTABLE_SHARED_MASTER, CTABLE_SHARED_READER };
 #endif
@@ -60,11 +60,10 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 	    return TCL_ERROR;
     }
 
-    switch ((enum options) optIndex) {
+    switch ((enum options_e) optIndex) {
 
         case OPT_CREATE: {
-	    int			 i;
-	    int			 baseNameLength = 0;
+	    Tcl_Size			 baseNameLength = 0;
 	    char		*commandName;
 #ifdef WITH_SHARED_TABLES
 	    int			 typeIndex = -1;
@@ -104,7 +103,7 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 	    if(!share_name) share_name = commandName;
 
 	    if (objc >= 5) {
-		int	  i;
+		int	  k;
 	        int	  listObjc;
 	        Tcl_Obj **listObjv;
 
@@ -130,26 +129,26 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 		}
 
 		// Pull meaningful keys out of key-value list.
-		for(i = 0; i < listObjc; i+=2) {
-		    char *key = Tcl_GetString(listObjv[i]);
+		for(k = 0; k < listObjc; k+=2) {
+		    char *key = Tcl_GetString(listObjv[k]);
 
 		    if(strcmp(key, "file") == 0)
-			share_file = Tcl_GetString(listObjv[i+1]);
+			share_file = Tcl_GetString(listObjv[k+1]);
 		    else if(strcmp(key, "name") == 0)
-			share_name = Tcl_GetString(listObjv[i+1]);
+			share_name = Tcl_GetString(listObjv[k+1]);
 		    else if(strcmp(key, "size") == 0)
-			raw_size = Tcl_GetString(listObjv[i+1]);
+			raw_size = Tcl_GetString(listObjv[k+1]);
 		    else if(strcmp(key, "minfree") == 0)
-			raw_min_free = Tcl_GetString(listObjv[i+1]);
+			raw_min_free = Tcl_GetString(listObjv[k+1]);
 		    else if(strcmp(key, "flags") == 0)
-			share_flags = parse_flags(Tcl_GetString(listObjv[i+1]));
+			share_flags = parse_flags(Tcl_GetString(listObjv[k+1]));
 		    else if(strcmp(key, "panic") == 0) {
-			if (Tcl_GetBooleanFromObj (interp, listObjv[i+1], &share_panic) == TCL_ERROR) {
+			if (Tcl_GetBooleanFromObj (interp, listObjv[k+1], &share_panic) == TCL_ERROR) {
 			    Tcl_AppendResult(interp, ", getting 'panic' flag", NULL);
 			    goto createError;
 			}
 		    } else if(strcmp(key, "pid") == 0) {
-			if (Tcl_GetIntFromObj (interp, listObjv[i+1], &pid) == TCL_ERROR) {
+			if (Tcl_GetIntFromObj (interp, listObjv[k+1], &pid) == TCL_ERROR) {
 			    Tcl_AppendResult(interp, ", getting 'pid' value", NULL);
 			    goto createError;
 			}
@@ -300,6 +299,7 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 		ctable->ll_head = ctable->share_ctable->ll_head;
 		ctable->keyTablePtr = NULL;
 	    } else {
+                int l;
 	        if(share_type == CTABLE_SHARED_MASTER) {
 	            // Allocate, and initialize nullKeyValue
 	            ctable->nullKeyValue = (char *)shmalloc (share, sizeof "");
@@ -322,8 +322,8 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 #endif
 		    ctable->skipLists = (jsw_skip_t **)ckalloc (creator->nFields * sizeof (jsw_skip_t *));
 
-	        for (i = 0; i < creator->nFields; i++) {
-		    ctable->skipLists[i] = NULL;
+	        for (l = 0; l < creator->nFields; l++) {
+		    ctable->skipLists[l] = NULL;
 	        }
 
 	        // create an array of pointers to possible linked lists,

From 4ae9e146fd21c4fe02006a029309947655904ea7 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 16:38:35 +0000
Subject: [PATCH 14/36] More enum tag updates, and another Tcl_Size missed

---
 ctables/command-body.c-subst | 2 +-
 ctables/init-exten.c-subst   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ctables/command-body.c-subst b/ctables/command-body.c-subst
index a244e063..2bc8afa1 100644
--- a/ctables/command-body.c-subst
+++ b/ctables/command-body.c-subst
@@ -785,7 +785,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 
       case OPT_SET: {
         int            i;
-	int            listObjc;
+	Tcl_Size       listObjc;
 	Tcl_Obj      **listObjv;
 	Tcl_Obj       *keyObj = objv[2];
 	int	       nocomplain = 0;
diff --git a/ctables/init-exten.c-subst b/ctables/init-exten.c-subst
index 4fc10793..60437d66 100644
--- a/ctables/init-exten.c-subst
+++ b/ctables/init-exten.c-subst
@@ -23,7 +23,7 @@ cExtensionObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *c
         "definition", "builder_version", "tables", (char *)NULL
     };
  
-    enum options
+    enum options_e
     {
         OPT_DEFINITION, OPT_VERSION, OPT_TABLES
     };
@@ -37,7 +37,7 @@ cExtensionObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *c
         return TCL_ERROR;
     }
 
-    switch ((enum options) optIndex) {
+    switch ((enum options_e) optIndex) {
 	case OPT_DEFINITION: {
 	    Tcl_SetStringObj (Tcl_GetObjResult (interp), sourceCode, -1);
 	    break;

From 384bc8292d85c8b070d5d4d7a82e9e4051543faf Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 16:42:38 +0000
Subject: [PATCH 15/36] Another Tcl_Size

---
 ctables/template.c-subst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/template.c-subst b/ctables/template.c-subst
index f1a90992..235a8ac7 100644
--- a/ctables/template.c-subst
+++ b/ctables/template.c-subst
@@ -104,7 +104,7 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
 
 	    if (objc >= 5) {
 		int	  k;
-	        int	  listObjc;
+	        Tcl_Size  listObjc;
 	        Tcl_Obj **listObjv;
 
 		if(Tcl_GetIndexFromObj(interp, objv[3], types, "type", TCL_EXACT, &typeIndex) != TCL_OK)

From e4fa1a87706dd96c7124f61fae535d7531be75d9 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 16:51:52 +0000
Subject: [PATCH 16/36] Another Tcl_Size! OMG!

---
 ctables/gentable.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index d07d88f2..db005e8b 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -2117,7 +2117,7 @@ ${table}_import_tabsep (Tcl_Interp *interp, CTable *ctable, const char *channelN
 
 //${table}_dumpFieldNums(fieldNums, nFields, "after key check");
     if(withNulls && !nullString) {
-	int nullLen;
+	Tcl_Size nullLen;
 
 	nullString = Tcl_GetStringFromObj (${table}_NullValueObj, &nullLen);
     }

From 9e215d5e80ce92997e16083cb1fa570e5c035c94 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 17:05:34 +0000
Subject: [PATCH 17/36] Bang! Another Tcl_Size!

---
 ctables/gentable.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index db005e8b..66c9b0c4 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -1725,7 +1725,7 @@ void
 ${table}_dstring_append_get_tabsep (const char *key, ctable_BaseRow *vPointer, int *fieldNums, int nFields, Tcl_DString *dsPtr, int noKeys, const char *sepstr, int quoteType, const char *nullString) {
     int              i;
     const char      *string;
-    int              nChars;
+    Tcl_Size         nChars;
     Tcl_Obj         *utilityObj = Tcl_NewObj();
     struct $table *row = (struct $table *) vPointer;
 

From f184b80a945ced47cfa90abff15aaafef3fcea59 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 17:16:08 +0000
Subject: [PATCH 18/36] Further down the rabbit hole.

---
 ctables/ctable_io.c  | 4 ++--
 ctables/gentable.tcl | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ctables/ctable_io.c b/ctables/ctable_io.c
index 75781515..a2c9d071 100644
--- a/ctables/ctable_io.c
+++ b/ctables/ctable_io.c
@@ -8,11 +8,11 @@
 // string was modified and needs to be freed.
 //
 CTABLE_INTERNAL int
-ctable_quoteString(const char **stringPtr, int *stringLengthPtr, int quoteType, const char *quotedChars)
+ctable_quoteString(const char **stringPtr, Tcl_Size *stringLengthPtr, int quoteType, const char *quotedChars)
 {
     int          i, j = 0;
     const char  *string = *stringPtr;
-    int          length = (stringLengthPtr ? *stringLengthPtr : strlen(string));
+    Tcl_Size     length = (stringLengthPtr ? *stringLengthPtr : strlen(string));
     char        *newptr = NULL;
     int		 quoteChar = '\0'; // no quote by default
     int		 maxExpansion = 4; // worst possible worst case
diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index 66c9b0c4..48902b0b 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -1691,7 +1691,7 @@ ${table}_get_string (const ctable_BaseRow *vPointer, int field, Tcl_Size *length
     Tcl_Size length;
     const struct $table *row = (const struct $table*) vPointer;
 
-    if (lengthPtr == (int *) NULL) {
+    if (lengthPtr == (Tcl_Size *) NULL) {
         lengthPtr = &length;
     }
 

From 2ca46cde65ff56466fe39a44813a6dd71c6418d2 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 17:27:07 +0000
Subject: [PATCH 19/36] inCount needs to be Tcl_Size

---
 ctables/gentable.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index 48902b0b..028b84a1 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -3023,7 +3023,7 @@ proc gen_delete_subr {subr struct} {
 variable isNullSubrSource {
 int ${table}_obj_is_null(Tcl_Obj *obj) {
     char     *objString;
-    int       objStringLength;
+    Tcl_Size  objStringLength;
 
      objString = Tcl_GetStringFromObj (obj, &objStringLength);
 

From 24743af819b9ec70d6ec2f07bcf6f7c929ac6a4d Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 17:34:25 +0000
Subject: [PATCH 20/36] AA different inCount.

---
 ctables/ctable.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/ctable.h b/ctables/ctable.h
index f4db3b3d..91da15d1 100644
--- a/ctables/ctable.h
+++ b/ctables/ctable.h
@@ -323,7 +323,7 @@ struct CTableSearchComponent {
     fieldCompareFunction_t   compareFunction;
     Tcl_Obj                **inListObj;
     ctable_BaseRow	   **inListRows;
-    int                      inCount;
+    Tcl_Size                 inCount;
     int                      fieldID;
     int                      comparisonType;
 };

From 5f7ee2828b756e12aa880ec620321f53584ac87d Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 18:14:02 +0000
Subject: [PATCH 21/36] Change name of sub-rows to avoid masking warning.

---
 ctables/command-body.c-subst | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/ctables/command-body.c-subst b/ctables/command-body.c-subst
index 2bc8afa1..4ff38eaf 100644
--- a/ctables/command-body.c-subst
+++ b/ctables/command-body.c-subst
@@ -1965,15 +1965,15 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
       case OPT_NULL: {
 	int            i;
 	int            field;
-        struct $table *row;
+        struct $table *found;
 
 	if (objc < 3) {
 	    Tcl_WrongNumArgs (interp, 2, objv, "key ?field...?");
 	    return TCL_ERROR;
 	}
 
-	row = (${table}*) ${table}_find (ctable, Tcl_GetString (objv[2]));
-	if (row == NULL) {
+	found = (${table}*) ${table}_find (ctable, Tcl_GetString (objv[2]));
+	if (found == NULL) {
 	    Tcl_AppendResult (interp, "no such key");
 	    return TCL_ERROR;
 	}
@@ -1982,7 +1982,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 	    Tcl_Obj *result = Tcl_NewObj();
 
 	    for(i = 0; i < $nFields; i++) {
-		if(${table}_is_null(row, i)) {
+		if(${table}_is_null(found, i)) {
 		    if(Tcl_ListObjAppendElement(interp, result, ${table}_NameObjList[i]) == TCL_ERROR) {
 			return TCL_ERROR;
 		    }
@@ -1997,7 +1997,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 	    if (Tcl_GetIndexFromObj (interp, objv[i], ${table}_fields, "field", TCL_EXACT, &field) != TCL_OK) {
 		return TCL_ERROR;
 	    }
-	    if(${table}_set_null(interp, ctable, row, field, CTABLE_INDEX_NORMAL) != TCL_OK) {
+	    if(${table}_set_null(interp, ctable, found, field, CTABLE_INDEX_NORMAL) != TCL_OK) {
 		return TCL_ERROR;
 	    }
 	}
@@ -2007,7 +2007,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
       case OPT_ISNULL: {
 	int            i;
 	int            field;
-        struct $table *row;
+        struct $table *found;
 	Tcl_Obj       *result = Tcl_NewObj();
 
 	if (objc < 4) {
@@ -2015,8 +2015,8 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 	    return TCL_ERROR;
 	}
 
-	row = (${table}*) ${table}_find (ctable, Tcl_GetString (objv[2]));
-	if (row == NULL) {
+	found = (${table}*) ${table}_find (ctable, Tcl_GetString (objv[2]));
+	if (found == NULL) {
 	    Tcl_AppendResult (interp, "no such key");
 	    return TCL_ERROR;
 	}
@@ -2025,7 +2025,7 @@ int ${table}ObjCmd (ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *con
 	    if (Tcl_GetIndexFromObj (interp, objv[i], ${table}_fields, "field", TCL_EXACT, &field) != TCL_OK) {
 		return TCL_ERROR;
 	    }
-	    if(Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(${table}_is_null(row, field))) != TCL_OK) {
+	    if(Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(${table}_is_null(found, field))) != TCL_OK) {
 		return TCL_ERROR;
 	    }
 	}
@@ -2245,7 +2245,7 @@ int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct curso
 	    int              i;
 	    Tcl_Size         listObjc;
 	    Tcl_Obj        **listObjv;
-	    struct ${table} *row = (struct ${table} *)cursor->tranTable[cursor->tranIndex];
+	    struct ${table} *cursor_row = (struct ${table} *)cursor->tranTable[cursor->tranIndex];
 	    int              nocomplain = 0;
 
 	    if(cursor->tranIndex >= cursor->offsetLimit) {
@@ -2308,7 +2308,7 @@ int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct curso
 	    }
 
 	    for (i = 0; i < listObjc; i+= 2) {
-		if (${table}_set_fieldobj (interp, ctable, listObjv[i+1], row, listObjv[i], CTABLE_INDEX_NORMAL, nocomplain) == TCL_ERROR) {
+		if (${table}_set_fieldobj (interp, ctable, listObjv[i+1], cursor_row, listObjv[i], CTABLE_INDEX_NORMAL, nocomplain) == TCL_ERROR) {
 		    Tcl_AppendResult (interp, " while processing key-value list", (char *)NULL);
 		    return TCL_ERROR;
 		}
@@ -2365,8 +2365,8 @@ int ${table}CursorCommandCommon(Tcl_Interp *interp, CTable *ctable, struct curso
 	    if(cursor->tranIndex >= cursor->offsetLimit) {
 		goto past_end_of_search;
 	    }
-	    struct ctable_BaseRow *row = cursor->tranTable[cursor->tranIndex];
-	    Tcl_SetObjResult (interp, Tcl_NewStringObj(row->hashEntry.key, -1));
+	    struct ctable_BaseRow *cursor_row = cursor->tranTable[cursor->tranIndex];
+	    Tcl_SetObjResult (interp, Tcl_NewStringObj(cursor_row->hashEntry.key, -1));
 	    return TCL_OK;
 	}
 

From b56e4870892a8921449c2b0c8d70c1c12ea6b7ae Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 18:25:49 +0000
Subject: [PATCH 22/36] Probe

---
 ctables/tests/speedtable.tcl | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ctables/tests/speedtable.tcl b/ctables/tests/speedtable.tcl
index bc815af2..eb2232d2 100644
--- a/ctables/tests/speedtable.tcl
+++ b/ctables/tests/speedtable.tcl
@@ -4,6 +4,10 @@
 
 source test_common.tcl
 
+set ::ctable::showCompilerCommands 1
+set ::ctable::errorDebug 1
+
+
 speedtables Topbrands 1.0 {
 
 table top_brands {
@@ -14,6 +18,12 @@ table top_brands {
 
 }
 
+puts "BEGIN DEBUG OUTPUT"
+if {[catch {puts [exec du -a .]} err]} {
+	puts "du error: $err"
+}
+puts "END DEBUG OUTPUT"
+
 package require Topbrands
 
 top_brands create t

From af6165de2311d91aacf68f3b8c27a115e37b6d8a Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 18:48:19 +0000
Subject: [PATCH 23/36] Do some ifdef shenanigans to figure out TCL required
 version.

---
 ctables/init-exten.c-subst | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/ctables/init-exten.c-subst b/ctables/init-exten.c-subst
index 60437d66..1142919d 100644
--- a/ctables/init-exten.c-subst
+++ b/ctables/init-exten.c-subst
@@ -102,6 +102,16 @@ ${extension}_SafeInit(Tcl_Interp *interp)
  *----------------------------------------------------------------------
  */
 
+#if TCL_MAJOR_VERSION == 8
+# define REQUIRED_VERSION "8.1"
+#else
+# if TCL_MAJOR_VERSION == 9
+#  define REQUIRED_VERSION "9.0"
+# else
+#  define REQUIRED_VERSION TCL_VERSION
+# endif
+#endif
+
 CTABLE_EXTERNAL int CTABLE_EXTERNAL2
 ${extension}_Init(Tcl_Interp *interp)
 {
@@ -114,7 +124,7 @@ ${extension}_Init(Tcl_Interp *interp)
      * This may work with 8.0, but we are using strictly stubs here,
      * which requires 8.1.
      */
-    if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
+    if (Tcl_InitStubs(interp, "8.1-", 0) == NULL) {
 	return TCL_ERROR;
     }
 
@@ -123,7 +133,7 @@ ${extension}_Init(Tcl_Interp *interp)
     Tcl_InitMemory(interp);
 #endif
 
-    if (Tcl_PkgRequire(interp, "Tcl", "8.1", 0) == NULL) {
+    if (Tcl_PkgRequire(interp, "Tcl", REQUIRED_VERSION, 0) == NULL) {
 	return TCL_ERROR;
     }
 

From e217df68ef490fa3d295810740502335987206e2 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 19:09:51 +0000
Subject: [PATCH 24/36] Back out debug output.

---
 ctables/tests/speedtable.tcl | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/ctables/tests/speedtable.tcl b/ctables/tests/speedtable.tcl
index eb2232d2..f68b76d6 100644
--- a/ctables/tests/speedtable.tcl
+++ b/ctables/tests/speedtable.tcl
@@ -7,7 +7,6 @@ source test_common.tcl
 set ::ctable::showCompilerCommands 1
 set ::ctable::errorDebug 1
 
-
 speedtables Topbrands 1.0 {
 
 table top_brands {
@@ -18,12 +17,6 @@ table top_brands {
 
 }
 
-puts "BEGIN DEBUG OUTPUT"
-if {[catch {puts [exec du -a .]} err]} {
-	puts "du error: $err"
-}
-puts "END DEBUG OUTPUT"
-
 package require Topbrands
 
 top_brands create t

From 25afe0f200d86481f8d29409dd096125b940f779 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 19:17:53 +0000
Subject: [PATCH 25/36] Don't depend on random global behaviour, put suffix in
 a test namespace.

---
 ctables/tests/master.tcl               |  4 +++-
 ctables/tests/master2.tcl              |  4 +++-
 ctables/tests/master_prebuild.tcl      |  5 +++--
 ctables/tests/master_server.tcl        |  4 +++-
 ctables/tests/masterspeed.tcl          |  4 +++-
 ctables/tests/multimaster.tcl          |  4 +++-
 ctables/tests/multireader.tcl          |  4 +++-
 ctables/tests/multitable.ct            | 16 +++++++++-------
 ctables/tests/poolspeed.tcl            |  4 +++-
 ctables/tests/reader.tcl               |  5 ++++-
 ctables/tests/readerperf.tcl           |  5 ++++-
 ctables/tests/shutdown_master.tcl      |  5 ++++-
 ctables/tests/top-brands-nokey-def.tcl | 14 ++++++++------
 13 files changed, 53 insertions(+), 25 deletions(-)

diff --git a/ctables/tests/master.tcl b/ctables/tests/master.tcl
index 1c9f373d..8a7e57cc 100644
--- a/ctables/tests/master.tcl
+++ b/ctables/tests/master.tcl
@@ -4,7 +4,9 @@
 
 source test_common.tcl
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 
 source top-brands-nokey-def.tcl
 
diff --git a/ctables/tests/master2.tcl b/ctables/tests/master2.tcl
index ea8163cb..7297237c 100644
--- a/ctables/tests/master2.tcl
+++ b/ctables/tests/master2.tcl
@@ -8,7 +8,9 @@ source test_common.tcl
 
 package require ctable_server
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 
 source top-brands-nokey-def.tcl
 
diff --git a/ctables/tests/master_prebuild.tcl b/ctables/tests/master_prebuild.tcl
index 2ffb6d27..42f36e4a 100644
--- a/ctables/tests/master_prebuild.tcl
+++ b/ctables/tests/master_prebuild.tcl
@@ -4,10 +4,11 @@
 
 package require ctable_server
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 
 source top-brands-nokey-def.tcl
 
-
 top_brands_nokey_m create m master file sharefile.dat
 
diff --git a/ctables/tests/master_server.tcl b/ctables/tests/master_server.tcl
index a81f6632..969754b6 100644
--- a/ctables/tests/master_server.tcl
+++ b/ctables/tests/master_server.tcl
@@ -4,7 +4,9 @@
 
 package require ctable_server
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 
 source top-brands-nokey-def.tcl
 
diff --git a/ctables/tests/masterspeed.tcl b/ctables/tests/masterspeed.tcl
index 013dac77..1f4db0e5 100644
--- a/ctables/tests/masterspeed.tcl
+++ b/ctables/tests/masterspeed.tcl
@@ -6,7 +6,9 @@ source test_common.tcl
 
 package require ctable_server
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 
 source top-brands-nokey-def.tcl
 
diff --git a/ctables/tests/multimaster.tcl b/ctables/tests/multimaster.tcl
index a42b5df9..72faffd3 100644
--- a/ctables/tests/multimaster.tcl
+++ b/ctables/tests/multimaster.tcl
@@ -4,7 +4,9 @@
 
 source test_common.tcl
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 set nametags {indexed 1}
 
 source multitable.ct
diff --git a/ctables/tests/multireader.tcl b/ctables/tests/multireader.tcl
index 39eefe09..8d5aab00 100644
--- a/ctables/tests/multireader.tcl
+++ b/ctables/tests/multireader.tcl
@@ -4,7 +4,9 @@
 
 package require ctable_client
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 set verbose 0
 
 source top-brands-nokey-def.tcl
diff --git a/ctables/tests/multitable.ct b/ctables/tests/multitable.ct
index 639fe393..a35d69df 100644
--- a/ctables/tests/multitable.ct
+++ b/ctables/tests/multitable.ct
@@ -4,27 +4,29 @@
 
 package require ctable
 
-if {![info exists suffix]} {
-	set suffix ""
+namespace eval ::ctable_test {
+	if {![info exists suffix]} {
+		set suffix ""
+	}
 }
 
 if {![info exists nametags]} {
 	set nametags [list]
 }
 
-CExtension multi$suffix 1.0 {
+CExtension multi$::ctable_test::suffix 1.0 {
 
-CTable nameval$suffix {
+CTable nameval$::ctable_test::suffix {
     varstring name {*}$nametags
     varstring value
 }
 
-CTable elements$suffix {
+CTable elements$::ctable_test::suffix {
     varstring name {*}$nametags
     varstring symbol
 }
 
-CTable anim_characters$suffix {
+CTable anim_characters$::ctable_test::suffix {
     varstring id indexed 1 unique 1 notnull 1
     varstring name indexed 1 unique 1
     varstring home indexed 1 unique 0
@@ -49,6 +51,6 @@ CTable albums {
 
 }
 
-package require Multi$suffix
+package require Multi$::ctable_test::suffix
 package require Multitoo
 
diff --git a/ctables/tests/poolspeed.tcl b/ctables/tests/poolspeed.tcl
index 87bf0f31..73fb8d27 100644
--- a/ctables/tests/poolspeed.tcl
+++ b/ctables/tests/poolspeed.tcl
@@ -6,7 +6,9 @@ source test_common.tcl
 
 package require ctable_server
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
 
 source top-brands-nokey-def.tcl
 
diff --git a/ctables/tests/reader.tcl b/ctables/tests/reader.tcl
index c14b69b6..75c4d8f6 100644
--- a/ctables/tests/reader.tcl
+++ b/ctables/tests/reader.tcl
@@ -4,7 +4,10 @@
 
 package require ctable_client
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
+
 set verbose 0
 
 source top-brands-nokey-def.tcl
diff --git a/ctables/tests/readerperf.tcl b/ctables/tests/readerperf.tcl
index 8c67b63e..64e12c19 100644
--- a/ctables/tests/readerperf.tcl
+++ b/ctables/tests/readerperf.tcl
@@ -4,7 +4,10 @@
 
 package require ctable_client
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
+
 set verbose 0
 
 source top-brands-nokey-def.tcl
diff --git a/ctables/tests/shutdown_master.tcl b/ctables/tests/shutdown_master.tcl
index be8712f3..f7fac7b1 100644
--- a/ctables/tests/shutdown_master.tcl
+++ b/ctables/tests/shutdown_master.tcl
@@ -6,7 +6,10 @@
 
 package require ctable_client
 
-set suffix _m
+namespace eval ::ctable_test {
+    set suffix _m
+}
+
 set verbose 0
 
 source top-brands-nokey-def.tcl
diff --git a/ctables/tests/top-brands-nokey-def.tcl b/ctables/tests/top-brands-nokey-def.tcl
index 9a1a361d..1e10be61 100644
--- a/ctables/tests/top-brands-nokey-def.tcl
+++ b/ctables/tests/top-brands-nokey-def.tcl
@@ -8,13 +8,15 @@ package require ctable
 
 #CTableBuildPath /tmp
 
-if {![info exists suffix]} {
-    set suffix ""
+namespace eval ::ctable_test {
+    if {![info exists suffix]} {
+	set suffix ""
+    }
 }
 
-CExtension topbrandsnokey$suffix 1.0 {
+CExtension topbrandsnokey$::ctable_test::suffix 1.0 {
 
-CTable top_brands_nokey$suffix {
+CTable top_brands_nokey$::ctable_test::suffix {
     varstring id indexed 1
     int rank indexed 1
     varstring name indexed 1
@@ -23,6 +25,6 @@ CTable top_brands_nokey$suffix {
 
 }
 
-package require Topbrandsnokey$suffix
+package require Topbrandsnokey$::ctable_test::suffix
 
-top_brands_nokey$suffix create t
+top_brands_nokey$::ctable_test::suffix create t

From f81be5a5b22c4f7e789d649c33ad763e3b94862d Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 19:26:56 +0000
Subject: [PATCH 26/36] Move more stuff into the safety of a namespace.

---
 ctables/tests/multimaster.tcl |  2 +-
 ctables/tests/multitable.ct   | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/ctables/tests/multimaster.tcl b/ctables/tests/multimaster.tcl
index 72faffd3..2cdf8a70 100644
--- a/ctables/tests/multimaster.tcl
+++ b/ctables/tests/multimaster.tcl
@@ -6,8 +6,8 @@ source test_common.tcl
 
 namespace eval ::ctable_test {
     set suffix _m
+    set nametags {indexed 1}
 }
-set nametags {indexed 1}
 
 source multitable.ct
 
diff --git a/ctables/tests/multitable.ct b/ctables/tests/multitable.ct
index a35d69df..4f3bf6db 100644
--- a/ctables/tests/multitable.ct
+++ b/ctables/tests/multitable.ct
@@ -8,21 +8,20 @@ namespace eval ::ctable_test {
 	if {![info exists suffix]} {
 		set suffix ""
 	}
-}
-
-if {![info exists nametags]} {
-	set nametags [list]
+	if {![info exists nametags]} {
+		set nametags [list]
+	}
 }
 
 CExtension multi$::ctable_test::suffix 1.0 {
 
 CTable nameval$::ctable_test::suffix {
-    varstring name {*}$nametags
+    varstring name {*}$::ctable_test::nametags
     varstring value
 }
 
 CTable elements$::ctable_test::suffix {
-    varstring name {*}$nametags
+    varstring name {*}$::ctable_test::nametags
     varstring symbol
 }
 

From 6a546051ccbc5a90adc4fd8f3982f67bdf171a87 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 19:34:55 +0000
Subject: [PATCH 27/36] Whakcamole another Tcl_Size in a test even.

---
 ctables/gentable.tcl     | 4 ++--
 ctables/tests/filter.tcl | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ctables/gentable.tcl b/ctables/gentable.tcl
index 028b84a1..14607178 100644
--- a/ctables/gentable.tcl
+++ b/ctables/gentable.tcl
@@ -2397,7 +2397,7 @@ proc gen_filters {} {
 		validate_arg_name $listName
 
 		emit "    Tcl_Obj **$listName;"
-		emit "    int       $listCount;\n"
+		emit "    Tcl_Size  $listCount;\n"
 		emit "    if(Tcl_ListObjGetElements(interp, filter, &$listCount, &$listName) != TCL_OK)"
 		emit "        return TCL_ERROR;"
 
@@ -2416,7 +2416,7 @@ proc gen_filters {} {
 		    gen_get_filter_arg [lindex $filter(args) 0] [lindex $filter(args) 1] filter
 	        } else {
 		    emit "        Tcl_Obj **filterList;"
-        	    emit "        int       filterCount;\n"
+		    emit "        Tcl_Size  filterCount;\n"
         	    emit "        if (Tcl_ListObjGetElements(interp, filter, &filterCount, &filterList) != TCL_OK)"
           	    emit "             return TCL_ERROR;\n"
 		    set argNames ""
diff --git a/ctables/tests/filter.tcl b/ctables/tests/filter.tcl
index 54dd3478..416c005c 100644
--- a/ctables/tests/filter.tcl
+++ b/ctables/tests/filter.tcl
@@ -36,7 +36,7 @@ CExtension Filtertest 1.0 {
       // Only parse target information if the search ID changes.
       if(sequence != lastSequence) {
         Tcl_Obj **filterList;
-        int       filterCount;
+        Tcl_Size  filterCount;
         if(Tcl_ListObjGetElements(interp, filter, &filterCount, &filterList) != TCL_OK)
 	  return TCL_ERROR;
         if(filterCount != 3) {

From 5db1773a40c43928f3967a50ac787ab80650ea7a Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 19:44:55 +0000
Subject: [PATCH 28/36] Show errors.

---
 ctables/tests/master_server.tcl        | 4 +++-
 ctables/tests/top-brands-nokey-def.tcl | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ctables/tests/master_server.tcl b/ctables/tests/master_server.tcl
index 969754b6..3054f874 100644
--- a/ctables/tests/master_server.tcl
+++ b/ctables/tests/master_server.tcl
@@ -8,8 +8,10 @@ namespace eval ::ctable_test {
     set suffix _m
 }
 
-source top-brands-nokey-def.tcl
+set ::ctable::showCompilerCommands 1
+set ::ctable::errorDebug 1
 
+source top-brands-nokey-def.tcl
 
 top_brands_nokey_m create m master file sharefile.dat
 puts "m share info -> [m share info]"
diff --git a/ctables/tests/top-brands-nokey-def.tcl b/ctables/tests/top-brands-nokey-def.tcl
index 1e10be61..c4b8c6d4 100644
--- a/ctables/tests/top-brands-nokey-def.tcl
+++ b/ctables/tests/top-brands-nokey-def.tcl
@@ -8,6 +8,9 @@ package require ctable
 
 #CTableBuildPath /tmp
 
+set ::ctable::showCompilerCommands 1
+set ::ctable::errorDebug 1
+
 namespace eval ::ctable_test {
     if {![info exists suffix]} {
 	set suffix ""

From 47802309490e86028df1969d38c832657b92abf4 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 20:02:58 +0000
Subject: [PATCH 29/36] Push tcl version up to tests.

---
 ctables/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ctables/Makefile.in b/ctables/Makefile.in
index 7dc96d92..051ad2c5 100755
--- a/ctables/Makefile.in
+++ b/ctables/Makefile.in
@@ -120,6 +120,7 @@ STLIB_LD	= @STLIB_LD@
 TCL_DEFS	= @TCL_DEFS@
 TCL_BIN_DIR	= @TCL_BIN_DIR@
 TCL_SRC_DIR	= @TCL_SRC_DIR@
+TCL_VERSION     = @TCL_VERSION@
 # This is necessary for packages that use private Tcl headers
 #TCL_TOP_DIR_NATIVE	= @TCL_TOP_DIR_NATIVE@
 # Not used, but retained for reference of what libs Tcl required
@@ -229,7 +230,7 @@ install-doc: doc
 #	done
 
 test: binaries libraries
-	cd $(srcdir)/tests && $(MAKE)
+	cd $(srcdir)/tests && $(MAKE) -DTCL_VERSION=$(TCL_VERSION)
 
 # various convenience targets to run test cases defined in the tests subdirectory.
 compare searchget null indef master speed pools reader stapi stapi2 stapi3 filter filter2 multireader speedreader readerperf tclobj barnrow gbarnrow:

From fc3649731fe4d3e72bb00d0e473c0ce45c052b54 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 20:08:07 +0000
Subject: [PATCH 30/36] Fix make syntax

---
 ctables/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/Makefile.in b/ctables/Makefile.in
index 051ad2c5..e01969c2 100755
--- a/ctables/Makefile.in
+++ b/ctables/Makefile.in
@@ -230,7 +230,7 @@ install-doc: doc
 #	done
 
 test: binaries libraries
-	cd $(srcdir)/tests && $(MAKE) -DTCL_VERSION=$(TCL_VERSION)
+	cd $(srcdir)/tests && $(MAKE) TCL_VERSION=$(TCL_VERSION)
 
 # various convenience targets to run test cases defined in the tests subdirectory.
 compare searchget null indef master speed pools reader stapi stapi2 stapi3 filter filter2 multireader speedreader readerperf tclobj barnrow gbarnrow:

From 84f855c9efc59eda9a4dd95cc4582ce3bc88b463 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 20:32:56 +0000
Subject: [PATCH 31/36] Set TCLVER from $(TCL_VERSION)

---
 ctables/Makefile.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ctables/Makefile.in b/ctables/Makefile.in
index e01969c2..b1d0c803 100755
--- a/ctables/Makefile.in
+++ b/ctables/Makefile.in
@@ -229,9 +229,12 @@ install-doc: doc
 #	    $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
 #	done
 
-test: binaries libraries
+test: sysconfig.sh binaries libraries
 	cd $(srcdir)/tests && $(MAKE) TCL_VERSION=$(TCL_VERSION)
 
+sysconfig.sh:
+	sed -i "/TCLVER/s/.*/TCLVER=$(TCL_VERSION)" sysconfig.sh
+
 # various convenience targets to run test cases defined in the tests subdirectory.
 compare searchget null indef master speed pools reader stapi stapi2 stapi3 filter filter2 multireader speedreader readerperf tclobj barnrow gbarnrow:
 	cd $(srcdir)/tests && $(MAKE) $@

From 699d27f43328b685728a77664bcbb64c0a1ba76b Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 20:44:37 +0000
Subject: [PATCH 32/36] Turn on command logging

---
 ctables/tests/master+reader.sh | 4 +++-
 ctables/tests/multimaster.sh   | 4 +++-
 ctables/tests/multireader.sh   | 4 +++-
 ctables/tests/readerperf.sh    | 4 +++-
 ctables/tests/stapi.sh         | 4 +++-
 5 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ctables/tests/master+reader.sh b/ctables/tests/master+reader.sh
index 322ef9d3..91d64355 100755
--- a/ctables/tests/master+reader.sh
+++ b/ctables/tests/master+reader.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
-#$Id$
+
+echo "Starting master+reader.sh"
+set -x
 
 . ./test_common.sh
 
diff --git a/ctables/tests/multimaster.sh b/ctables/tests/multimaster.sh
index 1e49008c..9787c273 100755
--- a/ctables/tests/multimaster.sh
+++ b/ctables/tests/multimaster.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
-#$Id$
+
+echo "Starting multimaster.sh"
+set -x
 
 . ./test_common.sh
 
diff --git a/ctables/tests/multireader.sh b/ctables/tests/multireader.sh
index 9842fb8a..bda1b586 100644
--- a/ctables/tests/multireader.sh
+++ b/ctables/tests/multireader.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
-#$Id$
+
+echo "Starting multireader.sh"
+set -x
 
 . ./test_common.sh
 
diff --git a/ctables/tests/readerperf.sh b/ctables/tests/readerperf.sh
index 02339f93..a2516501 100644
--- a/ctables/tests/readerperf.sh
+++ b/ctables/tests/readerperf.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
-#$Id$
+
+echo "Starting readerperf.sh"
+set -x
 
 . test_common.sh
 
diff --git a/ctables/tests/stapi.sh b/ctables/tests/stapi.sh
index 34025635..7575222f 100644
--- a/ctables/tests/stapi.sh
+++ b/ctables/tests/stapi.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
-#$Id$
+
+echo "Starting stapi.sh"
+set -x
 
 . ./test_common.sh
 

From 9179c96f7a6a4e704bb04f12713d8e56bbe764cb Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 20:59:36 +0000
Subject: [PATCH 33/36] Debugging and set up to get rid of that sysconfig.sh
 kludge

---
 ctables/Makefile.in       | 5 +++--
 ctables/tests/Makefile.in | 9 ++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ctables/Makefile.in b/ctables/Makefile.in
index b1d0c803..85808f0c 100755
--- a/ctables/Makefile.in
+++ b/ctables/Makefile.in
@@ -230,10 +230,11 @@ install-doc: doc
 #	done
 
 test: sysconfig.sh binaries libraries
-	cd $(srcdir)/tests && $(MAKE) TCL_VERSION=$(TCL_VERSION)
+	cd $(srcdir)/tests && $(MAKE)
 
 sysconfig.sh:
-	sed -i "/TCLVER/s/.*/TCLVER=$(TCL_VERSION)" sysconfig.sh
+	echo "@ SETTING TCLVER TO $(TCL_VERSION)"
+	echo "TCLVER=$(TCL_VERSION)" > sysconfig.sh
 
 # various convenience targets to run test cases defined in the tests subdirectory.
 compare searchget null indef master speed pools reader stapi stapi2 stapi3 filter filter2 multireader speedreader readerperf tclobj barnrow gbarnrow:
diff --git a/ctables/tests/Makefile.in b/ctables/tests/Makefile.in
index 3393dcc4..bbc21187 100644
--- a/ctables/tests/Makefile.in
+++ b/ctables/tests/Makefile.in
@@ -1,14 +1,14 @@
 #
 # run some tests
 #
-# $Id$
-#
 
 # default 
+TCL_VERSION     = @TCL_VERSION@
 TCLSH_ENV       = TCL_LIBRARY=`@CYGPATH@ @TCL_SRC_DIR@/library` \
                   @LD_LIBRARY_PATH_VAR@="@TCL_BIN_DIR@:$(@LD_LIBRARY_PATH_VAR@)" \
                   PATH="@TCL_BIN_DIR@:$(PATH)" \
-                  TCLLIBPATH=".."
+                  TCLLIBPATH=".." \
+                  TCL_VERSION="@TCL_VERSION@"
 TCLSH_PROG      = @TCLSH_PROG@
 TCLSH           = $(TCLSH_ENV) $(TCLSH_PROG)
 TCLSHM          = $(TCLSH)
@@ -24,6 +24,9 @@ TCLSHM          = $(TCLSH)
 all: maintests macip allstapi corrupt
 
 maintests:
+	@echo "ENVIRONMENT"
+	cat Makefile
+	$(TCLSH_ENV) env
 	rm -rf stobj
 	$(TCLSH) speedtable.tcl
 	$(TCLSH) serious-tests.tcl

From 8433292b531cc202249522a11a132bfab125ed2b Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 21:11:49 +0000
Subject: [PATCH 34/36] BRUTE FORCE

---
 ctables/tests/test_common.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ctables/tests/test_common.sh b/ctables/tests/test_common.sh
index 8b65d60b..1cdca961 100644
--- a/ctables/tests/test_common.sh
+++ b/ctables/tests/test_common.sh
@@ -4,6 +4,13 @@
 #
 
 . ../sysconfig.sh
+
+# override sysconfig.sh from environment
+if test ! -z "$TCL_VERSION"
+then
+  export TCLVER=$TCL_VERSION;;
+fi
+
 P=`cd ../..; pwd`
 export TCLLIBPATH="$P/ctables $P/ctable_server $P/stapi"
 

From 1790b78083e1d76b94ba4a5d8904693736755d52 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 21:19:41 +0000
Subject: [PATCH 35/36] Typo

---
 ctables/tests/test_common.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctables/tests/test_common.sh b/ctables/tests/test_common.sh
index 1cdca961..6c7ff083 100644
--- a/ctables/tests/test_common.sh
+++ b/ctables/tests/test_common.sh
@@ -8,7 +8,7 @@
 # override sysconfig.sh from environment
 if test ! -z "$TCL_VERSION"
 then
-  export TCLVER=$TCL_VERSION;;
+  export TCLVER=$TCL_VERSION
 fi
 
 P=`cd ../..; pwd`

From 7fcf2c0f2ff29ad0a56e90bcfdc4bfd03a397055 Mon Sep 17 00:00:00 2001
From: Peter da Silva 
Date: Thu, 8 Oct 2026 21:33:06 +0000
Subject: [PATCH 36/36] The [censored] scripts were ignoring the environment.

---
 ctables/Makefile.in       |  7 ++-----
 ctables/tests/Makefile.in | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/ctables/Makefile.in b/ctables/Makefile.in
index 85808f0c..8f0d2a70 100755
--- a/ctables/Makefile.in
+++ b/ctables/Makefile.in
@@ -229,12 +229,9 @@ install-doc: doc
 #	    $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
 #	done
 
-test: sysconfig.sh binaries libraries
-	cd $(srcdir)/tests && $(MAKE)
-
-sysconfig.sh:
-	echo "@ SETTING TCLVER TO $(TCL_VERSION)"
+test: binaries libraries
 	echo "TCLVER=$(TCL_VERSION)" > sysconfig.sh
+	cd $(srcdir)/tests && $(MAKE)
 
 # various convenience targets to run test cases defined in the tests subdirectory.
 compare searchget null indef master speed pools reader stapi stapi2 stapi3 filter filter2 multireader speedreader readerperf tclobj barnrow gbarnrow:
diff --git a/ctables/tests/Makefile.in b/ctables/tests/Makefile.in
index bbc21187..34a25509 100644
--- a/ctables/tests/Makefile.in
+++ b/ctables/tests/Makefile.in
@@ -109,25 +109,25 @@ allstapi: stapi multishared stapireturn stapicursors
 reader:
 	rm -rf stobj
 	rm -f *.dat
-	sh master+reader.sh
+	$(TCLSH_ENV) sh master+reader.sh
 	rm -f *.dat
 
 stapi:
 	rm -rf stobj
 	rm -f *.dat
-	sh stapi.sh
+	$(TCLSH_ENV) sh stapi.sh
 	rm -f *.dat
 
 stapi2:
 	rm -rf stobj
 	rm -f *.dat
-	sh stapi.sh -d 100 -c 40 -s stapi2.tcl
+	$(TCLSH_ENV) sh stapi.sh -d 100 -c 40 -s stapi2.tcl
 	rm -f *.dat
 
 stapi3:
 	rm -rf stobj
 	rm -f *.dat
-	sh stapi.sh -d 1 -c 40 -s stapi3.tcl
+	$(TCLSH_ENV) sh stapi.sh -d 1 -c 40 -s stapi3.tcl
 	rm -f *.dat
 
 filter:
@@ -139,24 +139,24 @@ filter2:
 	$(TCLSH) filter2.tcl
 
 multishared:
-	sh multimaster.sh
+	$(TCLSH_ENV) sh multimaster.sh
 
 multireader:
 	rm -rf stobj
 	rm -f *.dat
-	sh multireader.sh
+	$(TCLSH_ENV) sh multireader.sh
 	rm -f *.dat
 
 speedreader:
 	rm -rf stobj
 	rm -f *.dat
-	sh multireader.sh 1 1000000 5 10
+	$(TCLSH_ENV) sh multireader.sh 1 1000000 5 10
 	rm -f *.dat
 
 readerperf:
 	rm -rf stobj
 	rm -f *.dat
-	sh readerperf.sh
+	$(TCLSH_ENV) sh readerperf.sh
 	rm -f *.dat
 
 tclobj:
@@ -180,9 +180,9 @@ matchfail:
 stapireturn:
 	rm -rf stobj
 	rm -f *.dat
-	sh stapi.sh -s stapireturn.tcl
+	$(TCLSH_ENV) sh stapi.sh -s stapireturn.tcl
 
 stapicursors:
 	rm -rf stobj
 	rm -f *.dat
-	sh stapi.sh -s stapicursors.tcl
+	$(TCLSH_ENV) sh stapi.sh -s stapicursors.tcl