Changes On Branch less-memory-stringify

Changes In Branch less-memory-stringify Excluding Merge-Ins

This is equivalent to a diff from 3d037ffb60 to bf2b430faa

2017-10-18
20:00
Always build LibreSSL as PIC (in case we are building a shared object) check-in: 78c713f659 user: rkeene tags: trunk
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:02
Started work on supporting alternate roots Leaf check-in: 975c25c193 user: rkeene tags: support-altroot
04:01
Removed obsolete files from initialization check-in: 3d037ffb60 user: rkeene tags: trunk
2017-10-13
20:39
Updated to the latest version of tcc4tcl check-in: 5d9fc82c1f user: rkeene tags: trunk

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
	}

	return $ret
}

# Convert a string into a C-style binary string
## XXX: This function needs to be optimized








proc stringify {data} {

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

		append ret "\\x${char}"

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

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

	set ret "\"$ret\""

	return $ret
}

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







>
>
>
>
>
>
>
>
|
>
|



|


|



<
|
<







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 {outfd ""}} {
	stringify_putsOrAppend ret $outfd "\""

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

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

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


	stringify_putsOrAppend ret $outfd "\""


	return $ret
}

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