⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crtchannel.3

📁 tcl是工具命令语言
💻 3
📖 第 1 页 / 共 3 页
字号:
'\"'\" Copyright (c) 1996-1997 Sun Microsystems, Inc.'\" Copyright (c) 1997-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: CrtChannel.3,v 1.16 2002/07/01 18:24:39 jenglish Exp $.so man.macros.TH Tcl_CreateChannel 3 8.3 Tcl "Tcl Library Procedures".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMETcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption, Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelCloseProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, Tcl_ChannelSeekProc, Tcl_ChannelWideSeekProc, Tcl_ChannelSetOptionProc, Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, Tcl_ChannelHandlerProc, Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, Tcl_IsChannelExisting, Tcl_ClearChannelHandlers, Tcl_GetChannelThread, Tcl_ChannelBuffered \- procedures for creating and manipulating channels.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spTcl_Channel\fBTcl_CreateChannel\fR(\fItypePtr, channelName, instanceData, mask\fR).spClientData\fBTcl_GetChannelInstanceData\fR(\fIchannel\fR).spTcl_ChannelType *\fBTcl_GetChannelType\fR(\fIchannel\fR).spCONST char *\fBTcl_GetChannelName\fR(\fIchannel\fR).spint\fBTcl_GetChannelHandle\fR(\fIchannel, direction, handlePtr\fR).sp.VS 8.4Tcl_ThreadId\fBTcl_GetChannelThread\fR(\fIchannel\fR).VE 8.4.spint\fBTcl_GetChannelBufferSize\fR(\fIchannel\fR).sp\fBTcl_SetChannelBufferSize\fR(\fIchannel, size\fR).sp\fBTcl_NotifyChannel\fR(\fIchannel, mask\fR).spint\fBTcl_BadChannelOption\fR(\fIinterp, optionName, optionList\fR).VS 8.4.spint\fBTcl_IsChannelShared\fR(\fIchannel\fR).spint\fBTcl_IsChannelRegistered\fR(\fIinterp, channel\fR).spint\fBTcl_IsChannelExisting\fR(\fIchannelName\fR).spvoid\fBTcl_CutChannel\fR(\fIchannel\fR).spvoid\fBTcl_SpliceChannel\fR(\fIchannel\fR).spvoid\fBTcl_ClearChannelHandlers\fR(\fIchannel\fR).VE 8.4.spint\fBTcl_ChannelBuffered\fR(\fIchannel\fR).spCONST char *\fBTcl_ChannelName\fR(\fItypePtr\fR).spTcl_ChannelTypeVersion\fBTcl_ChannelVersion\fR(\fItypePtr\fR).spTcl_DriverBlockModeProc *\fBTcl_ChannelBlockModeProc\fR(\fItypePtr\fR).spTcl_DriverCloseProc *\fBTcl_ChannelCloseProc\fR(\fItypePtr\fR).spTcl_DriverClose2Proc *\fBTcl_ChannelClose2Proc\fR(\fItypePtr\fR).spTcl_DriverInputProc *\fBTcl_ChannelInputProc\fR(\fItypePtr\fR).spTcl_DriverOutputProc *\fBTcl_ChannelOutputProc\fR(\fItypePtr\fR).spTcl_DriverSeekProc *\fBTcl_ChannelSeekProc\fR(\fItypePtr\fR).sp.VS 8.4Tcl_DriverWideSeekProc *\fBTcl_ChannelWideSeekProc\fR(\fItypePtr\fR).VE 8.4.spTcl_DriverSetOptionProc *\fBTcl_ChannelSetOptionProc\fR(\fItypePtr\fR).spTcl_DriverGetOptionProc *\fBTcl_ChannelGetOptionProc\fR(\fItypePtr\fR).spTcl_DriverWatchProc *\fBTcl_ChannelWatchProc\fR(\fItypePtr\fR).spTcl_DriverGetHandleProc *\fBTcl_ChannelGetHandleProc\fR(\fItypePtr\fR).spTcl_DriverFlushProc *\fBTcl_ChannelFlushProc\fR(\fItypePtr\fR).spTcl_DriverHandlerProc *\fBTcl_ChannelHandlerProc\fR(\fItypePtr\fR).sp.SH ARGUMENTS.AS Tcl_ChannelType *channelName in.AP Tcl_ChannelType *typePtr inPoints to a structure containing the addresses of procedures thatcan be called to perform I/O and other functions on the channel..AP "CONST char" *channelName inThe name of this channel, such as \fBfile3\fR; must not be in useby any other channel. Can be NULL, in which case the channel iscreated without a name..AP ClientData instanceData inArbitrary one-word value to be associated with this channel.  Thisvalue is passed to procedures in \fItypePtr\fR when they are invoked..AP int mask inOR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicatewhether a channel is readable and writable..AP Tcl_Channel channel inThe channel to operate on..AP int direction in\fBTCL_READABLE\fR means the input handle is wanted; \fBTCL_WRITABLE\fRmeans the output handle is wanted..AP ClientData *handlePtr outPoints to the location where the desired OS-specific handle should bestored..AP int size inThe size, in bytes, of buffers to allocate in this channel..AP int mask inAn OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fRand \fBTCL_EXCEPTION\fR that indicates events that have occurred onthis channel..AP Tcl_Interp *interp inCurrent interpreter. (can be NULL).AP "CONST char" *optionName inName of the invalid option..AP "CONST char" *optionList inSpecific options list (space separated words, without "-") to append to the standard generic options list.Can be NULL for generic options error message only..BE.SH DESCRIPTION.PPTcl uses a two-layered channel architecture. It provides a generic upperlayer to enable C and Tcl programs to perform input and output using thesame APIs for a variety of files, devices, sockets etc. The generic C APIsare described in the manual entry for \fBTcl_OpenFileChannel\fR..PPThe lower layer provides type-specific channel drivers for each typeof device supported on each platform.  This manual entry describes theC APIs used to communicate between the generic layer and thetype-specific channel drivers.  It also explains how new types ofchannels can be added by providing new channel drivers..PPChannel drivers consist of a number of components: First, each channeldriver provides a \fBTcl_ChannelType\fR structure containing pointers tofunctions implementing the various operations used by the generic layer tocommunicate with the channel driver. The \fBTcl_ChannelType\fR structureand the functions referenced by it are described in the sectionTCL_CHANNELTYPE, below..PPSecond, channel drivers usually provide a Tcl command to createinstances of that type of channel. For example, the Tcl \fBopen\fRcommand creates channels that use the file and command channeldrivers, and the Tcl \fBsocket\fR command creates channels that useTCP sockets for network communication..PPThird, a channel driver optionally provides a C function to openchannel instances of that type. For example, \fBTcl_OpenFileChannel\fRopens a channel that uses the file channel driver, and\fBTcl_OpenTcpClient\fR opens a channel that uses the TCP networkprotocol.  These creation functions typically use\fBTcl_CreateChannel\fR internally to open the channel..PPTo add a new type of channel you must implement a C API or a Tcl commandthat opens a channel by invoking \fBTcl_CreateChannel\fR.When your driver calls \fBTcl_CreateChannel\fR it passes ina \fBTcl_ChannelType\fR structure describing the driver's I/Oprocedures.The generic layer will then invoke the functions referenced in thatstructure to perform operations on the channel..PP\fBTcl_CreateChannel\fR opens a new channel and associates the supplied\fItypePtr\fR and \fIinstanceData\fR with it. The channel is opened in themode indicated by \fImask\fR.For a discussion of channel drivers, their operations and the\fBTcl_ChannelType\fR structure, see the section TCL_CHANNELTYPE, below..PP\fBTcl_CreateChannel\fR interacts with the code managing the standardchannels. Once a standard channel was initialized either through acall to \fBTcl_GetStdChannel\fR or a call to \fBTcl_SetStdChannel\fRclosing this standard channel will cause the next call to\fBTcl_CreateChannel\fR to make the new channel the new standardchannel too. See \fBTcl_StandardChannels\fR for a general treatiseabout standard channels and the behaviour of the Tcl library withregard to them..PP\fBTcl_GetChannelInstanceData\fR returns the instance data associated withthe channel in \fIchannel\fR. This is the same as the \fIinstanceData\fRargument in the call to \fBTcl_CreateChannel\fR that created this channel..PP\fBTcl_GetChannelType\fR returns a pointer to the \fBTcl_ChannelType\fRstructure used by the channel in the \fIchannel\fR argument. This isthe same as the \fItypePtr\fR argument in the call to\fBTcl_CreateChannel\fR that created this channel..PP\fBTcl_GetChannelName\fR returns a string containing the name associatedwith the channel, or NULL if the \fIchannelName\fR argument to\fBTcl_CreateChannel\fR was NULL..PP\fBTcl_GetChannelHandle\fR places the OS-specific device handleassociated with \fIchannel\fR for the given \fIdirection\fR in thelocation specified by \fIhandlePtr\fR and returns \fBTCL_OK\fR.  Ifthe channel does not have a device handle for the specified direction,then \fBTCL_ERROR\fR is returned instead.  Different channel driverswill return different types of handle.  Refer to the manual entriesfor each driver to determine what type of handle is returned..VS 8.4.PP\fBTcl_GetChannelThread\fR returns the id of the thread currently managingthe specified \fIchannel\fR. This allows channel drivers to send their fileevents to the correct event queue even for a multi-threaded core..VE 8.4.PP\fBTcl_GetChannelMode\fR returns an OR-ed combination of \fBTCL_READABLE\fRand \fBTCL_WRITABLE\fR, indicating whether the channel is open for inputand output..PP\fBTcl_GetChannelBufferSize\fR returns the size, in bytes, of buffersallocated to store input or output in \fIchannel\fR. If the value was not setby a previous call to \fBTcl_SetChannelBufferSize\fR, described below, thenthe default value of 4096 is returned..PP\fBTcl_SetChannelBufferSize\fR sets the size, in bytes, of buffers thatwill be allocated in subsequent operations on the channel to store input oroutput. The \fIsize\fR argument should be between ten and one million,allowing buffers of ten bytes to one million bytes. If \fIsize\fR isoutside this range, \fBTcl_SetChannelBufferSize\fR sets the buffer size to4096..PP\fBTcl_NotifyChannel\fR is called by a channel driver to indicate tothe generic layer that the events specified by \fImask\fR haveoccurred on the channel.  Channel drivers are responsible for invokingthis function whenever the channel handlers need to be called for thechannel.  See \fBWATCHPROC\fR below for more details..PP\fBTcl_BadChannelOption\fR is called from driver specific set or get optionprocs to generate a complete error message..PP\fBTcl_ChannelBuffered\fR returns the number of bytes of inputcurrently buffered in the internal buffer (push back area) of thechannel itself. It does not report about the data in the overallbuffers for the stack of channels the supplied channel is part of..PP.VS 8.4\fBTcl_IsChannelShared\fR checks the refcount of the specified\fIchannel\fR and returns whether the \fIchannel\fR was shared amongmultiple interpreters (result == 1) or not (result == 0)..PP\fBTcl_IsChannelRegistered\fR checks whether the specified \fIchannel\fR isregistered in the given \fIinterp\fRreter (result == 1) or not(result == 0)..PP\fBTcl_IsChannelExisting\fR checks whether a channel with the specifiedname is registered in the (thread)-global list of all channels (result== 1) or not (result == 0)..PP\fBTcl_CutChannel\fR removes the specified \fIchannel\fR from the(thread)global list of all channels (of the current thread).Application to a channel still registered in some interpreteris not allowed..PP\fBTcl_SpliceChannel\fR adds the specified \fIchannel\fR to the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -