aboutsummaryrefslogtreecommitdiff
path: root/examples
AgeCommit message (Collapse)AuthorFilesLines
2024-02-17examples/tip.tcl: No need for output-on-writableSteve Bennett1-33/+6
Now that the I/O subsystem does auto-flush on write we no longer need to manually set up a writable handler.
2023-07-04interactive: enable hint supportSteve Bennett1-2/+2
And add a default implementation of tcl::stdhint to add hinting for some built-in commands. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04aio: change to use unix io, not stdioSteve Bennett1-10/+6
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-02-13redis: Add -async supportSteve Bennett1-0/+62
Supports communication with redis as part of an event loop Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-02-13vwait -signal docs and test scriptSteve Bennett1-0/+26
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2022-08-21docs: update for 0.81+Steve Bennett1-0/+27
Document changes since 0.81 and add documentation for new filename return for sockets. Internal version is now 0.82 in preparation for (eventual) 0.82 release. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2022-08-20oo: better object constructionSteve Bennett1-14/+24
Now a default constructor is created, as an alias for defaultconstrutor. The constructor is passed the arguments to new and by default this accepts a dictionary that is checked for valid instance variables and sets them. However the constructor can be replaced by one that takes arbitrary arguments. Thus we can how have: a new -optiona -optionb And the constructor is invoked with arguments '-optiona -optionab'. This makes object initialisation more flexible. ** Note: This is an incompatible change if you have classes with a constructor and you create object instances with new <dict>. Signed-off-by: Steve Bennett <steveb@workware.net.au> Documentation fixes - Co-authored-by: Adrian Ho <the.gromgit@gmail.com>
2022-07-25examples/redis-pubsub.tcl: better error handlingSteve Bennett1-10/+23
More gracefully handle errors, e.g. the redis server going away in line with how a real client would do this. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2022-05-17jim-redis: Add support for -typeSteve Bennett1-0/+11
For retrieving type information of return values. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2022-02-23aio: gets: Improve behaviour for non-blocking streamsSteve Bennett1-0/+38
Previously calling gets on a non-blocking stream could easily result in a partial line. Now if a partial line is read, return zero/empty to indicate that nothing is available while storing the partial line. The next call to gets (typically within a readable script) will continue appending to the previous partial line until a complete line can be returned. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-10jcov, jtime, jtrace: fix not removing callbackD. Bohdan3-3/+3
2021-01-09jimdb: A command line Jim debugger using xtraceSteve Bennett4-0/+176
Also add some additional tools that use xtrace. examples/jcov - code coverage examples/jtime - code coverage that measures execution time examples/jtrace - trace script execution Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01sdl: Add basic text supportSteve Bennett4-21/+734
Requires a truetype font file Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01Add examples/sdlevents.tclSteve Bennett1-0/+76
Add example of integrating SDL event loop and the Tcl event loop Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01sdl: convert to using jim-subcmdSteve Bennett2-20/+66
And add: - poll ?script? - optional window title Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-01sdl: Add support for SDL2Steve Bennett1-0/+28
Now we only support using pkg-config to find SDL, and prefer SDL2 over SDL. For compatibility between versions, the render surface is now cleared on flip. And closing the window now results in a JIM_EXIT return code from flip. Also supports [sdl clear] to clear the background to a given colour. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-11-15redis: Add simple redis client extensionSteve Bennett2-0/+115
Using the hiredis client library. Synchronous API only. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06aio: ssl: Allow SNI to be specifiedSteve Bennett3-52/+52
For some SSL connections it is necessary to set the Server Name Indication in the connection in order to receive the correct certificate. Allow this as part of the client ssl call with: $sock ssl -sni $servername Also for -server mode, allow the certificate and private key to be stored in a single file and only be specified once. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-11-15Update ssl cert to use a 4096 bit keySteve Bennett2-19/+75
Keep newer libssl happy Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-07-01aio: Add dgram unix socket supportSteve Bennett4-0/+110
Also add support for sockname and peername And remove unix domain sockets when the socket is closed And generally clean up the socket support Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-10-21doc: Update remaining references to os.waitSteve Bennett2-2/+2
Now simply 'wait' Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-09-21examples/tip.tcl: Use 'writable' when sending outputSteve Bennett1-7/+39
Avoids situations where the output might block Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-09-15history: Add autocompletion supportSteve Bennett1-0/+2
With 'history completion <cmd>' Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-10-26examples/tip.tcl: Gracefully handle serial port being removedSteve Bennett1-2/+9
e.g. a usb-serial port Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-10-19examples/tip.tcl: Lock the deviceSteve Bennett1-0/+5
Prevent multiple access to a serial port by using locking. This is probably compatible with most serial port locking on Linux. Perhaps on macosx. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-09-09Add examples/tip.tclSteve Bennett1-0/+148
Example of using the aio termios support Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-03-27oo: constructor, unknown and bug fixesSteve Bennett1-1/+16
- Added support for constructor, runs on new object creation - Added support for "unknown" method - Rename some dispatch variables (add double underscore) to avoid collision with user variables Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-02-01aio: fix aio ssl supportSteve Bennett4-1/+31
The following changes were not merged: - commit examples/{certificate,key}.pem - return AioFile from JimMakeChannel to allow ssl-specific settings to be set - improve examples/ssl.{client,server} so they work out-of-the-box Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-02-01aio: add OpenSSL/LibreSSL bindings.Dima Krasner2-0/+51
Example usage: set s [socket stream.server 127.0.0.1:8443] set c [[$s accept] ssl -server certificate.pem key.pem] puts [$c gets]
2014-09-01aio: optional argument addrvar for accept.Danyil Bohdan1-1/+2
2013-11-11Enhance examples/jtclsh.tclSteve Bennett1-11/+33
Now uses [info complete] to support continuations. Includes error code indication Signed-off-by: Steve Bennett <steveb@workware.net.au>
2013-08-02Correct file handler should be deletedSteve Bennett1-1/+1
Previously, Jim_DeleteFileHandler() would indiscriminately delete the first matching file handler in the list. Instead, it should delete the file handler matching the event mask. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2012-02-14Update examples/dns.tcl to match tcllibSteve Bennett1-184/+209
Now that Jim Tcl supports namespaces, dns.tcl from tcllib can be used with very few changes. Revert as much as possible to the original tcllib version in order to better show the differences between Jim Tcl and big Tcl. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-12-12Add support for lightweight namespacesSteve Bennett1-34/+29
See README.namespaces Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-12-09Add the history commandSteve Bennett1-0/+36
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-30examples/udp.client needs buffering noneSteve Bennett1-2/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-30Fix the poor-man's 'variable' in dns.tclSteve Bennett1-1/+1
Redefining upvar links is no longer allowed Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-26Class vars should take precedenceSteve Bennett1-0/+2
...over baseclass vars. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-24Restucture jim-aio for less duplication of codeSteve Bennett1-0/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-08-31Add examples of Metakit usage to examples/metakit.tclAlexander Shpilkin1-0/+112
2011-06-10Add aio support for bufferingSteve Bennett3-3/+5
And fconfigure for Tcl compatibility Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-10Add a dns/binary exampleSteve Bennett2-0/+1228
This is take from the tcllib dns package and shows the high level of compatibility with Tcl. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-04-23Clean out the tcltests directorySteve Bennett2-0/+102
Some tests are already in tests/, move some others. Move some examples to the examples directory Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-16Add a pure-TCl OO implementation to JimSteve Bennett1-0/+137
And document the OO extension in README.oo Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-03Fix some problems with the packaging systemSteve Bennett1-0/+2
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-15Implement 'pid handle'Steve Bennett1-1/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add an optional 'putter' function to parraySteve Bennett1-0/+17
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Implement open "|..."Steve Bennett1-0/+19
Uses a Tcl wrapper, popen, from tclcompat Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add basic ipv6 support to JimSteve Bennett5-2/+79
Use -ipv6 to signify that ipv6 should be used Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Small improvements to testsSteve Bennett1-0/+16
Make exec-9.7 test more reliable Quieten jim tests unless running manually Add jim pipe example Signed-off-by: Steve Bennett <steveb@workware.net.au>