mirror of https://github.com/KLayout/klayout.git
Adding --blend-mode to buddy scripts for mitigating the risk of joining files
This commit is contained in:
parent
f9762009c6
commit
85c3128c13
|
|
@ -80,6 +80,8 @@
|
|||
Iterated OASIS instances are stored and handled in a leaner way in viewer mode
|
||||
* Enhancement: Buddy scripts can concatenate files with "+" for input
|
||||
Concatenation happens by "blending files". Beware of the risk this implies.
|
||||
A new option "--blend-mode" has been introduced for supporting overwrite, skip
|
||||
and variant formation in case of cell name conflicts. See buddy script help.
|
||||
* Enhancement: Layer maps now support n:m layer mapping
|
||||
This allows mapping n input layers to one logical layer (merging) and also
|
||||
one input layer to m logical ones (clone layer). This applies to the
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ GenericReaderOptions::GenericReaderOptions ()
|
|||
|
||||
m_common_enable_text_objects = load_options.get_option_by_name ("text_enabled").to_bool ();
|
||||
m_common_enable_properties = load_options.get_option_by_name ("properties_enabled").to_bool ();
|
||||
m_cell_conflict_resolution = load_options.get_options<db::CommonReaderOptions> ().cell_conflict_resolution;
|
||||
|
||||
m_gds2_box_mode = load_options.get_option_by_name ("gds2_box_mode").to_uint ();
|
||||
m_gds2_allow_big_records = load_options.get_option_by_name ("gds2_allow_big_records").to_bool ();
|
||||
|
|
@ -197,6 +198,15 @@ GenericReaderOptions::add_options (tl::CommandLineOptions &cmd)
|
|||
"Each line in this file is read as one layer mapping expression. "
|
||||
"Empty lines or lines starting with a hash (#) character or with double slashes (//) are ignored."
|
||||
)
|
||||
<< tl::arg (group +
|
||||
"--" + m_long_prefix + "blend-mode=mode", &m_cell_conflict_resolution, "Specifies how cell conflicts are resolved when using file concatenation",
|
||||
"When concatenating file with '+', the reader will handle cells with the same names according to this mode:\n"
|
||||
"\n"
|
||||
"* 0: joins everything (default, risk of spoiling layouts)\n"
|
||||
"* 1: overwrite\n"
|
||||
"* 2: skip new cell\n"
|
||||
"* 3: create a variant with a new name"
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -684,6 +694,7 @@ GenericReaderOptions::configure (db::LoadLayoutOptions &load_options) const
|
|||
load_options.set_option_by_name ("create_other_layers", m_create_other_layers);
|
||||
load_options.set_option_by_name ("text_enabled", m_common_enable_text_objects);
|
||||
load_options.set_option_by_name ("properties_enabled", m_common_enable_properties);
|
||||
load_options.get_options<db::CommonReaderOptions> ().cell_conflict_resolution = db::CellConflictResolution (m_cell_conflict_resolution);
|
||||
|
||||
load_options.set_option_by_name ("gds2_box_mode", m_gds2_box_mode);
|
||||
load_options.set_option_by_name ("gds2_allow_big_records", m_gds2_allow_big_records);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ private:
|
|||
bool m_create_other_layers;
|
||||
double m_dbu;
|
||||
bool m_keep_layer_names;
|
||||
unsigned int m_cell_conflict_resolution;
|
||||
|
||||
// common GDS2+OASIS
|
||||
bool m_common_enable_text_objects;
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ TEST(10)
|
|||
// General
|
||||
"-im=1/0 3,4/0-255 A:17/0",
|
||||
"-is",
|
||||
"--blend-mode=1",
|
||||
// OASIS
|
||||
"--expect-strict-mode=1"
|
||||
};
|
||||
|
|
@ -258,6 +259,7 @@ TEST(10)
|
|||
EXPECT_EQ (stream_opt.get_option_by_name ("dxf_text_scaling").to_int (), 100);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("layer_map").to_user<db::LayerMap> ().to_string (), "layer_map()");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("create_other_layers").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("cell_conflict_resolution").to_string (), "AddToCell");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("properties_enabled").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("text_enabled").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("gds2_box_mode").to_uint (), (unsigned int) 1);
|
||||
|
|
@ -283,6 +285,7 @@ TEST(10)
|
|||
EXPECT_EQ (stream_opt.get_option_by_name ("dxf_text_scaling").to_int (), 75);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("layer_map").to_user<db::LayerMap> ().to_string (), "layer_map('1/0';'3-4/0-255';'A : 17/0')");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("create_other_layers").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("cell_conflict_resolution").to_string (), "OverwriteCell");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("properties_enabled").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("text_enabled").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("gds2_box_mode").to_uint (), (unsigned int) 3);
|
||||
|
|
|
|||
Loading…
Reference in New Issue