From aa361277a0b7de4785c6406a2fd6775e318034f7 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 22 Mar 2026 21:21:11 +0100 Subject: [PATCH] Implementing replication in LStream, OASIS and GDS2 --- src/db/db/dbCell.h | 13 +++- src/db/db/dbCommonReader.cc | 5 ++ src/db/db/dbLibraryProxy.cc | 7 ++ src/db/db/dbLibraryProxy.h | 8 ++ src/db/db/dbSaveLayoutOptions.cc | 70 +++++++++++++++-- src/db/db/dbSaveLayoutOptions.h | 2 +- src/db/db/dbStream.h | 5 ++ src/lay/lay/layLibraryController.cc | 22 ++++-- src/lay/lay/layLibraryController.h | 3 +- src/plugins/streamers/cif/db_plugin/dbCIF.cc | 5 ++ src/plugins/streamers/dxf/db_plugin/dbDXF.cc | 5 ++ .../gds2/db_plugin/contrib/dbGDS2Text.cc | 5 ++ .../streamers/gds2/db_plugin/dbGDS2.cc | 5 ++ .../gds2/db_plugin/dbGDS2WriterBase.cc | 76 ++++++++++--------- .../gds2/db_plugin/dbGDS2WriterBase.h | 2 +- .../lefdef/db_plugin/dbLEFDEFPlugin.cc | 5 ++ .../streamers/lstream/db_plugin/lstrPlugin.cc | 8 ++ .../streamers/lstream/db_plugin/lstrWriter.cc | 7 +- .../streamers/lstream/db_plugin/lstrWriter.h | 2 +- .../streamers/magic/db_plugin/dbMAG.cc | 5 ++ .../streamers/maly/db_plugin/dbMALY.cc | 5 ++ .../streamers/oasis/db_plugin/dbOASIS.cc | 5 ++ .../oasis/db_plugin/dbOASISWriter.cc | 25 +++--- .../pcb/db_plugin/dbGerberImporter.cc | 5 ++ src/tl/tl/tlExpression.cc | 2 - 25 files changed, 232 insertions(+), 70 deletions(-) diff --git a/src/db/db/dbCell.h b/src/db/db/dbCell.h index c616a105d..ac3430020 100644 --- a/src/db/db/dbCell.h +++ b/src/db/db/dbCell.h @@ -857,7 +857,7 @@ public: void check_locked () const; /** - * @brief Tell, if this cell is a proxy cell + * @brief Gets a value indicating if this cell is a proxy cell * * Proxy cells are such whose layout represents a snapshot of another entity. * Such cells can be PCell variants or library references for example. @@ -867,6 +867,17 @@ public: return false; } + /** + * @brief Gets a value indicating that this cell is a replica that can be skipped + * + * This attribute is evaluated by file writers to skip cell replicas for + * library cells that do not want to replicated. + */ + virtual bool can_skip_replica () const + { + return false; + } + /** * @brief Sets the cell name * diff --git a/src/db/db/dbCommonReader.cc b/src/db/db/dbCommonReader.cc index 2924d5685..617ea3f1f 100644 --- a/src/db/db/dbCommonReader.cc +++ b/src/db/db/dbCommonReader.cc @@ -692,6 +692,11 @@ public: return false; } + virtual bool supports_context () const + { + return false; + } + virtual tl::XMLElementBase *xml_reader_options_element () const { return new db::ReaderOptionsXMLElement ("common", diff --git a/src/db/db/dbLibraryProxy.cc b/src/db/db/dbLibraryProxy.cc index 8a4e043f2..58f79994e 100644 --- a/src/db/db/dbLibraryProxy.cc +++ b/src/db/db/dbLibraryProxy.cc @@ -241,6 +241,13 @@ LibraryProxy::update (db::ImportLayerMapping *layer_mapping) } } +bool +LibraryProxy::can_skip_replica () const +{ + const Library *lib = LibraryManager::instance ().lib (lib_id ()); + return lib && ! lib->replicate (); +} + std::string LibraryProxy::get_basic_name () const { diff --git a/src/db/db/dbLibraryProxy.h b/src/db/db/dbLibraryProxy.h index 233348daa..e947de690 100644 --- a/src/db/db/dbLibraryProxy.h +++ b/src/db/db/dbLibraryProxy.h @@ -93,6 +93,14 @@ public: return true; } + /** + * @brief Gets a value indicating that this cell is a replica that can be skipped + * + * This attribute is evaluated by file writers to skip cell replicas for + * library cells that do not want to replicated. + */ + virtual bool can_skip_replica () const; + /** * @brief Gets the basic name * diff --git a/src/db/db/dbSaveLayoutOptions.cc b/src/db/db/dbSaveLayoutOptions.cc index 4c2e55cf6..5561fcdea 100644 --- a/src/db/db/dbSaveLayoutOptions.cc +++ b/src/db/db/dbSaveLayoutOptions.cc @@ -56,7 +56,7 @@ SaveLayoutOptions::operator= (const SaveLayoutOptions &d) m_format = d.m_format; m_layers = d.m_layers; m_cells = d.m_cells; - m_implied_childred = d.m_implied_childred; + m_implied_children = d.m_implied_children; m_all_layers = d.m_all_layers; m_all_cells = d.m_all_cells; m_dbu = d.m_dbu; @@ -189,7 +189,7 @@ SaveLayoutOptions::add_cell (db::cell_index_type cell_index) { m_all_cells = false; m_cells.insert (cell_index); - m_implied_childred.insert (cell_index); + m_implied_children.insert (cell_index); } void @@ -204,7 +204,7 @@ SaveLayoutOptions::clear_cells () { m_all_cells = false; m_cells.clear (); - m_implied_childred.clear (); + m_implied_children.clear (); } void @@ -212,7 +212,7 @@ SaveLayoutOptions::select_all_cells () { m_all_cells = true; m_cells.clear (); - m_implied_childred.clear (); + m_implied_children.clear (); } void @@ -340,21 +340,75 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector &called) +{ + const db::Cell &c = layout.cell (ci); + if (c.can_skip_replica ()) { + return; + } + + for (auto cc = c.begin_child_cells (); ! cc.at_end (); ++cc) { + if (called.find (*cc) == called.end () && layout.is_valid_cell_index (*cc)) { + called.insert (*cc); + collect_called_cells_unskipped (*cc, layout, called); + } + } +} + void SaveLayoutOptions::get_cells (const db::Layout &layout, std::set &cells, const std::vector > &valid_layers, bool require_unique_names) const { + bool has_context = m_write_context_info; + for (tl::Registrar::iterator fmt = tl::Registrar::begin (); fmt != tl::Registrar::end (); ++fmt) { + if (fmt->format_name () == m_format) { + if (! fmt->supports_context ()) { + has_context = false; + } + break; + } + } + if (m_all_cells) { - for (db::Layout::const_iterator cell = layout.begin (); cell != layout.end (); ++cell) { - cells.insert (cell->cell_index ()); + bool has_skipped_replica = false; + + // check if we have skipped replicas + if (has_context) { + for (db::Layout::const_iterator cell = layout.begin (); cell != layout.end () && ! has_skipped_replica; ++cell) { + has_skipped_replica = cell->can_skip_replica (); + } + } + + // with skipped replicas start again and skip child cells of such cells + // unless they are needed in other places. + if (has_skipped_replica) { + + for (db::Layout::const_iterator cell = layout.begin (); cell != layout.end (); ++cell) { + if (cell->is_top ()) { + cells.insert (cell->cell_index ()); + collect_called_cells_unskipped (cell->cell_index (), layout, cells); + } + } + + } else { + + for (db::Layout::const_iterator cell = layout.begin (); cell != layout.end () && ! has_skipped_replica; ++cell) { + cells.insert (cell->cell_index ()); + } + } } else { for (std::set ::const_iterator c = m_cells.begin (); c != m_cells.end (); ++c) { cells.insert (*c); - if (m_implied_childred.find (*c) != m_implied_childred.end ()) { - layout.cell (*c).collect_called_cells (cells); + if (m_implied_children.find (*c) != m_implied_children.end ()) { + if (has_context) { + collect_called_cells_unskipped (*c, layout, cells); + } else { + layout.cell (*c).collect_called_cells (cells); + } } } diff --git a/src/db/db/dbSaveLayoutOptions.h b/src/db/db/dbSaveLayoutOptions.h index 2bc0ab2b7..730db06b2 100644 --- a/src/db/db/dbSaveLayoutOptions.h +++ b/src/db/db/dbSaveLayoutOptions.h @@ -449,7 +449,7 @@ private: std::string m_format; std::map m_layers; std::set m_cells; - std::set m_implied_childred; + std::set m_implied_children; bool m_all_layers; bool m_all_cells; double m_dbu; diff --git a/src/db/db/dbStream.h b/src/db/db/dbStream.h index ed217adbc..b6c1c4381 100644 --- a/src/db/db/dbStream.h +++ b/src/db/db/dbStream.h @@ -109,6 +109,11 @@ public: */ virtual bool can_write () const = 0; + /** + * @brief Returns true, when the format supports a context (e.g. PCell parameters, Library references) + */ + virtual bool supports_context () const = 0; + /** * @brief Delivers the XMLElement object that represents the reader options within a technology XML tree * diff --git a/src/lay/lay/layLibraryController.cc b/src/lay/lay/layLibraryController.cc index df342e21f..f68519041 100644 --- a/src/lay/lay/layLibraryController.cc +++ b/src/lay/lay/layLibraryController.cc @@ -172,15 +172,22 @@ LibraryController::sync_files () for (auto lf = lib_files.begin (); lf != lib_files.end (); ++lf) { - tl::log << "Reading lib file '" << *lf << "'"; + tl::log << "Reading lib file '" << lf->first << "'"; - std::vector libs; - read_lib_file (lf->first, lf->second, libs); + try { - read_libs (libs, new_lib_files); + std::vector libs; + read_lib_file (lf->first, lf->second, libs); - if (m_file_watcher) { - m_file_watcher->add_file (tl::absolute_file_path (lf->first)); + read_libs (libs, new_lib_files); + + if (m_file_watcher) { + m_file_watcher->add_file (tl::absolute_file_path (lf->first)); + } + + } catch (tl::Exception &ex) { + tl::error << tl::to_string (tr ("Error reading lib file")) << " " << lf->first << ":" << tl::endl << ex.msg (); + } catch (...) { } } @@ -416,7 +423,7 @@ LibraryController::read_libs (const std::vector auto ll = m_lib_files.find (lib_path); if (ll == m_lib_files.end ()) { needs_load = true; - } else if (fi.lastModified () > ll->second.time) { + } else if (fi.lastModified () > ll->second.time || im->tech != ll->second.tech || im->replicate != ll->second.replicate) { needs_load = true; } @@ -479,6 +486,7 @@ LibraryController::read_libs (const std::vector li.name = libname; li.time = fi.lastModified (); li.tech = im->tech; + li.replicate = im->replicate; new_lib_files.insert (std::make_pair (lib_path, li)); lib->set_name (libname); diff --git a/src/lay/lay/layLibraryController.h b/src/lay/lay/layLibraryController.h index c7970c5a4..54c345a02 100644 --- a/src/lay/lay/layLibraryController.h +++ b/src/lay/lay/layLibraryController.h @@ -135,10 +135,11 @@ private slots: private: struct LibInfo { - LibInfo () : name (), time (), tech () { } + LibInfo () : name (), time (), tech (), replicate (true) { } std::string name; QDateTime time; std::set tech; + bool replicate; }; tl::FileSystemWatcher *m_file_watcher; diff --git a/src/plugins/streamers/cif/db_plugin/dbCIF.cc b/src/plugins/streamers/cif/db_plugin/dbCIF.cc index f65f42638..693168c40 100644 --- a/src/plugins/streamers/cif/db_plugin/dbCIF.cc +++ b/src/plugins/streamers/cif/db_plugin/dbCIF.cc @@ -173,6 +173,11 @@ public: return true; } + virtual bool supports_context () const + { + return false; + } + virtual tl::XMLElementBase *xml_reader_options_element () const { return new db::ReaderOptionsXMLElement ("cif", diff --git a/src/plugins/streamers/dxf/db_plugin/dbDXF.cc b/src/plugins/streamers/dxf/db_plugin/dbDXF.cc index 59bf45244..0e63d4e6a 100644 --- a/src/plugins/streamers/dxf/db_plugin/dbDXF.cc +++ b/src/plugins/streamers/dxf/db_plugin/dbDXF.cc @@ -140,6 +140,11 @@ public: return true; } + virtual bool supports_context () const + { + return false; + } + virtual tl::XMLElementBase *xml_reader_options_element () const { return new db::ReaderOptionsXMLElement ("dxf", diff --git a/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2Text.cc b/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2Text.cc index 72744aadd..1124d8da4 100644 --- a/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2Text.cc +++ b/src/plugins/streamers/gds2/db_plugin/contrib/dbGDS2Text.cc @@ -89,6 +89,11 @@ class GDS2TextFormatDeclaration { return true; } + + virtual bool supports_context () const + { + return true; + } }; static tl::RegisteredClass format_txt_decl (new GDS2TextFormatDeclaration(), 1, "GDS2Text"); diff --git a/src/plugins/streamers/gds2/db_plugin/dbGDS2.cc b/src/plugins/streamers/gds2/db_plugin/dbGDS2.cc index 6d42a46d8..b5a25a343 100644 --- a/src/plugins/streamers/gds2/db_plugin/dbGDS2.cc +++ b/src/plugins/streamers/gds2/db_plugin/dbGDS2.cc @@ -66,6 +66,11 @@ class GDS2FormatDeclaration return true; } + virtual bool supports_context () const + { + return true; + } + virtual tl::XMLElementBase *xml_writer_options_element () const { return new db::WriterOptionsXMLElement ("gds2", diff --git a/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.cc b/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.cc index c6b7a3ea2..712ea2bd8 100644 --- a/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.cc +++ b/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.cc @@ -338,7 +338,7 @@ GDS2WriterBase::write_shape (const db::Layout &layout, int layer, int datatype, } void -GDS2WriterBase::write_cell (db::Layout &layout, const db::Cell &cref, const std::vector > &layers, const std::set &cell_set, double sf, short *time_data) +GDS2WriterBase::write_cell (db::Layout &layout, const db::Cell &cref, const std::vector > &layers, const std::set &cell_set, double sf, short *time_data, bool skip_body) { // cell header @@ -363,51 +363,56 @@ GDS2WriterBase::write_cell (db::Layout &layout, const db::Cell &cref, const std: } } - // instances + // skip instances and shapes for replicas + if (! skip_body) { - for (db::Cell::const_iterator inst = cref.begin (); ! inst.at_end (); ++inst) { + // instances - // write only instances to selected cells - if (m_keep_instances || cell_set.find (inst->cell_index ()) != cell_set.end ()) { + for (db::Cell::const_iterator inst = cref.begin (); ! inst.at_end (); ++inst) { + + // write only instances to selected cells + if (m_keep_instances || cell_set.find (inst->cell_index ()) != cell_set.end ()) { + + progress_checkpoint (); + try { + write_inst (sf, *inst, true /*normalize*/, m_resolve_skew_arrays, layout, inst->prop_id ()); + } catch (tl::Exception &ex) { + throw tl::Exception (ex.msg () + tl::to_string (tr (", writing instances"))); + } - progress_checkpoint (); - try { - write_inst (sf, *inst, true /*normalize*/, m_resolve_skew_arrays, layout, inst->prop_id ()); - } catch (tl::Exception &ex) { - throw tl::Exception (ex.msg () + tl::to_string (tr (", writing instances"))); } } - } + // shapes - // shapes + for (std::vector >::const_iterator l = layers.begin (); l != layers.end (); ++l) { - for (std::vector >::const_iterator l = layers.begin (); l != layers.end (); ++l) { + if (layout.is_valid_layer (l->first) && l->second.layer >= 0 && l->second.datatype >= 0) { - if (layout.is_valid_layer (l->first) && l->second.layer >= 0 && l->second.datatype >= 0) { - - int layer = l->second.layer; - if (layer > std::numeric_limits::max ()) { - throw tl::Exception (tl::sprintf (tl::to_string (tr ("Cannot write layer numbers larger than %d to GDS2 streams")), int (std::numeric_limits::max ()))); - } - int datatype = l->second.datatype; - if (datatype > std::numeric_limits::max ()) { - throw tl::Exception (tl::sprintf (tl::to_string (tr ("Cannot write datatype numbers larger than %d to GDS2 streams")), int (std::numeric_limits::max ()))); - } - - db::ShapeIterator shape (cref.shapes (l->first).begin (db::ShapeIterator::Boxes | db::ShapeIterator::Polygons | db::ShapeIterator::Edges | db::ShapeIterator::EdgePairs | db::ShapeIterator::Paths | db::ShapeIterator::Texts)); - while (! shape.at_end ()) { - - progress_checkpoint (); - - try { - write_shape (layout, layer, datatype, *shape, sf); - } catch (tl::Exception &ex) { - throw tl::Exception (ex.msg () + tl::sprintf (tl::to_string (tr (", writing layer %d/%d")), layer, datatype)); + int layer = l->second.layer; + if (layer > std::numeric_limits::max ()) { + throw tl::Exception (tl::sprintf (tl::to_string (tr ("Cannot write layer numbers larger than %d to GDS2 streams")), int (std::numeric_limits::max ()))); + } + int datatype = l->second.datatype; + if (datatype > std::numeric_limits::max ()) { + throw tl::Exception (tl::sprintf (tl::to_string (tr ("Cannot write datatype numbers larger than %d to GDS2 streams")), int (std::numeric_limits::max ()))); } - ++shape; + db::ShapeIterator shape (cref.shapes (l->first).begin (db::ShapeIterator::Boxes | db::ShapeIterator::Polygons | db::ShapeIterator::Edges | db::ShapeIterator::EdgePairs | db::ShapeIterator::Paths | db::ShapeIterator::Texts)); + while (! shape.at_end ()) { + + progress_checkpoint (); + + try { + write_shape (layout, layer, datatype, *shape, sf); + } catch (tl::Exception &ex) { + throw tl::Exception (ex.msg () + tl::sprintf (tl::to_string (tr (", writing layer %d/%d")), layer, datatype)); + } + + ++shape; + + } } @@ -580,7 +585,8 @@ GDS2WriterBase::write (db::Layout &layout, tl::OutputStream &stream, const db::S if (! cref.is_real_ghost_cell () && (! cref.is_proxy () || ! cref.is_top ())) { try { - write_cell (layout, cref, layers, cell_set, sf, time_data); + bool skip_body = options.write_context_info () && cref.can_skip_replica (); + write_cell (layout, cref, layers, cell_set, sf, time_data, skip_body); } catch (tl::Exception &ex) { throw tl::Exception (ex.msg () + tl::sprintf (tl::to_string (tr (", writing cell '%s'")), layout.cell_name (*cell))); } diff --git a/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.h b/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.h index 1bc41594c..fda28dcb6 100644 --- a/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.h +++ b/src/plugins/streamers/gds2/db_plugin/dbGDS2WriterBase.h @@ -181,7 +181,7 @@ private: void write_context_cell (db::Layout &layout, const short *time_data, const std::vector &cells); void write_context_string (size_t n, const std::string &s); void write_cell (db::Layout &layout, const db::Cell &cref, const std::vector > &layers, - const std::set &cell_set, double sf, short *time_data); + const std::set &cell_set, double sf, short *time_data, bool skip_body); void write_shape (const db::Layout &layout, int layer, int datatype, const db::Shape &shape, double sf); }; diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc index 1a974bc23..14cd567f3 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFPlugin.cc @@ -310,6 +310,11 @@ class LEFDEFFormatDeclaration return false; } + virtual bool supports_context () const + { + return false; + } + virtual tl::XMLElementBase *xml_reader_options_element () const { return new db::ReaderOptionsXMLElement ("lefdef", diff --git a/src/plugins/streamers/lstream/db_plugin/lstrPlugin.cc b/src/plugins/streamers/lstream/db_plugin/lstrPlugin.cc index 293e27ce5..92db1a264 100644 --- a/src/plugins/streamers/lstream/db_plugin/lstrPlugin.cc +++ b/src/plugins/streamers/lstream/db_plugin/lstrPlugin.cc @@ -105,6 +105,14 @@ class LStreamFormatDeclaration return true; } + /** + * @brief Returns a value indicating whether context information is supported + */ + virtual bool supports_context () const + { + return true; + } + virtual tl::XMLElementBase *xml_writer_options_element () const { return new db::WriterOptionsXMLElement ("lstream", diff --git a/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc b/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc index ccd31f815..43e6af816 100644 --- a/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc +++ b/src/plugins/streamers/lstream/db_plugin/lstrWriter.cc @@ -150,7 +150,8 @@ Writer::write (db::Layout &layout, tl::OutputStream &stream, const db::SaveLayou for (auto c = mp_layout->begin_top_down (); c != mp_layout->end_top_down (); ++c) { if (m_cells_to_write.find (*c) != m_cells_to_write.end ()) { m_cellname = layout.cell_name (*c); - write_cell (*c, kj_stream); + bool skip_body = options.write_context_info () && mp_layout->cell (*c).can_skip_replica (); + write_cell (*c, kj_stream, skip_body); m_cellname.clear (); } } @@ -911,9 +912,9 @@ Writer::make_meta_data (const db::Cell *cell, stream::metaData::MetaData::Builde * This method generates a single-view cell message (the view is only a layout view). */ void -Writer::write_cell (db::cell_index_type ci, kj::BufferedOutputStream &os) +Writer::write_cell (db::cell_index_type ci, kj::BufferedOutputStream &os, bool skip_body) { - bool needs_layout_view = ! mp_layout->cell (ci).is_real_ghost_cell (); + bool needs_layout_view = ! mp_layout->cell (ci).is_real_ghost_cell () && ! skip_body; bool needs_meta_data_view = mp_layout->begin_meta (ci) != mp_layout->end_meta (ci); capnp::MallocMessageBuilder message; diff --git a/src/plugins/streamers/lstream/db_plugin/lstrWriter.h b/src/plugins/streamers/lstream/db_plugin/lstrWriter.h index 9ebd751ac..b51d40d4a 100644 --- a/src/plugins/streamers/lstream/db_plugin/lstrWriter.h +++ b/src/plugins/streamers/lstream/db_plugin/lstrWriter.h @@ -114,7 +114,7 @@ private: void make_cell_hierarchy_tree (stream::library::CellHierarchyTree::Builder cell_tree); void make_meta_data (const db::Cell *cell, stream::metaData::MetaData::Builder meta_data); - void write_cell (db::cell_index_type ci, kj::BufferedOutputStream &os); + void write_cell (db::cell_index_type ci, kj::BufferedOutputStream &os, bool skip_body); void write_layout_view (db::cell_index_type ci, kj::BufferedOutputStream &os); void write_meta_data_view (db::cell_index_type ci, kj::BufferedOutputStream &os); void make_repetition (const RegularArray &array, stream::repetition::Repetition::Builder builder); diff --git a/src/plugins/streamers/magic/db_plugin/dbMAG.cc b/src/plugins/streamers/magic/db_plugin/dbMAG.cc index d4851fb4d..ccd8bc726 100644 --- a/src/plugins/streamers/magic/db_plugin/dbMAG.cc +++ b/src/plugins/streamers/magic/db_plugin/dbMAG.cc @@ -81,6 +81,11 @@ public: return true; } + virtual bool supports_context () const + { + return false; + } + virtual tl::XMLElementBase *xml_reader_options_element () const { return new db::ReaderOptionsXMLElement ("mag", diff --git a/src/plugins/streamers/maly/db_plugin/dbMALY.cc b/src/plugins/streamers/maly/db_plugin/dbMALY.cc index 0cee3c2e9..73823934b 100644 --- a/src/plugins/streamers/maly/db_plugin/dbMALY.cc +++ b/src/plugins/streamers/maly/db_plugin/dbMALY.cc @@ -161,6 +161,11 @@ public: return false; } + virtual bool supports_context () const + { + return false; + } + virtual tl::XMLElementBase *xml_reader_options_element () const { return new db::ReaderOptionsXMLElement ("maly", diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASIS.cc b/src/plugins/streamers/oasis/db_plugin/dbOASIS.cc index 621deca28..e87c2723e 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASIS.cc +++ b/src/plugins/streamers/oasis/db_plugin/dbOASIS.cc @@ -464,6 +464,11 @@ public: return true; } + virtual bool supports_context () const + { + return true; + } + virtual tl::XMLElementBase *xml_writer_options_element () const { return new db::WriterOptionsXMLElement ("oasis", diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc index 49f7b7077..93e0cafd0 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc +++ b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc @@ -1727,18 +1727,23 @@ OASISWriter::write (db::Layout &layout, tl::OutputStream &stream, const db::Save write_props (cref.prop_id ()); } - // instances - if (cref.cell_instances () > 0) { - write_insts (cell_set); - } + bool skip_body = options.write_context_info () && cref.can_skip_replica (); + if (! skip_body) { - // shapes - for (std::vector >::const_iterator l = layers.begin (); l != layers.end (); ++l) { - const db::Shapes &shapes = cref.shapes (l->first); - if (! shapes.empty ()) { - write_shapes (l->second, shapes); - m_progress.set (mp_stream->pos ()); + // instances + if (cref.cell_instances () > 0) { + write_insts (cell_set); } + + // shapes + for (std::vector >::const_iterator l = layers.begin (); l != layers.end (); ++l) { + const db::Shapes &shapes = cref.shapes (l->first); + if (! shapes.empty ()) { + write_shapes (l->second, shapes); + m_progress.set (mp_stream->pos ()); + } + } + } // end CBLOCK if required diff --git a/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc b/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc index 176c527df..3464b955e 100644 --- a/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc +++ b/src/plugins/streamers/pcb/db_plugin/dbGerberImporter.cc @@ -1206,6 +1206,11 @@ class GerberFormatDeclaration { return false; } + + virtual bool supports_context () const + { + return false; + } }; static tl::RegisteredClass format_decl (new GerberFormatDeclaration (), 1000, "GerberPCB"); diff --git a/src/tl/tl/tlExpression.cc b/src/tl/tl/tlExpression.cc index ef7b8345a..5328616eb 100644 --- a/src/tl/tl/tlExpression.cc +++ b/src/tl/tl/tlExpression.cc @@ -4108,8 +4108,6 @@ Eval::parse (Expression &expr, const std::string &s, bool top) void Eval::parse (Expression &expr, tl::Extractor &ex, bool top) { - ex.skip (); - expr = Expression (this, ex.get ()); tl::Extractor ex0 = ex;