* This file must be processed with flex. */
/*
- * GiNaC Copyright (C) 1999-2019 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "ginsh.h"
#include "ginsh_parser.hpp"
+using namespace std;
+using namespace GiNaC;
+
#define YY_INPUT(buf, result, max_size) (result = ginsh_input(buf, max_size))
// Table of all used symbols
YY_FATAL_ERROR("input in flex scanner failed");
result = n;
#endif
- } else if (((result = fread(buf, 1, max_size, yyin)) == 0) && ferror(yyin))
- YY_FATAL_ERROR("input in flex scanner failed");
+ } else {
+ int c = '*', n;
+ for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n)
+ buf[n] = (char)c;
+ if (c == '\n')
+ buf[n++] = (char)c;
+ if (c == EOF && ferror(yyin))
+ YY_FATAL_ERROR("input in flex scanner failed");
+ result = n;
+ }
return result;
}