Tcl_StackChannel, Tcl_UnstackChannel, Tcl_GetStackedChannel, Tcl_GetTopChannel − manipulate stacked I/O channels


#include <tcl.h>

(interp, typePtr, clientData, mask, channel)

(interp, channel)




Tcl_Interp *interp (in)

Interpreter for error reporting.

Tcl_ChannelType *typePtr (in)

The new channel I/O procedures to use for channel.

ClientData clientData (in)

Arbitrary one-word value to pass to channel I/O procedures.

int mask (in)

Conditions under which channel will be used: OR-ed combination of TCL_READABLE, TCL_WRITABLE and TCL_EXCEPTION. This can be a subset of the operations currently allowed on channel.

Tcl_Channel channel (in)

An existing Tcl channel such as returned by Tcl_CreateChannel.



These functions are for use by extensions that add processing layers to Tcl I/O channels. Examples include compression and encryption modules. These functions transparently stack and unstack a new channel on top of an existing one. Any number of channels can be stacked together.

The implementation of the Tcl channel code was rewritten in 8.3.2 to correct some problems with the previous implementation with regard to stacked channels. Anyone using stacked channels or creating stacked channel drivers should update to the new TCL_CHANNEL_VERSION_2 Tcl_ChannelType structure. See Tcl_CreateChannel for details.

Tcl_StackChannel stacks a new channel on an existing channel with the same name that was registered for channel by Tcl_RegisterChannel.

Tcl_StackChannel works by creating a new channel structure and placing itself on top of the channel stack. EOL translation, encoding and buffering options are shared between all channels in the stack. The hidden channel does no buffering, newline translations, or character set encoding. Instead, the buffering, newline translations, and encoding functions all remain at the top of the channel stack. A pointer to the new top channel structure is returned. If an error occurs when stacking the channel, NULL is returned instead.

The mask parameter specifies the operations that are allowed on the new channel. These can be a subset of the operations allowed on the original channel. For example, a read-write channel may become read-only after the Tcl_StackChannel call.

Closing a channel closes the channels stacked below it. The close of stacked channels is executed in a way that allows buffered data to be properly flushed.

Tcl_UnstackChannel reverses the process. The old channel is associated with the channel name, and the processing module added by Tcl_StackChannel is destroyed. If there is no old channel, then Tcl_UnstackChannel is equivalent to Tcl_Close. If an error occurs unstacking the channel, TCL_ERROR is returned, otherwise TCL_OK is returned.

Tcl_GetTopChannel returns the top channel in the stack of channels the supplied channel is part of.

Tcl_GetStackedChannel returns the channel in the stack of channels which is just below the supplied channel.


Notifier(3), Tcl_CreateChannel(3), Tcl_OpenFileChannel(3), vwait(n).


channel, compression

More Linux Commands

XCompositeRedirectSubwindows(3) - X Composite Extension libr
The composite extension provides several related mechanisms: Per-hierarchy storage The rendering of an entire hierarchy of windows is redirected to off-screen s

man(1) - an interface to the on-line reference manuals......
man is the systems manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of

setsid(2) - creates a session and sets the process group ID
setsid() creates a new session if the calling process is not a process group leader. The calling process is the leader of the new session, the process group lea

pam_syslog(3) - send messages to the system logger (ManPage)
The pam_syslog function logs messages using syslog(3) and is intended for internal use by Linux-PAM and PAM service modules. The priority argument is formed by

aulastlog(8) a program similar to lastlog - Linux man page
aulastlog is a program that prints out the last login for all users of a machine similar to the way lastlog does. The login-name, port, and last login time will

gnutls_pkcs11_obj_export(3) - API function - Linux man page
This function will export the PKCS11 object data. It is normal for data to be inaccesible and in that case GNUTLS_E_INVALID_REQUEST will be returned. If the buf

glPixelMapuiv(3gl) - set up pixel transfer maps (Man Page)
glPixelMap sets up translation tables, or maps, used by glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSub

LIST_ENTRY(3) implementations of lists, tail queues, and cir
These macros define and operate on three types of data structures: lists, tail queues, and circular queues. All three structures support the following functiona

pcre16_get_substring(3) Perl-compatible regular expressions
This is a convenience function for extracting a captured substring. The arguments are: subject Subject that has been successfully matched ovector Offset vector

rendercheck(1) - simple tests of the X Render extension.....
rendercheck is a set of simple tests of the X Render extension. It is designed for authors of Render implementations in X Servers. OPTIONS -d|--display display

Mail::SPF::Mech::A(3pm) - SPF record "a" mechanism class....
An object of class Mail::SPF::Mech::A represents an SPF record mechanism of type a. Constructors The following constructors are provided: new(%options): returns

gethostbyname_r(3) - get network host entry - Linux man page
The gethostbyname*(), gethostbyaddr*(), herror(), and hstrerror() functions are obsolete. Applications should use getaddrinfo(3), getnameinfo(3), and gai_strerr

We can't live, work or learn in freedom unless the software we use is free.