tuning of is_xschem_file proc to avoid misdetecton of valid files
This commit is contained in:
parent
6655a4a616
commit
e5d60bb92a
|
|
@ -885,6 +885,12 @@ void read_record(int firstchar, FILE *fp, int dbg_level)
|
|||
{
|
||||
int c;
|
||||
char *str = NULL;
|
||||
int unget = 1;
|
||||
|
||||
if(firstchar == -1) {
|
||||
firstchar = fgetc(fp);
|
||||
unget = 0;
|
||||
}
|
||||
dbg(dbg_level, "SKIP RECORD\n");
|
||||
if(firstchar != '{') {
|
||||
dbg(dbg_level, "%c", firstchar);
|
||||
|
|
@ -893,7 +899,7 @@ void read_record(int firstchar, FILE *fp, int dbg_level)
|
|||
if (c=='\r') continue;
|
||||
if(c == '\n') {
|
||||
dbg(dbg_level, "\n");
|
||||
ungetc(c, fp); /* so following read_line does not skip next line */
|
||||
if(unget) ungetc(c, fp); /* so following read_line does not skip next line */
|
||||
break;
|
||||
}
|
||||
if(c == '{') {
|
||||
|
|
|
|||
|
|
@ -2040,6 +2040,7 @@ proc is_xschem_file {f} {
|
|||
if {$a} {
|
||||
puts stderr "Can not open file $f"
|
||||
} else {
|
||||
fconfigure $fd -translation binary
|
||||
while { [gets $fd line] >=0 } {
|
||||
if { [regexp {^[TKGVSE] \{} $line] } { incr score }
|
||||
if { [regexp {^[BL] +[0-9]+ +[-0-9.eE]+ +[-0-9.eE]+ +[-0-9.eE]+ +[-0-9.eE]+ +\{} $line] } {incr score}
|
||||
|
|
@ -2049,7 +2050,7 @@ proc is_xschem_file {f} {
|
|||
set ret 1
|
||||
}
|
||||
}
|
||||
if { $score > 6 } { set ret 1} ;# Heuristic decision :-)
|
||||
if { $score > 4 } { set ret 1} ;# Heuristic decision :-)
|
||||
if { $ret } {
|
||||
if { $instances} {
|
||||
set ret SCHEMATIC
|
||||
|
|
|
|||
Loading…
Reference in New Issue