tclIO.c File Reference

#include "tclInt.h"
#include "tclIO.h"
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  ThreadSpecificData

Defines

#define BytesLeft(bufPtr)   ((bufPtr)->nextAdded - (bufPtr)->nextRemoved)
#define SpaceLeft(bufPtr)   ((bufPtr)->bufLength - (bufPtr)->nextAdded)
#define IsBufferReady(bufPtr)   ((bufPtr)->nextAdded > (bufPtr)->nextRemoved)
#define IsBufferEmpty(bufPtr)   ((bufPtr)->nextAdded == (bufPtr)->nextRemoved)
#define IsBufferFull(bufPtr)   ((bufPtr)->nextAdded >= (bufPtr)->bufLength)
#define IsBufferOverflowing(bufPtr)   ((bufPtr)->nextAdded > (bufPtr)->bufLength)
#define InsertPoint(bufPtr)   ((bufPtr)->buf + (bufPtr)->nextAdded)
#define RemovePoint(bufPtr)   ((bufPtr)->buf + (bufPtr)->nextRemoved)
#define SetFlag(statePtr, flag)   ((statePtr)->flags |= (flag))
#define ResetFlag(statePtr, flag)   ((statePtr)->flags &= ~(flag))
#define HaveOpt(minLength, nameString)
#define GET_CHANNELSTATE(objPtr)   ((ChannelState *) (objPtr)->internalRep.otherValuePtr)
#define SET_CHANNELSTATE(objPtr, storePtr)   ((objPtr)->internalRep.otherValuePtr = (void *) (storePtr))
#define ENCODING_LINESIZE   20
#define UTF_EXPANSION_FACTOR   1024

Functions

