diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-08-23 15:03:55 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-08-23 15:03:55 +0200 |
commit | 19cff41eb4261b20374058f16807a229af46f304 (patch) | |
tree | 10cdd990dfbba21e7851127fca75de4c74cdd274 /passes/cmds | |
parent | 5dce303a2a2c27d50e99856b6f33467798e13020 (diff) | |
download | yosys-19cff41eb4261b20374058f16807a229af46f304.tar.gz yosys-19cff41eb4261b20374058f16807a229af46f304.tar.bz2 yosys-19cff41eb4261b20374058f16807a229af46f304.zip |
Changed frontend-api from FILE to std::istream
Diffstat (limited to 'passes/cmds')
-rw-r--r-- | passes/cmds/show.cc | 8 | ||||
-rw-r--r-- | passes/cmds/write_file.cc | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/passes/cmds/show.cc b/passes/cmds/show.cc index fc6e972ee..3468eae78 100644 --- a/passes/cmds/show.cc +++ b/passes/cmds/show.cc @@ -720,13 +720,13 @@ struct ShowPass : public Pass { } for (auto filename : libfiles) { - FILE *f = fopen(filename.c_str(), "rt"); - if (f == NULL) + std::ifstream f; + f.open(filename.c_str()); + if (f.fail()) log_error("Can't open lib file `%s'.\n", filename.c_str()); RTLIL::Design *lib = new RTLIL::Design; - Frontend::frontend_call(lib, f, filename, (filename.size() > 3 && filename.substr(filename.size()-3) == ".il") ? "ilang" : "verilog"); + Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.substr(filename.size()-3) == ".il") ? "ilang" : "verilog"); libs.push_back(lib); - fclose(f); } if (libs.size() > 0) diff --git a/passes/cmds/write_file.cc b/passes/cmds/write_file.cc index a7cd7b438..813e215ba 100644 --- a/passes/cmds/write_file.cc +++ b/passes/cmds/write_file.cc @@ -41,7 +41,7 @@ struct WriteFileFrontend : public Frontend { log(" EOT\n"); log("\n"); } - virtual void execute(FILE *&f, std::string filename, std::vector<std::string> args, RTLIL::Design*) + virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design*) { bool append_mode = false; std::string output_filename; @@ -67,7 +67,7 @@ struct WriteFileFrontend : public Frontend { char buffer[64 * 1024]; size_t bytes; - while (0 < (bytes = fread(buffer, 1, sizeof(buffer), f))) + while (0 < (bytes = f->readsome(buffer, sizeof(buffer)))) fwrite(buffer, bytes, 1, of); fclose(of); |