term::receive::bind(n) | Terminal control | term::receive::bind(n) |
term::receive::bind - Keyboard dispatch from terminals
package require Tcl 8.4
package require term::receive::bind ?0.1?
term::receive::bind object ?map?
object map str cmd
object default cmd
object listen ?chan?
object unlisten ?chan?
object reset
object next char
object process str
object eof
This package provides a class for the creation of simple dispatchers from character sequences to actions. Internally each dispatcher is in essence a deterministic finite automaton with tree structure.
The package exports a single command, the class command, enabling the creation of dispatcher instances. Its API is:
The argument is a dictionary mapping from strings, i.e. character sequences to the command prefices to invoke when the sequence is found in the input stream.
The objects created by the class command provide the methods listed below:
If not specified chan defaults to stdin.
If not specified chan defaults to stdin.
The simplicity of the DFA means that it is not possible to recognize a character sequence with has a another recognized character sequence as its prefix.
In other words, the set of recognized strings has to form a prefix code.
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category term of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation.
character input, control, dispatcher, listener, receiver, terminal
Terminal control
Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
0.1 | term |