Jim Tcl
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

50 most recent check-ins

core: change "newVal" to "value" in [lset] usage Leaf check-in: 55942b5c7d user: steveb@workware.net.au tags: trunk,
core: put space before "..." in "wrong # args" msg

Resolves #173. check-in: a446bbc22f user: steveb@workware.net.au tags: trunk,

Announce 0.80 release

And update mailing list address Leaf check-in: fe54ddd58e user: steveb tags: www

build: Support sources with CRNL line endings

make-c-ext.tcl and parse-unidata.tcl now support input files with CRNL line endings

Reported-by: Mark@TheMarkitecht.com Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 50825e3222 user: steveb@workware.net.au tags: trunk,

docs: Fix minor typo in docs

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 33d7b0d622 user: steveb@workware.net.au tags: trunk,

bump version to 0.80

Update documentation to indicate v0.80 and update Tcl_shipped.html

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: e20da76be1 user: steveb@workware.net.au tags: trunk,

build: some systems have backtrace but not execinfo.h

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 6375ea11c6 user: steveb@workware.net.au tags: trunk,

oo: fix super for >2 levels of inheritance

Need to find the baseclass based on the current method class, not based on the object class.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 32a07c8ae5 user: steveb@workware.net.au tags: trunk,

core: make unary "!" work with non-int booleans check-in: 24326a6d18 user: steveb@workware.net.au tags: trunk,
build: avoid a spurious compiler warning

