This is not necessarily the current version of this TIP.
| TIP: | 220 |
| Title: | Add Tcl_SetChannelMode |
| Version: | $Revision: 1.1 $ |
| Author: | Colin McCormack <colin at sharedtech dot dyndns dot org> |
| State: | Draft |
| Type: | Project |
| Tcl-Version: | 8.5 |
| Vote: | Pending |
| Created: | Sunday, 12 September 2004 |
This TIP allows the tclvfs extension to adjust the writability of a channel within its close callbacks.
In order for the tclvfs extension to close a channel, it may need to write to that channel. If the channel is opened read-only, this causes a problem. This TIP proposes a new API that allows C code to modify the read/write status of a channel so that the close operation can be completed properly.
The following function, Tcl_SetChannelMode (the name analogous to the existing Tcl_GetChannelMode) will be added to the core and published as part of Tcl's public C API.
void
Tcl_SetChannelMode(chan, mode)
Tcl_Channel chan;
int mode;
{
ChannelState *statePtr = ((Channel*)chan)->state;
state->flags &= ~(TCL_READABLE | TCL_WRITABLE);
state->flags |= mode & (TCL_READABLE | TCL_WRITABLE);
}
This document has been placed in the public domain.
This is not necessarily the current version of this TIP.