Repository: KLayout/klayout (language: python)

Issue:
strmxor test.oas empty.oas xor.oas should use test.oas top cellname, not XOR
```
strmxor -l test.oas empty.oas xor.oas
klayout test.oas -s empty.oas -m xor.oas
```
loads the xor result file.
Trying to navigate to the errors in the Marker Database Browser shows:
```
0/0 [XOR]
Current layout cell 'test' not found in marker database and no path found from marker's cell 'XOR' to current cell in the layout database.
```
Instead of XOR strmxor should use the toplevel cellname of the first layout file.
[test.tgz](https://github.com/user-attachments/files/17106380/test.tgz)




Discussion / hints:

Fix patch:
diff --git a/src/buddies/src/bd/strmxor.cc b/src/buddies/src/bd/strmxor.cc
index 33d8e6ca35..b4797bca1f 100644
--- a/src/buddies/src/bd/strmxor.cc
+++ b/src/buddies/src/bd/strmxor.cc
@@ -360,7 +360,7 @@ BD_PUBLIC int strmxor (int argc, char *argv[])
   generic_reader_options_b.set_group_prefix ("Input B");
 
   std::string infile_a, infile_b, output;
-  std::string top_a, top_b;
+  std::string top_a, top_b, top_output;
   bool dont_summarize_missing_layers = false;
   bool silent = false;
   bool no_summary = false;
@@ -393,6 +393,10 @@ BD_PUBLIC int strmxor (int argc, char *argv[])
       << tl::arg ("-tb|--top-b=name",          &top_b,      "Specifies the top cell for the second layout",
                   "See --top-a for details."
                  )
+      << tl::arg ("-to|--top-output=name",     &top_output, "Specifies the top cell for the output layout",
+                  "This option is only used if an output layout is given. It will specify the name of top cell to use there. "
+                  "If not specified, KLayout uses the top cell name of the first layout or the one given with --top-a."
+                 )
       << tl::arg ("-u|--deep",                 &deep,       "Deep (hierarchical mode)",
                   "Enables hierarchical XOR (experimental). In this mode, tiling is not supported "
                   "and the tiling arguments are ignored."
@@ -518,7 +522,7 @@ BD_PUBLIC int strmxor (int argc, char *argv[])
 
   if (! output.empty ()) {
     output_layout.reset (new db::Layout ());
-    output_top = output_layout->add_cell ("XOR");
+    output_top = output_layout->add_cell (top_output.empty () ? top_a.c_str () : top_output.c_str ());
   }
 
   std::map<std::pair<int, db::LayerProperties>, ResultDescriptor> results;


Test patch:
diff --git a/testdata/bd/strmxor_au1.oas b/testdata/bd/strmxor_au1.oas
index 93919a14e3..5516527dd3 100644
Binary files a/testdata/bd/strmxor_au1.oas and b/testdata/bd/strmxor_au1.oas differ
diff --git a/testdata/bd/strmxor_au1d.oas b/testdata/bd/strmxor_au1d.oas
index 012da78437..a90086579e 100644
Binary files a/testdata/bd/strmxor_au1d.oas and b/testdata/bd/strmxor_au1d.oas differ
diff --git a/testdata/bd/strmxor_au2.oas b/testdata/bd/strmxor_au2.oas
index f88ca5cbda..dfbe699e2c 100644
Binary files a/testdata/bd/strmxor_au2.oas and b/testdata/bd/strmxor_au2.oas differ
diff --git a/testdata/bd/strmxor_au2d.oas b/testdata/bd/strmxor_au2d.oas
index fcef4685e5..da3127ce74 100644
Binary files a/testdata/bd/strmxor_au2d.oas and b/testdata/bd/strmxor_au2d.oas differ
diff --git a/testdata/bd/strmxor_au3.oas b/testdata/bd/strmxor_au3.oas
index 6206bfe2d6..6ea7c70d4a 100644
Binary files a/testdata/bd/strmxor_au3.oas and b/testdata/bd/strmxor_au3.oas differ
diff --git a/testdata/bd/strmxor_au3_heal.oas b/testdata/bd/strmxor_au3_heal.oas
index 0faf2da276..29700b89ad 100644
Binary files a/testdata/bd/strmxor_au3_heal.oas and b/testdata/bd/strmxor_au3_heal.oas differ
diff --git a/testdata/bd/strmxor_au3d.oas b/testdata/bd/strmxor_au3d.oas
index 012da78437..a90086579e 100644
Binary files a/testdata/bd/strmxor_au3d.oas and b/testdata/bd/strmxor_au3d.oas differ
diff --git a/testdata/bd/strmxor_au4.oas b/testdata/bd/strmxor_au4.oas
index 67526e2d4d..8437417d92 100644
Binary files a/testdata/bd/strmxor_au4.oas and b/testdata/bd/strmxor_au4.oas differ
diff --git a/testdata/bd/strmxor_au4_heal.oas b/testdata/bd/strmxor_au4_heal.oas
index b6301286ec..e8875bf504 100644
Binary files a/testdata/bd/strmxor_au4_heal.oas and b/testdata/bd/strmxor_au4_heal.oas differ
diff --git a/testdata/bd/strmxor_au4d.oas b/testdata/bd/strmxor_au4d.oas
index 996d58443a..0724ac6fec 100644
Binary files a/testdata/bd/strmxor_au4d.oas and b/testdata/bd/strmxor_au4d.oas differ
diff --git a/testdata/bd/strmxor_au5.oas b/testdata/bd/strmxor_au5.oas
index 7d444c2327..a032116c65 100644
Binary files a/testdata/bd/strmxor_au5.oas and b/testdata/bd/strmxor_au5.oas differ
diff --git a/testdata/bd/strmxor_au5d.oas b/testdata/bd/strmxor_au5d.oas
index fed55a7132..ab41c95ad4 100644
Binary files a/testdata/bd/strmxor_au5d.oas and b/testdata/bd/strmxor_au5d.oas differ
diff --git a/testdata/bd/strmxor_au6.oas b/testdata/bd/strmxor_au6.oas
index 64faa866c2..1580f4c2f3 100644
Binary files a/testdata/bd/strmxor_au6.oas and b/testdata/bd/strmxor_au6.oas differ
diff --git a/testdata/bd/strmxor_au6d.oas b/testdata/bd/strmxor_au6d.oas
index 2b90eba605..909af0996b 100644
Binary files a/testdata/bd/strmxor_au6d.oas and b/testdata/bd/strmxor_au6d.oas differ