aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-04-03expr: allow existing multiple argument support with --compatSteve Bennett3-4/+29
Some users may not be ready to immediately move to the single-argument expr, so provide a --compat option to configure to support the previous behaviour as a transition strategy. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-22json::encode: Improve the implementationSteve Bennett1-69/+62
Use a single subencoder proc for all types. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-19core: Fix memory leak replacing existing commandsSteve Bennett1-3/+11
Fixes #198 Reported-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-10install: Fix install of jimdb for out-of-tree buildSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-10tests: Fix debug.test for single arg exprSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-09expr: TIP 526, only support a single argSteve Bennett8-43/+29
Avoid unexpected issues by concatenating multiple arguments. This does create an incompatibility with early versions, but it is generally trivial to convert existing code to one of two forms: 1. expr {$a + $b} -- usually correct 2. expr "$a + $b" -- usually incorrect Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-07aio: pass socktype to getaddrinfo()prpr19xx1-8/+10
Some old systems are not happy with a numeric service and no socktype. Fixes #196 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-27aio: tests: bootstrap jimsh doesn't have posix open flagsSteve Bennett1-5/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-27tests: Fix return code from tests/runall.tclSteve Bennett1-2/+2
In the case where interp is not supported Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-27aio: mingw doesn't have O_NOCTTYSteve Bennett1-0/+4
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-27docs: Clarify that regexp back references are not supportedSteve Bennett1-0/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-27aio: open: support for POSIX open flagsSteve Bennett3-3/+112
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-20aio: rework internals of openSteve Bennett1-25/+27
In preparation for support of posix mode flags to open Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-20oo: minor code cleanupsSteve Bennett1-5/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-20oo: instance ref should be fully qualifiedSteve Bennett1-2/+1
In case the class is created with a namespace name Fixes #193 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-20jim.c: Fix compiler warningSteve Bennett1-0/+2
When namespace is disabled, Jim_memrchr is not needed Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-20build: some extensions are dep onlySteve Bennett1-2/+2
Extensions like nshelper and jsonencode should only be selected if explicitly enabled or if they are the target of a dependency. So enabling namespace enables nshelper, but --full --without-ext=namespace doesn't. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-20redis: avoid over-allocating memorySteve Bennett1-6/+7
Should not make any difference in practice, but the allocations should be size * (argc - 1) not size * argc - 1 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-02-05build: quieten compiler warningsSteve Bennett3-2/+8
Irrelevant warnings from some compilers Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-30lsearch, lsort: support for -stride and -indexSteve Bennett4-91/+441
Add -stride support to both lsearch and lsort Add -index support to lsearch Improve -index for lsort to support multiple indices Also harmonise some error messages with Tcl 8.7 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-23history: Add support for history keepSteve Bennett5-13/+56
Fixes #191 Signed-off-by: Steve Bennett <steveb@workware.net.au> Reported-by: D. Bohdan <dbohdan@dbohdan.com>
2021-01-10package: add ABI version checkingSteve Bennett28-88/+62
jim.h now includes JIM_ABI_VERSION that should be incremented whenever the ABI changes. Then all loadable modules should call Jim_CheckAbiVersion() to make sure they are loaded against the correct version. Add Jim_PackageProvideCheck() that does both Jim_CheckAbiVersion() and Jim_PackageProvide() to simplify the implementation of loadable extensions. Also rename the "big" sqlite3 extension to just sqlite to avoid a naming conflict with the smaller jim-sqlite3 extension. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-10jcov, jtime, jtrace: fix not removing callbackD. Bohdan3-3/+3
2021-01-09jimdb: A command line Jim debugger using xtraceSteve Bennett6-0/+643
Also add some additional tools that use xtrace. examples/jcov - code coverage examples/jtime - code coverage that measures execution time examples/jtrace - trace script execution Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-09Add the [xtrace] commandSteve Bennett4-12/+168
Allows a debugger or tracing facility to be implemented Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-06build: Need sdl needs 'check false'Steve Bennett2-2/+3
If no 'check' is provided, we assume that the checks passed. If pkg-config is specified, but no other check, use 'check false' to ensure the module is disable if the pkg-config checks don't pass. Also travis now does 'make all' so that any module extensions are also built, and add a dependency on libhiredis-dev to test building the redis extension. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-06configure: Add --allextmod optionSteve Bennett3-134/+166
To build all non-default extensions as modules if prerequisites are met. Also move the extension help out of the main help since it is quite long and show it with --extinfo. Now extension help is generated from $extdb to avoid the help and the module configuration becoming out of sync. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-03travis ci build: test bootstrap jimshSteve Bennett2-1/+12
Make sure we don't break the bootstrap jimsh Also build with --maintainer to check for assertion failures and reference count issues. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-03bootstrap jimsh: pass all testsSteve Bennett9-76/+108
In order to test bootstrap jimsh, it is very helpful if it can pass all the unit tests. - Set tcl_platform(bootstrap) to 1 for bootstrap jimsh or 0 otherwise - Use getref to determine in we have references, not ref since we implement a poor-man's ref for bootstrap jimsh - bootstrap jimsh package doesn't return a "Can't load package" message if loading the package fails - exec tests using [open |command] need pipe - bootstrap jimsh can't set file times with [file mtime] Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-03core: fix parsing of booleansSteve Bennett2-35/+28
When boolean parsing was combined in commit 982ec4f524bc81a240cb729cf09bd3c677aea485 it broken parsing of boolean values in expressions that weren't standalone. e.g. expr {true} was fine, but expr {true ? 4 : 5} was not. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-02build: Fix bootstrap buildSteve Bennett1-2/+2
In order for make-bootstrap-jim to reliably match #ifndef...JIM_BOOTSTRAP with the corresponding #endif, a corresponding comment needs to be added after the #endif Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-02build: Dynamic modules require $(LIBJIM)Steve Bennett1-1/+1
Add this depenency to avoid issues with parallel builds Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-02build: update autosetup for pkg-config fixSteve Bennett4-8/+8
v0.7.0-3-g35b88dc Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01sdl: Add basic text supportSteve Bennett6-24/+830
Requires a truetype font file Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01Add examples/sdlevents.tclSteve Bennett1-0/+76
Add example of integrating SDL event loop and the Tcl event loop Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01sdl: convert to using jim-subcmdSteve Bennett3-172/+348
And add: - poll ?script? - optional window title Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01sdl: Add support for SDL2Steve Bennett4-49/+181
Now we only support using pkg-config to find SDL, and prefer SDL2 over SDL. For compatibility between versions, the render surface is now cleared on flip. And closing the window now results in a JIM_EXIT return code from flip. Also supports [sdl clear] to clear the background to a given colour. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-27core: combine JimParseBoolean() and JimParseExprBoolean()Steve Bennett1-29/+34
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26try: reimplement in CSteve Bennett2-102/+150
For speed and size, since it shares a lot of the same code with catch Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26loop: Allow start value to be omittedSteve Bennett3-9/+28
It is convenient to be able to do just: loop i 5 { body } Where the start value is 0. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26docs: Documentation for integer expressionsSteve Bennett1-12/+23
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26core: commands that take an index now use integer expressionsSteve Bennett11-54/+189
This means that instead of just [list index 2+1], we can now do [list index end-$n*2+1] This applies to: lindex, linsert, lreplace, lset, lrange, lsort, regexp, regsub string index,first,last,range Also add tests for both direct integer expressions and indexes. Still needs doc update. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26Jim_GetWideExpr() now evaluates "safe" expressionsSteve Bennett2-3/+23
This means that $variable references and [commands] are not expanded. This should mitigate security concerns when using the 'integer expression' feature. It means that you must do: string repeat a $i*4 Not: string repeat a {$i*4} Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26core: support integer expressions in various commandsSteve Bennett9-60/+88
For convenience, many commands now accept integer expressions rather than only simple integers. These are: loop, range, incr, string repeat, lrepeat, pack, unpack, rand This simplifies many cases where previously expr {} or $() was required. e.g. foreach i [range 4+1 2*$b] { ... } string repeat 2**$n a Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26Revert "core: remove procargs and procbody from callframe"Steve Bennett1-0/+10
This reverts commit 6b287b9c6b6ec8fbc62f1cbaad48547cf5a4b65c. These are needed for reference counting. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-14redis: Check for error on NULL replySteve Bennett1-1/+4
A command may return NULL, but set an error (e.g. Server closed the connection). In this case, make sure to return the error. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-14core: remove procargs and procbody from callframeSteve Bennett1-10/+0
These stored the currently executing proc args and body (the same as are available via info args and info body), but were never used anywhere. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-11list, string: support any number of +/-n for indexSteve Bennett3-8/+39
It is especially convenient to add -1 for something like: lindex $list end-$BACK-1 or: string range $str $p $p+$len-1 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-11autosetup: keep clean the source tree on out-of-tree buildAntonio Borneo2-7/+6
If the build host doesn't have neither jimsh nor tclsh installed, during 'configure' the autosetup will build 'autosetup/jimsh0' inside the source tree. This happens also when out-of-tree build is used. Making dirty the source tree during out-of-tree build causes applications that use jimtcl as submodule (e.g. OpenOCD) to fail at 'make distcheck'. Modify 'autosetup-find-tclsh' to build 'jimsh0' in the current folder. For jimtcl project it would be the root of the source tree or the root of the out-of-tree build. Update 'Makefile.in' to search for 'jimsh0' in the new path during 'distclean'. Reported-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-11-30Makefile: remove examples.api/Makefile while 'distclean'Antonio Borneo1-1/+1
The working directory is not fully cleaned-up and remains dirty after 'make distclean'. Add file examples.api/Makefile in the list of files to remove during 'make distclean'. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>