mirror of
https://github.com/openhwgroup/cvw.git
synced 2025-06-27 08:50:26 -04:00
18 lines
535 B
Text
18 lines
535 B
Text
# Alec Vercruysse
|
|
# 2023-04-12
|
|
# Note that the target string is regex, and needs to be double-escaped.
|
|
# e.g. to match a (, you need \\(.
|
|
proc GetLineNum {fname target} {
|
|
set f [open $fname]
|
|
set linectr 1
|
|
while {[gets $f line] != -1} {
|
|
if {[regexp $target $line]} {
|
|
close $f
|
|
return $linectr
|
|
}
|
|
incr linectr
|
|
}
|
|
close $f
|
|
return -code error \
|
|
[append "target string not found " $target " not found by GetLineNum.do for coverage exclusion in " $fname]
|
|
}
|