diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-04-01 14:38:05 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-04-01 14:38:05 +0200 |
commit | 5919bf5525f91231210d79bb04ca46e70c7b4d8d (patch) | |
tree | 2b11cff508385c49b95b3877bc07a278843222ca /kernel/driver.cc | |
parent | 3ec9fa40486401814c6e3a7fd4b2b1b8fb3403b8 (diff) | |
download | yosys-5919bf5525f91231210d79bb04ca46e70c7b4d8d.tar.gz yosys-5919bf5525f91231210d79bb04ca46e70c7b4d8d.tar.bz2 yosys-5919bf5525f91231210d79bb04ca46e70c7b4d8d.zip |
Removed 4096 bytes limit for size of command from script file
Diffstat (limited to 'kernel/driver.cc')
-rw-r--r-- | kernel/driver.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index 8374afa7f..a397a16cc 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -28,6 +28,19 @@ #include "kernel/register.h" #include "kernel/log.h" +bool fgetline(FILE *f, std::string &buffer) +{ + buffer = ""; + char block[4096]; + while (1) { + if (fgets(block, 4096, f) == NULL) + return false; + buffer += block; + if (buffer.size() > 0 && (buffer[buffer.size()-1] == '\n' || buffer[buffer.size()-1] == '\r')) + return true; + } +} + static void run_frontend(std::string filename, std::string command, RTLIL::Design *design, std::string *backend_command) { if (command == "auto") { @@ -50,9 +63,13 @@ static void run_frontend(std::string filename, std::string command, RTLIL::Desig f = fopen(filename.c_str(), "r"); if (f == NULL) log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno)); - char buffer[4096]; - while (fgets(buffer, 4096, f) != NULL) { - Pass::call(design, buffer); + std::string command; + while (fgetline(f, command)) { + Pass::call(design, command); + design->check(); + } + if (!command.empty()) { + Pass::call(design, command); design->check(); } if (filename != "-") |