Check-in [f043a10e60]
Overview
Comment:Reduced change in Native ZLIB support patch
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f043a10e6071150d16125660e98a38bae80bf8c3
User & Date: rkeene on 2010-09-26 04:48:00
Other Links: manifest | tags
Context
2010-09-26
04:48
Added scripts to do nightly tests on Subversion and publish results check-in: 3df6039232 user: rkeene tags: trunk
04:48
Reduced change in Native ZLIB support patch check-in: f043a10e60 user: rkeene tags: trunk
04:47
Updated to mark kits which have been cross-compiled in yellow check-in: 2fb02e4e85 user: rkeene tags: trunk
Changes

Modified tclvfs/patches/8.6/tclvfs-20080503-supportnativezlib.diff from [60b79c951c] to [991c9c6c1f].

     1         -Binary files tclvfs-20080503.orig/library/.vfslib.tcl.swp and tclvfs-20080503-1rsk/library/.vfslib.tcl.swp differ
     2         -diff -uNr tclvfs-20080503.orig/library/vfslib.tcl tclvfs-20080503-1rsk/library/vfslib.tcl
            1  +Binary files tclvfs-20080503.orig/library/.vfslib.tcl.swp and tclvfs-20080503-2rsk/library/.vfslib.tcl.swp differ
            2  +diff -uNr tclvfs-20080503.orig/library/vfslib.tcl tclvfs-20080503-2rsk/library/vfslib.tcl
     3      3   --- tclvfs-20080503.orig/library/vfslib.tcl	2006-09-14 16:39:57.000000000 -0500
     4         -+++ tclvfs-20080503-1rsk/library/vfslib.tcl	2010-09-17 11:13:15.000000000 -0500
            4  ++++ tclvfs-20080503-2rsk/library/vfslib.tcl	2010-09-17 16:03:49.000000000 -0500
     5      5   @@ -5,6 +5,14 @@
     6      6    
     7      7    namespace eval ::vfs {
     8      8        variable zseq 0	;# used to generate temp zstream cmd names
     9      9   +    variable zlibPkg 0  ;# Use Tcl 8.6+ zlib command, or zlib package
    10     10   +}
    11     11   +
................................................................................
    13     13   +# Work with the Tcl 8.6+ built-in zlib command or the zlib package, if available
    14     14   +catch {
    15     15   +	package present zlib
    16     16   +	set ::vfs::zlibPkg 1
    17     17    }
    18     18    
    19     19    # for backwards compatibility
    20         -@@ -140,10 +148,70 @@
           20  +@@ -110,19 +118,26 @@
           21  + 		return $pos
    21     22    	}
           23  + 	    read {
           24  ++                if {$::vfs::zlibPkg} {
           25  ++                   set zputcmd fill
           26  ++                   set zgetcmd drain
           27  ++                } else {
           28  ++                   set zputcmd put
           29  ++                   set zgetcmd get
           30  ++                }
           31  + 		set r ""
           32  + 		set n $a1
           33  + 		#puts stderr " want $n z $zcmd pos $pos ilen $ilen"
           34  + 		if {$n + $pos > $ilen} { set n [expr {$ilen - $pos}] }
           35  + 		while {$n > 0} {
           36  +-		    if {[$zcmd fill] == 0} {
           37  ++                    if {![eof $ifd]} {
           38  + 		        set c [expr {$clen - [tell $ifd]}]
           39  + 			if {$c > 4096} { set c 4096 }
           40  + 			set data [read $ifd $c]
           41  + 			#puts "filled $c [string length $data]"
           42  +-			$zcmd fill $data
           43  +-		    }
           44  +-		    set data [$zcmd drain $n]
           45  ++                        $zcmd $zputcmd $data
           46  ++                    }
           47  ++		    set data [$zcmd $zgetcmd $n]
           48  + 		    #puts stderr " read [string length $data]"
           49  + 		    if {$data eq ""} break
           50  + 		    append r $data
           51  +@@ -141,8 +156,12 @@
    22     52        }
    23     53    
    24         -+    proc vfs::zstream_handler_native {zcmd ifd clen ilen imode cmd fd {a1 ""} {a2 ""}} {
    25         -+        upvar ::vfs::_zstream_pos($fd) pos
    26         -+
    27         -+        switch -- $cmd {
    28         -+            seek {
    29         -+                switch $a2 {
    30         -+                    1 - current { incr a1 $pos }
    31         -+                    2 - end { incr a1 $ilen }
    32         -+                }
    33         -+                # to seek back, rewind, i.e. start from scratch
    34         -+                if {$a1 < $pos} {
    35         -+                    rename $zcmd ""
    36         -+                    zlib $imode $zcmd
    37         -+                    seek $ifd 0
    38         -+                    set pos 0
    39         -+                }
    40         -+                # consume data while not yet at seek position
    41         -+                while {$pos < $a1} {
    42         -+                    set n [expr {$a1 - $pos}]
    43         -+                    if {$n > 4096} { set n 4096 }
    44         -+                    # 2003-02-09: read did not work (?), spell it out instead
    45         -+                    #read $fd $n
    46         -+                    zstream_handler $zcmd $ifd $clen $ilen $imode read $fd $n
    47         -+                }
    48         -+                return $pos
    49         -+            }
    50         -+            read {
    51         -+                set r ""
    52         -+                set n $a1
    53         -+                #puts stderr " want $n z $zcmd pos $pos ilen $ilen"
    54         -+                if {$n + $pos > $ilen} { set n [expr {$ilen - $pos}] }
    55         -+                while {$n > 0} {
    56         -+                    set c [expr {$clen - [tell $ifd]}]
    57         -+                    if {$c > 4096} { set c 4096 }
    58         -+                    set data [read $ifd $c]
    59         -+                    #puts "filled $c [string length $data]"
    60         -+                    $zcmd put $data
    61         -+                    set data [$zcmd get $n]
    62         -+                    #puts stderr " read [string length $data]"
    63         -+                    if {$data eq ""} break
    64         -+                    append r $data
    65         -+                    incr pos [string length $data]
    66         -+                    incr n -[string length $data]
    67         -+                }
    68         -+                return $r
    69         -+            }
    70         -+            close {
    71         -+                rename $zcmd ""
    72         -+                close $ifd
    73         -+                unset pos
    74         -+            }
    75         -+            default { error "bad cmd in zstream_handler: $cmd" }
    76         -+        }
    77         -+    }
    78         -+
    79     54        proc vfs::zstream {mode ifd clen ilen} {
    80     55   -	set cname _zstream_[incr ::vfs::zseq]
    81     56   -	zlib s$mode $cname
    82         --	set cmd [list ::vfs::zstream_handler $cname $ifd $clen $ilen s$mode]
    83     57   +        if {$::vfs::zlibPkg} {
    84     58   +            set cname _zstream_[incr ::vfs::zseq]
    85     59   +            zlib s$mode $cname
    86         -+            set cmd [list ::vfs::zstream_handler $cname $ifd $clen $ilen s$mode]
    87     60   +        } else {
    88     61   +            set cname [zlib stream $mode]
    89         -+            set cmd [list ::vfs::zstream_handler_native $cname $ifd $clen $ilen s$mode]
    90     62   +        }
           63  + 	set cmd [list ::vfs::zstream_handler $cname $ifd $clen $ilen s$mode]
    91     64    	set fd [rechan $cmd 2]
    92     65    	set ::vfs::_zstream_pos($fd) 0
    93         - 	return $fd