void TclInitIOSubsystem (void)
void TclFinalizeIOSubsystem (void)
void Tcl_SetStdChannel (Tcl_Channel channel, int type)
Tcl_Channel Tcl_GetStdChannel (int type)
void Tcl_CreateCloseHandler (Tcl_Channel chan, Tcl_CloseProc *proc, ClientData clientData)
void Tcl_DeleteCloseHandler (Tcl_Channel chan, Tcl_CloseProc *proc, ClientData clientData)
int Tcl_IsStandardChannel (Tcl_Channel chan)
void Tcl_RegisterChannel (Tcl_Interp *interp, Tcl_Channel chan)
int Tcl_UnregisterChannel (Tcl_Interp *interp, Tcl_Channel chan)
int Tcl_DetachChannel (Tcl_Interp *interp, Tcl_Channel chan)
Tcl_Channel Tcl_GetChannel (Tcl_Interp *interp, const char *chanName, int *modePtr)
int TclGetChannelFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Channel *channelPtr, int *modePtr, int flags)
Tcl_Channel Tcl_CreateChannel (Tcl_ChannelType *typePtr, const char *chanName, ClientData instanceData, int mask)
Tcl_Channel Tcl_StackChannel (Tcl_Interp *interp, Tcl_ChannelType *typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan)
int Tcl_UnstackChannel (Tcl_Interp *interp, Tcl_Channel chan)
Tcl_Channel Tcl_GetStackedChannel (Tcl_Channel chan)
Tcl_Channel Tcl_GetTopChannel (Tcl_Channel chan)
ClientData Tcl_GetChannelInstanceData (Tcl_Channel chan)
Tcl_ThreadId Tcl_GetChannelThread (Tcl_Channel chan)
Tcl_ChannelTypeTcl_GetChannelType (Tcl_Channel chan)
int Tcl_GetChannelMode (Tcl_Channel chan)
const char * Tcl_GetChannelName (Tcl_Channel chan)
int Tcl_GetChannelHandle (Tcl_Channel chan, int direction, ClientData *handlePtr)
void Tcl_CutChannel (Tcl_Channel chan)
void Tcl_SpliceChannel (Tcl_Channel chan)
int Tcl_Close (Tcl_Interp *interp, Tcl_Channel chan)
void Tcl_ClearChannelHandlers (Tcl_Channel channel)
int Tcl_Write (Tcl_Channel chan, const char *src, int srcLen)
int Tcl_WriteRaw (Tcl_Channel chan, const char *src, int srcLen)
int Tcl_WriteChars (Tcl_Channel chan, const char *src, int len)
int Tcl_WriteObj (Tcl_Channel chan, Tcl_Obj *objPtr)
int Tcl_Gets (Tcl_Channel chan, Tcl_DString *lineRead)
int Tcl_GetsObj (Tcl_Channel chan, Tcl_Obj *objPtr)
int Tcl_Read (Tcl_Channel chan, char *dst, int bytesToRead)
int Tcl_ReadRaw (Tcl_Channel chan, char *bufPtr, int bytesToRead)
int Tcl_ReadChars (Tcl_Channel chan, Tcl_Obj *objPtr, int toRead, int appendFlag)
int Tcl_Ungets (Tcl_Channel chan, const char *str, int len, int atEnd)
int Tcl_Flush (Tcl_Channel chan)
Tcl_WideInt Tcl_Seek (Tcl_Channel chan, Tcl_WideInt offset, int mode)
Tcl_WideInt Tcl_Tell (Tcl_Channel chan)
int Tcl_SeekOld (Tcl_Channel chan, int offset, int mode)
int Tcl_TellOld (Tcl_Channel chan)
int Tcl_TruncateChannel (Tcl_Channel chan, Tcl_WideInt length)
int Tcl_Eof (Tcl_Channel chan)
int Tcl_InputBlocked (Tcl_Channel chan)
int Tcl_InputBuffered (Tcl_Channel chan)
int Tcl_OutputBuffered (Tcl_Channel chan)
int Tcl_ChannelBuffered (Tcl_Channel chan)
void Tcl_SetChannelBufferSize (Tcl_Channel chan, int sz)
int Tcl_GetChannelBufferSize (Tcl_Channel chan)
int Tcl_BadChannelOption (Tcl_Interp *interp, const char *optionName, const char *optionList)
int Tcl_GetChannelOption (Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, Tcl_DString *dsPtr)
int Tcl_SetChannelOption (Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, const char *newValue)
void Tcl_NotifyChannel (Tcl_Channel channel, int mask)
void Tcl_CreateChannelHandler (Tcl_Channel chan, int mask, Tcl_ChannelProc *proc, ClientData clientData)
void Tcl_DeleteChannelHandler (Tcl_Channel chan, Tcl_ChannelProc *proc, ClientData clientData)
void TclChannelEventScriptInvoker (ClientData clientData, int mask)
int Tcl_FileEventObjCmd (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
int TclCopyChannel (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr)
int Tcl_GetChannelNames (Tcl_Interp *interp)
int Tcl_GetChannelNamesEx (Tcl_Interp *interp, const char *pattern)
int Tcl_IsChannelRegistered (Tcl_Interp *interp, Tcl_Channel chan)
int Tcl_IsChannelShared (Tcl_Channel chan)
int Tcl_IsChannelExisting (const char *chanName)
const char * Tcl_ChannelName (const Tcl_ChannelType *chanTypePtr)
Tcl_ChannelTypeVersion Tcl_ChannelVersion (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverBlockModeProc * Tcl_ChannelBlockModeProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverCloseProc * Tcl_ChannelCloseProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverClose2Proc * Tcl_ChannelClose2Proc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverInputProc * Tcl_ChannelInputProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverOutputProc * Tcl_ChannelOutputProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverSeekProc * Tcl_ChannelSeekProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverSetOptionProc * Tcl_ChannelSetOptionProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverGetOptionProc * Tcl_ChannelGetOptionProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverWatchProc * Tcl_ChannelWatchProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverGetHandleProc * Tcl_ChannelGetHandleProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverFlushProc * Tcl_ChannelFlushProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverHandlerProc * Tcl_ChannelHandlerProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverWideSeekProc * Tcl_ChannelWideSeekProc (const Tcl_ChannelType *chanTypePtr)
Tcl_DriverThreadActionProc * Tcl_ChannelThreadActionProc (const Tcl_ChannelType *chanTypePtr)
void Tcl_SetChannelErrorInterp (Tcl_Interp *interp, Tcl_Obj *msg)
void Tcl_SetChannelError (Tcl_Channel chan, Tcl_Obj *msg)
void Tcl_GetChannelErrorInterp (Tcl_Interp *interp, Tcl_Obj **msg)
void Tcl_GetChannelError (Tcl_Channel chan, Tcl_Obj **msg)
Tcl_DriverTruncateProc * Tcl_ChannelTruncateProc (const Tcl_ChannelType *chanTypePtr)


Define Documentation

#define BytesLeft ( bufPtr   )     ((bufPtr)->nextAdded - (bufPtr)->nextRemoved)

Definition at line 165 of file tclIO.c.

Referenced by Tcl_ChannelBuffered(), Tcl_InputBuffered(), and Tcl_OutputBuffered().

#define ENCODING_LINESIZE   20

#define GET_CHANNELSTATE ( objPtr   )     ((ChannelState *) (objPtr)->internalRep.otherValuePtr)

Definition at line 219 of file tclIO.c.

Referenced by TclGetChannelFromObj().

#define HaveOpt ( minLength,
nameString   ) 

Value:

((len > (minLength)) && (optionName[1] == (nameString)[1]) \
                && (strncmp(optionName, (nameString), len) == 0))

Definition at line 195 of file tclIO.c.

Referenced by Tcl_GetChannelOption(), and Tcl_SetChannelOption().

#define InsertPoint ( bufPtr   )     ((bufPtr)->buf + (bufPtr)->nextAdded)

Definition at line 177 of file tclIO.c.

Referenced by Tcl_Ungets().

#define IsBufferEmpty ( bufPtr   )     ((bufPtr)->nextAdded == (bufPtr)->nextRemoved)

Definition at line 171 of file tclIO.c.

Referenced by Tcl_SetChannelOption().

#define IsBufferFull ( bufPtr   )     ((bufPtr)->nextAdded >= (bufPtr)->bufLength)

Definition at line 173 of file tclIO.c.

#define IsBufferOverflowing ( bufPtr   )     ((bufPtr)->nextAdded > (bufPtr)->bufLength)

Definition at line 175 of file tclIO.c.

#define IsBufferReady ( bufPtr   )     ((bufPtr)->nextAdded > (bufPtr)->nextRemoved)

Definition at line 169 of file tclIO.c.

Referenced by Tcl_Close(), Tcl_Flush(), Tcl_OutputBuffered(), Tcl_Seek(), and Tcl_UnregisterChannel().

#define RemovePoint ( bufPtr   )     ((bufPtr)->buf + (bufPtr)->nextRemoved)

Definition at line 179 of file tclIO.c.

Referenced by Tcl_GetsObj().

#define ResetFlag ( statePtr,
flag   )     ((statePtr)->flags &= ~(flag))

