aboutsummaryrefslogtreecommitdiff
path: root/tclcompat.tcl
AgeCommit message (Collapse)AuthorFilesLines
2010-10-15Ensure that Tcl extensions can be built-in or externalSteve Bennett1-2/+0
All C extensions must call Jim_PackageProvide() make-c-ext ensures that Tcl extensions call Jim_PackageProvide() if compiled in. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add do-nothing fileevent for Tcl compatibilitySteve Bennett1-0/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add an optional 'putter' function to parraySteve Bennett1-3/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Implement open "|..."Steve Bennett1-0/+22
Uses a Tcl wrapper, popen, from tclcompat Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Implement 'info frame' and some related procsSteve Bennett1-16/+5
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>
2010-10-15Improvements to tailcallSteve Bennett1-1/+1
Add tests and documentation Make tailcall work within 'try' Fix tailcall interaction with uplevel Use tailcall for dispatch in tree.tcl Also some related improvements in tree.tcl Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Move some core procs into the (Tcl) stdlib extensionSteve Bennett1-5/+4
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>
2010-10-15Improvements to catch, return, signal, trySteve Bennett1-31/+89
Improve the ability to rethrow errors * Allow return to rethrow an error by accepting '-errorinfo stacktrace' * Also, 'catch ... opts' now also stores opts(-errorinfo) on error * Use these to provide better stack traces from 'case' and 'try' * Implement 'return -level' Make try/on/finally more Tcl 8.6 compatible * With support for 'on' handlers and docs Add support for catch options to try * Otherwise it's hard to use try to catch signals Improvements to signal handling * catch -signal now sets a list of the handled signals as the result * catch -signal won't execute the body at all if a handled signal is pending * up to 64 (jim_wide) signals can now be handled * if catch -signal is nested, the innermost catch will catch the error * new 'signal catch' allows ignored/blocked signals to be examined and cleared. * update docs on signal handling exec should indicate which signal killed the child Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix lassign to work properly with an empty listSteve Bennett1-2/+4
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Enhance catch and 'info returncodes'Steve Bennett1-1/+8
*: Add optional arg to catch, opts, like Tcl 8.5 to allow access to the code given by 'return -code' *: Use -- to signify end of options to catch *: 'info returncodes' can give the name of a single code *: Fix 'case' to handle 'return -code' properly
2010-10-15Add basic Tcl implementation of 'try ... finally'Steve Bennett1-15/+32
2010-10-15Improve stack trace handlingSteve Bennett1-13/+12
*: Get rid of JIM_ERR_ADDSTACK and use interp->addStackTrace instead *: 'return -code error' doesn't add a stack frame *: Rename _file_copy to {file copy} for better error messages *: Use 'return -code' to prevent excessive levels in the stack trace Also rename info_nameofexecutable to {info nameofexecutable}
2010-10-15Add support for 'file copy'Steve Bennett1-0/+23
2010-10-15Allow catch to specify what is caughtSteve Bennett1-7/+9
*: Default to the same as Tcl. Not signal, eval, exit. *: Use 'catch -exit' to also catch exit. *: Also map for standard return codes: [info returncodes] *: Also Jim_ReturnCode() *: Add Jim_FindByName() for searching in a char* array *: Fix 'info nameofexectutable' if $::jim_argv0 is not set
2010-10-15Bug fixes and featuresSteve Bennett1-0/+13
Support end+<n> index And generally simplify the index handling Add support for 'info nameofexecutable'
2010-10-15Various general fixes and cleanupsSteve Bennett1-0/+97
Add lsearch -command, update case to use lsearch Rename tcl6.tcl to tclcompat.tcl Remove // style comments Expand some tabs to spaces Fix some compiler warnings Remove some unused functions Don't close fd=-1 in exec