proc create_list {filename {prompt verbose} {opts "" }} {
set list_return {}

if {[file exists $filename] } {
if {$prompt eq "verbose" } {
puts "create_list : Reading file \"$filename \" and creating a Tcl List .."
}

set fullfile [open $filename r]

while {![eof $fullfile]} {
gets $fullfile line

if {[regexp {\S} $line ]} {
if {"ignore_comments" in $opts && [regexp {^\S*#} $line]} {
continue
}
regsub {\s+$} $line "" line
lappend list_return $line
}
}
close $fullfile
} else {
nv_msg fatal ""
}

return $list_return
}

posted on 2019-09-10 13:10  春风一郎  阅读(535)  评论(0编辑  收藏  举报