mirror of https://github.com/KLayout/klayout.git
Merge pull request #1697 from KLayout/bugfix/issue-1696
Bugfix/issue 1696
This commit is contained in:
commit
7b3804ce1a
|
|
@ -395,12 +395,18 @@ void LayoutToNetlistStandardReader::read_netlist (db::Netlist *netlist, db::Layo
|
|||
throw tl::Exception (tl::to_string (tr ("Duplicate definition of device class: ")) + class_name);
|
||||
}
|
||||
|
||||
db::DeviceClassTemplateBase *dct = db::DeviceClassTemplateBase::template_by_name (templ_name);
|
||||
if (! dct) {
|
||||
throw tl::Exception (tl::to_string (tr ("Invalid device class template: ")) + templ_name);
|
||||
db::DeviceClass *dc;
|
||||
if (templ_name.empty ()) {
|
||||
// generic device class (issue #1696)
|
||||
dc = new db::DeviceClass ();
|
||||
} else {
|
||||
db::DeviceClassTemplateBase *dct = db::DeviceClassTemplateBase::template_by_name (templ_name);
|
||||
if (! dct) {
|
||||
throw tl::Exception (tl::to_string (tr ("Invalid device class template: ")) + templ_name);
|
||||
}
|
||||
dc = dct->create ();
|
||||
}
|
||||
|
||||
db::DeviceClass *dc = dct->create ();
|
||||
dc->set_name (class_name);
|
||||
netlist->add_device_class (dc);
|
||||
|
||||
|
|
|
|||
|
|
@ -539,3 +539,27 @@ TEST(6_ReaderLog)
|
|||
compare_text_files (path, au_path);
|
||||
}
|
||||
|
||||
// issue #1696
|
||||
TEST(7_CustomDevice)
|
||||
{
|
||||
db::LayoutToNetlist l2n;
|
||||
|
||||
std::string in_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_7.l2n");
|
||||
tl::InputStream is_in (in_path);
|
||||
|
||||
db::LayoutToNetlistStandardReader reader (is_in);
|
||||
reader.read (&l2n);
|
||||
|
||||
// verify against the input
|
||||
|
||||
std::string path = tmp_file ("tmp.txt");
|
||||
{
|
||||
tl::OutputStream stream (path);
|
||||
db::LayoutToNetlistStandardWriter writer (stream, false);
|
||||
writer.write (&l2n);
|
||||
}
|
||||
|
||||
std::string au_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_au_7.l2n");
|
||||
|
||||
compare_text_files (path, au_path);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue