Age | Commit message (Collapse) | Author | Files | Lines |
|
Allows commands to run when a proc or interpreter exits.
If the $jim::defer variables exists at proc or interp exit,
it is treated as a list of scripts to evaluate (in reverse order).
The [defer] command is a helper to add scripts to $jim::defer
See tests/defer.test
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
It's convenient to support a non-gc lambda, even if references
are disabled.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
The script implementation of dict values was not correctly handling the case
where a dictionary had duplicate values.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Rather than "Runtime Error: <file>:<line>: ...", use
use "<file>:<line>: Error: ..."
This latter format is both shorter and more consistent with other tools (e.g. gcc).
This also allows errors to be reported with the default errorfmt of vim's quickfix feature.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
If argv0 is a relative path, [info nameofexecutable] returned
the wrong result after changing directory.
So calculate and stash the result during init.
Also move internal $jim_argv0 into namespace jim as $jim::argv0
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Sweep through and clean up all (most) of the comments in the code.
While there, adjust some variable and function names to be more consistent,
and make a few small code changes - again, mostly for consistency.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Rather than just the error backtrace ([info stacktrace]),
include the live stacktrace. This means it is possible to do:
if {[catch $script msg]}
puts [errorInfo $msg]
}
to output the stack trace from the top level, not just from the point of capture.
It is still possible to pass a stacktrace to errorInfo to override this behaviour.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
dict for, values, incr, append, lappend, update, replace and info
Also implement array stat (the same as dict info)
Note that [dict info] and [array stat] are for useful for checking
the behaviour of the hash randomiser
Add Jim_EvalEnsemble()
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
For efficiency since it can be heavily used
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Also some general documentation cleanups and trailing
white space removal.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
And allow commands to set a temporary name for the purpose
of generating error messages
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Implement 'dict with' and 'dict merge' as scripts since this is simpler.
Use 'dict size' to implement 'array size'
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Instead, set TCL_LIBRARY based on where jim is installed.
This defaults to /usr/local (thus /usr/local/lib/jim), or
can be modified with either configure or make. e.g.
./configure --prefix=/usr
or
make prefix=/usr install
Now auto_path is initialised only to TCL_LIBRARY, and doesn't
include "." which could be undesirable.
At the same time, simplify jimsh initialisation using a script
instead of C code. Add the path to the executable to auto_path.
Also, no longer use JIM_TCL_COMPAT. Always use the tcl-compatible
names, $auto_path and $tcl_interactive.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This makes for cleaner output from a console session
and is compatible with earlier versions of Jim.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Remove Jim_PrintErrorMessage() and create Jim_MakeErrorMessage() instead.
Move errorInfo to stdlib since it is now required.
Also move lassign from tclcompat to stdlib as a core command.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
info frame allows access to source file/line for earler call frames
Implement 'stacktrace' to give a live stacktrace
And 'stackdump' to convert a stack trace to readable form
Update 'errorInfo' to use 'stackdump'
Also fix tailcall to retain source info
And implement alias, lambda and curry with tailcall
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Also implement 'local' to declare/delete local procs
* Add tests/alias.test for testing alias, current, local
* proc now returns the name of the proc created
* Add helper 'function' to stdlib
Reimplement glob and case to use local procs
* This keeps these internal procs out of the global namespace
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|