memchan(n)
π memchan(n) π
okay bestie, pull up a chair, we're doing the C API today and honestly? it's giving iconic. this is the memchan manual page, section n, and it's about making memory channels from C. yes, from C. no, you don't have to be scared. i got you. π«Ά
β¨ NAME β¨
memchan β the C API for creating memory channels. that's it. that's the whole name. short, sweet, main character energy. π
πΈ SYNOPSIS πΈ
first things first, you gotta have your packages:
package require Tcl
package require memchan
then here's the whole squad of functions, verbatim, no notes:
Tcl_Channel Memchan_CreateMemoryChannel (Tcl_Interp *interp, int initialSize)
Tcl_Channel Memchan_CreateFifoChannel (Tcl_Interp *interp)
void Memchan_CreateFifo2Channel (Tcl_Interp *interp, Tcl_Channel *aPtr, Tcl_Channel *bPtr)
Tcl_Channel Memchan_CreateNullChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateZeroChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateRandomChannel (Tcl_Interp *interp)
look at them. six little functions. so cute. π
π¦ DESCRIPTION π¦
so the memchan package ships a C API specifically for third-party extension writers β that's you, if you're writing extensions, hi bestie π. it's exposed through a Tcl stubs library table, and the whole reason for that is to reduce version dependency, exactly like the way it's available for Tcl itself. so you're not chained to one exact version forever, which is lowkey a slay. β¨
π COMMAND π
okay here's the full roster again, because we do repeat ourselves and that's fine:
Tcl_Channel Memchan_CreateMemoryChannel (Tcl_Interp *interp, int initialSize)
Tcl_Channel Memchan_CreateFifoChannel (Tcl_Interp *interp)
void Memchan_CreateFifo2Channel (Tcl_Interp *interp, Tcl_Channel *aPtr, Tcl_Channel *bPtr)
Tcl_Channel Memchan_CreateNullChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateZeroChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateRandomChannel (Tcl_Interp *interp)
each one of these functions creates and returns a channel exactly as described in the Tcl command pages for each of the memchan commands. like, exactly exactly. no secret extra behaviour, no cap. and plot twist: the Tcl commands themselves internally call these functions to create their channels. so the C API is the girl behind the girl. π
now, the memchan channel takes an initialSize argument, and what that does is let you pre-allocate space for the internal buffer. fancy. normally though? you can just set it to 0 and move on with your life. periodt.
and the fifo2 API function looks a little different, bestie, and there's a real reason: it has to return two linked channels. two. linked. that's why it takes aPtr and bPtr instead of just handing you one channel back. makes sense, right? iconic behaviour honestly. π₯
π SEE ALSO π
Tcl_GetChannelName
go read that one too, iykyk. π
π COPYRIGHT π
Copyright (c) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
and that's the whole page, bestie!! π₯³ this was Memory channels, version 2.2, and the manual is memchan(n) β go forth and build memory channels, you absolute legend. mwah. πβ¨π¦π
π«Άπβ
π¦ where this page comes from
- fedora 43: memchan 2.3-34.fc43 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- fedora 43: memchan 2.3-34.fc43 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- fedora 44: memchan 2.3-35.fc44 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- fedora 44: memchan 2.3-35.fc44 Β· LicenseRef-Callaway-MIT AND LicenseRef-Callaway-Public-Domain
- Copyright (c) 2004 Pat Thoyts <patthoyts@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms