diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-10-18 19:26:03 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-10-18 19:26:03 +0200 |
commit | 6c1c1e9a07c66b37f65835ed03370ac062616b7a (patch) | |
tree | ba62b76eb7bbc368d1900297ad57bd8e593edb26 | |
parent | bb631c6f5c0026b0920996205329dae5836f9a1b (diff) | |
download | yosys-6c1c1e9a07c66b37f65835ed03370ac062616b7a.tar.gz yosys-6c1c1e9a07c66b37f65835ed03370ac062616b7a.tar.bz2 yosys-6c1c1e9a07c66b37f65835ed03370ac062616b7a.zip |
Improved new_id() for win32
-rw-r--r-- | kernel/yosys.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc index e26eaf4be..42cfcb5bb 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -358,11 +358,19 @@ void yosys_shutdown() RTLIL::IdString new_id(std::string file, int line, std::string func) { - std::string str = "$auto$"; +#ifdef _WIN32 + size_t pos = file.find_last_of("/\\"); +#else size_t pos = file.find_last_of('/'); - str += pos != std::string::npos ? file.substr(pos+1) : file; - str += stringf(":%d:%s$%d", line, func.c_str(), autoidx++); - return str; +#endif + if (pos != std::string::npos) + file = file.substr(pos+1); + + pos = func.find_last_of(':'); + if (pos != std::string::npos) + func = func.substr(pos+1); + + return stringf("$auto$%s:%d:%s$%d", file.c_str(), line, func.c_str(), autoidx++); } RTLIL::Design *yosys_get_design() |