Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

flaw in th script to be seen

Status
Not open for further replies.

sun_ray

Advanced Member level 3
Advanced Member level 3
Joined
Oct 3, 2011
Messages
772
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Visit site
Activity points
6,828
Hello following is a piece of code that compare two files named m1 and f1 and searches for a string that contain 'circuit1' in m1 and see if similar string consisting of string1 is there in f1. If I run the script I get a warning that extra character after close brace at the line that contain while {[gets $master_file line] >= 0 }{. Can you please where is the flaw that such a warning comes?


proc comparison {m1 f1} {

set master_file [open $m1 r]
set compare_file [open $f1 r]

set masterlist {}
set comparelist {}
set result {}

while {[gets $master_file line] >= 0 }{
if {[regexp {circuit1} $line]}{
lappend masterlist $line
}
}

while {[gets $compare_file line] >= 0 }{
if {[regexp {circuit1} $line]}{
lappend comparelist $line
}
}

for {set i 0} { $i< [llength $comparelist]} { incr i} {
for {set j 0} {$j < [llength $masterlist] } {incr j} {
lappend result [string compare [lindex $comparelist $i] [lindex $masterlist $j]]
}
set comp_var [lsearch $result "1"]
if {$comp_var eq -1} {
puts "[lindex $comparelist $i]"
}
set result {}
}
close $master_file
close $compare_file
}
comparison file1 file2
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top