From: Clifford Wolf Date: Thu, 28 Nov 2013 20:13:16 +0000 (+0100) Subject: Improved ID matching scheme in select (and thus for all commands) X-Git-Tag: yosys-0.2.0~284 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=293356e87cc7c798df45ce31f24252a5cf84ccd5;p=yosys.git Improved ID matching scheme in select (and thus for all commands) --- diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 1ab15c9a9..31afea209 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -29,10 +29,20 @@ static std::vector 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; }