Skip to content

Commit 894d18e

Browse files
dngarrettcradek
authored andcommitted
tooledit: bug fixes
make line number reporting begin at 1 fix misuse of continue statement
1 parent dcc5a94 commit 894d18e

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/emc/usr_intf/tooledit.tcl

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ proc ::tooledit::readfile {filename} {
262262
set fd [open $filename r]
263263
264264
set bct 0
265-
set lno 1
265+
set lno 0
266266
while {1} {
267267
gets $fd newline
268-
incr lno
268+
incr lno ;# starts at 1
269269
if [eof $fd] break
270270
foreach item {t p x y z a b c u v w d i j q comment} {
271271
set u($item) ""
@@ -833,31 +833,33 @@ proc ::tooledit::toolvalidate {args} {
833833
}
834834
835835
# check for multiple uses of a single pocket
836-
if ![info exists ::te(items)] continue
837-
set pocs ""
838-
foreach i $::te(items) {
839-
set p $::te(parm,$i,poc)
836+
if [info exists ::te(items)] {
837+
set pocs ""
838+
foreach i $::te(items) {
839+
set p $::te(parm,$i,poc)
840840
841-
if {[lsearch $pocs $p] >= 0} {
842-
set nextmsg [format [_ "Pocket <%s> specified multiple times"] $p]
843-
if {[lsearch $msg $nextmsg] >= 0} continue
844-
lappend msg $nextmsg
845-
} else {
846-
lappend pocs $p
841+
if {[lsearch $pocs $p] >= 0} {
842+
set nextmsg [format [_ "Pocket <%s> specified multiple times"] $p]
843+
if {[lsearch $msg $nextmsg] >= 0} continue
844+
lappend msg $nextmsg
845+
} else {
846+
lappend pocs $p
847+
}
847848
}
848849
}
849850
# check for multiple uses of a single tool
850-
if ![info exists ::te(items)] continue
851-
set tools ""
852-
foreach i $::te(items) {
853-
set t $::te(parm,$i,tool)
851+
if [info exists ::te(items)] {
852+
set tools ""
853+
foreach i $::te(items) {
854+
set t $::te(parm,$i,tool)
854855
855-
if {[lsearch $tools $t] >= 0} {
856-
set nextmsg [format [_ "Tool <%s> specified multiple times"] $t]
857-
if {[lsearch $msg $nextmsg] >= 0} continue
858-
lappend msg $nextmsg
859-
} else {
860-
lappend tools $t
856+
if {[lsearch $tools $t] >= 0} {
857+
set nextmsg [format [_ "Tool <%s> specified multiple times"] $t]
858+
if {[lsearch $msg $nextmsg] >= 0} continue
859+
lappend msg $nextmsg
860+
} else {
861+
lappend tools $t
862+
}
861863
}
862864
}
863865

0 commit comments

Comments
 (0)