summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-11-28 21:13:16 +0100
committerClifford Wolf <clifford@clifford.at>2013-11-28 21:13:16 +0100
commit293356e87cc7c798df45ce31f24252a5cf84ccd5 (patch)
tree188414375e21b03a2652398e6e1e867b89f99b96
parent792bbad44882914b9a0d3c20acfead7f67a46dbd (diff)
Improved ID matching scheme in select (and thus for all commands)
-rw-r--r--passes/cmds/select.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc
index 1ab15c9a..31afea20 100644
--- a/passes/cmds/select.cc
+++ b/passes/cmds/select.cc
@@ -29,10 +29,20 @@ static std::vector<RTLIL::Selection> work_stack;
static bool match_ids(RTLIL::IdString id, std::string pattern)
{
- if (!fnmatch(pattern.c_str(), id.c_str(), FNM_NOESCAPE))
+ if (id == pattern)
return true;
- if (id.size() > 0 && id[0] == '\\' && !fnmatch(pattern.c_str(), id.substr(1).c_str(), FNM_NOESCAPE))
+ if (id.size() > 0 && id[0] == '\\' && id.substr(1) == pattern)
return true;
+ if (!fnmatch(pattern.c_str(), id.c_str(), 0))
+ return true;
+ if (id.size() > 0 && id[0] == '\\' && !fnmatch(pattern.c_str(), id.substr(1).c_str(), 0))
+ return true;
+ if (id.size() > 0 && id[0] == '$' && pattern.size() > 0 && pattern[0] == '$') {
+ const char *p = id.c_str();
+ const char *q = strrchr(p, '$');
+ if (pattern == q)
+ return true;
+ }
return false;
}