Check-in [bf2b430faa]
Overview
Comment:Started work on a stringify that does not use as much RAM
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | less-memory-stringify
Files: files | file ages | folders
SHA1:bf2b430faa6d6f0a7c0f27481783c85e90bcc937
User & Date: rkeene on 2017-10-17 04:03:09
Other Links: manifest | tags
Context
2017-10-17
04:03
Started work on a stringify that does not use as much RAM Leaf check-in: bf2b430faa user: rkeene tags: less-memory-stringify
04:01
Removed obsolete files from initialization check-in: 3d037ffb60 user: rkeene tags: trunk
Changes

Modified kitsh/buildsrc/kitsh-0.0/dir2c.tcl from [990f9a7e47] to [2f404d8acb].

    59     59   	}
    60     60   
    61     61   	return $ret
    62     62   }
    63     63   
    64     64   # Convert a string into a C-style binary string
    65     65   ## XXX: This function needs to be optimized
    66         -proc stringify {data} {
    67         -	set ret "\""
           66  +proc stringify_putsOrAppend {var fd data} {
           67  +	if {$fd eq ""} {
           68  +		uplevel 1 [list append $var $data]
           69  +	} else {
           70  +		puts -nonewline $fd $data
           71  +	}
           72  +}
           73  +
           74  +proc stringify {data {outfd ""}} {
           75  +	stringify_putsOrAppend ret $outfd "\""
           76  +
    68     77   	for {set idx 0} {$idx < [string length $data]} {incr idx} {
    69     78   		binary scan [string index $data $idx] H* char
    70     79   
    71         -		append ret "\\x${char}"
           80  +		stringify_putsOrAppend ret $outfd "\\x${char}"
    72     81   
    73     82   		if {($idx % 20) == 0 && $idx != 0} {
    74         -			append ret "\"\n\""
           83  +			stringify_putsOrAppend ret $outfd "\"\n\""
    75     84   		}
    76     85   	}
    77     86   
    78         -	set ret [string trim $ret "\n\""]
    79         -
    80         -	set ret "\"$ret\""
           87  +	stringify_putsOrAppend ret $outfd "\""
    81     88   
    82     89   	return $ret
    83     90   }
    84     91   
    85     92   # Encrypt the data
    86     93   proc random_byte {} {
    87     94   	set value [expr {int(256 * rand())}]