aboutsummaryrefslogtreecommitdiff
path: root/jim.c
AgeCommit message (Collapse)AuthorFilesLines
2010-11-17For ctype macros, cast to unsigned charSteve Bennett1-14/+14
Instead of unsigned. Add UCHAR() macro for this. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-17Fix a bug in the UTF-8 implementation of string lastSteve Bennett1-1/+1
Indexing into the wrong string Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-17Add UTF-8 support to JimSteve Bennett1-691/+572
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-17[source] now opens the script file in text modeSteve Bennett1-6/+8
This allows scripts with CRLF line endings on (e.g.) cygwin to work without change. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-08Don't hardcode /lib/jimSteve Bennett1-1/+1
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-30Allow extensions to be built/installed as modulesSteve Bennett1-1/+1
This includes C extensions and Tcl extensions Also adds windows support (mingw32 and cygwin) Now the sqlite*, readline and win32 extensions are supported Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-30Determine platform_tcl() settings with configureSteve Bennett1-0/+3
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-30Add 'info channels'Steve Bennett1-8/+33
Like 'chan names' from Tcl Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Declare some internal functions staticSteve Bennett1-18/+18
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Add support for 'dict keys'Steve Bennett1-2/+39
And implement 'array names' in terms of it Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Add support for lsort -indexSteve Bennett1-43/+90
Also bring in some lsort tests from Tcl Also allow lsort to be reentrant (but not thread safe) Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Fix a parse error on trailine newlineSteve Bennett1-6/+3
If a script contain [ with a trailing backslash, the parser would crash. e.g. . list [split \ Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Licence wording updates.Steve Bennett1-2/+0
Per v0.51, don't refer to the FreeBSD licence Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15If three arguments are passed to 'puts' and the second isn't -nonewline, ↵Wojciech A. Koszek1-1/+1
return JIM_ERR instead of JIM_OK.
2010-10-15Fix a concat bugSteve Bennett1-1/+7
If a string ended in backslash-space, the trailing space was lost. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix error message for deleting nonexistent procSteve Bennett1-4/+8
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix some problems with global and upvarSteve Bennett1-13/+25
Redefining a link with upvar or global gave an error. Trying to access a non-existent var via a link gave the wrong error message. Added Tcl upvar tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix -Wshadow warningsSteve Bennett1-84/+83
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Some systems insist that ctype macros use unsignedSteve Bennett1-17/+17
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-15Add stubs in case of compiled-out package, aioSteve Bennett1-8/+13
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Remove dependence of jim core on stderrSteve Bennett1-29/+5
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-15Avoid over-aggressive optimisation in Jim_EvalObj()Steve Bennett1-54/+55
The optimisation for 'incr' should not use compare immediate Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Simplify dict creationSteve Bennett1-99/+32
Always convert via a list. Makes for smaller code with no noticable performance impact. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15More simplification of Jim_EvalObj()Steve Bennett1-122/+96
A bit smaller and easier to understand Move some common code to JimMakeScriptObj() Also add JimWideValue() to access internal int value Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix bug when renaming the current procSteve Bennett1-24/+16
Reference counting issues Also don't allow rename to an existing command (Tcl compatible) Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix reference counting of stack trace in 'error'Steve Bennett1-0/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Make jim more reentrantSteve Bennett1-1/+2
Make the exec wait table allocated and per-interpeter Use reentrant variants of some libc calls Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15string trimright now always removes nullsSteve Bennett1-3/+2
Not Tcl compatible, but makes sense Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Minor cleanups and fixesSteve Bennett1-14/+12
array get for odd length list now returns an error comment fixes and small code rearrangement Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to script internal repSteve Bennett1-65/+52
No need to keep line number info on every script token Instead add it into the 'LINE' token Also remember the first line number of the script in the script object Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15eventloop improvements and enhancementsSteve Bennett1-36/+0
Move Jim_EvalObjBackground() out of the core to eventloop Time events are now kept and triggered in time order Time handlers are removed before execution Add 'update' Add 'after info' and 'after idle' Include time events in the return from Jim_ProcessEvents() Add Tcl eventloop tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix some eventloop bugsSteve Bennett1-5/+13
bgerror is supposed to be suppressed subsequently if it returns break vwait should error on invalid array element vwait should return an empty result Don't accept 'after info' since it isn't supported Also add some eventloop tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up some debuggingSteve Bennett1-70/+48
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Source info was lost when converting source to listSteve Bennett1-2/+18
This meant that the single arg switch case would not give accurate line numbers Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Make sure all static data is marked read-onlySteve Bennett1-15/+13
This reduces the size of the non-shared data segment Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Better internal script representationSteve Bennett1-309/+295
Should have better performance No longer need the command struct Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add support for 'info references'Steve Bennett1-5/+32
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix crash on expand of empty argSteve Bennett1-6/+6
Found by the clang static analyser Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix a crash during list parsingSteve Bennett1-1/+6
If the list ended in a trailing newline Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15It was possible to create a bad refSteve Bennett1-2/+2
Need to fix invalid chars in the tag name Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix a bug with 'time' if the count is 0Steve Bennett1-3/+5
And also some other warnings courtesy of the clang static analyzer Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Reduce excessive stack usageSteve Bennett1-1/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Set $::errorCode from execSteve Bennett1-1/+21
This allows the return code from a failed 'exec' command to be retrieved. Also support -errorcode in catch and return. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Use setjmp to better handle lsort errorsSteve Bennett1-15/+15
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix some eventloop problemsSteve Bennett1-1/+1
File handlers now pass through the error code and the handler is deleted on error. If there is nothing to do, vwait returns. If bgerror doesn't exist, print the original error to stderr. Also remove the 'eof' event handler since it isn't needed. Can just call [eof $f]. This also fixes source locations within 'readable' scripts. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add 'string is' to JimSteve Bennett1-12/+104
Also, double parsing now allows trailing white space Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up the indentation messSteve Bennett1-2917/+3442
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to jim configureSteve Bennett1-15/+0
Create and use config.h Check for backtrace, fork, vfork, syslog, regcomp and others Disable extensions which require missing functions/features Check for one arg vs. two arg mkdir() Distinguish between mingw and native windows The aio extension has reduced functionality for ANSI C only Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Minor compiler compatibility fixes and ref count fixSteve Bennett1-6/+11
Don't mix declarations and code Don't try sizeof(long long) if we don't have it Object not freed on bad printf modifier in [format] Signed-off-by: Steve Bennett <steveb@workware.net.au>