aboutsummaryrefslogtreecommitdiff
path: root/jim-package.c
AgeCommit message (Collapse)AuthorFilesLines
2023-07-04aio: change to use unix io, not stdioSteve Bennett1-0/+1
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-21core: Display errors in a more "pythonesque" waySteve Bennett1-3/+0
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>
2020-04-17package: add package names as an alias for package listSteve Bennett1-3/+12
Use the same name for this subcommand as Tcl. For now we keep the existing package list in case it is in use. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-02-06package: fix corruption of versions string0.75Steve Bennett1-4/+3
Partially revert 5f31686cb40c5b84638dbb5ffe1ad327440e1903 The version isn't allocated in the hash table, so we can't take a reference to a version object. Packages once again have a fixed, dummy "1.0" version. Reported-by: Florian Schäfer <florian.schaefer+github@gmail.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-01-15package: simplification/code cleanupSteve Bennett1-72/+57
Also, packages can once again set a version != "1.0", but the version is ignored for "package require" Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-24Create build-jim-ext for building extensionsSteve Bennett1-2/+1
Simplifies the process of building loadable extensions Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-18Cleanup hash table interfacesSteve Bennett1-11/+8
Remove const-ness of hash table keys Also consolidate string hashtable ops Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-07Allow building with MSVC on windowsSteve Bennett1-1/+6
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-07Remove use of designated initialisersSteve Bennett1-18/+27
For better compatibility c89 compatibility. Also simplify jim-subcmd. Remove -usage and command descriptions. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-28Don't try to store an int into a (void *)Steve Bennett1-2/+2
Instead do it properly with a union Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-01Add Jim_String() macroSteve Bennett1-4/+4
It is very common to get the string value without the length. Jim_String() is a macro which does that. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-04-22[package require] should load at the global levelSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-21All Jim source should include jimautoconf.hSteve Bennett1-0/+1
This ensures that everything picks up the autoconf settings
2010-11-09Allow jim to be used as an autoconf subdirSteve Bennett1-2/+2
Ensure that no public headers include the autoconf header, jimautoconf.h, as it leads to problems with redefined symbols. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-03Fix some problems with the packaging systemSteve Bennett1-36/+38
Loadable modules should be tried before script packages. If a script accidentally tried to require itself, infinite recursion resulted. It is a bad idea to name a script the same as an extension/package. Also, keep the package name off the stack. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up some debuggingSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Reduce excessive stack usageSteve Bennett1-0/+3
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up the indentation messSteve Bennett1-44/+42
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improve stack trace handlingSteve Bennett1-6/+3
*: 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-15Documentation, build system updatesSteve Bennett1-1/+1
Document reference-related commands *: ref, getref, setref, finalize, lambda were missing Build system updates *: Add check for long long to configure *: Change -Dwith_jim_ext_... to -Djim_ext_... *: Fix jim-eventloop when compiling with no long long
2010-10-15Add Jim_SetResultFormatted() for simplied messagesSteve Bennett1-11/+4
Makes creating error messages much simpler Also convert a couple of long if/else to switch Also some error message improvements Also fix some memory leaks
2010-10-15Many improvements, bug fixesSteve Bennett1-1/+1
*: Allow math functions to be enabled via configure *: Allow support for references to be removed *: Documentation updates *: Jim_ListLength() now returns the result directly *: Optimise list -> dict conversion *: Consistent capitalisation of some structures, functions *: Add support for abbreviations to Jim_GetEnum() *: The commands to 'info' may be abbreviated *: Use abbreviation support in parsing options to 'subst' *: Use Jim_GetEnum() to parse return code names *: Optimise 'array get', 'array set' if no conversion needed *: Import Tcl string.test *: string compare now returns -1,0,1 like Tcl *: Fix 'string last' with index=0 *: Add support for 'string reverse' *: Add -nocase option to 'string equal' *: Fix infinite loop in 'string repeat str -1' *: Support braced patterns in glob *: glob should not return dot files unless the pattern starts with . *: Simplify glob.tcl by using some new features *: When creating C extensions from Tcl, preserve newlines and invoke with Jim_Eval_Named() to produce more meaningful error messages. *: Also remove all comments, not just those starting in the first column *: Add support for 'n+n' and 'n-n' in string/list indexes (Tcl 8.5) *: Add a level to the stack trace for 'return -code error' *: 'return -code' should also affect the return from 'source' (see Tcl docs) *: Fix lsort -command *: Some systems don't have INFINITY
2010-10-15Various general fixes and cleanupsSteve Bennett1-10/+10
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
2010-10-15aio fixesSteve Bennett1-1/+1
Fix argument checking/rearrangement in Tcl I/O compat Better aio error messages
2010-10-15Bugs, features and testsSteve Bennett1-25/+32
source fails with zero length file unknown can't be called recursively *: This can be useful when using unknown to dynamically load code, which may in turn want to dynamically load code *: Limit it to 50 recursions though Allow string greater/less comparison *: Comparing two strings for order did not work Implement file join *: It's not to hard and is handy when working with the current dir, "" Don't omit [unknown] completely from stack trace *: Since we lose valuable informtion, just omit the name Fix return from case Turn regexp patterns into real objects *: Thus caching the compiled regexps Allow error to rethrow an error Replace bcopy() with more standard memcpy() Fixes to parray, improve errorInfo *: errorInfo takes an optional stack trace Add tests for rethrowing errors via errorInfo Fix ndelay *: Was looking at wrong param *: Also fix usage/help for aio.socket Package should be able to call exit *: Currently any return from a package is changed to JIM_ERR Line counting is incorrect for backlash newline
2010-10-15Improve error handlingSteve Bennett1-1/+7
*: Improve stack trace handling on errors *: Add 'info source' *: Add 'info stacktrace' *: Add errorInfo procedure to generate a human readable stack trace *: Add tests for stacktrace ------------------------------------------------------------------------
2010-10-15Implement some new featuresSteve Bennett1-2/+2
Implement 'lreplace' Implement 'string last' Implement 'pid' Implement 'info procs' Implement 'info script' Implement 'info patchlevel' as an alias for 'info version' Implement syslog extensions for jim Fix return code display in jim-interactive.c Make jim more compatible if JIM_TCL_COMPAT is set *: Use tcl_interactive rather than jim_interactive *: Use auto_path rather than jim_libpath Add "." to the lib search path, not "./" Fix a couple of files with CRLF line endings
2010-10-15Fix some runtime errorsSteve Bennett1-2/+9
Need to duplicate a possibly shared object when loading a package fails Need to initialise signal-related fields in the jim interp Return an error from 'lsort -command' on failure
2010-10-15Convert package to use jim-subcmdSteve Bennett1-67/+100
Also, no need to install tcl extensions Display any errors from loading static extensions
2010-10-15Small improvementsSteve Bennett1-3/+6
Save (but then cleanup) generated extensions Add package and readdir to 'all' extensions Order of static extensions matters!! Simple C define support for configured extensions Fix some compiler warnings
2010-10-15Lots of improvementsSteve Bennett1-0/+72
jim --- Add a unique id facility to jim (Jim_GetId()) Remove unused jim_vasprintf(), Jim_AppendString_sprintf() Remove duplicate output in Jim_Panic() Add support for catch -signal aio --- Use this for aio handles aio automatically creates stdin, stdout and stderr channels Jim_AioFilehandle() returns the 'FILE *' filehandle for a channel If JIM_TCL_COMPAT is set, create top level open, close, read, puts, etc. load ---- load core command split out into jim-load.c package ------- package core command split out into jim-package.c added 'package list' posix ----- Remove os.sleep, os.usleep, os.sethostname, os.signal, pit, Jpit Most of these are in 'signal'
2010-10-15Simplify package command to ignore versionsSteve Bennett1-237/+25
Also remove win32 support
2010-10-15Split package and load out of jim.cSteve Bennett1-0/+349