Tcl Source Code

Artifact [1a29856729]
Login

Artifact 1a298567294ca255818847adb420e50920af5977:

Attachment "85.chan_v5.diff" to ticket [1276628fff] added by andreas_kupries 2006-03-28 01:07:31.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.3002
diff -w -u -r1.3002 ChangeLog
--- ChangeLog	27 Mar 2006 16:13:55 -0000	1.3002
+++ ChangeLog	27 Mar 2006 18:04:58 -0000
@@ -1,3 +1,18 @@
+2006-03-27  Andreas Kupries <[email protected]>
+
+	* doc/CrtChannel.3:    Added TCL_CHANNEL_VERSION_5, made it
+	* generic/tcl.h:       the version where the "truncateProc"
+	* generic/tclIO.c:     is defined at, and moved all channel
+	* generic/tclIOGT.c:   drivers of Tcl to v5.
+	* generic/tclIORChan.c: 
+	* unix/tclUnixChan.c: 
+	* unix/tclUnixPipe.c: 
+	* win/tclWinChan.c: 
+	* win/tclWinConsole.c: 
+	* win/tclWinPipe.c: 
+	* win/tclWinSerial.c: 
+	* win/tclWinSock.c: 
+
 2006-03-27  Don Porter  <[email protected]>
 
 	*** 8.5a4 TAGGED FOR RELEASE ***
Index: doc/CrtChannel.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/CrtChannel.3,v
retrieving revision 1.32
diff -w -u -r1.32 CrtChannel.3
--- doc/CrtChannel.3	5 Oct 2005 20:36:16 -0000	1.32
+++ doc/CrtChannel.3	27 Mar 2006 18:04:58 -0000
@@ -384,10 +384,12 @@
 The \fIversion\fR field should be set to the version of the structure
 that you require. \fBTCL_CHANNEL_VERSION_2\fR is the minimum recommended.
 \fBTCL_CHANNEL_VERSION_3\fR must be set to specifiy the \fIwideSeekProc\fR member.
+\fBTCL_CHANNEL_VERSION_4\fR must be set to specifiy the \fIthreadActionProc\fR member
+(includes \fIwideSeekProc\fR).
 .VS 8.5
-\fBTCL_CHANNEL_VERSION_4\fR must be set to specifiy the
-\fIthreadActionProc\fR and \fItruncateProc\fR members (includes
-\fIwideSeekProc\fR).
+\fBTCL_CHANNEL_VERSION_5\fR must be set to specifiy the
+\fItruncateProc\fR members (includes
+\fIwideSeekProc\fR and \fIthreadActionProc\fR).
 .VE 8.5
 If it is not set to any of these, then this
 \fBTcl_ChannelType\fR is assumed to have the original structure.  See
@@ -398,8 +400,9 @@
 This value can be retrieved with \fBTcl_ChannelVersion\fR, which returns
 one of
 .VS 8.5
-\fBTCL_CHANNEL_VERSION_4\fR,
+\fBTCL_CHANNEL_VERSION_5\fR,
 .VE 8.5
+\fBTCL_CHANNEL_VERSION_4\fR,
 \fBTCL_CHANNEL_VERSION_3\fR,
 \fBTCL_CHANNEL_VERSION_2\fR or \fBTCL_CHANNEL_VERSION_1\fR.
 .SS BLOCKMODEPROC
Index: generic/tcl.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.h,v
retrieving revision 1.210
diff -w -u -r1.210 tcl.h
--- generic/tcl.h	27 Dec 2005 17:39:01 -0000	1.210
+++ generic/tcl.h	27 Mar 2006 18:04:58 -0000
@@ -1516,6 +1516,7 @@
 #define TCL_CHANNEL_VERSION_2	((Tcl_ChannelTypeVersion) 0x2)
 #define TCL_CHANNEL_VERSION_3	((Tcl_ChannelTypeVersion) 0x3)
 #define TCL_CHANNEL_VERSION_4	((Tcl_ChannelTypeVersion) 0x4)
+#define TCL_CHANNEL_VERSION_5	((Tcl_ChannelTypeVersion) 0x5)
 
 /*
  * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc
@@ -1667,12 +1668,16 @@
     /*
      * Only valid in TCL_CHANNEL_VERSION_4 channels or later
      * TIP #218, Channel Thread Actions
-     * TIP #208 (part relating to truncation)
      */
     Tcl_DriverThreadActionProc *threadActionProc;
 				/* Function to call to notify the driver of
 				 * thread specific activity for a channel. May
 				 * be NULL. */
