]> www.ginac.de Git - cln.git/blobdiff - src/integer/input/cl_I_read_stream.cc
Fix compilation with GCC 4.4.
[cln.git] / src / integer / input / cl_I_read_stream.cc
index 1ffd54b176f6e35e6789b7822b548e078b6ee853..227d845be9e70ff3961079fee504fc67fc033be6 100644 (file)
@@ -3,7 +3,7 @@
 // It does not pull in all the rational number code.
 
 // General includes.
-#include "cl_sysdep.h"
+#include "base/cl_sysdep.h"
 
 // Specification.
 #include "cln/integer_io.h"
@@ -13,7 +13,7 @@
 
 #include "cln/input.h"
 #include "cln/io.h"
-#include "cl_spushstring.h"
+#include "base/string/cl_spushstring.h"
 
 namespace cln {
 
@@ -48,8 +48,8 @@ const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
        var int c;
        // Skip whitespace at the beginning.
        loop {
-               c = freadchar(stream);
-               if (c == cl_EOF) goto eof;
+               c = stream.get();
+               if (stream.eof() || stream.fail()) goto eof;
                if ((c == ' ') || (c == '\t') || (c == '\n'))
                        continue;
                else
@@ -64,8 +64,8 @@ const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
                buffer.push(c);
                // Read some digits, then a letter, then a token.
                loop {
-                       c = freadchar(stream);
-                       if (c == cl_EOF) goto eof;
+                       c = stream.get();
+                       if (stream.eof() || stream.fail()) goto eof;
                        buffer.push(c);
                        if ((c >= '0') && (c <= '9'))
                                continue;
@@ -74,19 +74,19 @@ const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
                }
                if (!(((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))))
                        goto syntax1;
-               c = freadchar(stream);
-               if (c == cl_EOF) goto eof;
+               c = stream.get();
+               if (stream.eof() || stream.fail()) goto eof;
        }
        // Read a number token.
        if (!number_char_p(c))
                goto syntax1;
        loop {
                buffer.push(c);
-               c = freadchar(stream);
-               if (c == cl_EOF)
+               c = stream.get();
+               if (stream.eof() || stream.fail())
                        break;
                if (!number_char_p(c)) {
-                       funreadchar(stream,c);
+                       stream.putback(c);
                        break;
                }
        }