File: receive.man

package info (click to toggle)
tcllib 1.20%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 68,064 kB
  • sloc: tcl: 216,842; ansic: 14,250; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 881; makefile: 107; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (77 lines) | stat: -rw-r--r-- 2,128 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin term::receive n 0.1]
[keywords {character input}]
[keywords control]
[keywords {get character}]
[keywords listener]
[keywords receiver]
[keywords terminal]
[copyright {2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>}]
[moddesc   {Terminal control}]
[titledesc {General input from terminals}]
[category  {Terminal control}]
[require Tcl 8.4]
[require term::receive [opt 0.1]]
[description]

This package provides the most primitive commands for receiving
characters to a terminal. They are in essence convenient wrappers
around the builtin commands [cmd read] and [cmd fileevent].

[list_begin definitions]
[call [cmd ::term::receive::getch] [opt [arg chan]]]

This command reads a single character from the channel with handle
[arg chan] and returns it as the result of the command.

[para]

If not specified [arg chan] defaults to [const stdin].

[para]

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 [package term::ansi::ctrl::unix].

[call [cmd ::term::receive::listen] [arg cmd] [opt [arg chan]]]

This command sets up a filevent listener for the channel with handle
[arg chan] and invokes the command prefix [arg cmd] whenever
characters have been received, or EOF was reached.

[para]

If not specified [arg chan] defaults to [const stdin].

[para]

The signature of the command prefix is

[list_begin definitions]
[call [arg cmd] [method process] [arg string]]

This method is invoked when characters were received, and [arg string]
holds them for processing.

[call [arg cmd] [method 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.

[list_end]

[call [cmd ::term::receive::unlisten] [opt [arg chan]]]

This command disables the filevent listener for the channel with handle
[arg chan].

[para]

If not specified [arg chan] defaults to [const stdin].

[list_end]

[vset CATEGORY term]
[include ../common-text/feedback.inc]
[manpage_end]