mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-22 05:47:31 +02:00
Generalize the hname_t to handle n-dimensional scope arrays.
... Not that they actually exist yet. But this fixes some symbol search issues and makes room for this support in the future.
This commit is contained in:
@@ -160,12 +160,21 @@ inline static const char *basename(ivl_scope_t scope, const char *inst)
|
||||
|
||||
static perm_string make_scope_name(const hname_t&name)
|
||||
{
|
||||
if (! name.has_number())
|
||||
if (! name.has_numbers())
|
||||
return name.peek_name();
|
||||
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof buf, "%s[%d]",
|
||||
name.peek_name().str(), name.peek_number());
|
||||
snprintf(buf, sizeof buf, "%s", name.peek_name().str());
|
||||
|
||||
char*cp = buf + strlen(buf);
|
||||
size_t ncp = sizeof buf - (cp-buf);
|
||||
|
||||
for (size_t idx = 0 ; idx < name.has_numbers() ; idx += 1) {
|
||||
int len = snprintf(cp, ncp, "[%d]", name.peek_number(idx));
|
||||
cp += len;
|
||||
ncp -= len;
|
||||
}
|
||||
|
||||
return lex_strings.make(buf);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user