Definition at line 186 of file tclIO.c.

Referenced by Tcl_Close(), Tcl_GetsObj(), Tcl_ReadRaw(), Tcl_Seek(), Tcl_SetChannelOption(), and Tcl_Ungets().

#define SET_CHANNELSTATE ( objPtr,
storePtr   )     ((objPtr)->internalRep.otherValuePtr = (void *) (storePtr))

Definition at line 221 of file tclIO.c.

#define SetFlag ( statePtr,
flag   )     ((statePtr)->flags |= (flag))

#define SpaceLeft ( bufPtr   )     ((bufPtr)->bufLength - (bufPtr)->nextAdded)

Definition at line 167 of file tclIO.c.

#define UTF_EXPANSION_FACTOR   1024


Function Documentation

int Tcl_BadChannelOption ( Tcl_Interp interp,
const char *  optionName,
const char *  optionList 
)

Tcl_DriverBlockModeProc* Tcl_ChannelBlockModeProc ( const Tcl_ChannelType chanTypePtr  ) 

int Tcl_ChannelBuffered ( Tcl_Channel  chan  ) 

Definition at line 6882 of file tclIO.c.

References BytesLeft, Channel::inQueueHead, and ChannelBuffer::nextPtr.

Tcl_DriverClose2Proc* Tcl_ChannelClose2Proc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 9952 of file tclIO.c.

References Tcl_ChannelType::close2Proc.

Tcl_DriverCloseProc* Tcl_ChannelCloseProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 9928 of file tclIO.c.

References Tcl_ChannelType::closeProc.

Tcl_DriverFlushProc* Tcl_ChannelFlushProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10144 of file tclIO.c.

References Tcl_ChannelType::flushProc, and TCL_CHANNEL_VERSION_2.

Tcl_DriverGetHandleProc* Tcl_ChannelGetHandleProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10120 of file tclIO.c.

References Tcl_ChannelType::getHandleProc.

Tcl_DriverGetOptionProc* Tcl_ChannelGetOptionProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10072 of file tclIO.c.

References Tcl_ChannelType::getOptionProc.

Tcl_DriverHandlerProc* Tcl_ChannelHandlerProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10172 of file tclIO.c.

References Tcl_ChannelType::handlerProc, and TCL_CHANNEL_VERSION_2.

Tcl_DriverInputProc* Tcl_ChannelInputProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 9976 of file tclIO.c.

References Tcl_ChannelType::inputProc.

const char* Tcl_ChannelName ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 9808 of file tclIO.c.

References Tcl_ChannelType::typeName.

Tcl_DriverOutputProc* Tcl_ChannelOutputProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10000 of file tclIO.c.

References Tcl_ChannelType::outputProc.

Tcl_DriverSeekProc* Tcl_ChannelSeekProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10024 of file tclIO.c.