+
+    /*
+     * Only valid in TCL_CHANNEL_VERSION_5 channels or later
+     * TIP #208, File Truncation
+     */
     Tcl_DriverTruncateProc *truncateProc;
 				/* Function to call to truncate the underlying
 				 * file to a particular length. May be NULL if
Index: generic/tclIO.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIO.c,v
retrieving revision 1.105
diff -w -u -r1.105 tclIO.c
--- generic/tclIO.c	10 Mar 2006 17:32:51 -0000	1.105
+++ generic/tclIO.c	27 Mar 2006 18:04:58 -0000
@@ -9263,6 +9263,8 @@
 	return TCL_CHANNEL_VERSION_3;
     } else if (chanTypePtr->version == TCL_CHANNEL_VERSION_4) {
 	return TCL_CHANNEL_VERSION_4;
+    } else if (chanTypePtr->version == TCL_CHANNEL_VERSION_5) {
+	return TCL_CHANNEL_VERSION_5;
     } else {
 	/*
 	 * In <v2 channel versions, the version field is occupied by the
@@ -9953,7 +9955,7 @@
 Tcl_ChannelTruncateProc(
     Tcl_ChannelType *chanTypePtr)	/* Pointer to channel type. */
 {
-    if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_4)) {
+    if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_5)) {
 	return chanTypePtr->truncateProc;
     } else {
 	return NULL;
Index: generic/tclIOGT.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOGT.c,v
retrieving revision 1.14
diff -w -u -r1.14 tclIOGT.c
--- generic/tclIOGT.c	1 Nov 2005 15:30:52 -0000	1.14
+++ generic/tclIOGT.c	27 Mar 2006 18:04:58 -0000
@@ -120,7 +120,7 @@
 
 static Tcl_ChannelType transformChannelType = {
     "transform",			/* Type name. */
-    TCL_CHANNEL_VERSION_3,
+    TCL_CHANNEL_VERSION_5,              /* v5 channel */
     TransformCloseProc,			/* Close proc. */
     TransformInputProc,			/* Input proc. */
     TransformOutputProc,		/* Output proc. */
@@ -134,6 +134,8 @@
     NULL,				/* Flush proc. */
     TransformNotifyProc,                /* Handling of events bubbling up */
     TransformWideSeekProc,		/* Wide seek proc */
+    NULL,                               /* thread action */
+    NULL,                               /* truncate */
 };
 
 /*
Index: generic/tclIORChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIORChan.c,v
retrieving revision 1.14
diff -w -u -r1.14 tclIORChan.c
--- generic/tclIORChan.c	17 Feb 2006 16:16:47 -0000	1.14
+++ generic/tclIORChan.c	27 Mar 2006 18:04:58 -0000
@@ -59,7 +59,7 @@
 
 static Tcl_ChannelType tclRChannelType = {
     "tclrchannel",	/* Type name.					*/
-    TCL_CHANNEL_VERSION_3,
+    TCL_CHANNEL_VERSION_5, /* v5 channel */
     ReflectClose,	/* Close channel, clean instance data		*/
     ReflectInput,	/* Handle read request				*/
     ReflectOutput,	/* Handle write request				*/
@@ -72,7 +72,9 @@
     ReflectBlock,	/* Set blocking/nonblocking.	     NULL'able	*/
     NULL,		/* Flush channel. Not used by core.  NULL'able	*/
     NULL,		/* Handle events.		     NULL'able	*/
-    ReflectSeekWide	/* Move access point (64 bit).	     NULL'able	*/
+    ReflectSeekWide,       /* Move access point (64 bit).      NULL'able  */
+    NULL,                  /* thread action */
+    NULL,                  /* truncate */
 };
 
 /*
Index: unix/tclUnixChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixChan.c,v
retrieving revision 1.68
diff -w -u -r1.68 tclUnixChan.c
--- unix/tclUnixChan.c	25 Mar 2006 03:18:55 -0000	1.68
+++ unix/tclUnixChan.c	27 Mar 2006 18:04:58 -0000
@@ -298,7 +298,7 @@
 
 static Tcl_ChannelType fileChannelType = {
     "file",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     FileCloseProc,		/* Close proc. */
     FileInputProc,		/* Input proc. */
     FileOutputProc,		/* Output proc. */
