3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-13 04:28:18 +00:00

More Win32 build fixes

This commit is contained in:
Clifford Wolf 2014-10-10 18:34:19 +02:00
parent 2c683102be
commit 54bf3a95dd
2 changed files with 11 additions and 10 deletions

View file

@ -34,6 +34,7 @@
using namespace SubCircuit; using namespace SubCircuit;
#ifndef _YOSYS_
static std::string my_stringf(const char *fmt, ...) static std::string my_stringf(const char *fmt, ...)
{ {
std::string string; std::string string;
@ -52,6 +53,9 @@ static std::string my_stringf(const char *fmt, ...)
return string; return string;
} }
#else
# define my_stringf YOSYS_NAMESPACE_PREFIX stringf
#endif
SubCircuit::Graph::Graph(const Graph &other, const std::vector<std::string> &otherNodes) SubCircuit::Graph::Graph(const Graph &other, const std::vector<std::string> &otherNodes)
{ {

View file

@ -518,24 +518,21 @@ struct ExtractPass : public Pass {
if (args[argidx] == "-swap" && argidx+2 < args.size()) { if (args[argidx] == "-swap" && argidx+2 < args.size()) {
std::string type = RTLIL::escape_id(args[++argidx]); std::string type = RTLIL::escape_id(args[++argidx]);
std::set<std::string> ports; std::set<std::string> ports;
char *ports_str = strdup(args[++argidx].c_str()); std::string ports_str = args[++argidx], p;
for (char *sptr, *p = strtok_r(ports_str, ",\t\r\n ", &sptr); p != NULL; p = strtok_r(NULL, ",\t\r\n ", &sptr)) while (!(p = next_token(ports_str, ",\t\r\n ")).empty())
ports.insert(RTLIL::escape_id(p)); ports.insert(RTLIL::escape_id(p));
free(ports_str);
solver.addSwappablePorts(type, ports); solver.addSwappablePorts(type, ports);
continue; continue;
} }
if (args[argidx] == "-perm" && argidx+3 < args.size()) { if (args[argidx] == "-perm" && argidx+3 < args.size()) {
std::string type = RTLIL::escape_id(args[++argidx]); std::string type = RTLIL::escape_id(args[++argidx]);
std::vector<std::string> map_left, map_right; std::vector<std::string> map_left, map_right;
char *left_str = strdup(args[++argidx].c_str()); std::string left_str = args[++argidx];
char *right_str = strdup(args[++argidx].c_str()); std::string right_str = args[++argidx], p;
for (char *sptr, *p = strtok_r(left_str, ",\t\r\n ", &sptr); p != NULL; p = strtok_r(NULL, ",\t\r\n ", &sptr)) while (!(p = next_token(left_str, ",\t\r\n ")).empty())
map_left.push_back(RTLIL::escape_id(p)); map_left.push_back(RTLIL::escape_id(p));
for (char *sptr, *p = strtok_r(right_str, ",\t\r\n ", &sptr); p != NULL; p = strtok_r(NULL, ",\t\r\n ", &sptr)) while (!(p = next_token(right_str, ",\t\r\n ")).empty())
map_right.push_back(RTLIL::escape_id(p)); map_right.push_back(RTLIL::escape_id(p));
free(left_str);
free(right_str);
if (map_left.size() != map_right.size()) if (map_left.size() != map_right.size())
log_cmd_error("Arguments to -perm are not a valid permutation!\n"); log_cmd_error("Arguments to -perm are not a valid permutation!\n");
std::map<std::string, std::string> map; std::map<std::string, std::string> map;
@ -665,7 +662,7 @@ struct ExtractPass : public Pass {
log("Solving for %s in %s.\n", ("needle_" + RTLIL::unescape_id(needle->name)).c_str(), haystack_it.first.c_str()); log("Solving for %s in %s.\n", ("needle_" + RTLIL::unescape_id(needle->name)).c_str(), haystack_it.first.c_str());
solver.solve(results, "needle_" + RTLIL::unescape_id(needle->name), haystack_it.first, false); solver.solve(results, "needle_" + RTLIL::unescape_id(needle->name), haystack_it.first, false);
} }
log("Found %zd matches.\n", results.size()); log("Found %d matches.\n", GetSize(results));
if (results.size() > 0) if (results.size() > 0)
{ {