]> www.ginac.de Git - cln.git/blobdiff - src/integer/input/cl_I_read.cc
* Remove unused labels.
[cln.git] / src / integer / input / cl_I_read.cc
index 06f3cd4767924514eee183f9b97a2ee8f558ad62..645b9b5d1db425fcb798a7f5df97a80d6fc48414 100644 (file)
@@ -6,20 +6,18 @@
 #include "cl_sysdep.h"
 
 // Specification.
-#include "cl_integer_io.h"
+#include "cln/integer_io.h"
 
 
 // Implementation.
 
-#include <string.h>
-#include "cl_input.h"
-#include "cl_integer.h"
+#include <cstring>
+#include "cln/input.h"
+#include "cln/integer.h"
 #include "cl_I.h"
-#include "cl_abort.h"
+#include "cln/abort.h"
 
-#undef floor
-#include <math.h>
-#define floor cln_floor
+namespace cln {
 
 // Step forward over all digits, to the end of string or to the next non-digit.
 static const char * skip_digits (const char * ptr, const char * string_limit, unsigned int base)
@@ -56,7 +54,7 @@ const cl_I read_integer (const cl_read_flags& flags, const char * string, const
        ASSERT((flags.syntax & ~(syntax_integer|syntax_maybe_bad)) == 0);
        // If no string_limit is given, it defaults to the end of the string.
        if (!string_limit)
-               string_limit = string + strlen(string);
+               string_limit = string + ::strlen(string);
        if (flags.syntax & syntax_integer) {
                // Check for integer syntax.
                var unsigned int rational_base = flags.rational_base;
@@ -83,9 +81,9 @@ const cl_I read_integer (const cl_read_flags& flags, const char * string, const
                                                goto not_integer_syntax;
                                        var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr);
                                        if (!((base >= 2) && (base <= 36))) {
-                                               fprint(cl_stderr, "Base must be an integer in the range from 2 to 36, not ");
-                                               fprint(cl_stderr, base);
-                                               fprint(cl_stderr, "\n");
+                                               fprint(std::cerr, "Base must be an integer in the range from 2 to 36, not ");
+                                               fprint(std::cerr, base);
+                                               fprint(std::cerr, "\n");
                                                cl_abort();
                                        }
                                        rational_base = FN_to_UL(base); ptr = base_end_ptr;
@@ -124,7 +122,6 @@ const cl_I read_integer (const cl_read_flags& flags, const char * string, const
                }
        }
 not_integer_syntax:
-bad_syntax:
        if (flags.syntax & syntax_maybe_bad) {
                ASSERT(end_of_parse);
                *end_of_parse = string;
@@ -132,3 +129,5 @@ bad_syntax:
        }
        read_number_bad_syntax(string,string_limit);
 }
+
+}  // namespace cln