]> www.ginac.de Git - cln.git/blobdiff - src/real/input/cl_R_read_stream.cc
Fix compilation on CYGWIN:
[cln.git] / src / real / input / cl_R_read_stream.cc
index 7be4ecbae3af3cd9e16b43b994fbd2b5194d03dc..8415c1527c8c9d4f84128799a6907611b35070a0 100644 (file)
@@ -26,21 +26,21 @@ public:
        char* end_pointer (void) { return buffer+index; }
 };
 
-static cl_boolean number_char_p (char c)
+static bool number_char_p (char c)
 {
        if ((c >= '0') && (c <= '9'))
-               return cl_true;
+               return true;
        if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')))
-               return cl_true;
+               return true;
        switch (c) {
                case '+': case '-': case '.': case '_': case '/':
-                       return cl_true;
+                       return true;
                default:
-                       return cl_false;
+                       return false;
        }
 }
 
-const cl_R read_real (cl_istream stream, const cl_read_flags& flags)
+const cl_R read_real (std::istream& stream, const cl_read_flags& flags)
 {
        // One pre-allocated buffer. This reduces the allocation/free cost.
        static pushstring_hack buffer;
@@ -74,7 +74,6 @@ const cl_R read_real (cl_istream stream, const cl_read_flags& flags)
                }
                if (!(((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))))
                        goto syntax1;
-               buffer.push(c);
                c = freadchar(stream);
                if (c == cl_EOF) goto eof;
        }
@@ -99,10 +98,10 @@ const cl_R read_real (cl_istream stream, const cl_read_flags& flags)
 
        // Handle syntax error.
 syntax1:       buffer.push(c);
-       read_number_bad_syntax(buffer.start_pointer(),buffer.end_pointer());
+       throw read_number_bad_syntax_exception(buffer.start_pointer(),buffer.end_pointer());
 
        // Handle premature EOF.
-eof:   read_number_eof();
+eof:   throw read_number_eof_exception();
 }
 
 }  // namespace cln