Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Rawbin must set channel to binary before reading/writing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:eef93ae4e9c1cba7ded2d60154efa5b8322401a2
User & Date: erikj 2017-11-16 21:00:36
Context
2017-11-16
21:07
Added *nix script make_pycco mirroring Windows .bat version. Regenerated docs. check-in: 54828bd154 user: erikj tags: trunk
21:00
Rawbin must set channel to binary before reading/writing. check-in: eef93ae4e9 user: erikj tags: trunk
2017-11-14
07:14
Deleted 0-length file that somehow got added. check-in: 7b1f1bf6fd user: erikj tags: trunk
Changes

Changes to binconvert.tcl.

179
180
181
182
183
184
185
186
187
188

189

190



191
192
193
194
195
196
197
    # these formats are normally only used on relatively small files, we're
    # temporarily storing the whole thing in memory.  If you run out of
    # memory here, your file is on the order of a Gigabyte or more... and
    # these are really not appropriate formats for something that large.
    set cnt 1
    set chan [open $fname r]
    try {
        set dataS [read $chan]
        # Unless the data is raw binary, split the input data into lines.
        # If the format *is* raw binary, there's no lines to split.

        if {$datafmt ne "rawbin"} {

            set dataL [split $dataS \n]



        }
    } finally {
        chan close $chan
    }

    ##### Parse input data
    # Note that actual input parsing here is done by the parser selected







<

|
>

>

>
>
>







179
180
181
182
183
184
185

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
    # these formats are normally only used on relatively small files, we're
    # temporarily storing the whole thing in memory.  If you run out of
    # memory here, your file is on the order of a Gigabyte or more... and
    # these are really not appropriate formats for something that large.
    set cnt 1
    set chan [open $fname r]
    try {

        # Unless the data is raw binary, split the input data into lines.
        # If the format *is* raw binary, there's no lines to split, but we
        # need to read it as binary.
        if {$datafmt ne "rawbin"} {
            set dataS [read $chan]
            set dataL [split $dataS \n]
        } else {
            chan configure $chan -translation {binary binary} -encoding binary
            set dataS [read $chan]
        }
    } finally {
        chan close $chan
    }

    ##### Parse input data
    # Note that actual input parsing here is done by the parser selected

Changes to make_pycco.bat.

2
3
4
5
6
7
8
9
10
setlocal EnableDelayedExpansion 
set filelist=-i
for /f "tokens=* USEBACKQ" %%F in (`dir *.tcl /b`) do (
    if /i "%%F" neq "pkgIndex.tcl" (
        set filelist=!filelist! %%F
    )
)
echo filelist is: %filelist%
pycco %filelist%







<

2
3
4
5
6
7
8

9
setlocal EnableDelayedExpansion 
set filelist=-i
for /f "tokens=* USEBACKQ" %%F in (`dir *.tcl /b`) do (
    if /i "%%F" neq "pkgIndex.tcl" (
        set filelist=!filelist! %%F
    )
)

pycco %filelist%

Changes to rawbin.tcl.

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
    # Scan the list for the end address.
    set maxAddr 0
    foreach {addr dataL} $segmentList {
        if {$maxAddr < ($addr + [llength $dataL])} {
            set maxAddr [expr {$addr + [llength $dataL]}]
        }
    }
    set outL [lrepeat $fillValue ]

    # We have our filled output list.  For each segment, replace the data
    # in the appropriate range with the segment data.
    foreach {addr dataL} $segmentList {
        set outL [lreplace $outL $addr [expr {$addr + [llength $dataL]}] {*}$dataL]]
    }

    # After the output list is completely filled, convert it to a binary
    # string and write it to disk.  Don't forget to set the output channel to
    # binary too, to keep line feeds from being corrupted.
    set outS [binary format c* $outL]
    chan configure $outchan -translation binary
    puts $outchan $outS
}







|











|


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
    # Scan the list for the end address.
    set maxAddr 0
    foreach {addr dataL} $segmentList {
        if {$maxAddr < ($addr + [llength $dataL])} {
            set maxAddr [expr {$addr + [llength $dataL]}]
        }
    }
    set outL [lrepeat $fillValue]

    # We have our filled output list.  For each segment, replace the data
    # in the appropriate range with the segment data.
    foreach {addr dataL} $segmentList {
        set outL [lreplace $outL $addr [expr {$addr + [llength $dataL]}] {*}$dataL]]
    }

    # After the output list is completely filled, convert it to a binary
    # string and write it to disk.  Don't forget to set the output channel to
    # binary too, to keep line feeds from being corrupted.
    set outS [binary format c* $outL]
    chan configure $outchan -translation {binary binary} -encoding binary
    puts $outchan $outS
}