Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/ChnlStack.3 @ 25

Last change on this file since 25 was 25, checked in by landauf, 17 years ago

added tcl to libs

File size: 3.9 KB
Line 
1'\"
2'\" Copyright (c) 1999-2000 Ajuba Solutions.
3'\"
4'\" See the file "license.terms" for information on usage and redistribution
5'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6'\"
7'\" RCS: @(#) $Id: ChnlStack.3,v 1.8 2006/11/15 09:23:01 dkf Exp $
8.so man.macros
9.TH Tcl_StackChannel 3 8.3 Tcl "Tcl Library Procedures"
10.BS
11'\" Note:  do not modify the .SH NAME line immediately below!
12.SH NAME
13Tcl_StackChannel, Tcl_UnstackChannel, Tcl_GetStackedChannel, Tcl_GetTopChannel \- manipulate stacked I/O channels
14.SH SYNOPSIS
15.nf
16.nf
17\fB#include <tcl.h>\fR
18.sp
19Tcl_Channel
20\fBTcl_StackChannel\fR(\fIinterp, typePtr, clientData, mask, channel\fR)
21.sp
22int
23\fBTcl_UnstackChannel\fR(\fIinterp, channel\fR)
24.sp
25Tcl_Channel
26\fBTcl_GetStackedChannel\fR(\fIchannel\fR)
27.sp
28Tcl_Channel
29\fBTcl_GetTopChannel\fR(\fIchannel\fR)
30.sp
31.SH ARGUMENTS
32.AS Tcl_ChannelType clientData
33.AP Tcl_Interp *interp in
34Interpreter for error reporting.
35.AP Tcl_ChannelType *typePtr in
36The new channel I/O procedures to use for \fIchannel\fR.
37.AP ClientData clientData in
38Arbitrary one-word value to pass to channel I/O procedures.
39.AP int mask in
40Conditions under which \fIchannel\fR will be used: OR-ed combination of
41\fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR and \fBTCL_EXCEPTION\fR.
42This can be a subset of the operations currently allowed on \fIchannel\fR.
43.AP Tcl_Channel channel in
44An existing Tcl channel such as returned by \fBTcl_CreateChannel\fR.
45.BE
46
47.SH DESCRIPTION
48.PP
49These functions are for use by extensions that add processing layers to Tcl
50I/O channels.  Examples include compression and encryption modules.  These
51functions transparently stack and unstack a new channel on top of an
52existing one.  Any number of channels can be stacked together.
53.PP
54The implementation of the Tcl channel code was rewritten in 8.3.2 to
55correct some problems with the previous implementation with regard to
56stacked channels.  Anyone using stacked channels or creating stacked
57channel drivers should update to the new \fBTCL_CHANNEL_VERSION_2\fR
58\fBTcl_ChannelType\fR structure.  See \fBTcl_CreateChannel\fR for details.
59.PP
60\fBTcl_StackChannel\fR stacks a new \fIchannel\fR on an existing channel
61with the same name that was registered for \fIchannel\fR by
62\fBTcl_RegisterChannel\fR.
63.PP
64\fBTcl_StackChannel\fR works by creating a new channel structure and
65placing itself on top of the channel stack.  EOL translation, encoding and
66buffering options are shared between all channels in the stack.  The hidden
67channel does no buffering, newline translations, or character set encoding.
68Instead, the buffering, newline translations, and encoding functions all
69remain at the top of the channel stack.  A pointer to the new top channel
70structure is returned.  If an error occurs when stacking the channel, NULL
71is returned instead.
72.PP
73The \fImask\fR parameter specifies the operations that are allowed on the
74new channel.  These can be a subset of the operations allowed on the
75original channel.  For example, a read-write channel may become read-only
76after the \fBTcl_StackChannel\fR call.
77.PP
78Closing a channel closes the channels stacked below it.  The close of
79stacked channels is executed in a way that allows buffered data to be
80properly flushed.
81.PP
82\fBTcl_UnstackChannel\fR reverses the process.  The old channel is
83associated with the channel name, and the processing module added by
84\fBTcl_StackChannel\fR is destroyed.  If there is no old channel, then
85\fBTcl_UnstackChannel\fR is equivalent to \fBTcl_Close\fR.  If an error
86occurs unstacking the channel, \fBTCL_ERROR\fR is returned, otherwise
87\fBTCL_OK\fR is returned.
88.PP
89\fBTcl_GetTopChannel\fR returns the top channel in the stack of
90channels the supplied channel is part of.
91.PP
92\fBTcl_GetStackedChannel\fR returns the channel in the stack of
93channels which is just below the supplied channel.
94
95.SH "SEE ALSO"
96Notifier(3), Tcl_CreateChannel(3), Tcl_OpenFileChannel(3), vwait(n).
97
98.SH KEYWORDS
99channel, compression
Note: See TracBrowser for help on using the repository browser.