summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.h
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIO.h')
-rw-r--r--generic/tclIO.h68
1 files changed, 26 insertions, 42 deletions
diff --git a/generic/tclIO.h b/generic/tclIO.h
index 08fff44..348a9c5 100644
--- a/generic/tclIO.h
+++ b/generic/tclIO.h
@@ -36,21 +36,21 @@
*/
typedef struct ChannelBuffer {
- Tcl_Size refCount; /* Current uses count */
- Tcl_Size nextAdded; /* The next position into which a character
+ int refCount; /* Current uses count */
+ int nextAdded; /* The next position into which a character
* will be put in the buffer. */
- Tcl_Size nextRemoved; /* Position of next byte to be removed from
+ int nextRemoved; /* Position of next byte to be removed from
* the buffer. */
- Tcl_Size bufLength; /* How big is the buffer? */
+ int bufLength; /* How big is the buffer? */
struct ChannelBuffer *nextPtr;
/* Next buffer in chain. */
- char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real
- * buffer occupies this space + bufSize-1
+ char buf[4]; /* Placeholder for real buffer. The real
+ * buffer occuppies this space + bufSize-4
* bytes. This must be the last field in the
* structure. */
} ChannelBuffer;
-#define CHANNELBUFFER_HEADER_SIZE offsetof(ChannelBuffer, buf)
+#define CHANNELBUFFER_HEADER_SIZE (sizeof(ChannelBuffer) - 4)
/*
* How much extra space to allocate in buffer to hold bytes from previous
@@ -96,9 +96,9 @@ typedef struct EventScriptRecord {
typedef struct Channel {
struct ChannelState *state; /* Split out state information */
- void *instanceData; /* Instance-specific data provided by creator
+ ClientData instanceData; /* Instance-specific data provided by creator
* of channel. */
- const Tcl_ChannelType *typePtr; /* Pointer to channel type structure. */
+ Tcl_ChannelType *typePtr; /* Pointer to channel type structure. */
struct Channel *downChanPtr;/* Refers to channel this one was stacked
* upon. This reference is NULL for normal
* channels. See Tcl_StackChannel. */
@@ -113,7 +113,7 @@ typedef struct Channel {
ChannelBuffer *inQueueHead; /* Points at first buffer in input queue. */
ChannelBuffer *inQueueTail; /* Points at last buffer in input queue. */
- Tcl_Size refCount;
+ int refCount;
} Channel;
/*
@@ -129,7 +129,7 @@ typedef struct ChannelState {
char *channelName; /* The name of the channel instance in Tcl
* commands. Storage is owned by the generic
* IO code, is dynamically allocated. */
- int flags; /* OR'ed combination of the flags defined
+ int flags; /* ORed combination of the flags defined
* below. */
Tcl_Encoding encoding; /* Encoding to apply when reading or writing
* data on this channel. NULL means no
@@ -158,14 +158,12 @@ typedef struct ChannelState {
* of line sequences in output? */
int inEofChar; /* If nonzero, use this as a signal of EOF on
* input. */
-#if TCL_MAJOR_VERSION < 9
int outEofChar; /* If nonzero, append this to the channel when
- * it is closed if it is open for writing. For Tcl 8.x only */
-#endif
+ * it is closed if it is open for writing. */
int unreportedError; /* Non-zero if an error report was deferred
* because it happened in the background. The
* value is the POSIX error code. */
- Tcl_Size refCount; /* How many interpreters hold references to
+ int refCount; /* How many interpreters hold references to
* this IO channel? */
struct CloseCallback *closeCbPtr;
/* Callbacks registered to be called when the
@@ -188,11 +186,8 @@ typedef struct ChannelState {
EventScriptRecord *scriptRecordPtr;
/* Chain of all scripts registered for event
* handlers ("fileevent") on this channel. */
- Tcl_Size bufSize; /* What size buffers to allocate? */
+ int bufSize; /* What size buffers to allocate? */
Tcl_TimerToken timer; /* Handle to wakeup timer for this channel. */
- Channel *timerChanPtr; /* Needed in order to decrement the refCount of
- the right channel when the timer is
- deleted. */
struct CopyState *csPtrR; /* State of background copy for which channel
* is input, or NULL. */
struct CopyState *csPtrW; /* State of background copy for which channel
@@ -211,7 +206,7 @@ typedef struct ChannelState {
* TIP #219 ... Info for the I/O system ...
* Error message set by channel drivers, for the propagation of arbitrary
* Tcl errors. This information, if present (chanMsg not NULL), takes
- * precedence over a Posix error code returned by a channel operation.
+ * precedence over a posix error code returned by a channel operation.
*/
Tcl_Obj* chanMsg;
@@ -219,21 +214,21 @@ typedef struct ChannelState {
* because it happened in the background. The
* value is the chanMg, if any. #219's
* companion to 'unreportedError'. */
- size_t epoch; /* Used to test validity of stored channelname
- * lookup results. */
- int maxPerms; /* TIP #220: Max access privileges
- * the channel was created with. */
} ChannelState;
/*
- * Values for the flags field in Channel. Any OR'ed combination of the
+ * Values for the flags field in Channel. Any ORed combination of the
* following flags can be stored in the field. These flags record various
* options and state bits about the channel. In addition to the flags below,
* the channel can also have TCL_READABLE (1<<1) and TCL_WRITABLE (1<<2) set.
*/
-#define CHANNEL_NONBLOCKING (1<<6) /* Channel is currently in nonblocking
+#define CHANNEL_NONBLOCKING (1<<3) /* Channel is currently in nonblocking
* mode. */
+#define CHANNEL_LINEBUFFERED (1<<4) /* Output to the channel must be
+ * flushed after every newline. */
+#define CHANNEL_UNBUFFERED (1<<5) /* Output to the channel must always
+ * be flushed immediately. */
#define BG_FLUSH_SCHEDULED (1<<7) /* A background flush of the queued
* output buffers has been
* scheduled. */
@@ -272,29 +267,18 @@ typedef struct ChannelState {
* delivered for buffered data until
* the state of the channel
* changes. */
-#define CHANNEL_ENCODING_ERROR (1<<15) /* set if channel
- * encountered an encoding error */
#define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is
* being used. */
-#define CHANNEL_LINEBUFFERED (1<<17) /* Output to the channel must be
- * flushed after every newline. */
-#define CHANNEL_UNBUFFERED (1<<18) /* Output to the channel must always
- * be flushed immediately. */
+
#define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed.
* Its structures are still live and
* usable, but it may not be closed
* again from within the close
* handler. */
-#define CHANNEL_CLOSEDWRITE (1<<21) /* Channel write side has been closed.
- * No further Tcl-level write IO on
- * the channel is allowed. */
-
-/*
- * The length of time to wait between synthetic timer events. Must be zero or
- * bad things tend to happen.
- */
-
-#define SYNTHETIC_EVENT_TIME 0
+#define CHANNEL_TAINTED (1<<20) /* Channel stack structure has changed.
+ * Used by Channel Tcl_Obj type to
+ * determine if we have to revalidate
+ * the channel. */
/*
* Local Variables: