1tcl::chan::halfpipe(n) Reflected/virtual channel supporttcl::chan::halfpipe(n)
2
3
4
5______________________________________________________________________________
6
8 tcl::chan::halfpipe - In-memory channel, half of a fifo2
9
11 package require Tcl 8.5
12
13 package require TclOO
14
15 package require tcl::chan::events ?1?
16
17 package require tcl::chan::halfpipe ?1.0.1?
18
19 ::tcl::chan::halfpipe ?-option value...?
20
21 objectCmd put bytes
22
23______________________________________________________________________________
24
26 The tcl::chan::halfpipe package provides a command creating one half of
27 a tcl::chan::fifo2 pair. Writing into such a channel invokes a set of
28 callbacks which then handle the data. This is similar to a channel han‐
29 dler, except having a much simpler API.
30
31 The internal TclOO class implementing the channel handler is a sub-
32 class of the tcl::chan::events framework.
33
35 ::tcl::chan::halfpipe ?-option value...?
36 This command creates a halfpipe channel and configures it with
37 the callbacks to run when the channel is closed, data was writ‐
38 ten to it, or ran empty. See the section Options for the list of
39 options and associated semantics. The result of the command is
40 a list containing two elements, the handle of the new channel,
41 and the object command of the channel handler, in this order.
42 The latter is supplied to the caller to provide her with access
43 to the put method for adding data to the channel.
44
45 Two halfpipes with a bit of glue logic in the callbacks make for
46 one tcl::chan::fifo2.
47
48 objectCmd put bytes
49 This method of the channel handler object puts the data bytes
50 into the channel so that it can be read from it.
51
53 -close-command cmdprefix
54 This callback is invoked when the channel is closed. A single
55 argument is supplied, the handle of the channel being closed.
56 The result of the callback is ignored.
57
58 -write-command cmdprefix
59 This callback is invoked when data is written to the channel.
60 Two arguments are supplied, the handle of the channel written
61 to, and the data written. The result of the callback is ig‐
62 nored.
63
64 -empty-command cmdprefix
65 This callback is invoked when the channel has run out of data to
66 read. A single argument is supplied, the handle of the channel.
67
69 This document, and the package it describes, will undoubtedly contain
70 bugs and other problems. Please report such in the category virtchan‐
71 nel of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].
72 Please also report any ideas for enhancements you may have for either
73 package and/or documentation.
74
75 When proposing code changes, please provide unified diffs, i.e the out‐
76 put of diff -u.
77
78 Note further that attachments are strongly preferred over inlined
79 patches. Attachments can be made by going to the Edit form of the
80 ticket immediately after its creation, and then using the left-most
81 button in the secondary navigation bar.
82
84 callbacks, fifo, in-memory channel, reflected channel, tip 219, virtual
85 channel
86
88 Channels
89
91 Copyright (c) 2009, 2019 Andreas Kupries <andreas_kupries@users.sourceforge.net>
92
93
94
95
96tcllib 1.0.1 tcl::chan::halfpipe(n)