Check-in [94567b3779]
Overview
SHA1:94567b3779af01db7bb1d245a03f83fa3e82f638
Date: 2012-10-08 19:35:04
User: rkeene
Comment:Fixed issue with newer versions of Tcl providing a zlib package (version 2.0)
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
References
2012-10-08
19:35 • Ticket [f929fddcfc] Tclkit generation problems status still Open with 1 other change (user: rkeene) [details]
Tags And Properties
Context
2012-10-08
19:40
[7c0261e55c] Updated to hide distclean output (user: rkeene, tags: trunk)
19:35
[94567b3779] Fixed issue with newer versions of Tcl providing a zlib package (version 2.0) (user: rkeene, tags: trunk)
19:12
[2ba5f90d1b] Updated to not require running "./configure" for pre.sh (user: rkeene, tags: trunk)
Changes

Modified tclvfs/patches/8.6/tclvfs-20080503-supportnativezlib.diff from [7076e29d82] to [cc9a9d6176].

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15

16
17
18
19
20
21
22
23
24
25
26
..
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
diff -uNr tclvfs-20080503.orig/library/vfslib.tcl tclvfs-20080503-3rsk/library/vfslib.tcl
--- tclvfs-20080503.orig/library/vfslib.tcl	2011-07-16 15:31:29.000000000 +0200
+++ tclvfs-20080503-3rsk/library/vfslib.tcl	2011-07-16 15:32:28.000000000 +0200
@@ -5,6 +5,14 @@
 
 namespace eval ::vfs {
     variable zseq 0	;# used to generate temp zstream cmd names
+    variable zlibPkg 0  ;# Use Tcl 8.6+ zlib command, or zlib package
+}
+
+
+# Work with the Tcl 8.6+ built-in zlib command or the zlib package, if available
+catch {
+	package present zlib

+	set ::vfs::zlibPkg 1

 }
 
 # for backwards compatibility
@@ -94,8 +102,12 @@
 		}
 		# to seek back, rewind, i.e. start from scratch
 		if {$a1 < $pos} {
-		    rename $zcmd ""
-		    zlib $imode $zcmd
+		    if {$::vfs::zlibPkg} {
+    			rename $zcmd ""
................................................................................
+    			zlib $imode $zcmd
+		    } else {
+			$zcmd reset
+		    }
 		    seek $ifd 0
 		    set pos 0
 		}
@@ -110,19 +122,26 @@
 		return $pos
 	    }
 	    read {
+                if {$::vfs::zlibPkg} {
+                   set zputcmd fill
+                   set zgetcmd drain
+                } else {
................................................................................
-		    set data [$zcmd drain $n]
+                        $zcmd $zputcmd $data
+                    }
+		    set data [$zcmd $zgetcmd $n]
 		    #puts stderr " read [string length $data]"
 		    if {$data eq ""} break
 		    append r $data
@@ -141,8 +160,12 @@
     }
 
     proc vfs::zstream {mode ifd clen ilen} {
-	set cname _zstream_[incr ::vfs::zseq]
-	zlib s$mode $cname
+        if {$::vfs::zlibPkg} {
+            set cname _zstream_[incr ::vfs::zseq]
|
|
|
|









|
>
|
>



|







 







|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
..
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
diff -uNr tclvfs-20080503/library/vfslib.tcl tclvfs-20080503-supportnativezlib/library/vfslib.tcl
--- tclvfs-20080503/library/vfslib.tcl	2006-09-14 16:39:57.000000000 -0500
+++ tclvfs-20080503-supportnativezlib/library/vfslib.tcl	2012-10-08 14:30:50.930779011 -0500
@@ -5,6 +5,16 @@
 
 namespace eval ::vfs {
     variable zseq 0	;# used to generate temp zstream cmd names
+    variable zlibPkg 0  ;# Use Tcl 8.6+ zlib command, or zlib package
+}
+
+
+# Work with the Tcl 8.6+ built-in zlib command or the zlib package, if available
+catch {
+	set ::vfs::zlibVers [package present zlib]
+	if {$::vfs::zlibVers == "1.1"} {
+		set ::vfs::zlibPkg 1
+	}
 }
 
 # for backwards compatibility
@@ -94,8 +104,12 @@
 		}
 		# to seek back, rewind, i.e. start from scratch
 		if {$a1 < $pos} {
-		    rename $zcmd ""
-		    zlib $imode $zcmd
+		    if {$::vfs::zlibPkg} {
+    			rename $zcmd ""
................................................................................
+    			zlib $imode $zcmd
+		    } else {
+			$zcmd reset
+		    }
 		    seek $ifd 0
 		    set pos 0
 		}
@@ -110,19 +124,26 @@
 		return $pos
 	    }
 	    read {
+                if {$::vfs::zlibPkg} {
+                   set zputcmd fill
+                   set zgetcmd drain
+                } else {
................................................................................
-		    set data [$zcmd drain $n]
+                        $zcmd $zputcmd $data
+                    }
+		    set data [$zcmd $zgetcmd $n]
 		    #puts stderr " read [string length $data]"
 		    if {$data eq ""} break
 		    append r $data
@@ -141,8 +162,12 @@
     }
 
     proc vfs::zstream {mode ifd clen ilen} {
-	set cname _zstream_[incr ::vfs::zseq]
-	zlib s$mode $cname
+        if {$::vfs::zlibPkg} {
+            set cname _zstream_[incr ::vfs::zseq]