More robust Nexus::name() method.
This version handles some error conditions.
This commit is contained in:
parent
6bc3f98e0a
commit
cb381b3ee3
26
net_link.cc
26
net_link.cc
|
|
@ -514,16 +514,24 @@ const char* Nexus::name() const
|
||||||
<< obj->name() << " pin " << pin
|
<< obj->name() << " pin " << pin
|
||||||
<< " type=" << typeid(*obj).name() << "?" << endl;
|
<< " type=" << typeid(*obj).name() << "?" << endl;
|
||||||
|
|
||||||
}
|
ostringstream tmp;
|
||||||
assert(sig);
|
tmp << "nex=" << this << ends;
|
||||||
ostringstream tmp;
|
const string tmps = tmp.str();
|
||||||
tmp << scope_path(sig->scope()) << "." << sig->name();
|
name_ = new char[strlen(tmps.c_str()) + 1];
|
||||||
if (sig->pin_count() > 1)
|
strcpy(name_, tmps.c_str());
|
||||||
tmp << "<" << pin << ">";
|
} else {
|
||||||
|
assert(sig);
|
||||||
|
ostringstream tmp;
|
||||||
|
tmp << scope_path(sig->scope()) << "." << sig->name();
|
||||||
|
if (sig->pin_count() > 1)
|
||||||
|
tmp << "<" << pin << ">";
|
||||||
|
tmp << ends;
|
||||||
|
|
||||||
|
const string tmps = tmp.str();
|
||||||
|
name_ = new char[strlen(tmps.c_str()) + 1];
|
||||||
|
strcpy(name_, tmps.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
const string tmps = tmp.str();
|
|
||||||
name_ = new char[strlen(tmps.c_str()) + 1];
|
|
||||||
strcpy(name_, tmps.c_str());
|
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue