memchan(3tcl)
π NAME π
memchan β the girl who creates and manipulates memory channels, no cap β¨
πΈ SYNOPSIS πΈ
package require Tcl
package require memchan
memchan ?-initial-size len?
π¦ DESCRIPTION π¦
okay so bestie, this manpage is doing double duty β it documents both the whole package and the command memchan. iykyk.
The package itself hands you a bunch of in-memory channels that you can use to:
- capture stream-like information in a natural way instead of using
setandappendto manipulate strings π«Ά - or transfer data between interpreters, in the same thread or not. periodt π
π COMMAND π
memchan ?-initial-size len?
creates a chunk-oriented in-memory channel and returns its handle. If you specify an initial size, the system will pre-allocate len bytes of buffer space for the contents. This is no restriction on the ultimate size of the channel β it will always grow as much as is necessary to accommodate the data written into it. she's a grower, not a shower πβ¨
The channels created here can be transferred between interpreters in the same thread and between threads, but only as a whole. It is not possible to use them to create a bi- or unidirectional connection between two interpreters. sorry bestie, that's just not her vibe π
Memory channels created by memchan provide two read-only options which can be queried via the standard fconfigure command. These are:
-lengthβ the value of this option is the number of bytes currently stored in the queried memory channel. π-allocatedβ the value of this option is the number of bytes currently allocated by the queried memory channel. This number is at least as big as the value of-length. π
As the channels generated by memchan grow as necessary, they are always writable. This means that a writable fileevent-handler will fire continuously. she's always ready, main character energy fr fr π
The channels are also readable if they contain more than zero bytes and the seek location is not at the end of the channel. Under these conditions a readable fileevent-handler will fire continuously too. β
β οΈ heads up bestie: note that writing to such a channel usually occurs at the end, thus suppressing readable events. This also means that users have to take care to seek the channel to a location before the end before trying to read data back. don't get caught slipping π
π SEE ALSO π
fifo, fifo2, null, random, zero
π KEYWORDS π
channel, chunk, i/o, in-memory channel, memchan
β¨ COPYRIGHT β¨
Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole thing bestie π«Ά this was Memory channels, version 2.2, manual section memchan(3tcl) β slay, read responsibly, mwah ππ
π¦ where this page comes from
- debian trixie: tcl-memchan 2.3+dfsg-2
- ubuntu questing: tcl-memchan 2.3+dfsg-2
- ubuntu resolute: tcl-memchan 2.3+dfsg-2build1
- ubuntu stonking: tcl-memchan 2.3+dfsg-5
- Copyright (c) 1996-2003 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms