ChnlStack.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
- '"
- '" Copyright (c) 1999-2000 Ajuba Solutions.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: ChnlStack.3,v 1.4.4.1 2004/07/16 20:10:58 andreas_kupries Exp $
- .so man.macros
- .TH Tcl_StackChannel 3 8.3 Tcl "Tcl Library Procedures"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- Tcl_StackChannel, Tcl_UnstackChannel, Tcl_GetStackedChannel, Tcl_GetTopChannel - stack an I/O channel on top of another, and undo it
- .SH SYNOPSIS
- .nf
- .nf
- fB#include <tcl.h>fR
- .sp
- Tcl_Channel
- fBTcl_StackChannelfR(fIinterp, typePtr, clientData, mask, channelfR)
- .sp
- int
- fBTcl_UnstackChannelfR(fIinterp, channelfR)
- .sp
- Tcl_Channel
- fBTcl_GetStackedChannelfR(fIchannelfR)
- .sp
- Tcl_Channel
- fBTcl_GetTopChannelfR(fIchannelfR)
- .sp
- .SH ARGUMENTS
- .AS Tcl_ChannelType
- .AP Tcl_Interp *interp in
- Interpreter for error reporting.
- .AP Tcl_ChannelType *typePtr in
- The new channel I/O procedures to use for fIchannelfP.
- .AP ClientData clientData in
- Arbitrary one-word value to pass to channel I/O procedures.
- .AP int mask in
- Conditions under which fIchannelfR will be used: OR-ed combination of
- fBTCL_READABLEfR, fBTCL_WRITABLEfR and fBTCL_EXCEPTIONfR.
- This can be a subset of the operations currently allowed on fIchannelfP.
- .AP Tcl_Channel channel in
- An existing Tcl channel such as returned by fBTcl_CreateChannelfR.
- .BE
- .SH DESCRIPTION
- .PP
- 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.
- .PP
- 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 fBTCL_CHANNEL_VERSION_2fR
- fBTcl_ChannelTypefR structure. See fBTcl_CreateChannelfR for details.
- .PP
- fBTcl_StackChannelfR stacks a new fIchannelfP on an existing channel
- with the same name that was registered for fIchannelfP by
- fBTcl_RegisterChannelfP.
- .PP
- fBTcl_StackChannelfR 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.
- .PP
- The fImaskfP 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 fBTcl_StackChannelfR call.
- .PP
- 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.
- .PP
- fBTcl_UnstackChannelfP reverses the process. The old channel is
- associated with the channel name, and the processing module added by
- fBTcl_StackChannelfR is destroyed. If there is no old channel, then
- fBTcl_UnstackChannelfP is equivalent to fBTcl_ClosefP. If an error
- occurs unstacking the channel, fBTCL_ERRORfR is returned, otherwise
- fBTCL_OKfR is returned.
- .PP
- fBTcl_GetTopChannelfR returns the top channel in the stack of
- channels the supplied channel is part of.
- .PP
- fBTcl_GetStackedChannelfR returns the channel in the stack of
- channels which is just below the supplied channel.
- .SH "SEE ALSO"
- Notifier(3), Tcl_CreateChannel(3), Tcl_OpenFileChannel(3), vwait(n).
- .SH KEYWORDS
- channel, compression