13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
-
+
|
proc ::xvfs::printHelp {channel {errors ""}} {
if {[llength $errors] != 0} {
foreach error $errors {
puts $channel "error: $error"
}
puts $channel ""
}
puts $channel "Usage: dir2c \[--help\] \[--output <filename>\] --directory <rootDirectory> --name <fsName>"
puts $channel "Usage: dir2c \[--help\] \[--set-mode {flexible|standalone|client}\] \[--output <filename>\] --directory <rootDirectory> --name <fsName>"
flush $channel
}
proc ::xvfs::sanitizeCString {string} {
set output [join [lmap char [split $string ""] {
if {![regexp {[A-Za-z0-9./-]} $char]} {
binary scan $char H* char
|
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
-
+
|
}
"--directory" {
set rootDirectory $val
}
"--name" {
set fsName $val
}
"--output" - "--header" {
"--output" - "--header" - "--set-mode" {
# Ignored, handled as part of some other process
}
default {
printHelp stderr [list "Invalid option: $arg $val"]
exit 1
}
}
|
305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
+
+
+
+
+
+
+
+
|
}
proc ::xvfs::staticIncludeHeader {pathToHeaderFile} {
set fd [open $pathToHeaderFile]
::xvfs::staticIncludeHeaderData [read $fd]
close $fd
}
proc ::xvfs::setSpecificMode {mode} {
::minirivet::_emitOutput "#undef XVFS_MODE_SERVER\n"
::minirivet::_emitOutput "#undef XVFS_MODE_CLIENT\n"
::minirivet::_emitOutput "#undef XVFS_MODE_FLEXIBLE\n"
::minirivet::_emitOutput "#undef XVFS_MODE_STANDALONE\n"
::minirivet::_emitOutput "#define XVFS_MODE_[string toupper $mode] 1\n"
}
proc ::xvfs::_tryFit {list} {
set idx -1
set lastItem -100000
foreach item $list {
incr idx
|