When compiled with -Os and arm-linux-musleabihf-gcc (crosstool-NG 9.2.0

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: d6b06a4d60 user: steveb@workware.net.au tags: trunk,

build: Update autosetup to 0.7.0

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: e25409f079 user: steveb@workware.net.au tags: trunk,

docs: Update docs to indicate recent changes.

Docs now indicate 0.79+, in preparation for 0.80 release And correctly indicate the changes since 0.79

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 79eb5bafa5 user: steveb@workware.net.au tags: trunk,

dict: add support for getwithdefault/getdef

TIP 342 (https://core.tcl-lang.org/tips/doc/trunk/tip/342.md)

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 9c74d4e496 user: steveb@workware.net.au tags: trunk,

docs: document operators lt, gt, le, ge check-in: 32032bade5 user: steveb@workware.net.au tags: trunk,
core: implement string comparison operators

TIP 461 check-in: a28bb3f645 user: steveb@workware.net.au tags: trunk,

docs: reword paragraph on integer prefixes

Thanks to @gromgit on GitHub for suggesting this phrasing. check-in: a32d1df2c5 user: steveb@workware.net.au tags: trunk,

core: implement 0d radix prefix for decimal

TIP 472 check-in: 82887f743a user: steveb@workware.net.au tags: trunk,

docs: remove generation of "Last updated" field

The generation of this field makes the resulting Tcl.html different between builds, as it records the time of generation, remove this as it causes jimtcl rpms for different arches (on RHEL/Fedora) to have a file conflict on Tcl.html. check-in: c9268b7aec user: steveb@workware.net.au tags: trunk,

jimregexp: rename local regex functions

Avoid possible problems with when linking by renaming local regex to jim_regcomp, jim_regexec, etc.

Fixes: #163

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: f606e46268 user: steveb@workware.net.au tags: trunk,

aio: ssl: connection close isn't an error

A return code of SSL_ERROR_ZERO_RETURN means the connection was closed. It isn't an error.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: cca6487bac user: steveb@workware.net.au tags: trunk,

string last: fix segfault with invalid index

[string last foo bar -1] gave segfault due to missing check for invalid index.

Fixes #161

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: ec4ab28788 user: steveb@workware.net.au tags: trunk,

docs: use "empty string" instead of "null string"

Avoid ambiguity re null characters

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 3dcc60f21c user: steveb@workware.net.au tags: trunk,

core: dicts (and arrays) now preserve insertion order

Although the documentation has always stated that, like Tcl, insertion order of dictionaries was preserved, this has never been the case. Instead, dictionaries were implemented as simple hash tables that did not preserve order.

Now, a new implementation of dictionaries preserves insertion order and has a number of other benefits.

Instead of hashing keys and storing keys and values in the hash table, the keys and values are not stored in a separate table, exactly as lists are stored, with alternating key, value pairs. Iterating over the dictionary is exactly like iterating over a list, where the order is consistent.

The hash table uses closed hashing rather than open hashing to avoid allocatation of hash entry structures. Instead a fixed (but expandable) hash table maps the key hash to the offset in the key/value table. This use of offsets means that if the key/value table grows, the offsets remain valid. Likewise, if the hash table needs to grow, the key, value table remains unchanged.

In addition to the offset (which indexes to the value, and 0 means the hash table entry is unused), the original hash is stored in the hash table. This reduces the need for object comparisons on hash entry collisions.

The collision resolution algorithm is the same as that used by Python:

peturb >>= 5; idx = (5 * idx + 1 + peturb) & dict->sizemask;

In order to reduce collisions, the hash table is expanded once it reaches half full. This is more conservative that Python where the table is expanded when it is two thirds full.

Note that if a hash collision occurs and then the original entry that cased the hash collision is removed, we still need to continue iterating when searching for the new key. Don't stop at the now-empty slot. So these entries are marked with offset=-1 to indicate that they need to be skipped.

In addition, the new faster hashing algorithm from Tcl 8.7 is used. This the hash for integers to be calculated efficiently without requiring them to be converted to string form first.

This implementation is modelled largely on the Python dict implementation.

Overall the performance should be an improvement over the current implementation, whilst preserving order. Dictionary creating and insertion should be faster as hash entries do not need to be allocated and resizing should be slightly faster. Entry lookup should be about the same, except may be faster for pure integer keys.

Below are some indicative benchmarks.

OLD NEW dict-create-1.1 Create empty dict 97.2ns . dict-create-1.2 Create small dict 440ns -27% dict-create-1.3 Create medium dict 1.54us -57% dict-create-1.4 Create large dict (int keys) 130us -80% dict-create-1.5 Create large dict (string keys) 143us -75% dict-set-1.1 Replace existing item 258ns -34% dict-set-1.2 Replace nonexistent item 365ns -49% dict-exists-1.1 Find existing item 55.7ns -5% dict-exists-1.2 Find nonexistent item 55.0ns -5%

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 6059149233 user: steveb@workware.net.au tags: trunk,

core: info commands failed to match under some conditions

Now that proc names are stored as-is in the commands table, info commands needs to take into account matching both foo::test and ::foo::test against the pattern ::foo::*

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 2b4649e040 user: steveb@workware.net.au tags: trunk,

update .gitignore adding jimtcl.pc and tests/Makefile

Commit aa4427dee716 ("Add pkg-config support: jimtcl.pc") adds the build time file jimtcl.pc

Commit 630df0da46f4 ("Update autosetup to v0.6.8") adds running make-template on tests/Makefile.in, producing tests/Makefile

Add both jimtcl.pc and tests/Makefile to .gitignore

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> check-in: ab48a51022 user: steveb@workware.net.au tags: trunk,

core: tidy up command creation/replacement

We can simply use Jim_ReplaceHashEntry() when replacing a command in non-local mode now that the proc epoch doesn't need to be incremented.

And JimRemoveHashEntry() only has one caller, so fold it into Jim_DeleteHashEntry()

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 36590d5480 user: steveb@workware.net.au tags: trunk,

core: improvements to garbage collection

Don't look up every object in the command table, since it can be slow to do that. Only lookup if the object looks like a reference.

Also, script and expression objects can't contain references that aren't already contained in sub-objects, so there is no need to scan them for references.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 222f6bb70b user: steveb@workware.net.au tags: trunk,

time: show results less than 1us per iteration

In this case, show the result as a decimal value

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 31ae2de94c user: steveb@workware.net.au tags: trunk,

core: improve the performance of lists

Under some circumstances, such as lrepeat and lreverse we know the length of the final list, so allocate the final size immediately rather than growing the table in multiple steps.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 1cf25d4e7e user: steveb@workware.net.au tags: trunk,

dict exists: Improve performance when when key not found

Pass JIM_NONE to prevent an error message being generated which is subsequently thrown away.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: a9b4e2719f user: steveb@workware.net.au tags: trunk,

core: fix regtest TEST 35

The changes in cdfa4637afe broke TEST 35 because the cmd pointer is dereferenced before checking the procEpoch instead of afterwards.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 719133fbde user: steveb@workware.net.au tags: trunk,

update all extensions for new Jim_DeleteCommand() API

Now argument is Jim_Obj *, not const char *

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: c1d67897a6 user: steveb@workware.net.au tags: trunk,

tests: allow more time for some tests

If running in a VM with very variable time

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: aa40189e9c user: steveb@workware.net.au tags: trunk,

tests: Fix some tests when certain features are disabled

namespace, ssl

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 5bebff2c66 user: steveb@workware.net.au tags: trunk,

core: improve performance through negative command caching

Instead of incrementing the proc epoch on every command removal and some command creation, cache previous deleted commands (empty structure only). Periodically increment the proc epoch and invalide all cached commands.

This is especially a win when creating short lived commands. e.g.

proc a {} { local proc b {} { # do something } # now b is removed }

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: ca09b7dbee user: steveb@workware.net.au tags: trunk,

core: command (proc) names may now contained embedded nulls

The hash table used to store commands now uses Jim_Obj keys rather than allocated char *, so embedded nulls are supported.

This means that some API function such as Jim_RenameCommand() now take Jim_Obj * rather than const char *, however Jim_CreateCommand() is retained with const char * for convenience and the new Jim_CreateCommandObj() is added.

This is generally a performance win as the existing Jim_Obj can be used as the key.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 18c50f0234 user: steveb@workware.net.au tags: trunk,

core: string match and other glob matching support embedded nulls

string match, switch -glob, info commands, etc. all now support patterns and strings with embedded nulls.

Fixes #143

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 2d665a5721 user: steveb@workware.net.au tags: trunk,

core: variable names may now contain embedded nulls

Hash tables used to store variables are now use Jim_Obj keys rather than allocated char *, so embedded nulls are supported.

This is generally a performance win as the existing Jim_Obj can be used as the key.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 301a79bda0 user: steveb@workware.net.au tags: trunk,

windows: struct _stat64 should be struct __stat64

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: b7c99732bf user: steveb@workware.net.au tags: trunk,

apply: handle the JIM_RETURN return code

The fix for tailcall in 0d5a208e92 meant that a JIM_RETURN return code from apply was no longer being converted to the appropriate return code.o

Fixes: #157

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 8b74e12e7f user: steveb@workware.net.au tags: trunk,

test(aio,socket,tty): match musl error messages check-in: eea04e0122 user: steveb@workware.net.au tags: trunk,
lsearch: handle too few args with -command

Fixes #155

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 81340a76d5 user: steveb@workware.net.au tags: trunk,

oo: Fix super invocation

An implicit concat was being done on the arguments to 'super', so arguments containing spaces were mangled.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: cb747c48bd user: steveb@workware.net.au tags: trunk,

tests: interactive.tests requires socket pty support

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 7238d1fe64 user: steveb@workware.net.au tags: trunk,

tests: Add interactive mode tests

Using a custom "expect-like" module to allow testing Jim in interactive mode. This also exercises the 'socket pty' support.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 882fcea2b0 user: steveb@workware.net.au tags: trunk,

lsearch, switch: fix -regexp case with option-like pattern

If the pattern begins with -, the internal invocation of regexp will treat the pattern as an option. Fix this by adding -- to the internal invocation of regexp.

Fixes #154

Reported-by: Barry Arthur <barry.arthur@gmail.com> Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: d24b054d03 user: steveb@workware.net.au tags: trunk,

tests: socket.test check for ipv6 support

Skip ipv6 tests if not supported

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 4e00acc7fd user: steveb@workware.net.au tags: trunk,

aio: Add socket pty

Allows a psuedo-tty pair to be created.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 97e3266c50 user: steveb@workware.net.au tags: trunk,

tests: jimsh.tests additional tests

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 76c8d41636 user: steveb@workware.net.au tags: trunk,

tests: ssl.test: Enable SNI and test verify

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: f68cae92e0 user: steveb@workware.net.au tags: trunk,