| author | Felix Salfelder <felix@salfelder.org> | 2025年11月13日 00:00:00 +0000 |
|---|---|---|
| committer | Felix Salfelder <felix@salfelder.org> | 2025年11月13日 00:00:00 +0000 |
| commit | 7bea976f78cffa63d1b028ce39fa98517adfd4b6 (patch) | |
| tree | 7e310df2d39574b10ae2cc0a53f0220c3aaac867 | |
| parent | addf4eca4c5c83e410a379a4dd6c4e120801592b (diff) | |
| download | gnucap-7bea976f78cffa63d1b028ce39fa98517adfd4b6.tar.gz | |
| -rw-r--r-- | lib/e_card.cc | 21 | ||||
| -rw-r--r-- | tests/==out/d_subckt.bin.0.ckt.out | 9 | ||||
| -rw-r--r-- | tests/d_subckt.bin.0.ckt | 15 |
diff --git a/lib/e_card.cc b/lib/e_card.cc index 9178a7d3..239da0c3 100644 --- a/lib/e_card.cc +++ b/lib/e_card.cc @@ -188,31 +188,22 @@ CARD* CARD::find_in_my_scope(const std::string& name) assert(scope()); CARD_LIST::iterator i = scope()->find_(name); + CARD_LIST::iterator j = i; if (i == scope()->end()) { throw Exception_Cant_Find(long_label(), name, ((owner()) ? owner()->long_label() : "(root)")); + }else if(scope()->find_again(name, ++j) != scope()->end()){ + error(bWARNING, "duplicate match " + name + " in " + long_label() + "\n"); }else{ } return *i; } /*--------------------------------------------------------------------------*/ -/* find_in_my_scope: find in same scope as myself - * whatever is found will have the same owner as me. - * capable of finding me. - * throws exception if can't find. +/* find_in_my_scope const. same as above, but const */ -const CARD* CARD::find_in_my_scope(const std::string& name)const +const CARD* CARD::find_in_my_scope(const std::string& name) const { - assert(name != ""); - assert(scope()); - - CARD_LIST::const_iterator i = scope()->find_(name); - if (i == scope()->end()) { - throw Exception_Cant_Find(long_label(), name, - ((owner()) ? owner()->long_label() : "(root)")); - }else{ - } - return *i; + return const_cast<CARD*>(this)->find_in_my_scope(name); } /*--------------------------------------------------------------------------*/ /* find_in_parent_scope: find in parent's scope diff --git a/tests/==out/d_subckt.bin.0.ckt.out b/tests/==out/d_subckt.bin.0.ckt.out new file mode 100644 index 00000000..17d61bd8 --- /dev/null +++ b/tests/==out/d_subckt.bin.0.ckt.out @@ -0,0 +1,9 @@ +* subckt, param, bin test +>>>>>.subckt foo (a k) +>>>>>.model mydio d is=1e-9 +>>>>>.model mydio d is=1e-10 +>>>>>.print op v(nodes) +duplicate match mydio in x9.d1 +>>>>>.op +# v(9) + 27. 0.53599 diff --git a/tests/d_subckt.bin.0.ckt b/tests/d_subckt.bin.0.ckt new file mode 100644 index 00000000..93a8c5c6 --- /dev/null +++ b/tests/d_subckt.bin.0.ckt @@ -0,0 +1,15 @@ +* subckt, param, bin test +.options trace + +.subckt foo (a k) +.model mydio d is=1e-9 +.model mydio d is=1e-10 +d1 (a k) mydio area=1 +.ends + +i9 (0 9) 1 +x9 (9 0) foo + +.print op v(nodes) +.op +.end |