我正在編寫一個程序o/p從文件到表格格式的錯誤/嚴重性/發生,但它不起作用。tcl程序不能正常工作
片段文件:
error_name: xxxxxxxxxx
Severity: Warning Occurrence: 2
error_name2:xxxxxxxxxxx.
Severity: Warning Occurrence: 16
error_name3:xxxxxxxxxxxxx
Severity: Warning Occurrence: 15
代碼:
proc get_clp_summary { Infile } {
set run_summary_file [ glob $Infile/summary.rpt ]
set fp [ open $run_summary_file "r" ]
while { [ gets $fp line ]!= -1 } {
foreach {match label value} [regexp -inline -all {(\w+):\s*(\S*)} $line] {
switch -exact -- $label {
Severity {set sev $value}
Occurrence {set count $value}
default {set err $label}
}
lappend pack_stats [ list $err $sev $count]
puts $pack_stats
}
return $pack_stats
}
##################################################################
set run_time_stats [ get_clp_summary [ lindex $argv 0 ] ]
puts ""
puts ""
puts ""
table_styler
puts " \<table id=\"customers\" style=\"margin-bottom:10px;\" \> "
puts "\<th\> Rule \<\/th\>"
puts "\<th\> Severity \<\/th\>"
puts "\<th\> Occurrence \<\/th\>"
puts "\<\/tr\>"
foreach k $run_time_stats {
set st [ lindex $k 0 ]
set st_type [ lindex $k 1 ]
set st_count [lindex $k 2]
set BGCOLOR #FFFFFF
puts " \<tr\> \<td\> $st \<\/\> \<td bgcolor=\"$BGCOLOR\" \> $st \<\/td\> "
puts "\<td\> \<td bgcolor=\"$BGCOLOR\" \> $st_type \<\/td\> \"
puts "\<td\> $st_count \<\/td\> "
puts "\<\/tr\>"
}
puts " \<\/table\> "
}
puts " \<\/body\> "
puts " \<\/html\> "
請定義「不工作」。它給你什麼?一個錯誤?沒有輸出? –
它沒有任何東西 – tcluser16