aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-06-11core: improvements to garbage collectionSteve Bennett1-23/+18
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>
2020-06-11time: show results less than 1us per iterationSteve Bennett1-4/+7
In this case, show the result as a decimal value Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-11core: improve the performance of listsSteve Bennett1-14/+25
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>
2020-06-11dict exists: Improve performance when when key not foundSteve Bennett1-2/+2
Pass JIM_NONE to prevent an error message being generated which is subsequently thrown away. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-10core: fix regtest TEST 35Steve Bennett1-10/+8
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>
2020-06-05update all extensions for new Jim_DeleteCommand() APISteve Bennett4-7/+7
Now argument is Jim_Obj *, not const char * Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-05tests: allow more time for some testsSteve Bennett3-18/+18
If running in a VM with very variable time Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-05tests: Fix some tests when certain features are disabledSteve Bennett3-7/+13
namespace, ssl Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-05core: improve performance through negative command cachingSteve Bennett2-14/+49
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>
2020-06-05core: command (proc) names may now contained embedded nullsSteve Bennett7-189/+173
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>
2020-06-05core: string match and other glob matching support embedded nullsSteve Bennett3-29/+79
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>
2020-06-05core: variable names may now contain embedded nullsSteve Bennett7-121/+167
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>
2020-06-05windows: struct _stat64 should be struct __stat64Steve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-30apply: handle the JIM_RETURN return codeSteve Bennett1-15/+15
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>
2020-05-28test(aio,socket,tty): match musl error messagesD. Bohdan3-5/+5
2020-05-27lsearch: handle too few args with -commandSteve Bennett2-0/+10
Fixes #155 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-23oo: Fix super invocationSteve Bennett1-1/+1
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>
2020-05-07tests: interactive.tests requires socket pty supportSteve Bennett1-0/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-07tests: Add interactive mode testsSteve Bennett2-0/+368
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>
2020-05-07lsearch, switch: fix -regexp case with option-like patternSteve Bennett4-12/+41
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>
2020-05-06tests: socket.test check for ipv6 supportSteve Bennett1-4/+18
Skip ipv6 tests if not supported Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06aio: Add socket ptySteve Bennett3-2/+45
Allows a psuedo-tty pair to be created. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: jimsh.tests additional testsSteve Bennett1-0/+16
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: ssl.test: Enable SNI and test verifySteve Bennett1-4/+8
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06aio: ssl: Allow SNI to be specifiedSteve Bennett5-63/+88
For some SSL connections it is necessary to set the Server Name Indication in the connection in order to receive the correct certificate. Allow this as part of the client ssl call with: $sock ssl -sni $servername Also for -server mode, allow the certificate and private key to be stored in a single file and only be specified once. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06aio: Fix eventloop and eof for ssl connectionsSteve Bennett4-44/+131
We can't use feof() and 'buffering none' on ssl connections. Instead we have to get eof from the ssl layer, and provide special handling for buffering in the eventloop. For eof, add ssl_eof() and detect SSL_read() results that indicate eof to set AIO_EOF in flags. For buffering, add 'read -pending' that will read, and then immediately read any buffered data so that the 'readable' event will trigger next time. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: add ssl.testSteve Bennett3-0/+168
Note that there is currently a problem with ssl and readable events Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: add socket.testsSteve Bennett1-0/+367
Basic testing of each of the socket types Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests/runall.tcl: support tests that forkSteve Bennett1-0/+7
Because we use catch -exit { ... }, if a test uses os.fork we will return in both the parent in the child. To fix this, require the child to use exit 99, and detect this case and exit from the child in this case. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06exit: Set the exit code as the interp resultSteve Bennett3-3/+4
If exit is caught with catch -exit, it is currently not possible to retrieve the exit value. If an exit code is provided, set it as the interp result. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-05file: stat: Fixes for 64 bit times on WindowsSteve Bennett2-28/+36
While -D__MINGW_USE_VC2005_COMPAT enables a 64-bit time_t, it is necessary to explicitly use _stat64 to access the stat structure containing 64 bit times. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04tests: Fixes to recent tests for windowsSteve Bennett7-20/+34
Mostly just avoiding running certain tests, but also: - rename() won't overwrite an existing file on Windows - ensure that eof returns 0 or 1 - in aio.test, create and read the file in binary mode Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04jim.c: Fix UpdateStringOfIndex()Steve Bennett2-1/+9
In case the index is invalid, the string should contain -MAX_INT Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04exec: remove useless initialisationSteve Bennett1-3/+0
numPids is always zero here so the code does nothing Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04aio: Improve ipv6 error messageSteve Bennett1-1/+1
To show both the host and port Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04scan: Fix a utf-8 bug for string lengthSteve Bennett2-12/+20
The string length was being checked in chars instead of bytes Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04regsub: Fix regsub -all with \ASteve Bennett3-11/+18
regsub -all matches \A against the start of each match, but correctly handle a pattern like ^ which does not advance the match Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04regexp: Improved error messageSteve Bennett3-9/+23
Detect and produce an error for missing closing bracket ] Consider a trailing backslash as an invalid escape Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04signal check: fix error returnSteve Bennett2-5/+3
If the signal is invalid, indicate that Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04unpack: consistent error messagesSteve Bennett2-23/+17
between pack and unpack Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04file readlink: change error message to match TclSteve Bennett2-2/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04file: rootname, dirname fixes to match TclSteve Bennett2-9/+16
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04tests: Add many new additional tests for code coverageSteve Bennett24-52/+1589
readdir, tty, utf8, signal, alarm, kill, file, jimsh, posix, aio, history, interp, pack, unpack, eventloop, exec, load, package, regexp, regsub Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04aio: remove leftover debuggingSteve Bennett1-1/+0
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04build: Improve coverage supportSteve Bennett2-7/+22
Disable optimisation during coverage. Set CCACHE_DISABLE=1 in the environment, just to be sure to disable ccache Also cleanup coverage files in subdirs too Add support for both lcov and gcovr Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-28tests: namespace.testSteve Bennett1-0/+25
More namespace tests from Evan Hunter Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-28tests: debug.testEvan Hunter2-12/+128
Also requires fixing 'debug' command so that the interpreter & tcltest.tcl can tell it is not supported. And the result of 'debug show' is now returned as the interpreter result rather than being printed.
2020-04-28jim.c: Fix malloc -> Jim_AllocSteve Bennett1-1/+1
The expression tree nodes are freed with Jim_Free and should be allocated with Jim_Alloc Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17tests: file tempfile: don't do path/template tests on windowsSteve Bennett1-3/+8
As Windows doesn't respect the path/template Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17tests: improve code coverageSteve Bennett6-0/+175
- clock - array - file tempfile - lreverse - string byterange - aio tty Signed-off-by: Steve Bennett <steveb@workware.net.au>