diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-08-13 13:40:29 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-08-13 13:40:29 +0200 |
commit | 28bc7aeb9345377d7815ad5ae9a941e55409bc4b (patch) | |
tree | 54c02c292e637dfd51ae0a18cc3aa5fc1c3e1295 /passes/abc | |
parent | c27120fcbc69f7b942788d72677f34e4a96ab48a (diff) | |
download | yosys-28bc7aeb9345377d7815ad5ae9a941e55409bc4b.tar.gz yosys-28bc7aeb9345377d7815ad5ae9a941e55409bc4b.tar.bz2 yosys-28bc7aeb9345377d7815ad5ae9a941e55409bc4b.zip |
Filter ANSI escape sequences from ABC output
Diffstat (limited to 'passes/abc')
-rw-r--r-- | passes/abc/abc.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/passes/abc/abc.cc b/passes/abc/abc.cc index 77419e616..b9baea38b 100644 --- a/passes/abc/abc.cc +++ b/passes/abc/abc.cc @@ -639,10 +639,25 @@ static void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std log("ABC: %s", logbuf); #else bool got_cr = false; + int escape_seq_state = 0; std::string linebuf; char logbuf[1024]; while (fgets(logbuf, 1024, f) != NULL) for (char *p = logbuf; *p; p++) { + if (escape_seq_state == 0 && *p == '\033') { + escape_seq_state = 1; + continue; + } + if (escape_seq_state == 1) { + escape_seq_state = *p == '[' ? 2 : 0; + continue; + } + if (escape_seq_state == 2) { + if ((*p < '0' || '9' < *p) && *p != ';') + escape_seq_state = 0; + continue; + } + escape_seq_state = 0; if (*p == '\r') { got_cr = true; continue; |