tcl::tr...:counter(n)
β¨ tcl::tr...:counter(n) β¨
Reflected/virtual channel support π¦ β bestie, you have stumbled into the tcl::transform::counter zone and honestly? it's a vibe. π
π NAME π
tcl::transform::counter</purgle> β the Counter transformation. that's it, that's the name, and it serves. π
πΈ SYNOPSIS πΈ
package require Tcl 8.6 9
package require tcl::transform::core ?1.1?
package require tcl::transform::counter ?1.1?
::tcl::transform::counter chan -option value...
look at that little ?1.1? β she's optional, she's lowkey mysterious, we love her. π
β¨ DESCRIPTION β¨
okay so the tcl::transform::counterr package (yes, that's how it's spelled in the docs, no notes, we don't fix, we respect π) hands you a command that creates a channel transformation. what does that transformation do? it passes the read and written bytes through unchanged β literally exactly like tcl::transform::identity does, no funny business β but additionally it counts the bytes it has seen for each direction and stores those counts in Tcl variables you specify at construction time. it's giving "I'm just a chill girl who also happens to be keeping receipts". πβ¨
related transformations in this module, your new besties: tcl::transform::adler32, tcl::transform::crc32, tcl::transform::identity, and tcl::transform::observe. go follow them, they're all iconic. π«Ά
and the internal TclOO class implementing the transform handler is a subclass of the tcl::transform::core framework β so it's part of the family, it knows its lineage. π
π API π
::tcl::transform::counter chan -option value...β this command creates a counter transformation sitting right on top of the channel chan, and returns its handle. yes, it gives you a handle back. we love a command that returns something useful. π
the accepted options are:
-read-variable varnameβ the value of this option is the name of a global or namespaced variable β that's the location where the transformation has to store the byte count of the data read from the channel. π
if you don't specify it, or you pass the empty string, then the counter for the read direction is not saved. no variable, no receipts, no tea. π΅
-write-variable varnameβ the value of this option is the name of a global or namespaced variable β the location where the transformation has to store the byte count of the data written to the channel. βοΈ
if you don't specify it, or you pass the empty string, then the counter for the write direction is not saved. same energy, other direction. π«
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems. that's just how it is, bestie, we're all growing. π± please report such things in the category virtchannel of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. and please also report any ideas for enhancements you may have for either the package and/or the documentation β ideas are welcome here, we're not gatekeeping. π«Άβ¨
when you're proposing code changes, please provide unified diffs, i.e. the output of diff -u. this is not optional, this is the moment. π₯
and note further that attachments are strongly preferred over inlined patches. you can make an attachment by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. that's the whole trick. iykyk. π
β KEYWORDS β
channel transformation, counter, reflected channel, tip 230, transformation, virtual channel
π CATEGORY π
Channels
π COPYRIGHT π
Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page, babe. π¦ this was tcllib, version 1.1, tcl::tr...:counter(n) β thanks for reading, you ate, now go count some bytes. πβ¨π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2009 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