[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnucap-devel] max_nodes, net_nodes
From: |
Felix Salfelder |
Subject: |
[Gnucap-devel] max_nodes, net_nodes |
Date: |
Mon, 22 Sep 2014 18:26:05 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi Al.
in COMPONENT::set_port_by_name, there is a call to port_name(i) in
for (int i=0; i<max_nodes(); ++i) {
[..]
}
and then
std::string DEV_SUBCKT::port_name(int i)const {
if (_parent) {
return _parent->port_value(i);
}else{itested();
return "";
}
}
here, _parent is a MODEL_SUBCKT where port_value comes from COMPONENT, but...
const std::string COMPONENT::port_value(int i)const
{
assert(_n);
assert(i >= 0);
assert(i < net_nodes()); // <- boom
return _n[i].short_label();
}
now, this looks reasonable...
- change max_nodes() in DEV_SUBCKT to
{if(_parent){ return _parent->net_nodes();}else{return PORTS_PER_SUBCKT;}}
- change the asertion in COMPONENT::port_value(int) to
assert(i < max_nodes());
do you agree? anything else maybe?
thanks
felix
- [Gnucap-devel] max_nodes, net_nodes,
Felix Salfelder <=