aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-07-10tests: event.test: increase waits in event-11.4Steve Bennett1-3/+3
This test can be at bit flaky on slower machines (perhaps running under a VM or qemu). Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-10build: update autosetup to v0.7.1-11-g9d20e8aSteve Bennett5-2161/+3982
Mostly for update bootstrap jimsh Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-10bootstrap-jim: Set _FILE_OFFSET_BITS=64Steve Bennett1-0/+1
Without this, readdir() doesn't work properly on some 32 bit platforms Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-10info script: return real current source fileSteve Bennett3-4/+47
And allow current source file to be set Fixes: #268 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-06aio: fix autocomplete for socketSteve Bennett1-3/+8
The checks for -ipv6, -async broke 'socket -commands' Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-05tests: Fix/add some constraint checksSteve Bennett2-1/+3
In case socket pty, interp are not available Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04core: add support for proc statics by referenceSteve Bennett4-94/+346
set a 5 proc b {} {&a} { incr a } b Now a is 6 because b captured a by reference instead of by value Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04initjimsh: update autocomplete, stdhintSteve Bennett1-3/+3
To add new commands that now support -help, -commands Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04debug: convert to use subcmdSteve Bennett2-142/+126
This means we get -commands and usage via -help Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04info: convert to use subcmdSteve Bennett1-97/+92
This means we get -commands and usage via -help Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04dict: convert to use subcmdSteve Bennett3-76/+68
This means we get -commands and usage via -help And update dict2.test for minor difference in usage Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04string: convert to subcmdSteve Bennett1-100/+89
This means we get -commands and usage via -help Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04namespace: convert to use subcmdSteve Bennett1-110/+119
This means we get -commands and usage via -help Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04subcmd: minor improvementsSteve Bennett2-4/+28
Add support for modulo maxarg count. If maxargs is (e.g.) -2, then a multiple of 2 args is expected. Also expose Jim_SubCmdArgError() to make it easy to add additional arg validation but still have subcmd report the usage. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04docs: Document tcl::stdhint, history hintsSteve Bennett1-0/+44
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04interactive: enable hint supportSteve Bennett6-26/+189
And add a default implementation of tcl::stdhint to add hinting for some built-in commands. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04docs: Add documentation for -noclose flagSteve Bennett1-27/+47
To open, socket and accept Also document aio getfd Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04aio: support accept ?-noclose?Steve Bennett1-3/+11
And also fix a minor bug that if unable to format the socket address the file descriptor would be left open. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04tests: add aio.test for open -nocloseSteve Bennett1-2/+19
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04aio: add -noclose flag to socket and openSteve Bennett1-25/+42
socket ?-noclose? ... open filename ?-noclose? ... Normally Jim will set O_CLOEXEC on all files and sockets that are opened however sometimes it is desirable to keep file descriptors open for child processes. The -noclose flags does this (on supported platforms). Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04docs: document aio changesSteve Bennett1-179/+193
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04aio: change to use unix io, not stdioSteve Bennett1-0/+3
This changes especially makes buffered I/O work with non-blocking channels. - separate read and write buffering - support for timeout on blocking read - read/write on same channel in event loop with buffering - read buffer is the same across read, gets, copyto - autoflush non-blocking writes via event loop - copyto can now copy to any filehandle-like command - add some copyto tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04tests: tty.test: use a pty pair if stdin/stdout is not a ttySteve Bennett1-12/+25
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04tests: expect.tcl: leave the channel in non-blocking modeSteve Bennett1-2/+1
This is simpler now that we can write to a non-blocking socket even if it is "full". Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04aio: close should still close AIO_KEEPOPEN channelsSteve Bennett1-1/+4
AIO_KEEPOPEN won't close a channel (such as stdin, stdout) when the command is deleted/replaced, but an explicit close will still close the channel. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04tcltest: rework constraint systemSteve Bennett35-163/+188
Now 'constraint cmd|package' is like 'needs' but sets a constraint The command to 'needs cmd' and 'constraint cmd' can now take a subcommand to check. Add 'constraint|needs eval|expr' to make some constraint checks simpler. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04aio: change to use unix io, not stdioSteve Bennett18-475/+1003
This changes especially makes buffered I/O work with non-blocking channels. - separate read and write buffering - support for timeout on blocking read - read/write on same channel in event loop with buffering - read buffer is the same across read, gets, copyto - autoflush non-blocking writes via event loop - copyto can now copy to any filehandle-like command - add some copyto tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-22docs: minor fix for currySteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-22build: Add -I. as the first include pathSteve Bennett2-12/+12
If building on a system with an installed jim.h, we want to be sure to pick up the local jim headers in preference. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-21stackdump: truncate command at first newlineSteve Bennett1-0/+4
Often the command in a stack trace will be a long script. This makes it hard to read the stacktrace, so in this case truncate at the first newline and add ... Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-21docs: documentation updates for stacktrace changesSteve Bennett1-5/+10
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-21jimdb: update for new stackframe supportSteve Bennett1-6/+6
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-21core: Display errors in a more "pythonesque" waySteve Bennett10-288/+234
A typical error message now looks like this: t4.tcl:2: Error: syntax error in expression: "blah" Traceback (most recent call last): File "t4.tcl", line 14 c 1 2 3 File "t4.tcl", line 10, in c b a c File "t4.tcl", line 6, in b a A14 File "t4.tcl", line 2, in a expr blah This is produced by stackdump (that can be replaced), called by errorInfo. Note that now stacktraces (stacktrace, info stacktrace, $opts(-errorinfo)) include the running command at each level in addition to proc, file, line. In order for scripts to detect this new format, a new entry tcl_platform entry has been added: tcl_platform(stackFormat) = 4 (to signify 4 elements per frame) In addition, instead of building the error stack frame as the stack is unwound in response to an error, instead the entire current stack trace is captured by stacktrace. This means that the trace extends beyond the try/catch right back to the initial interpreter command. The 'stacktrace' command is now implemented in C based on the same code that generates the error stacktrace. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-21core: improve eval frame handlingSteve Bennett3-119/+70
Now callers to JimInvokeCommand() are expected to push and eval frame. Then we no longer need to carry currentScriptObj, argc, argv in the interp since these are in the current eval frame. Note that this change simply renames some unused fields in Jim_Interp for ABI compatibility, but these will be removed in due course. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-20file: use 64 bit stat functions if necessarySteve Bennett3-7/+31
Some 32 bit systems may require explicit use of stat64, etc. Fixes #263
2023-05-25docs: document multi-level break, continueSteve Bennett1-5/+26
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-05-25tests: for multi-level break, continueSteve Bennett1-0/+127
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-05-25core: support multi-level while, break from loopsSteve Bennett2-23/+76
loop i 5 { loop j 6 { # This breaks out of both loops break 2 } } Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-05-09core: avoid rare crash on shutdownSteve Bennett1-14/+11
If deferred commands run on shutdown as stack frames are unwound, it is possible that a command is deleted but a later command still has a reference to it. So instead of trying to optimise this case by freeing immediately, cache deleted commands and let the be freed once all stack frames are destroyed. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-05-07jim-sqlite3: remove unused variable, rowsSteve Bennett1-3/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-05-06rlprompt.tcl: Update comment instructionsSteve Bennett1-1/+1
At some point $jim_interactive changed to the Tcl-compatible $tcl_interactive Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-05-06jim: info frame improvementsSteve Bennett5-57/+93
always include 'proc' even if introspection disabled correctly set 'proc' at the eval frame level that is currently running in the given proc. This makes it easier to produce an accurate level stacktrace even across uplevel, etc. Update stacktrace to use the new info frame. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-04-19regexp: fix incorrect check for invalid escape sequence at end of charsetSteve Bennett2-1/+5
Fixes #259 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-04-19regexp: fix check for termination in [[:class:]]Steve Bennett2-0/+8
Fixes #259 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-04-19vwait: Fix an arg problem with -signalSteve Bennett1-1/+1
'vwait -signal done' should wait for variable 'done' to change but instead waits for a variable '-signal' to changed. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-04-13stacktrace: handle missing cmd in [info frame]Steve Bennett1-1/+1
Some stack frames may have no cmd (e.g. with eval). Ensure that [stacktrace] still handles such frames by setting an empty proc name in that case. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-03-20Add support for ./configure --disable-introspectionSteve Bennett3-13/+39
Sometimes it can be useful to provide an embedded interpreter where introspection is not permitted. This includes: - info commands, procs, channels: only allow exact match, not glob pattern - info frame: don't include cmd and proc in the returned dict - info level: only return the command name, not the command arguments - info body, args, statics: do not allow these to be called Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-03-20build: allow build without math functionsSteve Bennett1-4/+7
if sin(), etc. aren't available, just build without math functions unless --math is explicitly given Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-03-20build: define _GNU_SOURCE only on the command lineSteve Bennett6-24/+2
Not in source files See https://ariadne.space/2021/12/21/stop-defining-feature-test-macros-in-your-code/ Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-03-06examples.api: drop last JIM_EMBEDDED definitionsAntonio Borneo4-4/+0
The macro JIM_EMBEDDED was required to be defined before including jim.h in applications that embed jimtcl. This requirement has been dropped in 2010 with commit 2d8564100c86 ("Documentation updates") but it's use has remained for longer and it even re-appeared later in the examples.api. Drop last instances of JIM_EMBEDDED. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>