diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-04-08 12:14:34 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-04-08 12:14:34 +0200 |
commit | 21a1cc1b60f0c646dcc46c89440fc1a2cf606743 (patch) | |
tree | ce642af5e328a4947be37e23315c5389fe8b9fc8 /kernel/yosys.cc | |
parent | aa0ab975b956e3b37c4d861fcf067475a28fd491 (diff) | |
download | yosys-21a1cc1b60f0c646dcc46c89440fc1a2cf606743.tar.gz yosys-21a1cc1b60f0c646dcc46c89440fc1a2cf606743.tar.bz2 yosys-21a1cc1b60f0c646dcc46c89440fc1a2cf606743.zip |
Added support for "file names with blanks"
Diffstat (limited to 'kernel/yosys.cc')
-rw-r--r-- | kernel/yosys.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 884b2c59b..bbc142f14 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -182,13 +182,23 @@ int readsome(std::istream &f, char *s, int n) return rc; } -std::string next_token(std::string &text, const char *sep) +std::string next_token(std::string &text, const char *sep, bool long_strings) { size_t pos_begin = text.find_first_not_of(sep); if (pos_begin == std::string::npos) pos_begin = text.size(); + if (long_strings && pos_begin != text.size() && text[pos_begin] == '"') { + string sep_string = sep; + for (size_t i = pos_begin+1; i < text.size(); i++) + if (text[i] == '"' && (i+1 == text.size() || sep_string.find(text[i+1]) != std::string::npos)) { + std::string token = text.substr(pos_begin, i-pos_begin+1); + text = text.substr(i+1); + return token; + } + } + size_t pos_end = text.find_first_of(sep, pos_begin); if (pos_end == std::string::npos) @@ -505,6 +515,14 @@ const char *create_prompt(RTLIL::Design *design, int recursion_counter) return buffer; } +void rewrite_filename(std::string &filename) +{ + if (filename.substr(0, 1) == "\"" && filename.substr(GetSize(filename)-1) == "\"") + filename = filename.substr(1, GetSize(filename)-2); + if (filename.substr(0, 2) == "+/") + filename = proc_share_dirname() + filename.substr(2); +} + #ifdef YOSYS_ENABLE_TCL static int tcl_yosys_cmd(ClientData, Tcl_Interp *interp, int argc, const char *argv[]) { |