mirror of https://github.com/KLayout/klayout.git
Removed D25 tech component
This commit is contained in:
parent
8c0498cc4c
commit
4acd0aabc5
|
|
@ -204,7 +204,6 @@ SOURCES = \
|
|||
gsiDeclDbNetlistCrossReference.cc \
|
||||
gsiDeclDbLayoutVsSchematic.cc \
|
||||
dbNetlistObject.cc \
|
||||
dbD25TechnologyComponent.cc \
|
||||
gsiDeclDbTexts.cc \
|
||||
dbTexts.cc \
|
||||
dbDeepTexts.cc \
|
||||
|
|
@ -381,7 +380,6 @@ HEADERS = \
|
|||
dbLayoutVsSchematicFormatDefs.h \
|
||||
dbLayoutVsSchematic.h \
|
||||
dbNetlistObject.h \
|
||||
dbD25TechnologyComponent.h \
|
||||
dbTexts.h \
|
||||
dbDeepTexts.h \
|
||||
dbAsIfFlatTexts.h \
|
||||
|
|
|
|||
|
|
@ -1,436 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2022 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "dbD25TechnologyComponent.h"
|
||||
#include "tlClassRegistry.h"
|
||||
#include "tlString.h"
|
||||
|
||||
namespace db
|
||||
{
|
||||
|
||||
std::string d25_component_name ()
|
||||
{
|
||||
return std::string ("d25");
|
||||
}
|
||||
|
||||
std::string d25_description ()
|
||||
{
|
||||
return tl::to_string (tr ("Z stack (2.5d)"));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// D25LayerInfo implementation
|
||||
|
||||
D25LayerInfo::D25LayerInfo ()
|
||||
: m_layer (), m_zstart (0.0), m_zstop (0.0)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
D25LayerInfo::~D25LayerInfo ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
D25LayerInfo::D25LayerInfo (const D25LayerInfo &other)
|
||||
{
|
||||
operator= (other);
|
||||
}
|
||||
|
||||
D25LayerInfo &
|
||||
D25LayerInfo::operator= (const D25LayerInfo &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
m_layer = other.m_layer;
|
||||
m_zstart = other.m_zstart;
|
||||
m_zstop = other.m_zstop;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
D25LayerInfo::operator== (const D25LayerInfo &other) const
|
||||
{
|
||||
return fabs (m_zstart - other.m_zstart) < db::epsilon && fabs (m_zstop - other.m_zstop) < db::epsilon;
|
||||
}
|
||||
|
||||
void
|
||||
D25LayerInfo::set_layer (const db::LayerProperties &l)
|
||||
{
|
||||
m_layer = l;
|
||||
}
|
||||
|
||||
void
|
||||
D25LayerInfo::set_layer_from_string (const std::string &l)
|
||||
{
|
||||
db::LayerProperties lp;
|
||||
tl::Extractor ex (l.c_str ());
|
||||
try {
|
||||
lp.read (ex);
|
||||
} catch (tl::Exception &) {
|
||||
// ignore errors for now.
|
||||
}
|
||||
m_layer = lp;
|
||||
}
|
||||
|
||||
std::string
|
||||
D25LayerInfo::layer_as_string () const
|
||||
{
|
||||
return m_layer.to_string ();
|
||||
}
|
||||
|
||||
void
|
||||
D25LayerInfo::set_zstart (double z0)
|
||||
{
|
||||
m_zstart = z0;
|
||||
}
|
||||
|
||||
void
|
||||
D25LayerInfo::set_zstop (double z1)
|
||||
{
|
||||
m_zstop = z1;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// D25TechnologyComponent implementation
|
||||
|
||||
D25TechnologyComponent::D25TechnologyComponent ()
|
||||
: db::TechnologyComponent (d25_component_name (), d25_description ())
|
||||
{
|
||||
// provide some explanation for the initialization
|
||||
m_src =
|
||||
"# Provide z stack information here\n"
|
||||
"#\n"
|
||||
"# Each line is one layer. The specification consists of a layer specification, a colon and arguments.\n"
|
||||
"# The arguments are named (like \"x=...\") or in serial. Parameters are separated by comma or blanks.\n"
|
||||
"# Named arguments are:\n"
|
||||
"#\n"
|
||||
"# zstart The lower z position of the extruded layer in µm\n"
|
||||
"# zstop The upper z position of the extruded layer in µm\n"
|
||||
"# height The height of the extruded layer in µm\n"
|
||||
"#\n"
|
||||
"# 'height', 'zstart' and 'zstop' can be used in any combination. If no value is given for 'zstart',\n"
|
||||
"# the upper level of the previous layer will be used.\n"
|
||||
"#\n"
|
||||
"# If a single unnamed parameter is given, it corresponds to 'height'. Two parameters correspond to\n"
|
||||
"# 'zstart' and 'zstop'.\n"
|
||||
"#\n"
|
||||
"# Examples:\n"
|
||||
"# 1: 0.5 1.5 # extrude layer 1/0 from 0.5 to 1.5 vertically\n"
|
||||
"# 1/0: 0.5 1.5 # same with explicit datatype\n"
|
||||
"# 1: zstop=1.5, zstart=0.5 # same with named parameters\n"
|
||||
"# 1: height=1.0, zstop=1.5 # same with z stop minus height\n"
|
||||
"# 1: 1.0 zstop=1.5 # same with height as unnamed parameter\n"
|
||||
"#\n"
|
||||
"# VARIABLES\n"
|
||||
"#\n"
|
||||
"# You can declare variables with:\n"
|
||||
"# var name = value\n"
|
||||
"#\n"
|
||||
"# You can use variables inside numeric expressions.\n"
|
||||
"# Example:\n"
|
||||
"# var hmetal = 0.48\n"
|
||||
"# 7/0: 0.5 0.5+hmetal*2 # 2x thick metal\n"
|
||||
"#\n"
|
||||
"# You cannot use variables inside layer specifications currently.\n"
|
||||
"#\n"
|
||||
"# CONDITIONALS\n"
|
||||
"#\n"
|
||||
"# You can enable or disable branches of the table using 'if', 'else', 'elseif' and 'end':\n"
|
||||
"# Example:\n"
|
||||
"# var thick_m1 = true\n"
|
||||
"# if thickm1\n"
|
||||
"# 1: 0.5 1.5\n"
|
||||
"# else\n"
|
||||
"# 1: 0.5 1.2\n"
|
||||
"# end\n"
|
||||
"\n"
|
||||
;
|
||||
}
|
||||
|
||||
D25TechnologyComponent::D25TechnologyComponent (const D25TechnologyComponent &d)
|
||||
: db::TechnologyComponent (d25_component_name (), d25_description ())
|
||||
{
|
||||
m_src = d.m_src;
|
||||
}
|
||||
|
||||
D25TechnologyComponent::layers_type
|
||||
D25TechnologyComponent::compile_from_source () const
|
||||
{
|
||||
layers_type layers;
|
||||
|
||||
int current_line = 0;
|
||||
|
||||
try {
|
||||
|
||||
tl::Eval eval;
|
||||
std::vector<bool> conditional_stack;
|
||||
|
||||
std::vector<std::string> lines = tl::split (m_src, "\n");
|
||||
for (std::vector<std::string>::const_iterator l = lines.begin (); l != lines.end (); ++l) {
|
||||
|
||||
++current_line;
|
||||
|
||||
tl::Extractor ex (l->c_str ());
|
||||
|
||||
if (ex.test ("#")) {
|
||||
// ignore comments
|
||||
} else if (ex.at_end ()) {
|
||||
// ignore empty lines
|
||||
|
||||
} else if (ex.test ("if")) {
|
||||
|
||||
tl::Expression x;
|
||||
eval.parse (x, ex);
|
||||
conditional_stack.push_back (x.execute ().to_bool ());
|
||||
|
||||
ex.expect_end ();
|
||||
|
||||
} else if (ex.test ("else")) {
|
||||
|
||||
if (conditional_stack.empty ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("'else' without 'if'")));
|
||||
}
|
||||
|
||||
conditional_stack.back () = ! conditional_stack.back ();
|
||||
|
||||
ex.expect_end ();
|
||||
|
||||
} else if (ex.test ("end")) {
|
||||
|
||||
if (conditional_stack.empty ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("'end' without 'if'")));
|
||||
}
|
||||
|
||||
conditional_stack.pop_back ();
|
||||
|
||||
ex.expect_end ();
|
||||
|
||||
} else if (ex.test ("elsif")) {
|
||||
|
||||
if (conditional_stack.empty ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("'elsif' without 'if'")));
|
||||
}
|
||||
|
||||
tl::Expression x;
|
||||
eval.parse (x, ex);
|
||||
conditional_stack.back () = x.execute ().to_bool ();
|
||||
|
||||
ex.expect_end ();
|
||||
|
||||
} else if (! conditional_stack.empty () && ! conditional_stack.back ()) {
|
||||
|
||||
continue;
|
||||
|
||||
} else if (ex.test ("var")) {
|
||||
|
||||
std::string n;
|
||||
ex.read_name (n);
|
||||
|
||||
ex.expect ("=");
|
||||
|
||||
tl::Expression x;
|
||||
eval.parse (x, ex);
|
||||
eval.set_var (n, x.execute ());
|
||||
|
||||
ex.expect_end ();
|
||||
|
||||
} else if (ex.test ("print")) {
|
||||
|
||||
tl::Expression x;
|
||||
eval.parse (x, ex);
|
||||
ex.expect_end ();
|
||||
|
||||
tl::info << x.execute ().to_string ();
|
||||
|
||||
} else if (ex.test ("error")) {
|
||||
|
||||
tl::Expression x;
|
||||
eval.parse (x, ex);
|
||||
ex.expect_end ();
|
||||
|
||||
throw tl::Exception (x.execute ().to_string ());
|
||||
|
||||
} else {
|
||||
|
||||
db::D25LayerInfo info;
|
||||
if (! layers.empty ()) {
|
||||
info.set_zstart (layers.back ().zstop ());
|
||||
info.set_zstop (layers.back ().zstop ());
|
||||
}
|
||||
|
||||
tl::Variant z0, z1, h;
|
||||
std::vector<double> args;
|
||||
|
||||
db::LayerProperties lp;
|
||||
lp.read (ex);
|
||||
info.set_layer (lp);
|
||||
|
||||
ex.expect (":");
|
||||
|
||||
while (! ex.at_end ()) {
|
||||
|
||||
if (ex.test ("#")) {
|
||||
break;
|
||||
}
|
||||
|
||||
tl::Expression pvx;
|
||||
|
||||
std::string pn;
|
||||
if (ex.try_read_name (pn)) {
|
||||
ex.expect ("=");
|
||||
eval.parse (pvx, ex);
|
||||
} else {
|
||||
eval.parse (pvx, ex);
|
||||
}
|
||||
|
||||
double pv = pvx.execute ().to_double ();
|
||||
|
||||
ex.test (",");
|
||||
|
||||
if (pn.empty ()) {
|
||||
args.push_back (pv);
|
||||
} else if (pn == "zstart") {
|
||||
z0 = pv;
|
||||
} else if (pn == "zstop") {
|
||||
z1 = pv;
|
||||
} else if (pn == "height") {
|
||||
h = pv;
|
||||
} else {
|
||||
throw tl::Exception (tl::to_string (tr ("Invalid parameter name: ")) + pn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (args.size () == 0) {
|
||||
if (z0.is_nil () && z1.is_nil ()) {
|
||||
if (! h.is_nil ()) {
|
||||
info.set_zstop (info.zstop () + h.to_double ());
|
||||
}
|
||||
} else if (z0.is_nil ()) {
|
||||
info.set_zstop (z1.to_double ());
|
||||
if (! h.is_nil ()) {
|
||||
info.set_zstart (info.zstop () - h.to_double ());
|
||||
}
|
||||
} else if (z1.is_nil ()) {
|
||||
info.set_zstart (z0.to_double ());
|
||||
if (! h.is_nil ()) {
|
||||
info.set_zstop (info.zstart () + h.to_double ());
|
||||
}
|
||||
} else {
|
||||
info.set_zstart (z0.to_double ());
|
||||
info.set_zstop (z1.to_double ());
|
||||
}
|
||||
} else if (args.size () == 1) {
|
||||
if (! h.is_nil ()) {
|
||||
if (! z0.is_nil ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Redundant parameters: zstart already given")));
|
||||
}
|
||||
if (! z1.is_nil ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Redundant parameters: zstop implicitly given")));
|
||||
}
|
||||
info.set_zstart (args[0]);
|
||||
info.set_zstop (args[0] + h.to_double ());
|
||||
} else {
|
||||
if (! z1.is_nil ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Redundant parameters: zstop implicitly given")));
|
||||
}
|
||||
info.set_zstop ((! z0.is_nil () ? z0.to_double () : info.zstart ()) + args[0]);
|
||||
}
|
||||
} else if (args.size () == 2) {
|
||||
if (! z0.is_nil ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Redundant parameters: zstart already given")));
|
||||
}
|
||||
if (! z1.is_nil ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Redundant parameters: zstop already given")));
|
||||
}
|
||||
if (! h.is_nil ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("Redundant parameters: height implicitly given")));
|
||||
}
|
||||
info.set_zstart (args[0]);
|
||||
info.set_zstop (args[1]);
|
||||
} else {
|
||||
throw tl::Exception (tl::to_string (tr ("Too many parameters (max 2)")));
|
||||
}
|
||||
|
||||
layers.push_back (info);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (! conditional_stack.empty ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("'if', 'else' or 'elsif' without matching 'end'")));
|
||||
}
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
throw tl::Exception (ex.msg () + tl::sprintf (tl::to_string (tr (" in line %d")), current_line));
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
std::string
|
||||
D25TechnologyComponent::to_string () const
|
||||
{
|
||||
layers_type layers = compile_from_source ();
|
||||
std::string res;
|
||||
|
||||
for (layers_type::const_iterator i = layers.begin (); i != layers.end (); ++i) {
|
||||
if (! res.empty ()) {
|
||||
res += "\n";
|
||||
}
|
||||
res += i->layer ().to_string () + ": zstart=" + tl::to_string (i->zstart ()) + ", zstop=" + tl::to_string (i->zstop ());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// D25TechnologyComponent technology component registration
|
||||
|
||||
class D25TechnologyComponentProvider
|
||||
: public db::TechnologyComponentProvider
|
||||
{
|
||||
public:
|
||||
D25TechnologyComponentProvider ()
|
||||
: db::TechnologyComponentProvider ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
virtual db::TechnologyComponent *create_component () const
|
||||
{
|
||||
return new D25TechnologyComponent ();
|
||||
}
|
||||
|
||||
virtual tl::XMLElementBase *xml_element () const
|
||||
{
|
||||
return new db::TechnologyComponentXMLElement<D25TechnologyComponent> (d25_component_name (),
|
||||
tl::make_member (&D25TechnologyComponent::src, &D25TechnologyComponent::set_src, "src")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<db::TechnologyComponentProvider> tc_decl (new D25TechnologyComponentProvider (), 3100, d25_component_name ().c_str ());
|
||||
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2022 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HDR_dbD25TechnologyComponent
|
||||
#define HDR_dbD25TechnologyComponent
|
||||
|
||||
#include "dbTechnology.h"
|
||||
#include "dbLayerProperties.h"
|
||||
|
||||
namespace db
|
||||
{
|
||||
|
||||
class DB_PUBLIC D25LayerInfo
|
||||
{
|
||||
public:
|
||||
D25LayerInfo ();
|
||||
~D25LayerInfo ();
|
||||
D25LayerInfo (const D25LayerInfo &other);
|
||||
D25LayerInfo &operator= (const D25LayerInfo &other);
|
||||
|
||||
bool operator== (const D25LayerInfo &other) const;
|
||||
|
||||
const db::LayerProperties &layer () const
|
||||
{
|
||||
return m_layer;
|
||||
}
|
||||
|
||||
void set_layer_from_string (const std::string &l);
|
||||
std::string layer_as_string () const;
|
||||
|
||||
void set_layer (const db::LayerProperties &l);
|
||||
|
||||
double zstart () const
|
||||
{
|
||||
return m_zstart;
|
||||
}
|
||||
|
||||
void set_zstart (double z0);
|
||||
|
||||
double zstop () const
|
||||
{
|
||||
return m_zstop;
|
||||
}
|
||||
|
||||
void set_zstop (double z1);
|
||||
|
||||
private:
|
||||
db::LayerProperties m_layer;
|
||||
double m_zstart, m_zstop;
|
||||
};
|
||||
|
||||
class DB_PUBLIC D25TechnologyComponent
|
||||
: public db::TechnologyComponent
|
||||
{
|
||||
public:
|
||||
D25TechnologyComponent ();
|
||||
D25TechnologyComponent (const D25TechnologyComponent &d);
|
||||
|
||||
typedef std::list<D25LayerInfo> layers_type;
|
||||
|
||||
layers_type compile_from_source () const;
|
||||
|
||||
const std::string &src () const
|
||||
{
|
||||
return m_src;
|
||||
}
|
||||
|
||||
// for persistency only, use "compile_from_source" to read from a source string
|
||||
void set_src (const std::string &s)
|
||||
{
|
||||
m_src = s;
|
||||
}
|
||||
|
||||
std::string to_string () const;
|
||||
|
||||
db::TechnologyComponent *clone () const
|
||||
{
|
||||
return new D25TechnologyComponent (*this);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_src;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2022 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "dbD25TechnologyComponent.h"
|
||||
#include "tlUnitTest.h"
|
||||
|
||||
|
||||
TEST(1)
|
||||
{
|
||||
db::D25TechnologyComponent comp;
|
||||
|
||||
comp.set_src ("1/0: 1.0 1.5 # a comment");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5");
|
||||
|
||||
comp.set_src ("1/0: zstart=1.0 zstop=1.5");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5");
|
||||
|
||||
comp.set_src ("1/0: zstart=1.0 height=0.5");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5");
|
||||
|
||||
comp.set_src ("1/0: 1.0 height=0.5");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5");
|
||||
|
||||
comp.set_src ("1/0: zstop=1.5 height=0.5");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5");
|
||||
|
||||
comp.set_src ("1/0: zstart=1.0 zstop=1.5\nname: height=3");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5\nname: zstart=1.5, zstop=4.5");
|
||||
|
||||
comp.set_src ("1/0: zstart=1.0 zstop=1.5\nname: zstart=4.0 height=3\n\n# a comment line");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5\nname: zstart=4, zstop=7");
|
||||
|
||||
comp.set_src ("var x=1.0\n1/0: zstart=x zstop=x+0.5\nname: zstart=4.0 height=3\n\n# a comment line");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5\nname: zstart=4, zstop=7");
|
||||
|
||||
comp.set_src ("var x=1.0\nif x == 1.0\n1/0: zstart=x zstop=x+0.5\nelse\n1/0: zstart=0 zstop=0\nend\nname: zstart=4.0 height=3\n\n# a comment line");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=1, zstop=1.5\nname: zstart=4, zstop=7");
|
||||
|
||||
comp.set_src ("var x=2.0\nif x == 1.0\n1/0: zstart=x zstop=x+0.5\nelse\n1/0: zstart=0 zstop=0\nend\nname: zstart=4.0 height=3\n\n# a comment line");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (comp.to_string (), "1/0: zstart=0, zstop=0\nname: zstart=4, zstop=7");
|
||||
|
||||
try {
|
||||
comp.set_src ("blabla");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (false, true);
|
||||
} catch (...) { }
|
||||
|
||||
try {
|
||||
comp.set_src ("1/0: 1 2 3");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (false, true);
|
||||
} catch (...) { }
|
||||
|
||||
try {
|
||||
comp.set_src ("1/0: foo=1 bar=2");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (false, true);
|
||||
} catch (...) { }
|
||||
|
||||
try {
|
||||
comp.set_src ("1/0: 1;*2");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (false, true);
|
||||
} catch (...) { }
|
||||
|
||||
try {
|
||||
comp.set_src ("error 42");
|
||||
comp.compile_from_source ();
|
||||
EXPECT_EQ (false, true);
|
||||
} catch (...) { }
|
||||
}
|
||||
|
|
@ -39,7 +39,6 @@ SOURCES = \
|
|||
dbPolygonToolsTests.cc \
|
||||
dbTechnologyTests.cc \
|
||||
dbStreamLayerTests.cc \
|
||||
dbD25TechnologyComponentTests.cc \
|
||||
dbVectorTests.cc \
|
||||
dbVariableWidthPathTests.cc \
|
||||
dbTransTests.cc \
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>D25TechnologyComponentEditor</class>
|
||||
<widget class="QFrame" name="D25TechnologyComponentEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>549</width>
|
||||
<height>434</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html>2.5d Vertical stack information (see <a href="int:/about/25d_view.xml">here</a> for details)</html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lnum_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Line</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QTextEdit" name="src_te">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2022 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "laybasicConfig.h"
|
||||
#include "dbD25TechnologyComponent.h"
|
||||
#include "layD25TechnologyComponent.h"
|
||||
#include "layQtTools.h"
|
||||
|
||||
#include <QResource>
|
||||
#include <QBuffer>
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
||||
D25TechnologyComponentEditor::D25TechnologyComponentEditor (QWidget *parent)
|
||||
: TechnologyComponentEditor (parent)
|
||||
{
|
||||
setupUi (this);
|
||||
|
||||
src_te->setFont (monospace_font ());
|
||||
|
||||
activate_help_links (label);
|
||||
|
||||
QResource res (tl::to_qstring (":/syntax/d25_text.xml"));
|
||||
QByteArray data ((const char *) res.data (), int (res.size ()));
|
||||
#if QT_VERSION >= 0x60000
|
||||
if (res.compressionAlgorithm () == QResource::ZlibCompression) {
|
||||
#else
|
||||
if (res.isCompressed ()) {
|
||||
#endif
|
||||
data = qUncompress (data);
|
||||
}
|
||||
|
||||
QBuffer input (&data);
|
||||
input.open (QIODevice::ReadOnly);
|
||||
mp_hl_basic_attributes.reset (new GenericSyntaxHighlighterAttributes ());
|
||||
mp_hl_attributes.reset (new GenericSyntaxHighlighterAttributes (mp_hl_basic_attributes.get ()));
|
||||
lay::GenericSyntaxHighlighter *hl = new GenericSyntaxHighlighter (src_te, input, mp_hl_attributes.get ());
|
||||
input.close ();
|
||||
|
||||
hl->setDocument (src_te->document ());
|
||||
|
||||
connect (src_te, SIGNAL (cursorPositionChanged ()), this, SLOT (cursor_position_changed ()));
|
||||
}
|
||||
|
||||
void
|
||||
D25TechnologyComponentEditor::cursor_position_changed ()
|
||||
{
|
||||
int line = src_te->textCursor ().block ().firstLineNumber () + 1;
|
||||
lnum_label->setText (tl::to_qstring (tl::sprintf (tl::to_string (tr ("Line %d")), line)));
|
||||
}
|
||||
|
||||
void
|
||||
D25TechnologyComponentEditor::commit ()
|
||||
{
|
||||
db::D25TechnologyComponent *data = dynamic_cast <db::D25TechnologyComponent *> (tech_component ());
|
||||
if (! data) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string src = tl::to_string (src_te->toPlainText ());
|
||||
|
||||
// test-compile before setting it
|
||||
db::D25TechnologyComponent tc;
|
||||
tc.set_src (src);
|
||||
tc.compile_from_source ();
|
||||
|
||||
data->set_src (src);
|
||||
}
|
||||
|
||||
void
|
||||
D25TechnologyComponentEditor::setup ()
|
||||
{
|
||||
db::D25TechnologyComponent *data = dynamic_cast <db::D25TechnologyComponent *> (tech_component ());
|
||||
if (! data) {
|
||||
return;
|
||||
}
|
||||
|
||||
src_te->setPlainText (tl::to_qstring (data->src ()));
|
||||
}
|
||||
|
||||
class D25TechnologyComponentEditorProvider
|
||||
: public lay::TechnologyEditorProvider
|
||||
{
|
||||
public:
|
||||
virtual lay::TechnologyComponentEditor *create_editor (QWidget *parent) const
|
||||
{
|
||||
return new D25TechnologyComponentEditor (parent);
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::TechnologyEditorProvider> editor_decl (new D25TechnologyComponentEditorProvider (), 3100, "d25");
|
||||
|
||||
} // namespace lay
|
||||
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2022 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HDR_layD25TechnologyComponent
|
||||
#define HDR_layD25TechnologyComponent
|
||||
|
||||
#include "ui_D25TechnologyComponentEditor.h"
|
||||
#include "layTechnology.h"
|
||||
#include "layGenericSyntaxHighlighter.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace lay {
|
||||
|
||||
class D25TechnologyComponentEditor
|
||||
: public lay::TechnologyComponentEditor,
|
||||
public Ui::D25TechnologyComponentEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
D25TechnologyComponentEditor (QWidget *parent);
|
||||
|
||||
void commit ();
|
||||
void setup ();
|
||||
|
||||
private slots:
|
||||
void cursor_position_changed ();
|
||||
|
||||
private:
|
||||
std::unique_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -74,8 +74,7 @@ FORMS = \
|
|||
NetInfoDialog.ui \
|
||||
NetExportDialog.ui \
|
||||
SelectCellViewForm.ui \
|
||||
LayoutStatistics.ui \
|
||||
D25TechnologyComponentEditor.ui
|
||||
LayoutStatistics.ui
|
||||
|
||||
RESOURCES = \
|
||||
laybasicResources.qrc \
|
||||
|
|
@ -192,7 +191,6 @@ SOURCES = \
|
|||
laySelectCellViewForm.cc \
|
||||
layLayoutStatisticsForm.cc \
|
||||
gsiDeclLayNetlistBrowserDialog.cc \
|
||||
layD25TechnologyComponent.cc \
|
||||
layLayoutViewFunctions.cc
|
||||
|
||||
HEADERS = \
|
||||
|
|
@ -300,7 +298,6 @@ HEADERS = \
|
|||
layDispatcher.h \
|
||||
laySelectCellViewForm.h \
|
||||
layLayoutStatisticsForm.h \
|
||||
layD25TechnologyComponent.h \
|
||||
layLayoutViewFunctions.h
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
#include "layLayoutView.h"
|
||||
|
||||
#include "dbRecursiveShapeIterator.h"
|
||||
#include "dbD25TechnologyComponent.h"
|
||||
#include "dbEdgeProcessor.h"
|
||||
#include "dbPolygonGenerators.h"
|
||||
#include "dbPolygonTools.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue