diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-10-10 18:02:17 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-10-10 18:02:17 +0200 |
commit | 774933a0d88502585cf8c169280e71d0c3d182fc (patch) | |
tree | 18c07989447718e0aa16ac84bf2fdc04126d564b /passes/cmds | |
parent | bbd808072be859074a023795a15bebab87cbfba8 (diff) | |
download | yosys-774933a0d88502585cf8c169280e71d0c3d182fc.tar.gz yosys-774933a0d88502585cf8c169280e71d0c3d182fc.tar.bz2 yosys-774933a0d88502585cf8c169280e71d0c3d182fc.zip |
Replaced fnmatch() with patmatch()
Diffstat (limited to 'passes/cmds')
-rw-r--r-- | passes/cmds/cover.cc | 8 | ||||
-rw-r--r-- | passes/cmds/select.cc | 15 |
2 files changed, 10 insertions, 13 deletions
diff --git a/passes/cmds/cover.cc b/passes/cmds/cover.cc index 057f31217..64f7acf50 100644 --- a/passes/cmds/cover.cc +++ b/passes/cmds/cover.cc @@ -19,11 +19,9 @@ #include <sys/types.h> #include <unistd.h> -#include <fnmatch.h> -#include "kernel/register.h" -#include "kernel/rtlil.h" -#include "kernel/log.h" +#include "kernel/yosys.h" +#include "kernel/patmatch.h" USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN @@ -123,7 +121,7 @@ struct CoverPass : public Pass { for (auto &it : get_coverage_data()) { if (!patterns.empty()) { for (auto &p : patterns) - if (!fnmatch(p.c_str(), it.first.c_str(), 0)) + if (patmatch(p.c_str(), it.first.c_str())) goto pattern_match; continue; } diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 363687f25..893f897d2 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -17,12 +17,11 @@ * */ -#include "kernel/register.h" +#include "kernel/yosys.h" #include "kernel/celltypes.h" #include "kernel/sigtools.h" -#include "kernel/log.h" +#include "kernel/patmatch.h" #include <string.h> -#include <fnmatch.h> #include <errno.h> USING_YOSYS_NAMESPACE @@ -38,9 +37,9 @@ static bool match_ids(RTLIL::IdString id, std::string pattern) return true; if (id.size() > 0 && id[0] == '\\' && id.substr(1) == pattern) return true; - if (!fnmatch(pattern.c_str(), id.c_str(), 0)) + if (patmatch(pattern.c_str(), id.c_str())) return true; - if (id.size() > 0 && id[0] == '\\' && !fnmatch(pattern.c_str(), id.substr(1).c_str(), 0)) + if (id.size() > 0 && id[0] == '\\' && patmatch(pattern.c_str(), id.substr(1).c_str())) return true; if (id.size() > 0 && id[0] == '$' && pattern.size() > 0 && pattern[0] == '$') { const char *p = id.c_str(); @@ -83,7 +82,7 @@ static bool match_attr_val(const RTLIL::Const &value, std::string pattern, char std::string value_str = value.decode_string(); if (match_op == '=') - if (!fnmatch(pattern.c_str(), value.decode_string().c_str(), FNM_NOESCAPE)) + if (patmatch(pattern.c_str(), value.decode_string().c_str())) return true; if (match_op == '=') @@ -107,9 +106,9 @@ static bool match_attr(const std::map<RTLIL::IdString, RTLIL::Const> &attributes { if (name_pat.find('*') != std::string::npos || name_pat.find('?') != std::string::npos || name_pat.find('[') != std::string::npos) { for (auto &it : attributes) { - if (!fnmatch(name_pat.c_str(), it.first.c_str(), FNM_NOESCAPE) && match_attr_val(it.second, value_pat, match_op)) + if (patmatch(name_pat.c_str(), it.first.c_str()) && match_attr_val(it.second, value_pat, match_op)) return true; - if (it.first.size() > 0 && it.first[0] == '\\' && !fnmatch(name_pat.c_str(), it.first.substr(1).c_str(), FNM_NOESCAPE) && match_attr_val(it.second, value_pat, match_op)) + if (it.first.size() > 0 && it.first[0] == '\\' && patmatch(name_pat.c_str(), it.first.substr(1).c_str()) && match_attr_val(it.second, value_pat, match_op)) return true; } } else { |