References Tcl_ChannelType::seekProc.

Tcl_DriverSetOptionProc* Tcl_ChannelSetOptionProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10048 of file tclIO.c.

References Tcl_ChannelType::setOptionProc.

Tcl_DriverThreadActionProc* Tcl_ChannelThreadActionProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10229 of file tclIO.c.

References TCL_CHANNEL_VERSION_4, and Tcl_ChannelType::threadActionProc.

Tcl_DriverTruncateProc* Tcl_ChannelTruncateProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10545 of file tclIO.c.

References TCL_CHANNEL_VERSION_5, and Tcl_ChannelType::truncateProc.

Tcl_DriverWatchProc* Tcl_ChannelWatchProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10096 of file tclIO.c.

References Tcl_ChannelType::watchProc.

Tcl_DriverWideSeekProc* Tcl_ChannelWideSeekProc ( const Tcl_ChannelType chanTypePtr  ) 

Definition at line 10200 of file tclIO.c.

References TCL_CHANNEL_VERSION_3, and Tcl_ChannelType::wideSeekProc.

void Tcl_CreateChannelHandler ( Tcl_Channel  chan,
int  mask,
Tcl_ChannelProc *  proc,
ClientData  clientData 
)

void Tcl_CreateCloseHandler ( Tcl_Channel  chan,
Tcl_CloseProc *  proc,
ClientData  clientData 
)

Definition at line 502 of file tclIO.c.

References ckalloc, CloseCallback::clientData, CloseCallback::nextPtr, and CloseCallback::proc.

Referenced by Tcl_SocketObjCmd().

void Tcl_DeleteChannelHandler ( Tcl_Channel  chan,
Tcl_ChannelProc *  proc,
ClientData  clientData 
)

void Tcl_DeleteCloseHandler ( Tcl_Channel  chan,
Tcl_CloseProc *  proc,
ClientData  clientData 
)

int Tcl_DetachChannel ( Tcl_Interp interp,
Tcl_Channel  chan 
)

Definition at line 985 of file tclIO.c.

References TCL_ERROR, and Tcl_IsStandardChannel().

int Tcl_Eof ( Tcl_Channel  chan  ) 

Definition at line 6740 of file tclIO.c.

References CHANNEL_EOF, CHANNEL_STICKY_EOF, and Tcl_InputBuffered().

Referenced by Tcl_EofObjCmd(), and Tcl_GetsObjCmd().

int Tcl_GetChannelBufferSize ( Tcl_Channel  chan  ) 

Definition at line 6961 of file tclIO.c.

void Tcl_GetChannelError ( Tcl_Channel  chan,
Tcl_Obj **  msg 
)

Definition at line 10517 of file tclIO.c.

Referenced by TclChanCaughtErrorBypass().

void Tcl_GetChannelErrorInterp ( Tcl_Interp interp,
Tcl_Obj **  msg 
)

Definition at line 10489 of file tclIO.c.

References Interp::chanMsg, and iPtr.

Referenced by TclChanCaughtErrorBypass().

int Tcl_GetChannelHandle ( Tcl_Channel  chan,
int  direction,
ClientData *  handlePtr 
)

ClientData Tcl_GetChannelInstanceData ( Tcl_Channel  chan  ) 

Definition at line 1842 of file tclIO.c.

References Channel::instanceData.

Referenced by Tcl_PidObjCmd(), TclChanPostEventObjCmd(), and TclGetAndDetachPids().

int Tcl_GetChannelMode ( Tcl_Channel  chan  ) 

Definition at line 1922 of file tclIO.c.

References TCL_READABLE, and TCL_WRITABLE.

const char* Tcl_GetChannelName ( Tcl_Channel  chan  ) 

int Tcl_GetChannelNames ( Tcl_Interp interp  ) 

Definition at line 9575 of file tclIO.c.

References Tcl_GetChannelNamesEx().

Tcl_ThreadId Tcl_GetChannelThread ( Tcl_Channel  chan  ) 

Definition at line 1868 of file tclIO.c.

References ChannelState::managingThread, and Channel::state.

Tcl_ChannelType* Tcl_GetChannelType ( Tcl_Channel  chan  ) 

int Tcl_Gets ( Tcl_Channel  chan,
Tcl_DString lineRead 
)

Tcl_Channel Tcl_GetStackedChannel ( Tcl_Channel  chan  ) 

Definition at line 1788 of file tclIO.c.

References Channel::downChanPtr.

Tcl_Channel Tcl_GetTopChannel ( Tcl_Channel  chan  ) 

Definition at line 1816 of file tclIO.c.

