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: branch diff | 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
60
61
62
63
64
65








66
67



68
69
70
71

72
73
74

75
76
77
78
79

80
81
82
83
84
85
86
87
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73


74
75
76
77
78
79

80
81
82

83
84
85
86


87

88
89
90
91
92
93
94







+
+
+
+
+
+
+
+
-
-
+
+
+



-
+


-
+



-
-
+
-







	}

	return $ret
}

# Convert a string into a C-style binary string
## XXX: This function needs to be optimized
proc stringify_putsOrAppend {var fd data} {
	if {$fd eq ""} {
		uplevel 1 [list append $var $data]
	} else {
		puts -nonewline $fd $data
	}
}

proc stringify {data} {
	set ret "\""
proc stringify {data {outfd ""}} {
	stringify_putsOrAppend ret $outfd "\""

	for {set idx 0} {$idx < [string length $data]} {incr idx} {
		binary scan [string index $data $idx] H* char

		append ret "\\x${char}"
		stringify_putsOrAppend ret $outfd "\\x${char}"

		if {($idx % 20) == 0 && $idx != 0} {
			append ret "\"\n\""
			stringify_putsOrAppend ret $outfd "\"\n\""
		}
	}

	set ret [string trim $ret "\n\""]

	stringify_putsOrAppend ret $outfd "\""
	set ret "\"$ret\""

	return $ret
}

# Encrypt the data
proc random_byte {} {
	set value [expr {int(256 * rand())}]