Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

receive(n) [osx man page]

term::receive(n)						 Terminal control						  term::receive(n)

__________________________________________________________________________________________________________________________________________________

NAME
term::receive - General input from terminals SYNOPSIS
package require Tcl 8.4 package require term::receive ?0.1? ::term::receive::getch ?chan? ::term::receive::listen cmd ?chan? cmd process string cmd eof ::term::receive::unlisten ?chan? _________________________________________________________________ DESCRIPTION
This package provides the most primitive commands for receiving characters to a terminal. They are in essence convenient wrappers around the builtin commands read and fileevent. ::term::receive::getch ?chan? This command reads a single character from the channel with handle chan and returns it as the result of the command. If not specified chan defaults to stdin. It is the responsibility of the caller to make sure that the channel can provide single characters. On unix this can be done, for example, by using the command of package term::ansi::ctrl::unix. ::term::receive::listen cmd ?chan? This command sets up a filevent listener for the channel with handle chan and invokes the command prefix cmd whenever characters have been received, or EOF was reached. If not specified chan defaults to stdin. The signature of the command prefix is cmd process string This method is invoked when characters were received, and string holds them for processing. cmd eof This method is invoked when EOF was reached on the channel we listen on. It will be the last call to be received by the callback. ::term::receive::unlisten ?chan? This command disables the filevent listener for the channel with handle chan. If not specified chan defaults to stdin. BUGS, IDEAS, FEEDBACK 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. KEYWORDS
character input, control, get character, listener, receiver, terminal CATEGORY
Terminal control COPYRIGHT
Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net> term 0.1 term::receive(n)

Check Out this Related Man Page

term::receive::bind(n)						 Terminal control					    term::receive::bind(n)

__________________________________________________________________________________________________________________________________________________

NAME
term::receive::bind - Keyboard dispatch from terminals SYNOPSIS
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 _________________________________________________________________ DESCRIPTION
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. CLASS API
The package exports a single command, the class command, enabling the creation of dispatcher instances. Its API is: term::receive::bind object ?map? This command creates a new dispatcher object with the name object, initializes it, and returns the fully qualified name of the object command as its result. 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. OBJECT API
The objects created by the class command provide the methods listed below: object map str cmd This method adds an additional mapping from the string str to the action cmd. The mapping will take effect immediately should the processor be in a prefix of str, or at the next reset operation. The action is a command prefix and will be invoked with one argu- ment appended to it, the character sequence causing the invokation. It is executed in the global namespace. object default cmd This method defines a default action cmd which will be invoked whenever an unknown character sequence is encountered. The command prefix is handled in the same as the regular action defined via method map. object listen ?chan? This methods sets up a filevent listener for the channel with handle chan and invokes the dispatcher object whenever characters have been received, or EOF was reached. If not specified chan defaults to stdin. object unlisten ?chan? This methods removes the filevent listener for the channel with handle chan. If not specified chan defaults to stdin. object reset This method resets the character processor to the beginning of the tree. object next char This method causes the character processor to process the character c. This may simply advance the internal state, or invoke an associated action for a recognized sequence. object process str This method causes the character processor to process the character sequence str, advancing the internal state and invoking action as necessary. This is a callback for listen. object eof This method causes the character processor to handle EOF on the input. This is currently no-op. This is a callback for listen. NOTES
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. BUGS, IDEAS, FEEDBACK 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. KEYWORDS
character input, control, dispatcher, listener, receiver, terminal CATEGORY
Terminal control COPYRIGHT
Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net> term 0.1 term::receive::bind(n)
Man Page