References Channel::state, and ChannelState::topChanPtr.

int Tcl_InputBlocked ( Tcl_Channel  chan  ) 

Definition at line 6768 of file tclIO.c.

Referenced by Tcl_FblockedObjCmd(), Tcl_GetsObjCmd(), and Tcl_Main().

int Tcl_InputBuffered ( Tcl_Channel  chan  ) 

Definition at line 6796 of file tclIO.c.

References BytesLeft, and ChannelBuffer::nextPtr.

Referenced by Tcl_Eof(), Tcl_Seek(), and Tcl_Tell().

int Tcl_IsChannelExisting ( const char *  chanName  ) 

int Tcl_IsChannelRegistered ( Tcl_Interp interp,
Tcl_Channel  chan 
)

int Tcl_IsChannelShared ( Tcl_Channel  chan  ) 

Definition at line 9733 of file tclIO.c.

int Tcl_IsStandardChannel ( Tcl_Channel  chan  ) 

int Tcl_OutputBuffered ( Tcl_Channel  chan  ) 

Definition at line 6840 of file tclIO.c.

References BytesLeft, IsBufferReady, and ChannelBuffer::nextPtr.

Referenced by Tcl_Seek(), and Tcl_Tell().

int Tcl_Read ( Tcl_Channel  chan,
char *  dst,
int  bytesToRead 
)

Definition at line 4899 of file tclIO.c.

References Channel::state, and TCL_READABLE.

Referenced by TclLoadFile().

int Tcl_ReadChars ( Tcl_Channel  chan,
Tcl_Obj objPtr,
int  toRead,
int  appendFlag 
)

Definition at line 5104 of file tclIO.c.

References Channel::state, and TCL_READABLE.

Referenced by Tcl_ExecObjCmd(), Tcl_FSEvalFileEx(), Tcl_ReadObjCmd(), and TclCleanupChildren().

int Tcl_ReadRaw ( Tcl_Channel  chan,
char *  bufPtr,
int  bytesToRead 
)

int Tcl_SeekOld ( Tcl_Channel  chan,
int  offset,
int  mode 
)

Definition at line 6532 of file tclIO.c.

References Tcl_LongAsWide, Tcl_Seek(), and Tcl_WideAsLong.

void Tcl_SetChannelBufferSize ( Tcl_Channel  chan,
int  sz 
)

Definition at line 6916 of file tclIO.c.

References ckalloc, ckfree, and TCL_WRITABLE.

Referenced by Tcl_SetChannelOption().

void Tcl_SetChannelError ( Tcl_Channel  chan,
Tcl_Obj msg 
)

Definition at line 10294 of file tclIO.c.

References Tcl_IncrRefCount, and TclDecrRefCount.

void Tcl_SetChannelErrorInterp ( Tcl_Interp interp,
Tcl_Obj msg 
)

Definition at line 10258 of file tclIO.c.

References Interp::chanMsg, iPtr, Tcl_IncrRefCount, and TclDecrRefCount.

Referenced by Tcl_Close().

int Tcl_TellOld ( Tcl_Channel  chan  ) 

Definition at line 6545 of file tclIO.c.

References Tcl_Tell(), and Tcl_WideAsLong.

int Tcl_TruncateChannel ( Tcl_Channel  chan,
Tcl_WideInt  length 
)

int Tcl_Ungets ( Tcl_Channel  chan,
const char *  str,
int  len,
int  atEnd 
)

int Tcl_UnregisterChannel ( Tcl_Interp interp,
Tcl_Channel  chan 
)

int Tcl_Write ( Tcl_Channel  chan,
const char *  src,
int  srcLen 
)

Definition at line 3138 of file tclIO.c.

References TCL_WRITABLE.

int Tcl_WriteChars ( Tcl_Channel  chan,
const char *  src,
int  len 
)

Definition at line 3247 of file tclIO.c.

References TCL_WRITABLE.

int Tcl_WriteObj ( Tcl_Channel  chan,
Tcl_Obj objPtr 
)

int Tcl_WriteRaw ( Tcl_Channel  chan,
const char *  src,
int  srcLen 
)

void TclChannelEventScriptInvoker ( ClientData  clientData,
int  mask 
)

int TclGetChannelFromObj ( Tcl_Interp interp,
Tcl_Obj objPtr,
Tcl_Channel *  channelPtr,
int *  modePtr,
int  flags 
)

void TclInitIOSubsystem ( void   ) 

Definition at line 243 of file tclIO.c.

References TCL_TSD_INIT.

Referenced by TclInitSubsystems().



Generated on Wed Mar 12 12:18:32 2008 by  doxygen 1.5.1