diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-tcl8-build-install-test.yaml similarity index 86% rename from .github/workflows/linux-ci.yml rename to .github/workflows/linux-tcl8-build-install-test.yaml index f1d3956d..19a94956 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: @@ -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/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 diff --git a/.github/workflows/mac-ci.yml b/.github/workflows/mac-ci.yml deleted file mode 100644 index 8afdbe58..00000000 --- a/.github/workflows/mac-ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Mac CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - 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 - - name: configure - run: | - autoreconf -vi - ./configure --with-tcl=/usr/local/opt/tcl-tk/lib --prefix=/usr/local - - name: make - run: make - - name: install - run: sudo make install diff --git a/.github/workflows/mac-tcl8-build-install.yaml b/.github/workflows/mac-tcl8-build-install.yaml new file mode 100644 index 00000000..9ad5bc33 --- /dev/null +++ b/.github/workflows/mac-tcl8-build-install.yaml @@ -0,0 +1,34 @@ +name: Mac tcl8 build-install + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + set -x + brew update + brew reinstall tcl-tk@8 + brew install autoconf + brew install automake + brew install boost boost-build + - name: configure + run: | + autoreconf -vi + 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 + run: sudo make install diff --git a/ctables/Makefile.in b/ctables/Makefile.in index 7dc96d92..8f0d2a70 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,6 +230,7 @@ install-doc: doc # done 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. diff --git a/ctables/command-body.c-subst b/ctables/command-body.c-subst index 855fb3cc..4ff38eaf 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,27 +151,27 @@ 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 + 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; @@ -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,14 +392,14 @@ 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; 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?"); @@ -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) { @@ -700,13 +700,13 @@ 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; 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]); @@ -785,11 +785,11 @@ 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; - Tcl_Obj *CONST*origObjv = objv; + Tcl_Obj *const *origObjv = objv; while (objc > 3) { char *option = Tcl_GetString (objv[3]); @@ -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)) { @@ -1669,11 +1669,11 @@ 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; - 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?"); @@ -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; } } @@ -2161,10 +2161,10 @@ 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 }; - 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 }; + static const char *cursorCommands[] = { "destroy", "reset", "next", "index", "get", "set", "array_get", "array_get_with_nulls", "delete", "count", "at_end", "key", NULL }; + 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,9 +2243,9 @@ 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]; + 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; } @@ -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/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 { 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 868a2836..91da15d1 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" @@ -321,7 +323,7 @@ struct CTableSearchComponent { fieldCompareFunction_t compareFunction; Tcl_Obj **inListObj; ctable_BaseRow **inListRows; - int inCount; + Tcl_Size inCount; int fieldID; int comparisonType; }; @@ -402,7 +404,7 @@ struct CTableSearch { Tcl_Channel tabsepChannel; int writingTabsepIncludeFieldNames; - CONST char *sepstr; + const char *sepstr; // count of matches during a search int matchCount; @@ -437,9 +439,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 +456,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 +471,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, 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); @@ -488,7 +490,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 +500,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_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_io.c b/ctables/ctable_io.c index e87a0e21..a2c9d071 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, Tcl_Size *stringLengthPtr, int quoteType, const char *quotedChars) { int i, j = 0; - CONST char *string = *stringPtr; - int length = (stringLengthPtr ? *stringLengthPtr : strlen(string)); + const char *string = *stringPtr; + Tcl_Size 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..fa7fd44f 100644 --- a/ctables/ctable_search.c +++ b/ctables/ctable_search.c @@ -113,8 +113,8 @@ 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; +ctable_ParseFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, const char **fieldNames, int **fieldListPtr, int *fieldCountPtr) { + Tcl_Size nFields; Tcl_Obj **fieldsObjv; int i; int *fieldList; @@ -156,8 +156,8 @@ 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; +ctable_ParseSortFieldList (Tcl_Interp *interp, Tcl_Obj *fieldListObj, const char **fieldNames, CTableSort *sort) { + Tcl_Size nFields; Tcl_Obj **fieldsObjv; Tcl_Obj *fieldNameObj; int i; @@ -318,20 +318,20 @@ 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; + Tcl_Size componentListCount; Tcl_Obj **termList; - int termListCount; + Tcl_Size termListCount; int field; 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; @@ -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) { @@ -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; } @@ -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; @@ -2011,17 +2011,17 @@ 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}; + 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 @@ -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 @@
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..14607178 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) {
@@ -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 "
@@ -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++) {
@@ -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) {
@@ -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);
@@ -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;
@@ -1686,12 +1686,12 @@ ${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;
+const char *
+${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) {
+ if (lengthPtr == (Tcl_Size *) NULL) {
lengthPtr = &length;
}
@@ -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,10 +1722,10 @@ 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;
- int nChars;
+ const char *string;
+ Tcl_Size 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;
@@ -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);
}
@@ -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 ""
@@ -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\","
}
@@ -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);
@@ -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;
@@ -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],"
}
@@ -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 {}
@@ -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 ""
@@ -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
@@ -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..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:
@@ -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 */
@@ -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;
@@ -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. */
{
@@ -544,11 +544,11 @@ 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;
- 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);
@@ -591,9 +591,9 @@ 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;
+ const char *string = (const char *) keyPtr;
unsigned int result;
int c;
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/init-exten.c-subst b/ctables/init-exten.c-subst
index f9035264..1142919d 100644
--- a/ctables/init-exten.c-subst
+++ b/ctables/init-exten.c-subst
@@ -15,15 +15,15 @@ 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
};
- 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;
@@ -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;
}
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;
diff --git a/ctables/shared/shared.c b/ctables/shared/shared.c
index 7bae6ea0..a7c66cc2 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;
@@ -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++;
}
@@ -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;
+ 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 };
+ static const char *commands[] = {"create", "attach", "list", "detach", "names", "get", "multiget", "set", "info", "free", (char *)NULL};
+ 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 {
+ 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/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);
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
diff --git a/ctables/template.c-subst b/ctables/template.c-subst
index 3e045b07..235a8ac7 100644
--- a/ctables/template.c-subst
+++ b/ctables/template.c-subst
@@ -21,16 +21,16 @@
*/
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
};
- 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,8 +103,8 @@ ${table}MetaObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj
if(!share_name) share_name = commandName;
if (objc >= 5) {
- int i;
- int listObjc;
+ int k;
+ Tcl_Size listObjc;
Tcl_Obj **listObjv;
if(Tcl_GetIndexFromObj(interp, objv[3], types, "type", TCL_EXACT, &typeIndex) != TCL_OK)
@@ -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,
diff --git a/ctables/tests/Makefile.in b/ctables/tests/Makefile.in
index 3393dcc4..34a25509 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
@@ -106,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:
@@ -136,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:
@@ -177,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
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) {
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/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..3054f874 100644
--- a/ctables/tests/master_server.tcl
+++ b/ctables/tests/master_server.tcl
@@ -4,10 +4,14 @@
package require ctable_server
-set suffix _m
+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/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.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/multimaster.tcl b/ctables/tests/multimaster.tcl
index a42b5df9..2cdf8a70 100644
--- a/ctables/tests/multimaster.tcl
+++ b/ctables/tests/multimaster.tcl
@@ -4,8 +4,10 @@
source test_common.tcl
-set suffix _m
-set nametags {indexed 1}
+namespace eval ::ctable_test {
+ set suffix _m
+ set nametags {indexed 1}
+}
source multitable.ct
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/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..4f3bf6db 100644
--- a/ctables/tests/multitable.ct
+++ b/ctables/tests/multitable.ct
@@ -4,27 +4,28 @@
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]
+ }
}
-if {![info exists nametags]} {
- set nametags [list]
-}
-
-CExtension multi$suffix 1.0 {
+CExtension multi$::ctable_test::suffix 1.0 {
-CTable nameval$suffix {
- varstring name {*}$nametags
+CTable nameval$::ctable_test::suffix {
+ varstring name {*}$::ctable_test::nametags
varstring value
}
-CTable elements$suffix {
- varstring name {*}$nametags
+CTable elements$::ctable_test::suffix {
+ varstring name {*}$::ctable_test::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 +50,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.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/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/speedtable.tcl b/ctables/tests/speedtable.tcl
index bc815af2..f68b76d6 100644
--- a/ctables/tests/speedtable.tcl
+++ b/ctables/tests/speedtable.tcl
@@ -4,6 +4,9 @@
source test_common.tcl
+set ::ctable::showCompilerCommands 1
+set ::ctable::errorDebug 1
+
speedtables Topbrands 1.0 {
table top_brands {
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
diff --git a/ctables/tests/test_common.sh b/ctables/tests/test_common.sh
index 8b65d60b..6c7ff083 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"
diff --git a/ctables/tests/top-brands-nokey-def.tcl b/ctables/tests/top-brands-nokey-def.tcl
index 9a1a361d..c4b8c6d4 100644
--- a/ctables/tests/top-brands-nokey-def.tcl
+++ b/ctables/tests/top-brands-nokey-def.tcl
@@ -8,13 +8,18 @@ package require ctable
#CTableBuildPath /tmp
-if {![info exists suffix]} {
- set suffix ""
+set ::ctable::showCompilerCommands 1
+set ::ctable::errorDebug 1
+
+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 +28,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