1term::receive(n) Terminal control term::receive(n)
2
3
4
5______________________________________________________________________________
6
8 term::receive - General input from terminals
9
11 package require Tcl 8.4
12
13 package require term::receive ?0.1?
14
15 ::term::receive::getch ?chan?
16
17 ::term::receive::listen cmd ?chan?
18
19 cmd process string
20
21 cmd eof
22
23 ::term::receive::unlisten ?chan?
24
25_________________________________________________________________
26
28 This package provides the most primitive commands for receiving charac‐
29 ters to a terminal. They are in essence convenient wrappers around the
30 builtin commands read and fileevent.
31
32 ::term::receive::getch ?chan?
33 This command reads a single character from the channel with han‐
34 dle chan and returns it as the result of the command.
35
36 If not specified chan defaults to stdin.
37
38 It is the responsibility of the caller to make sure that the
39 channel can provide single characters. On unix this can be done,
40 for example, by using the command of package
41 term::ansi::ctrl::unix.
42
43 ::term::receive::listen cmd ?chan?
44 This command sets up a filevent listener for the channel with
45 handle chan and invokes the command prefix cmd whenever charac‐
46 ters have been received, or EOF was reached.
47
48 If not specified chan defaults to stdin.
49
50 The signature of the command prefix is
51
52 cmd process string
53 This method is invoked when characters were received, and
54 string holds them for processing.
55
56 cmd eof
57 This method is invoked when EOF was reached on the chan‐
58 nel we listen on. It will be the last call to be
59 received by the callback.
60
61 ::term::receive::unlisten ?chan?
62 This command disables the filevent listener for the channel with
63 handle chan.
64
65 If not specified chan defaults to stdin.
66
68 character input, control, get character, listener, receiver, terminal
69
71 Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
72
73
74
75
76term 0.1 term::receive(n)