@@ -328,7 +328,7 @@
 
 static Tcl_ChannelType ttyChannelType = {
     "tty",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     TtyCloseProc,		/* Close proc. */
     FileInputProc,		/* Input proc. */
 #if BAD_TIP35_FLUSH
@@ -358,7 +358,7 @@
 
 static Tcl_ChannelType tcpChannelType = {
     "tcp",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     TcpCloseProc,		/* Close proc. */
     TcpInputProc,		/* Input proc. */
     TcpOutputProc,		/* Output proc. */
Index: unix/tclUnixPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixPipe.c,v
retrieving revision 1.32
diff -w -u -r1.32 tclUnixPipe.c
--- unix/tclUnixPipe.c	2 Nov 2005 23:26:50 -0000	1.32
+++ unix/tclUnixPipe.c	27 Mar 2006 18:04:58 -0000
@@ -70,7 +70,7 @@
 
 static Tcl_ChannelType pipeChannelType = {
     "pipe",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     PipeCloseProc,		/* Close proc. */
     PipeInputProc,		/* Input proc. */
     PipeOutputProc,		/* Output proc. */
@@ -85,6 +85,7 @@
     NULL,			/* handler proc. */
     NULL,			/* wide seek proc */
     NULL,			/* thread action proc */
+    NULL,                       /* truncation */
 };
 
 /*
Index: win/tclWinChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinChan.c,v
retrieving revision 1.46
diff -w -u -r1.46 tclWinChan.c
--- win/tclWinChan.c	13 Dec 2005 22:43:18 -0000	1.46
+++ win/tclWinChan.c	27 Mar 2006 18:04:58 -0000
@@ -103,7 +103,7 @@
 
 static Tcl_ChannelType fileChannelType = {
     "file",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     FileCloseProc,		/* Close proc. */
     FileInputProc,		/* Input proc. */
     FileOutputProc,		/* Output proc. */
Index: win/tclWinConsole.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinConsole.c,v
retrieving revision 1.18
diff -w -u -r1.18 tclWinConsole.c
--- win/tclWinConsole.c	13 Dec 2005 22:43:18 -0000	1.18
+++ win/tclWinConsole.c	27 Mar 2006 18:04:58 -0000
@@ -165,7 +165,7 @@
 
 static Tcl_ChannelType consoleChannelType = {
     "console",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     ConsoleCloseProc,		/* Close proc. */
     ConsoleInputProc,		/* Input proc. */
     ConsoleOutputProc,		/* Output proc. */
@@ -180,6 +180,7 @@
     NULL,			/* handler proc. */
     NULL,			/* wide seek proc */
     ConsoleThreadActionProc,    /* thread action proc */
+    NULL,                       /* truncation */
 };
 
 /*
Index: win/tclWinPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinPipe.c,v
retrieving revision 1.62
diff -w -u -r1.62 tclWinPipe.c
--- win/tclWinPipe.c	10 Mar 2006 17:34:35 -0000	1.62
+++ win/tclWinPipe.c	27 Mar 2006 18:04:58 -0000
@@ -210,7 +210,7 @@
 
 static Tcl_ChannelType pipeChannelType = {
     "pipe",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     TCL_CLOSE2PROC,		/* Close proc. */
     PipeInputProc,		/* Input proc. */
     PipeOutputProc,		/* Output proc. */
@@ -225,6 +225,7 @@
     NULL,			/* handler proc. */
     NULL,			/* wide seek proc */
     PipeThreadActionProc,	/* thread action proc */
+    NULL,                       /* truncate */
 };
 
 /*
Index: win/tclWinSerial.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinSerial.c,v
retrieving revision 1.33
diff -w -u -r1.33 tclWinSerial.c
--- win/tclWinSerial.c	31 Oct 2005 13:53:33 -0000	1.33
+++ win/tclWinSerial.c	27 Mar 2006 18:04:58 -0000
@@ -205,7 +205,7 @@
 
 static Tcl_ChannelType serialChannelType = {
     "serial",			/* Type name. */
-    TCL_CHANNEL_VERSION_4,	/* v4 channel */
+    TCL_CHANNEL_VERSION_5,	/* v5 channel */
     SerialCloseProc,		/* Close proc. */
     SerialInputProc,		/* Input proc. */
     SerialOutputProc,		/* Output proc. */
@@ -220,6 +220,7 @@
     NULL,			/* handler proc. */
     NULL,			/* wide seek proc */
     SerialThreadActionProc,	/* thread action proc */
+    NULL,                       /* truncate */
 };
 
 /*
Index: win/tclWinSock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinSock.c,v
retrieving revision 1.52
diff -w -u -r1.52 tclWinSock.c
--- win/tclWinSock.c	10 Mar 2006 17:34:35 -0000	1.52
+++ win/tclWinSock.c	27 Mar 2006 18:04:58 -0000
@@ -265,7 +265,7 @@
 
 static Tcl_ChannelType tcpChannelType = {
     "tcp",		    /* Type name. */
-    TCL_CHANNEL_VERSION_4,  /* v4 channel */
+    TCL_CHANNEL_VERSION_5,  /* v5 channel */
     TcpCloseProc,	    /* Close proc. */
     TcpInputProc,	    /* Input proc. */
     TcpOutputProc,	    /* Output proc. */
@@ -280,6 +280,7 @@
     NULL,		    /* handler proc. */
     NULL,		    /* wide seek proc */
     TcpThreadActionProc,    /* thread action proc */
+    NULL,                   /* truncate */
 };
 
 /*