memchan(3tcl)

πŸ“¦
version 2.3 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– memchan β€” the C API edition (it's memchan(3tcl) bestie, section 3, C library, let's GO)

okay so if you're a C extension author and you want in on the memory-channel magic, this is your page. no cap. πŸ¦‹


✨ SYNOPSIS ✨

package require Tcl

package require memchan
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)

🌸 DESCRIPTION 🌸

The memchan package ships a whole C API for third-party extension writers to use, because she's generous like that πŸ’…. It's exposed by a Tcl stubs library table β€” which is the same move Tcl itself makes β€” specifically so that version dependency stays low. Obsessed. ✨


πŸ‘‘ COMMAND πŸ‘‘

the whole lineup, one by one, no skips:

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 of these functions creates and returns a channel exactly as described in the Tcl command pages for each of the memchan commands, fr fr. And plot twist β€” the Tcl commands are lowkey just calling these functions internally to make their channels. main character energy from the C side tbh. πŸ’–

The memchan channel accepts an initialSize argument so you can pre-allocate space for the internal buffer if you want to be fancy. Normally you can just set it to 0 and vibe. 🫢

The fifo2 API function looks a little different because β€” and this is the whole reason β€” it must return two linked channels. two of them. a matched set. πŸ’•


πŸŽ€ SEE ALSO πŸŽ€

  • Tcl_GetChannelName

Copyright (c) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>


and that's the page bestie, thanks for coming to my ted talk 🧚 β€” this was Memory channels, version 2.2, stamped memchan(3tcl), mwah πŸ’‹

πŸ“¦ where this page comes from