This commit is contained in:
Matthias Koefferlein 2024-04-14 19:43:50 +02:00
parent 030ee37f64
commit 6a876d2cd6
6 changed files with 60 additions and 0 deletions

View File

@ -633,6 +633,13 @@ SpiceCircuitDict::get_line ()
} else if (ex.test_without_case (".endl")) {
std::string name;
if (ex.try_read_name (name)) {
if (! m_in_lib.empty () && mp_netlist->normalize_name (name) != m_in_lib.back ()) {
warn (tl::sprintf (tl::to_string (tr (".endl has wrong name: %s given, %s expected")), mp_netlist->normalize_name (name), m_in_lib.back ()));
}
}
if (! m_in_lib.empty ()) {
m_in_lib.pop_back ();
} else {

View File

@ -836,6 +836,28 @@ TEST(21_lib)
);
}
// issue #1681, .endl with lib name
TEST(22_endl)
{
db::Netlist nl;
std::string path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "nreader22.cir");
db::NetlistSpiceReader reader;
tl::InputStream is (path);
reader.read (is, nl);
EXPECT_EQ (nl.to_string (),
"circuit .TOP ();\n"
" device CAP '10' (A='1',B='2') (C=1e-12,A=0,P=0);\n"
" device CAP '1' (A='1',B='2') (C=1e-10,A=0,P=0);\n"
" device CAP '2A' (A='1',B='2') (C=1.01e-10,A=0,P=0);\n"
" device CAP '2B' (A='1',B='2') (C=1.02e-10,A=0,P=0);\n"
" device CAP '100' (A='1',B='2') (C=1.5e-11,A=0,P=0);\n"
"end;\n"
);
}
TEST(100_ExpressionParser)
{
std::map<std::string, tl::Variant> vars;

6
testdata/algo/nreader22.cir vendored Normal file
View File

@ -0,0 +1,6 @@
.lib nreader22_lib1.cir lib1
.lib nreader22_lib1.cir lib2
C100 1 2 15p

4
testdata/algo/nreader22_inc.cir vendored Normal file
View File

@ -0,0 +1,4 @@
C2a 1 2 101p
C2b 1 2 102p

10
testdata/algo/nreader22_lib1.cir vendored Normal file
View File

@ -0,0 +1,10 @@
.lib lib1
.lib nreader22_lib2.cir lib3
C1 1 2 100p
.endl lib1
.lib lib2
.include nreader22_inc.cir
.endl lib2

11
testdata/algo/nreader22_lib2.cir vendored Normal file
View File

@ -0,0 +1,11 @@
.lib lib3
C10 1 2 1p
.endl lib3
C11 1 2 1.5p
.lib lib4
C12 1 2 42p
.endl lib4