3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-20 04:43:40 +00:00

Re-introduced Yosys::readsome() helper function

(f.read() + f.gcount() made problems with lines > 16kB)
This commit is contained in:
Clifford Wolf 2014-10-23 10:47:21 +02:00
parent 750c615e7f
commit c5eb5e56b8
6 changed files with 25 additions and 21 deletions

View file

@ -196,16 +196,14 @@ static std::string next_token(bool pass_newline = false)
static void input_file(std::istream &f, std::string filename)
{
char buffer[513];
int rc;
insert_input("");
auto it = input_buffer.begin();
input_buffer.insert(it, "`file_push " + filename + "\n");
while (1) {
f.read(buffer, sizeof(buffer)-1);
if (f.gcount() <= 0)
break;
buffer[f.gcount()] = 0;
while ((rc = readsome(f, buffer, sizeof(buffer)-1)) > 0) {
buffer[rc] = 0;
input_buffer.insert(it, buffer);
}
input_buffer.insert(it, "\n`file_pop\n");