aboutsummaryrefslogtreecommitdiff
path: root/tclcompat.tcl
AgeCommit message (Collapse)AuthorFilesLines
2011-05-27closing an 'open |...' filehandle should waitSteve Bennett1-0/+6
for the detached child processes to complete. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-05-19Fix some missing closing bracketsSteve Bennett1-2/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-06Make tclcompat work without aioSteve Bennett1-22/+23
This is an unusual case, but useful for testing Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-24Remove the bio extension and add 'copyto' to aio.Steve Bennett1-1/+1
The bio extension is a hangover from TinyTcl. Since Jim supports binary strings, there isn't much need for it except for 'bio copy'. So move this to aio as 'copyto' and implement 'file copy' in terms of it. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-08Don't hardcode /lib/jimSteve Bennett1-15/+0
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>
2010-10-30Determine platform_tcl() settings with configureSteve Bennett1-2/+0
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Portability fixesSteve Bennett1-0/+2
Especially for eCos, mingw32 and cygwin Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Remove dependence of jim core on stderrSteve Bennett1-22/+0
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>
2010-10-15Implement 'pid handle'Steve Bennett1-5/+27
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Implement Tcl I/O wrappers in TclSteve Bennett1-1/+31
This allows 'rename' etc. to work correctly and is smaller, simpler code Also, read -nonewline is mutually exclusive with 'numChars' Signed-off-by: Steve Bennett <steveb@workware.net.au>
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