Qucs / qucs

Qucs Project official mirror
http://qucs.sourceforge.net/
GNU General Public License v2.0
1.15k stars 213 forks source link

qucs schematic file extension #391

Closed felix-salfelder closed 9 years ago

felix-salfelder commented 9 years ago

qucs uses .sch as the file extension for what is called "schematic file". gschem uses the same extension.

qucs should be able to read/write file formats other than its own. verilog and gschem would be the first i'd like to implement. if this happens, the .sch extension will be ambiguous...

what shall we do about it? does it matter?

guitorri commented 9 years ago

IMHO it does not matter. We should not rely on file extension for file processing.

felix-salfelder commented 9 years ago

sure, but what will the File->Open dialog do about the types? (sorry, i am not used to graphical UI stuff, and this question might be stupid).

guitorri commented 9 years ago

Perhaps have:

Qucs schematic (.sch)
gEDA schematic (.sch)

Ultimately the reader should check the contents and inform the user about unexpected file contents. No?

For the record KiCAD also uses .sch.

felix-salfelder commented 9 years ago

Ultimately the reader should check the contents and inform the user about unexpected file contents. No?

OK, the file selector simply lists all .sch files, and we need several readers, and a lookahead. should be feasible.

reader = NULL;
for (i in readers[".sch"]){
    if i->understands(file){
         reader = *i;
    }else{
    }
}
if(!reader){
    error("none of the readers can read your file");
}else{
    try{
       reader->parse(schematic, file);
    }except e{
        error( reader->name() + "was not able to read file:" + e.string())
    }
}

For the record KiCAD also uses .sch.

ok, thanks for the input, all the more we will need the above.