3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-27 02:45:52 +00:00

Replaced readsome() with read() and gcount()

This commit is contained in:
Clifford Wolf 2014-10-15 01:12:53 +02:00
parent cf85aab62f
commit c3e9922b5d
4 changed files with 11 additions and 23 deletions

View file

@ -196,14 +196,16 @@ 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 ((rc = readsome(f, buffer, sizeof(buffer)-1)) > 0) {
buffer[rc] = 0;
while (1) {
f.read(buffer, sizeof(buffer)-1);
if (f.gcount() <= 0)
break;
buffer[f.gcount()] = 0;
input_buffer.insert(it, buffer);
}
input_buffer.insert(it, "\n`file_pop\n");