]> www.ginac.de Git - cln.git/commitdiff
* */*: Removed problematic stdin, stdout and stderr definitions.
authorRichard Kreckel <kreckel@ginac.de>
Fri, 24 Nov 2000 20:51:06 +0000 (20:51 +0000)
committerRichard Kreckel <kreckel@ginac.de>
Fri, 24 Nov 2000 20:51:06 +0000 (20:51 +0000)
          Use std::cin, std::cout, std::cerr instead (obsoletes 2000-10-29).

56 files changed:
benchmarks/timebench1.cc
benchmarks/timebench2a.cc
benchmarks/timebench2ap.cc
benchmarks/timebench2b.cc
doc/cln.tex
examples/contfrac.cc
examples/fibonacci.cc
examples/legendre.cc
examples/nextprime.cc
include/cln/io.h
include/cln/modinteger.h
include/cln/object.h
include/cln/timing.h
src/base/cl_N_err_d0.cc
src/base/cl_as_err.cc
src/base/cl_debugout.cc
src/base/cl_malloc.cc
src/base/cl_notreached.cc
src/base/digitseq/cl_DS_mul_fftc.h
src/base/digitseq/cl_DS_mul_fftcs.h
src/base/digitseq/cl_DS_mul_fftr.h
src/base/input/cl_read_err_bad.cc
src/base/input/cl_read_err_eof.cc
src/base/input/cl_read_err_junk.cc
src/base/input/cl_read_globals.cc [deleted file]
src/base/output/cl_prin_globals.cc
src/base/ring/cl_no_ring.cc
src/complex/input/cl_N_read.cc
src/float/base/cl_F_err_nan.cc
src/float/base/cl_F_err_ov.cc
src/float/base/cl_F_err_un.cc
src/integer/algebraic/cl_I_sqrt.cc
src/integer/bitwise/cl_I_asherr.cc
src/integer/bitwise/cl_I_logbitp_I.cc
src/integer/conv/cl_I_to_L.cc
src/integer/conv/cl_I_to_Q.cc
src/integer/conv/cl_I_to_UL.cc
src/integer/conv/cl_I_to_UQ.cc
src/integer/division/cl_I_exquoerr.cc
src/integer/input/cl_I_read.cc
src/modinteger/cl_MI_int.h
src/polynomial/elem/cl_UP_no_ring.cc
src/rational/input/cl_RA_read.cc
src/real/format-output/cl_fmt_cardinal.cc
src/real/format-output/cl_fmt_newroman.cc
src/real/format-output/cl_fmt_oldroman.cc
src/real/input/cl_R_read.cc
src/real/random/cl_R_random.cc
tests/exam.h
tests/exam_I_gcd.cc
tests/main.cc
tests/test.h
tests/timeMImisc5.cc
tests/timeUPMImul.cc
tests/timepi.cc
tests/timesquare.cc

index 201dd001b1b28f0fdd1b475a6940048ebbd4a40b..3f736538a8495fe7eb7f62f84391451ed54391a8 100644 (file)
@@ -61,13 +61,13 @@ int main (int argc, char * argv[])
        if (argc < 1)
                exit(1);
 
-       fprint(stderr, "Number of repetitions: ");
-       fprintdecimal(stderr, repetitions);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "Number of repetitions: ");
+       fprintdecimal(std::cerr, repetitions);
+       fprint(std::cerr, "\n");
 
        float_format_t prec = float_format(1000);
 
-       fprint(stderr, "pi\n");
+       fprint(std::cerr, "pi\n");
        { cl_F p;
          { CL_TIMING; p = pi(prec); }
          { CL_TIMING;
@@ -77,7 +77,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "gamma\n");
+       fprint(std::cerr, "gamma\n");
        { cl_F p;
          { CL_TIMING; p = eulerconst(prec); }
          { CL_TIMING;
@@ -87,7 +87,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "e\n");
+       fprint(std::cerr, "e\n");
        { cl_F p = exp1(prec);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -96,7 +96,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "sqrt(3)\n");
+       fprint(std::cerr, "sqrt(3)\n");
        { cl_R p = sqrt(cl_float(3,prec));
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -105,7 +105,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "exp(log(2))\n");
+       fprint(std::cerr, "exp(log(2))\n");
        { cl_N p = exp(log(cl_float(2,prec)));
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -114,7 +114,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "log(exp(2))\n");
+       fprint(std::cerr, "log(exp(2))\n");
        { cl_N p = log(exp(cl_float(2,prec)));
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -123,7 +123,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "sin(pi/3)\n");
+       fprint(std::cerr, "sin(pi/3)\n");
        { cl_R p = sin(pi(prec)/3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -132,7 +132,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "cos(pi/3)\n");
+       fprint(std::cerr, "cos(pi/3)\n");
        { cl_R p = cos(pi(prec)/3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -141,7 +141,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "arcsin(sqrt(3)/2)\n");
+       fprint(std::cerr, "arcsin(sqrt(3)/2)\n");
        { cl_N p = asin(sqrt(cl_float(3,prec))/2);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -150,7 +150,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "arccos(sqrt(3)/2)\n");
+       fprint(std::cerr, "arccos(sqrt(3)/2)\n");
        { cl_N p = acos(sqrt(cl_float(3,prec))/2);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -159,7 +159,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "sinh(log(2))\n");
+       fprint(std::cerr, "sinh(log(2))\n");
        { cl_N p = sinh(log(cl_float(2,prec)));
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -168,7 +168,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "cosh(log(2))\n");
+       fprint(std::cerr, "cosh(log(2))\n");
        { cl_N p = cosh(log(cl_float(2,prec)));
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -177,7 +177,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "arsinh(pi)\n");
+       fprint(std::cerr, "arsinh(pi)\n");
        { cl_N p = asinh(pi(prec));
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -186,7 +186,7 @@ int main (int argc, char * argv[])
          cout << p << endl << endl;
        }
 
-       fprint(stderr, "arcosh(pi)\n");
+       fprint(std::cerr, "arcosh(pi)\n");
        { cl_N p = acosh(pi(prec));
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
index 84a5dfbcbe023e65017c72e2ce7cfd6f1139ccb0..93222c4411930ae1a1da1e69346074efb9d97377 100644 (file)
@@ -31,8 +31,8 @@ int main (int argc, char * argv[])
        if (argc < 1)
                exit(1);
        
-       stderr << "Number of digits: " << digits << endl;
-       stderr << "Number of repetitions: " << repetitions << endl;
+       cerr << "Number of digits: " << digits << endl;
+       cerr << "Number of repetitions: " << repetitions << endl;
 
        float_format_t prec = float_format(digits);
        float_format_t prec2 = float_format(digits*2);
@@ -41,7 +41,7 @@ int main (int argc, char * argv[])
        cl_I x2 = floor1(sqrt(cl_float(3,prec)) * pow);
        cl_I x3 = pow+1;
 
-       stderr << "multiplication" << endl;
+       cerr << "multiplication" << endl;
        { cl_I r = x1*x2;
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -50,7 +50,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "division" << endl;
+       cerr << "division" << endl;
        { cl_I_div_t qr = floor2(x1,x2);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -59,7 +59,7 @@ int main (int argc, char * argv[])
          cout << qr.quotient << endl << qr.remainder << endl << endl;
        }
 
-       stderr << "isqrt" << endl;
+       cerr << "isqrt" << endl;
        { cl_I r = isqrt(x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -68,7 +68,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "gcd" << endl;
+       cerr << "gcd" << endl;
        { cl_I r = gcd(x1,x2);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
index 401e9292a8eaf4e8c295575908a54b910b691cc7..7254c1d270917c7753df8b08fb9c3518473efd17 100644 (file)
@@ -28,8 +28,8 @@ int main (int argc, char * argv[])
        if (argc < 1)
                exit(1);
 
-       stderr << "Limit: " << limit << endl;
-       stderr << "Number of repetitions: " << repetitions << endl;
+       cerr << "Limit: " << limit << endl;
+       cerr << "Number of repetitions: " << repetitions << endl;
 
        { CL_TIMING;
          for (int rep = repetitions; rep > 0; rep--)
index 94c48ee77e9c2881cbf29e3f74a8178e946e27ff..0e8e1c40ff1381055d90677292e52f853942fe20 100644 (file)
@@ -34,15 +34,15 @@ int main (int argc, char * argv[])
        if (argc < 1)
                exit(1);
 
-       stderr << "Number of digits: " << digits << endl;
-       stderr << "Number of repetitions (except for pi,euler,e): " << repetitions << endl;
+       cerr << "Number of digits: " << digits << endl;
+       cerr << "Number of repetitions (except for pi,euler,e): " << repetitions << endl;
 
        float_format_t prec = float_format(digits);
        cl_F x1 = sqrt(cl_float(2,prec));
        cl_F x2 = sqrt(cl_float(3,prec));
        cl_F x3 = The(cl_F)(log(cl_float(2,prec)));
 
-       stderr << "multiplication" << endl;
+       cerr << "multiplication" << endl;
        { cl_F r = x1*x2;
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -51,7 +51,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "sqrt" << endl;
+       cerr << "sqrt" << endl;
        { cl_F r = sqrt(x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -60,25 +60,25 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "pi" << endl;
+       cerr << "pi" << endl;
        { cl_F r;
          { CL_TIMING; r = pi(prec); }
          cout << r << endl << endl;
        }
 
-       stderr << "eulerconst" << endl;
+       cerr << "eulerconst" << endl;
        { cl_F r;
          { CL_TIMING; r = eulerconst(prec); }
          cout << r << endl << endl;
        }
 
-       stderr << "e" << endl;
+       cerr << "e" << endl;
        { cl_F r;
          { CL_TIMING; r = exp1(prec); }
          cout << r << endl << endl;
        }
 
-       stderr << "exp" << endl;
+       cerr << "exp" << endl;
        { cl_F r = exp(-x1);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -87,7 +87,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "log" << endl;
+       cerr << "log" << endl;
        { cl_N r = log(x2);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -96,7 +96,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "sin" << endl;
+       cerr << "sin" << endl;
        { cl_R r = sin(5*x1);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -105,7 +105,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "cos" << endl;
+       cerr << "cos" << endl;
        { cl_R r = cos(5*x1);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -114,7 +114,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "asin" << endl;
+       cerr << "asin" << endl;
        { cl_N r = asin(x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -123,7 +123,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "acos" << endl;
+       cerr << "acos" << endl;
        { cl_N r = acos(x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -132,7 +132,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "atan" << endl;
+       cerr << "atan" << endl;
        { cl_F r = atan(x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -141,7 +141,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "sinh" << endl;
+       cerr << "sinh" << endl;
        { cl_F r = sinh(x2);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -150,7 +150,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "cosh" << endl;
+       cerr << "cosh" << endl;
        { cl_F r = cosh(x2);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -159,7 +159,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "asinh" << endl;
+       cerr << "asinh" << endl;
        { cl_N r = asinh(x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -168,7 +168,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "acosh" << endl;
+       cerr << "acosh" << endl;
        { cl_N r = acosh(1+x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
@@ -177,7 +177,7 @@ int main (int argc, char * argv[])
          cout << r << endl << endl;
        }
 
-       stderr << "atanh" << endl;
+       cerr << "atanh" << endl;
        { cl_N r = atanh(x3);
          { CL_TIMING;
            for (int rep = repetitions; rep > 0; rep--)
index 27a4eba9177affed367b0ee90a2acf8fb0a6aa99..4aee82f88a65e49276414c531b1a12db35fa9df3 100644 (file)
@@ -553,7 +553,8 @@ Rational numbers are always normalized to the form
 are coprime integers and the denominator is positive. If the resulting
 denominator is @code{1}, the rational number is converted to an integer.
 
-Small integers (typically in the range @code{-2^30}@dots{}@code{2^30-1},
+@cindex immediate numbers
+Small integers (typically in the range @code{-2^29}@dots{}@code{2^29-1},
 for 32-bit machines) are especially efficient, because they consume no heap
 allocation. Otherwise the distinction between these immediate integers
 (called ``fixnums'') and heap allocated integers (called ``bignums'')
@@ -2418,13 +2419,6 @@ Including @code{<cln/io.h>} defines a type @code{cl_istream}, which is
 the type of the first argument to all input functions. @code{cl_istream}
 is the same as @code{std::istream&}.
 
-The variable
-@itemize @asis
-@item
-@code{cl_istream stdin}
-@end itemize
-contains the standard input stream.
-
 These are the simple input functions:
 
 @table @code
@@ -2524,20 +2518,6 @@ Including @code{<cln/io.h>} defines a type @code{cl_ostream}, which is
 the type of the first argument to all output functions. @code{cl_ostream}
 is the same as @code{std::ostream&}.
 
-The variable
-@itemize @asis
-@item
-@code{cl_ostream stdout}
-@end itemize
-contains the standard output stream.
-
-The variable
-@itemize @asis
-@item
-@code{cl_ostream stderr}
-@end itemize
-contains the standard error output stream.
-
 These are the simple output functions:
 
 @table @code
@@ -3285,6 +3265,7 @@ Garbage collection: A reference counting mechanism makes sure that any
 number object's storage is freed immediately when the last reference to the
 object is gone.
 @item
+@cindex immediate numbers
 Small integers are represented as immediate values instead of pointers
 to heap allocated storage. This means that integers @code{> -2^29},
 @code{< 2^29} don't consume heap memory, unless they were explicitly allocated
index ba1e3d426dd884735024c74e3edb8440bc27b347..e716f050f2a664483b8777c939862568ce666f3e 100644 (file)
@@ -8,6 +8,7 @@
 #include <cln/io.h>
 #include <cln/integer_io.h>
 
+using namespace std;
 using namespace cln;
 
 // Our private error handling: return to the main program.
@@ -27,23 +28,23 @@ int main (int argc, char* argv[])
                cl_R x = arg;
                // Check sign.
                if (minusp(x)) {
-                       stdout << '-';
+                       cout << '-';
                        x = -x;
                }
-               fprint(stdout, "[");
+               cout << "[";
                const char* separator = "; ";
                for (;;) {
                        // Split x into integral and fractional part.
                        cl_R_div_t x_split = floor2(x);
-                       stdout << x_split.quotient;
+                       cout << x_split.quotient;
                        x = x_split.remainder;
                        if (zerop(x))
                                break;
-                       stdout << separator;
+                       cout << separator;
                        separator = ", ";
                        // Invert x.
                        x = recip(x);
                }
-               stdout << ']' << std::endl;
+               cout << ']' << endl;
        }
 }
index a0fb5542cfadf7cbd6560ced06af74bdaa19da81..df975125ff41fb885a5fdb7eb73f03f4d2df3c72 100644 (file)
@@ -125,11 +125,11 @@ const cl_I fibonacci_slow (int n)
 int main (int argc, char* argv[])
 {
        if (argc != 2) {
-               stderr << "Usage: fibonacci n" << endl;
+               cerr << "Usage: fibonacci n" << endl;
                return(1);
        }
        int n = atoi(argv[1]);
-       stdout << "fib(" << n << ") = " << fibonacci(n) << endl;
+       cout << "fib(" << n << ") = " << fibonacci(n) << endl;
        return(0);
 }
 
@@ -143,27 +143,27 @@ int main (int argc, char* argv[])
                argc -= 2; argv += 2;
        }
        if (argc != 2) {
-               stderr << "Usage: fibonacci n" << endl;
+               cerr << "Usage: fibonacci n" << endl;
                return(1);
        }
        int n = atoi(argv[1]);
        { CL_TIMING;
-               stdout << "fib(" << n << ") = ";
+               cout << "fib(" << n << ") = ";
                for (int rep = repetitions-1; rep > 0; rep--)
                        fibonacci(n);
-               stdout << fibonacci(n) << endl;
+               cout << fibonacci(n) << endl;
        }
        { CL_TIMING;
-               stdout << "fib(" << n << ") = ";
+               cout << "fib(" << n << ") = ";
                for (int rep = repetitions-1; rep > 0; rep--)
                        fibonacci_compact(n);
-               stdout << fibonacci_compact(n) << endl;
+               cout << fibonacci_compact(n) << endl;
        }
        { CL_TIMING;
-               stdout << "fib(" << n << ") = ";
+               cout << "fib(" << n << ") = ";
                for (int rep = repetitions-1; rep > 0; rep--)
                        fibonacci_slow(n);
-               stdout << fibonacci_slow(n) << endl;
+               cout << fibonacci_slow(n) << endl;
        }
        return(0);
 }
index 6805767f7caca9dcd9212c9bd38e6a771e48736a..c0e4b90a4ad90b3e52efb8ee7580a75385bdacc1 100644 (file)
@@ -10,6 +10,7 @@
 #include <cln/io.h>
 #include <stdlib.h>
 
+using namespace std;
 using namespace cln;
 
 // Computes the n-th Legendre polynomial in R[x], using the formula
@@ -54,21 +55,21 @@ const cl_UP_MI legendre (const cl_modint_ring& R, int n)
 int main (int argc, char* argv[])
 {
        if (!(argc == 2 || argc == 3)) {
-               fprint(stderr, "Usage: legendre n [m]\n");
+               cerr << "Usage: legendre n [m]" << endl;
                exit(1);
        }
        int n = atoi(argv[1]);
        if (!(n >= 0)) {
-               fprint(stderr, "Usage: legendre n [m]  with n >= 0\n");
+               cerr << "Usage: legendre n [m]  with n >= 0" << endl;
                exit(1);
        }
        if (argc == 2) {
                cl_UP p = legendre(cl_RA_ring,n);
-               fprint(stdout, p);
+               cout << p << endl;
        } else {
                cl_I m = argv[2];
                cl_UP p = legendre(find_modint_ring(m),n);
-               fprint(stdout, p);
+               cout << p << endl;
        }
-       fprint(stdout, "\n");
+       return 0;
 }
index b7aa26d6c9feff7c39c36f6c2854a5ac2482329b..9b24aa109a06f5947614e97e34d5b43a9146ce17 100644 (file)
 int main (int argc, char* argv[])
 {
        if (argc != 2) {
-               cln::stderr << "Usage: nextprime x" << std::endl;
+               std::cerr << "Usage: nextprime x" << std::endl;
                return(1);
        }
        cln::cl_R x = (cln::cl_R)argv[1];
        cln::cl_I p = cln::nextprobprime(x);
-       cln::stdout << p << std::endl;
+       std::cout << p << std::endl;
        return(0);
 }
index e997d84709e97bddbb4e082633415aec46bb2058..246e5fd6f9162b44b64f8c5230780e572e09c848 100644 (file)
@@ -1,4 +1,4 @@
-// I/O through <stdio.h> or <iostream>
+// I/O through <iostream>
 
 #ifndef _CL_IO_H
 #define _CL_IO_H
@@ -20,9 +20,6 @@ namespace cln {
 
 typedef std::istream& cl_istream;
 typedef std::ostream& cl_ostream;
-extern cl_istream stdin;
-extern cl_ostream stdout;
-extern cl_ostream stderr;
 extern std::ostream* cl_debugout_stream;
 #define cl_debugout  (*cl_debugout_stream)
 
index ed3b1532a5edef033894d12f853006dffe5d40f0..4624be7ac5b74045231309db67ebceb592591ab0 100644 (file)
@@ -75,10 +75,10 @@ struct cl_composite_condition : public cl_condition {
        // Constructors.
        cl_composite_condition (const cl_I& _p)
                : p (_p), factor (0)
-               { print(stderr); }
+               { print(std::cerr); }
        cl_composite_condition (const cl_I& _p, const cl_I& _f)
                : p (_p), factor (_f)
-               { print(stderr); }
+               { print(std::cerr); }
        // Implement general condition methods.
        const char * name () const;
        void print (cl_ostream) const;
index 617f7f32b1350c2e2a189edc8e4db86bb9bd4666..fb509bd67594ffc153b30f973112b8f525c87386 100644 (file)
@@ -175,7 +175,7 @@ typedef void (*cl_heap_destructor_function) (cl_heap* pointer);
 #define cl_class_flags_subclass_rational  8  // all instances belong to cl_RA
 #define cl_class_flags_number_ring       16  // all instances are rings whose
                                              // elements belong to cl_number
-// Function to print an object for debugging, to stderr.
+// Function to print an object for debugging, to cerr.
 typedef void (*cl_heap_dprint_function) (cl_heap* pointer);
 
 struct cl_class {
index 2b650062a3d6442909f308408a9152b00bcd53da..76883ba7fff44e8807e44c5036bf561612244c1a 100644 (file)
@@ -52,8 +52,8 @@ extern void cl_timing_report (cl_ostream, const cl_time_consumption&);
 struct cl_timing {
        // Constructor, starts the time interval.
        cl_timing (cl_time_consumption& accumulator);
-       cl_timing (cl_ostream destination = stderr);
-       cl_timing (const char *, cl_ostream destination = stderr);
+       cl_timing (cl_ostream destination = std::cerr);
+       cl_timing (const char *, cl_ostream destination = std::cerr);
        // Destructor, closes the time interval and does a report.
        ~cl_timing ();  
 //private:
@@ -67,7 +67,7 @@ struct cl_timing {
 // Usage:
 //     { CL_TIMING; computation(); }
 // or  { CL_TIMING(accumulator); computation(); }
-// or  { CL_TIMING(stdout); computation(); }
+// or  { CL_TIMING(cout); computation(); }
 // The timing interval starts immediately and ends at the closing brace.
 #define CL_TIMING  CL_TIMING1(__LINE__)
 #define CL_TIMING1(line)  CL_TIMING2(line)
index 6d09e8ca0c52b842e32fff96fd63cd999336256c..5360d6e9ab044c67951a1584c4d2ed2ab5a31781 100644 (file)
@@ -16,7 +16,7 @@ namespace cln {
 
 void cl_error_division_by_0 (void)
 {
-       fprint(stderr, "Division by zero.\n");
+       fprint(std::cerr, "Division by zero.\n");
        cl_abort();
 }
 
index 565753a6cf26d0652fdf494df93e70a358faa687..2becee83e4dba81f901c364cf86902bce1b04ff7 100644 (file)
@@ -16,22 +16,22 @@ namespace cln {
 
 void cl_as_error (const cl_number& obj, const char * typestring, const char * filename, int line)
 {
-       fprint(stderr, "Type assertion failed: in file ");
-       fprint(stderr, filename);
-       fprint(stderr, ", line ");
-       fprintdecimal(stderr, line);
-       fprint(stderr, ", not ");
-       fprint(stderr, typestring);
-       fprint(stderr, ": ");
+       fprint(std::cerr, "Type assertion failed: in file ");
+       fprint(std::cerr, filename);
+       fprint(std::cerr, ", line ");
+       fprintdecimal(std::cerr, line);
+       fprint(std::cerr, ", not ");
+       fprint(std::cerr, typestring);
+       fprint(std::cerr, ": ");
 #if 0 // This brings in a dependency from the complex and float printer and all the float stuff.
-       fprint(stderr, obj);
+       fprint(std::cerr, obj);
 #else
-       fprint(stderr, "@0x");
-       fprinthexadecimal(stderr, (unsigned long)(void*)&obj);
-       fprint(stderr, ": 0x");
-       fprinthexadecimal(stderr, (unsigned long)obj.word);
+       fprint(std::cerr, "@0x");
+       fprinthexadecimal(std::cerr, (unsigned long)(void*)&obj);
+       fprint(std::cerr, ": 0x");
+       fprinthexadecimal(std::cerr, (unsigned long)obj.word);
 #endif
-       fprint(stderr, "\n");
+       fprint(std::cerr, "\n");
        cl_abort();
 }
 
index ddfd01514f7a75df739e261383bccdd53f2c0ef0..c195f8f67c85b6f3d2c43511d862213462b9dae6 100644 (file)
@@ -10,7 +10,7 @@
 // Implementation.
 
 // Just assume that the debugger runs on /dev/tty, independently of
-// stdin, stdout, stderr.
+// cin, cout, cerr.
 
 #include <fstream>
 
index 8765cf1078062089e9f6ae4e91a00224d71bd80c..4ca4fc3ff0d4ce75baaa67e81df7e31438711895 100644 (file)
@@ -28,7 +28,7 @@ static void* xmalloc (size_t size)
        void* ptr = malloc(size);
        if (ptr)
                return ptr;
-       fprint(stderr, "Out of virtual memory.\n");
+       fprint(std::cerr, "Out of virtual memory.\n");
        cl_abort();
 }
 
index 94455f38f2e8af8f4c7f40adf0d5faadfe55baeb..95b27e5b230b0d81aa85954faed0b5f217d76500 100644 (file)
@@ -16,12 +16,12 @@ namespace cln {
 
 void cl_notreached_abort (const char* filename, int lineno)
 {
-       fprint(stderr, "Internal error: statement in file ");
-       fprint(stderr, filename);
-       fprint(stderr, ", line ");
-       fprintdecimal(stderr, lineno);
-       fprint(stderr, " has been reached!!\n");
-       fprint(stderr, "Please send the authors of the program a description how you produced this error!\n");
+       fprint(std::cerr, "Internal error: statement in file ");
+       fprint(std::cerr, filename);
+       fprint(std::cerr, ", line ");
+       fprintdecimal(std::cerr, lineno);
+       fprint(std::cerr, " has been reached!!\n");
+       fprint(std::cerr, "Please send the authors of the program a description how you produced this error!\n");
        cl_abort();
 }
 
index 7384194e4838ec3bcf1bd1e7c78d2cef03c1c7d4..0c1e7caf717c7367033b63c1a8b51cdc67abffaa 100644 (file)
@@ -663,7 +663,7 @@ static void fill_factor (uintL N, fftc_complex* x, uintL l,
        if (max_l(2) > intDsize && l > intDsize) {
                // l > intDsize
                if (max_l(2) > 64 && l > 64) {
-                       fprint(stderr, "FFT problem: l > 64 not supported by pow2_table\n");
+                       fprint(std::cerr, "FFT problem: l > 64 not supported by pow2_table\n");
                        cl_abort();
                }
                var fftc_real carry = 0;
@@ -944,7 +944,7 @@ static inline void mulu_fftcomplex_nocheck (const uintD* sourceptr1, uintC len1,
        for ( ; ; k++) {
                if (k >= sizeof(max_l_table)/sizeof(max_l_table[0])
                    || max_l_table[k] <= 0) {
-                       fprint(stderr, "FFT problem: numbers too big, floating point precision not sufficient\n");
+                       fprint(std::cerr, "FFT problem: numbers too big, floating point precision not sufficient\n");
                        cl_abort();
                }
                if (2*ceiling((uintL)len1*intDsize,max_l_table[k])-1 <= ((uintL)1 << k))
@@ -1100,7 +1100,7 @@ static void mulu_fftcomplex (const uintD* sourceptr1, uintC len1,
        var uintD checksum = multiply_checksum(checksum1,checksum2);
        mulu_fftcomplex_nocheck(sourceptr1,len1,sourceptr2,len2,destptr);
        if (!(checksum == compute_checksum(destptr,len1+len2))) {
-               fprint(stderr, "FFT problem: checksum error\n");
+               fprint(std::cerr, "FFT problem: checksum error\n");
                cl_abort();
        }
 }
index 4fc42b222cca070168529785bbb45e9a6721c031..f63ea29a9ea6d4aa16339a1b8f637f6998eefcc4 100644 (file)
@@ -727,7 +727,7 @@ static void fill_factor (uintL N, fftcs_real* x, uintL l,
        if (max_l(2) > intDsize && l > intDsize) {
                // l > intDsize
                if (max_l(2) > 64 && l > 64) {
-                       fprint(stderr, "FFT problem: l > 64 not supported by pow2_table\n");
+                       fprint(std::cerr, "FFT problem: l > 64 not supported by pow2_table\n");
                        cl_abort();
                }
                var fftcs_real carry = 0;
@@ -1000,7 +1000,7 @@ static inline void mulu_fftcs_nocheck (const uintD* sourceptr1, uintC len1,
        for ( ; ; k++) {
                if (k >= sizeof(max_l_table)/sizeof(max_l_table[0])
                    || max_l_table[k] <= 0) {
-                       fprint(stderr, "FFT problem: numbers too big, floating point precision not sufficient\n");
+                       fprint(std::cerr, "FFT problem: numbers too big, floating point precision not sufficient\n");
                        cl_abort();
                }
                if (2*ceiling((uintL)len1*intDsize,max_l_table[k])-1 <= ((uintL)1 << k))
@@ -1150,7 +1150,7 @@ static void mulu_fftcs (const uintD* sourceptr1, uintC len1,
        var uintD checksum = multiply_checksum(checksum1,checksum2);
        mulu_fftcs_nocheck(sourceptr1,len1,sourceptr2,len2,destptr);
        if (!(checksum == compute_checksum(destptr,len1+len2))) {
-               fprint(stderr, "FFT problem: checksum error\n");
+               fprint(std::cerr, "FFT problem: checksum error\n");
                cl_abort();
        }
 }
index c5781dd05b22cfbe6dcdc561f1dc9b2c77de7efc..ee8165773cc0303ee46ad371ab6f299fae59765f 100644 (file)
@@ -714,7 +714,7 @@ static void fill_factor (uintL N, fftr_real* x, uintL l,
        if (max_l(2) > intDsize && l > intDsize) {
                // l > intDsize
                if (max_l(2) > 64 && l > 64) {
-                       fprint(stderr, "FFT problem: l > 64 not supported by pow2_table\n");
+                       fprint(std::cerr, "FFT problem: l > 64 not supported by pow2_table\n");
                        cl_abort();
                }
                var fftr_real carry = 0;
@@ -987,7 +987,7 @@ static inline void mulu_fftr_nocheck (const uintD* sourceptr1, uintC len1,
        for ( ; ; k++) {
                if (k >= sizeof(max_l_table)/sizeof(max_l_table[0])
                    || max_l_table[k] <= 0) {
-                       fprint(stderr, "FFT problem: numbers too big, floating point precision not sufficient\n");
+                       fprint(std::cerr, "FFT problem: numbers too big, floating point precision not sufficient\n");
                        cl_abort();
                }
                if (2*ceiling((uintL)len1*intDsize,max_l_table[k])-1 <= ((uintL)1 << k))
@@ -1137,7 +1137,7 @@ static void mulu_fftr (const uintD* sourceptr1, uintC len1,
        var uintD checksum = multiply_checksum(checksum1,checksum2);
        mulu_fftr_nocheck(sourceptr1,len1,sourceptr2,len2,destptr);
        if (!(checksum == compute_checksum(destptr,len1+len2))) {
-               fprint(stderr, "FFT problem: checksum error\n");
+               fprint(std::cerr, "FFT problem: checksum error\n");
                cl_abort();
        }
 }
index 1fdc227b0a9c9b7d630f065e33a49ade5b31fdf9..023abb81bc087ba5a62b0886bbb672398a917d7d 100644 (file)
@@ -16,10 +16,10 @@ namespace cln {
 
 void read_number_bad_syntax (const char * string, const char * string_limit)
 {
-       fprint(stderr, "Illegal number syntax: \"");
+       fprint(std::cerr, "Illegal number syntax: \"");
        for (const char * ptr = string; ptr != string_limit; ptr++)
-               fprintchar(stderr, *ptr);
-       fprint(stderr, "\"\n");
+               fprintchar(std::cerr, *ptr);
+       fprint(std::cerr, "\"\n");
        cl_abort();
 }
 
index ac27d37699cad64112c81f007d54a78db1519552..5fc8318fe73e679059945f767ea519dcca4b648f 100644 (file)
@@ -16,7 +16,7 @@ namespace cln {
 
 void read_number_eof (void)
 {
-       fprint(stderr, "read_number: end of stream encountered\n");
+       fprint(std::cerr, "read_number: end of stream encountered\n");
        cl_abort();
 }
 
index 88741094e7649f37200b6d74907a45dc463d9740..8e629334b576fb3d167453d5e72d1fb0610530f0 100644 (file)
@@ -16,15 +16,15 @@ namespace cln {
 
 void read_number_junk (const char * string_rest, const char * string, const char * string_limit)
 {
-       fprint(stderr, "Junk after number: ");
+       fprint(std::cerr, "Junk after number: ");
        { for (const char * ptr = string; ptr != string_rest; ptr++)
-               fprintchar(stderr, *ptr);
+               fprintchar(std::cerr, *ptr);
        }
-       fprint(stderr, "\"");
+       fprint(std::cerr, "\"");
        { for (const char * ptr = string_rest; ptr != string_limit; ptr++)
-               fprintchar(stderr, *ptr);
+               fprintchar(std::cerr, *ptr);
        }
-       fprint(stderr, "\"\n");
+       fprint(std::cerr, "\"\n");
        cl_abort();
 }
 
diff --git a/src/base/input/cl_read_globals.cc b/src/base/input/cl_read_globals.cc
deleted file mode 100644 (file)
index 06bfbb2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// Global variables in CLN
-
-// Specification.
-#include "cln/io.h"
-
-// Implementation.
-
-namespace cln {
-
-cl_istream stdin = std::cin;
-
-}  // namespace cln
index 98ce10279e4f0d6f60f13558932e4ab3d5fd3625..fcfea5f31b2fe3f856dfe48731cc1db164fa5468 100644 (file)
@@ -13,9 +13,6 @@ CL_PROVIDE(cl_prin_globals)
 
 namespace cln {
 
-cl_ostream stdout = std::cout;
-cl_ostream stderr = std::cerr;
-
 cl_print_flags default_print_flags;
 #if 0 // The default constructors already do this.
 AT_INITIALIZATION(default_print_flags)
index 1331da0e224d6ac01c0e1b10aa947492ec334b9d..b804a1100b6ada110f939a664d3165516627ed94 100644 (file)
@@ -19,18 +19,18 @@ namespace cln {
 nonreturning_function(static, uninitialized_ring, (void));
 static void uninitialized_ring ()
 {
-       fprint(stderr, "Uninitialized ring operation called\n");
+       fprint(std::cerr, "Uninitialized ring operation called\n");
        cl_abort();
 }
 
 nonreturning_function(static, uninitialized_error, (const _cl_ring_element&));
 static void uninitialized_error (const _cl_ring_element& obj)
 {
-       fprint(stderr, "Uninitialized ring element @0x");
-       fprinthexadecimal(stderr, (unsigned long)(void*)&obj);
-       fprint(stderr, ": 0x");
-        fprinthexadecimal(stderr, (unsigned long)obj.rep.word);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "Uninitialized ring element @0x");
+       fprinthexadecimal(std::cerr, (unsigned long)(void*)&obj);
+       fprint(std::cerr, ": 0x");
+        fprinthexadecimal(std::cerr, (unsigned long)obj.rep.word);
+       fprint(std::cerr, "\n");
        cl_abort();
 }
 
index 37560e259ee2670eedb60c83b69f23923d88e447..f54b2709b60e9dc78c18cd618f40855d1ffd54d2 100644 (file)
 #undef floor
 #include <cmath>
 #define floor cln_floor
-// Ugh, some compilers #define stderr, confusing cln::stderr
-#ifdef stderr
-  #undef stderr
-#endif
 
 
 namespace cln {
@@ -96,9 +92,9 @@ const cl_N read_complex (const cl_read_flags& flags, const char * string, const
                                                goto not_rational_syntax;
                                        var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr);
                                        if (!((base >= 2) && (base <= 36))) {
-                                               fprint(stderr, "Base must be an integer in the range from 2 to 36, not ");
-                                               fprint(stderr, base);
-                                               fprint(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;
index 0b6824c0a0993b22c873e929ea0a943ffaab7f32..f616ec53c601ab13e6f5308732913e56399a8157 100644 (file)
@@ -16,7 +16,7 @@ namespace cln {
 
 void cl_error_floating_point_nan (void)
 {
-       fprint(stderr, "floating point NaN occurred.\n");
+       fprint(std::cerr, "floating point NaN occurred.\n");
        cl_abort();
 }
 
index aaf06378fb4dbd199f74e8f48f3b58f57551ba63..270b052ee01b00a4e0b4d8d8b2f72b41521fe15e 100644 (file)
@@ -16,7 +16,7 @@ namespace cln {
 
 void cl_error_floating_point_overflow (void)
 {
-       fprint(stderr, "Floating point overflow.\n");
+       fprint(std::cerr, "Floating point overflow.\n");
        cl_abort();
 }
 
index cf1c9f4ab1052b73005e069074d49bc325813fd8..3ac0dcf6f5f41aab7d0e402e7b71fdf4e672604c 100644 (file)
@@ -16,7 +16,7 @@ namespace cln {
 
 void cl_error_floating_point_underflow (void)
 {
-       fprint(stderr, "Floating point underflow.\n");
+       fprint(std::cerr, "Floating point underflow.\n");
        cl_abort();
 }
 
index d59ba68e42831eadd44006293b8078de6a4e49e3..9de7f748bbf9bd311a7730f5c90d476dd5f8f2da 100644 (file)
@@ -21,9 +21,9 @@ namespace cln {
 cl_boolean isqrt (const cl_I& x, cl_I* w)
 {
        if (minusp(x)) {
-               fprint(stderr, "isqrt: applied to negative number: ");
-               fprint(stderr, x);
-               fprint(stderr, "\n");
+               fprint(std::cerr, "isqrt: applied to negative number: ");
+               fprint(std::cerr, x);
+               fprint(std::cerr, "\n");
                cl_abort();
        }
        CL_ALLOCA_STACK;
index 3e1d7cc48e921ef162422566dcb51540e33a8066..24dda4d7c5e3f24bfb53c2baf5a2a978d671f5d0 100644 (file)
@@ -18,9 +18,9 @@ namespace cln {
 
 void cl_ash_error (const cl_I& badamount)
 {
-       fprint(stderr, "ash: too large shift amount: ");
-       fprint(stderr, badamount);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "ash: too large shift amount: ");
+       fprint(std::cerr, badamount);
+       fprint(std::cerr, "\n");
        cl_abort();
 }
 
index 83f217ad3025039f851c244aa1d0b4e098d1afc6..7dc76a09da4475795e9af609d34d496e773be8ff 100644 (file)
@@ -44,9 +44,9 @@ cl_boolean logbitp (const cl_I& x, const cl_I& y)
         }
         else
         // x<0
-        { fprint(stderr, "logbitp: Index is negative: ");
-          fprint(stderr, x);
-          fprint(stderr, "\n");
+        { fprint(std::cerr, "logbitp: Index is negative: ");
+          fprint(std::cerr, x);
+          fprint(std::cerr, "\n");
           cl_abort();
         }
 }
index 87e8f84868ec79964f16d52ec54684935b8bf669..cd3c8804cd8dc8d97ee016d841a27cb5ffeb373f 100644 (file)
@@ -70,9 +70,9 @@ sint32 cl_I_to_L (const cl_I& obj)
                #undef IF_LENGTH
        }
        bad: // unpassendes Objekt
-       fprint(stderr, "Not a 32-bit integer: ");
-       fprint(stderr, obj);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "Not a 32-bit integer: ");
+       fprint(std::cerr, obj);
+       fprint(std::cerr, "\n");
        cl_abort();
     }
 }
index 66e7627f5405f8ace83b68b48246d868d23d4f30..ed53195bd3a7e1275c27e677c8a3695e3334369d 100644 (file)
@@ -131,9 +131,9 @@ sint64 cl_I_to_Q (const cl_I& obj)
                #undef IF_LENGTH
        }
        bad: // unpassendes Objekt
-       fprint(stderr, "Not a 64-bit integer: ");
-       fprint(stderr, obj);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "Not a 64-bit integer: ");
+       fprint(std::cerr, obj);
+       fprint(std::cerr, "\n");
        cl_abort();
     }
 }
index c4fffac9b24a69d60d29a46558a346694e91e793..aff8f34f713227addf9f84aeea98271942aff96d 100644 (file)
@@ -54,9 +54,9 @@ uint32 cl_I_to_UL (const cl_I& obj)
                #undef IF_LENGTH
        }
        bad: // unpassendes Objekt
-       fprint(stderr, "Not a 32-bit integer: ");
-       fprint(stderr, obj);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "Not a 32-bit integer: ");
+       fprint(std::cerr, obj);
+       fprint(std::cerr, "\n");
        cl_abort();
 }
 
index 2367493d115c463969b0ab788c3f6167820f755e..a45fedee088473c7dbffdc0bd88ccf5d3c3e539b 100644 (file)
@@ -91,9 +91,9 @@ uint64 cl_I_to_UQ (const cl_I& obj)
                #undef IF_LENGTH
        }
        bad: // unpassendes Objekt
-       fprint(stderr, "Not a 64-bit integer: ");
-       fprint(stderr, obj);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "Not a 64-bit integer: ");
+       fprint(std::cerr, obj);
+       fprint(std::cerr, "\n");
        cl_abort();
 }
 
index 3e4b6de2c2f19bc106cef1e85dc0ae12093444f5..a8198ac64c9c5f9dce0ec80ec86beb70e84716b7 100644 (file)
@@ -17,11 +17,11 @@ namespace cln {
 
 void cl_error_exquo (const cl_I& x, const cl_I& y)
 {
-       fprint(stderr, "Quotient ");
-       fprint(stderr, x);
-       fprint(stderr, " / ");
-       fprint(stderr, y);
-       fprint(stderr, " is not an integer.\n");
+       fprint(std::cerr, "Quotient ");
+       fprint(std::cerr, x);
+       fprint(std::cerr, " / ");
+       fprint(std::cerr, y);
+       fprint(std::cerr, " is not an integer.\n");
        cl_abort();
 }
 
index eff618b891e191eaedd41187df3855be7770bdb9..893dbf72c1f95e853f98610eb937ade75b110574 100644 (file)
@@ -81,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(stderr, "Base must be an integer in the range from 2 to 36, not ");
-                                               fprint(stderr, base);
-                                               fprint(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;
index 4466b12442ab12243b4ecc72e43082f7de3b49e1..9690dc82d063c123cd3583868953d7fc04df4dd0 100644 (file)
@@ -31,7 +31,7 @@ static const _cl_MI int_random (cl_heap_modint_ring* R, random_state& randomstat
 {
        unused R;
        unused randomstate;
-       fprint(stderr, "Z / 0 Z not a finite set - no equidistributed random function.\n");
+       fprint(std::cerr, "Z / 0 Z not a finite set - no equidistributed random function.\n");
        cl_abort();
 #if ((defined(__sparc__) || defined(__sparc64__)) && !defined(__GNUC__)) // Sun CC wants a return value
        return _cl_MI(R, 0);
index 78482d7d24ce4f54dea8066179d0938c577f8243..cc936344960e0da722edcd905b15384de16fda6d 100644 (file)
@@ -19,18 +19,18 @@ namespace cln {
 nonreturning_function(static, uninitialized_ring, (void));
 static void uninitialized_ring ()
 {
-       fprint(stderr, "Uninitialized ring operation called\n");
+       fprint(std::cerr, "Uninitialized ring operation called\n");
        cl_abort();
 }
 
 nonreturning_function(static, uninitialized_error, (const _cl_UP&));
 static void uninitialized_error (const _cl_UP& obj)
 {
-       fprint(stderr, "Uninitialized ring element @0x");
-       fprinthexadecimal(stderr, (unsigned long)(void*)&obj);
-       fprint(stderr, ": 0x");
-        fprinthexadecimal(stderr, (unsigned long)obj.rep.word);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "Uninitialized ring element @0x");
+       fprinthexadecimal(std::cerr, (unsigned long)(void*)&obj);
+       fprint(std::cerr, ": 0x");
+        fprinthexadecimal(std::cerr, (unsigned long)obj.rep.word);
+       fprint(std::cerr, "\n");
        cl_abort();
 }
 
index ccfde0bc85586eed7d73f24e139fbb6560c9c6b8..5bf2ac905a9c99ef0a3e720bfac47df2d52207d5 100644 (file)
@@ -83,9 +83,9 @@ const cl_RA read_rational (const cl_read_flags& flags, const char * string, cons
                                                goto not_rational_syntax;
                                        var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr);
                                        if (!((base >= 2) && (base <= 36))) {
-                                               fprint(stderr, "Base must be an integer in the range from 2 to 36, not ");
-                                               fprint(stderr, base);
-                                               fprint(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;
index 41be5acf9a727f8d11d23b3de549a428933a8368..f2c3dff595cba57e44503c90d1c5fcbe264f3112 100644 (file)
@@ -107,9 +107,9 @@ void format_cardinal (cl_ostream stream, const cl_I& argument)
                var uintL * small_piece_ptr = &small_pieces[0];
                do {
                        if (*illion_ptr == NULL) {
-                               fprint(stderr, "format_cardinal: argument too large: ");
-                               fprint(stderr, argument);
-                               fprint(stderr, "\n");
+                               fprint(std::cerr, "format_cardinal: argument too large: ");
+                               fprint(std::cerr, argument);
+                               fprint(std::cerr, "\n");
                                cl_abort();
                        }
                        var cl_I_div_t div = floor2(arg,1000);
index 836f2c94f0fcb65fef361ac35c5ead5622bd53de..e0c953dc36bb5a738908e67cffb10ed52204ed17 100644 (file)
@@ -18,9 +18,9 @@ namespace cln {
 void format_new_roman (cl_ostream stream, const cl_I& arg)
 {
        if (!(0 < arg && arg < 4000)) {
-               fprint(stderr, "format_new_roman: argument should be in the range 1 - 3999, not ");
-               fprint(stderr, arg);
-               fprint(stderr, ".\n");
+               fprint(std::cerr, "format_new_roman: argument should be in the range 1 - 3999, not ");
+               fprint(std::cerr, arg);
+               fprint(std::cerr, ".\n");
                cl_abort();
        }
        var uintL value = cl_I_to_UL(arg);
index df3343c2d2d0a17dede3b24f5efdcca5aa9fc7a6..cc9f9cacaba4d706a428dfa0e1b92f22d105124d 100644 (file)
@@ -18,9 +18,9 @@ namespace cln {
 void format_old_roman (cl_ostream stream, const cl_I& arg)
 {
        if (!(0 < arg && arg < 5000)) {
-               fprint(stderr, "format_old_roman: argument should be in the range 1 - 4999, not ");
-               fprint(stderr, arg);
-               fprint(stderr, ".\n");
+               fprint(std::cerr, "format_old_roman: argument should be in the range 1 - 4999, not ");
+               fprint(std::cerr, arg);
+               fprint(std::cerr, ".\n");
                cl_abort();
        }
        var uintL value = cl_I_to_UL(arg);
index 9cd38848938b2cb3ba048c5604bced85eaa4c257..5eaf8b5ba1cd8e46a9e5e89a3f28e82ff9aad846 100644 (file)
 #undef floor
 #include <cmath>
 #define floor cln_floor
-// Ugh, some compilers #define stderr, confusing cln::stderr
-#ifdef stderr
-  #undef stderr
-#endif
 
 
 namespace cln {
@@ -94,9 +90,9 @@ const cl_R read_real (const cl_read_flags& flags, const char * string, const cha
                                                goto not_rational_syntax;
                                        var cl_I base = read_integer(10,0,ptr,0,base_end_ptr-ptr);
                                        if (!((base >= 2) && (base <= 36))) {
-                                               fprint(stderr, "Base must be an integer in the range from 2 to 36, not ");
-                                               fprint(stderr, base);
-                                               fprint(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;
index e30ba67e3fad85d9300a7e9a5110a414bf736dcc..473e897ecb037162fa1b53c788945354e6ce7970 100644 (file)
@@ -32,9 +32,9 @@ const cl_R random_R (random_state& r, const cl_R& n)
                        }
                }
        }
-       fprint(stderr, "random: argument should be positive and an integer or float: ");
-       fprint(stderr, n);
-       fprint(stderr, "\n");
+       fprint(std::cerr, "random: argument should be positive and an integer or float: ");
+       fprint(std::cerr, n);
+       fprint(std::cerr, "\n");
        cl_abort();
 }
 
index a2e6f7054b3f55094070abea89aea23592bd0d69..b46fe891167096ebbbb01c8ae92feac7917a67b4 100644 (file)
@@ -53,9 +53,9 @@ static int test_##typename##_##opname (void)                          \
                rtype computed_result = arg1 op arg2;                   \
                rtype result = rtype(test.result);                      \
                if (computed_result != result) {                        \
-                       stderr << "Error in " #typename "_" #opname "_tests[" << i << "] !" << endl; \
-                       stderr << "Result should be: " << result << endl;       \
-                       stderr << "Result computed : " << computed_result << endl << endl;      \
+                       std::cerr << "Error in " #typename "_" #opname "_tests[" << i << "] !" << endl; \
+                       std::cerr << "Result should be: " << result << endl;    \
+                       std::cerr << "Result computed : " << computed_result << endl << endl;   \
                        error = 1;                                      \
                }                                                       \
        }                                                               \
@@ -74,9 +74,9 @@ static int test_##typename##_floor (void)                             \
                cl_I result1 = cl_I(test.result1);                      \
                type result2 = type(test.result2);                      \
                if ((computed_result.quotient != result1) || (computed_result.remainder != result2)) { \
-                       stderr << "Error in " #typename "_floor_tests[" << i << endl; \
-                       stderr << "Results should be: " << result1 << ", " << result2 << endl;  \
-                       stderr << "Results computed : " << computed_result.quotient << ", " << computed_result.remainder << endl << endl;       \
+                       std::cerr << "Error in " #typename "_floor_tests[" << i << endl; \
+                       std::cerr << "Results should be: " << result1 << ", " << result2 << endl;       \
+                       std::cerr << "Results computed : " << computed_result.quotient << ", " << computed_result.remainder << endl << endl;    \
                        error = 1;                                      \
                }                                                       \
        }                                                               \
index 2d536605eb86dd99121fcfb7fa499f58c1dc29d9..09589dd91daf4cdee3e58f81e08fb43d2319b542 100644 (file)
@@ -7,7 +7,7 @@ using namespace cln;
 
 #define ASSERT(expr)  \
   if (!(expr)) {                                        \
-       stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
        error = 1;                                      \
   }
 
@@ -31,9 +31,9 @@ static int test_##typename##_##opname (void)                          \
                rtype computed_result = opname(arg1,arg2);              \
                rtype result = rtype(test.result);                      \
                if (computed_result != result) {                        \
-                       stderr << "Error in " #typename "_" #opname "_tests[" << i << "] !" << endl;    \
-                       stderr << "Result should be: " << result << endl;       \
-                       stderr << "Result computed : " << computed_result << endl << endl;      \
+                       std::cerr << "Error in " #typename "_" #opname "_tests[" << i << "] !" << endl; \
+                       std::cerr << "Result should be: " << result << endl;    \
+                       std::cerr << "Result computed : " << computed_result << endl << endl;   \
                        error = 1;                                      \
                }                                                       \
        }                                                               \
index 23aaff97c6a52b21b175182dfeb250e987e5958e..e928abfb9722885003530f045a315dc0f35dad39 100644 (file)
@@ -13,7 +13,7 @@
 #include <cln/timing.h>
 
 #define DUMP(expr)  \
-       fprint(stdout, #expr" = "); fprint(stdout, expr); fprint(stdout, "\n");
+       fprint(cout, #expr" = "); fprint(cout, expr); fprint(cout, "\n");
 
 int main (int argc, char* argv[])
 {
@@ -21,8 +21,8 @@ int main (int argc, char* argv[])
 
 #if 0
        cl_F archimedes = pi((float_format_t)10000);
-       fprint(stdout, archimedes);
-       fprint(stdout, "\n");
+       fprint(cout, archimedes);
+       fprint(cout, "\n");
 #endif
 
 #if 0
@@ -30,11 +30,11 @@ int main (int argc, char* argv[])
        cl_FF x1 = "-0.2173f0";
        cl_FF x2 = "5.5084f9";
        cl_FF y = "-1.19698f9";
-       fprint(stdout, "x1 = "); print_float_binary(stdout,x1); fprint(stdout, " = "); fprint(stdout,x1); fprint(stdout, "\n");
-       fprint(stdout, "x2 = "); print_float_binary(stdout,x2); fprint(stdout, " = "); fprint(stdout,x2); fprint(stdout, "\n");
-       fprint(stdout, "y = "); print_float_binary(stdout,y); fprint(stdout, " = "); fprint(stdout,y); fprint(stdout, "\n");
+       fprint(cout, "x1 = "); print_float_binary(cout,x1); fprint(cout, " = "); fprint(cout,x1); fprint(cout, "\n");
+       fprint(cout, "x2 = "); print_float_binary(cout,x2); fprint(cout, " = "); fprint(cout,x2); fprint(cout, "\n");
+       fprint(cout, "y = "); print_float_binary(cout,y); fprint(cout, " = "); fprint(cout,y); fprint(cout, "\n");
        cl_FF x = x1*x2;
-       fprint(stdout, "x1*x2 = "); print_float_binary(stdout,x); fprint(stdout, " = "); fprint(stdout,x); fprint(stdout, "\n");
+       fprint(cout, "x1*x2 = "); print_float_binary(cout,x); fprint(cout, " = "); fprint(cout,x); fprint(cout, "\n");
 #endif
 
 #if 0
@@ -42,8 +42,8 @@ int main (int argc, char* argv[])
        cl_I y = ++x;
        x *= 2;
        x++;
-       fprint(stdout, "x = "); fprint(stdout, x); fprint(stdout, "\n");
-       fprint(stdout, "y = "); fprint(stdout, y); fprint(stdout, "\n");
+       fprint(cout, "x = "); fprint(cout, x); fprint(cout, "\n");
+       fprint(cout, "y = "); fprint(cout, y); fprint(cout, "\n");
 #endif
 
 #if 0
index 9e17d775fa3011569079bfd86c6c2c7d795116d3..3df9f9a5e70eef688ab26d755b9483cea9afb374 100644 (file)
@@ -4,40 +4,40 @@ using namespace cln;
 
 #define ASSERT(expr)  \
   if (!(expr)) {                                       \
-       stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;       \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
        error = 1;                                      \
   }
 
 #define ASSERT1(expr,a)  \
   if (!(expr)) {                                       \
-       stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;       \
-       stderr << #a" = " << a << endl;                 \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       std::cerr << #a" = " << a << endl;                      \
        error = 1;                                      \
   }
 
 #define ASSERT2(expr,a,b)  \
   if (!(expr)) {                                       \
-       stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;       \
-       stderr << #a" = " << a << endl;                 \
-       stderr << #b" = " << b << endl;                 \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       std::cerr << #a" = " << a << endl;                      \
+       std::cerr << #b" = " << b << endl;                      \
        error = 1;                                      \
   }
 
 #define ASSERT3(expr,a,b,c)  \
   if (!(expr)) {                                       \
-       stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;       \
-       stderr << #a" = " << a << endl;                 \
-       stderr << #b" = " << b << endl;                 \
-       stderr << #c" = " << c << endl;                 \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       std::cerr << #a" = " << a << endl;                      \
+       std::cerr << #b" = " << b << endl;                      \
+       std::cerr << #c" = " << c << endl;                      \
        error = 1;                                      \
   }
 
 #define ASSERT4(expr,a,b,c,d)  \
   if (!(expr)) {                                       \
-       stderr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;       \
-       stderr << #a" = " << a << endl;                 \
-       stderr << #b" = " << b << endl;                 \
-       stderr << #c" = " << c << endl;                 \
-       stderr << #d" = " << d << endl;                 \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       std::cerr << #a" = " << a << endl;                      \
+       std::cerr << #b" = " << b << endl;                      \
+       std::cerr << #c" = " << c << endl;                      \
+       std::cerr << #d" = " << d << endl;                      \
        error = 1;                                      \
   }
index 5473f06105058800eb4e5ef12557b539682d49a9..7a147e1cca236ec94570ebb08725da1a030c49bd 100644 (file)
@@ -20,17 +20,17 @@ int main (int argc, char * argv[])
        {
                cl_MI a = R->canonhom("1111111111111111111111111111111111111111111111111");
                cl_MI b = R->canonhom("777777777777777777777777777777777777777777777777");
-               stdout << "product modulo p" << endl;
+               cout << "product modulo p" << endl;
                { CL_TIMING;
                  for (int rep = repetitions; rep > 0; rep--)
                    { cl_MI c = R->mul(a,b); }
                }
-               stdout << "square modulo p" << endl;
+               cout << "square modulo p" << endl;
                { CL_TIMING;
                  for (int rep = repetitions; rep > 0; rep--)
                    { cl_MI c = R->square(a); }
                }
-               stdout << "quotient modulo p" << endl;
+               cout << "quotient modulo p" << endl;
                { CL_TIMING;
                  for (int rep = repetitions; rep > 0; rep--)
                    { cl_MI c = R->div(a,b); }
@@ -39,17 +39,17 @@ int main (int argc, char * argv[])
        {
                cl_MI a = R->canonhom("1234567890123456789012345678901234567890123456789");
                cl_MI b = R->canonhom("909090909090909090909090909090909090909090909090");
-               stdout << "product modulo p" << endl;
+               cout << "product modulo p" << endl;
                { CL_TIMING;
                  for (int rep = repetitions; rep > 0; rep--)
                    { cl_MI c = R->mul(a,b); }
                }
-               stdout << "square modulo p" << endl;
+               cout << "square modulo p" << endl;
                { CL_TIMING;
                  for (int rep = repetitions; rep > 0; rep--)
                    { cl_MI c = R->square(a); }
                }
-               stdout << "quotient modulo p" << endl;
+               cout << "quotient modulo p" << endl;
                { CL_TIMING;
                  for (int rep = repetitions; rep > 0; rep--)
                    { cl_MI c = R->div(a,b); }
index 98b5f6ac2146d52288870f2781cd3ca53434e2bd..2e3636aee29669c67620f72925b6b78452b4c818 100644 (file)
@@ -28,7 +28,7 @@ int main (int argc, char * argv[])
                p1.set_coeff(i, R1->canonhom((int)(1.618033989*i*i)));
        p1.finalize();
 
-       stdout << p1 << endl;
+       cout << p1 << endl;
 
        cl_UP sp1 = PR1->zero();
        { CL_TIMING;
@@ -36,7 +36,7 @@ int main (int argc, char * argv[])
            { sp1 = square(p1); }
        }
 
-       stdout << sp1 << endl;
+       cout << sp1 << endl;
 }
 
 // Time:
index bb88b9a3d5f177fe5ef6d38611806d52903f2498..ff5850aeb3d754dbff296c8984291745b7ee0c9f 100644 (file)
@@ -52,9 +52,9 @@ int main (int argc, char * argv[])
        int n = atoi(argv[1]);
        float_format_t prec = float_format(n);
        cl_F p;
-       stderr << "Computing pi" << endl;
+       cerr << "Computing pi" << endl;
        { CL_TIMING; p = pi(prec); }
-       stderr << "Converting pi to decimal" << endl;
+       cerr << "Converting pi to decimal" << endl;
        { CL_TIMING; cout << p << endl << endl; }
 #endif
 }
index 017559694dd44867b4e21d7dbc72908975a40bee..63d361935d4dfbdfc683b7a650d47c45c1c5878e 100644 (file)
@@ -21,12 +21,12 @@ int main (int argc, char * argv[])
        cl_I M2 = (cl_I)1 << (intDsize*m2);
        cl_I a = random_I(M1);
        cl_I b = random_I(M2);
-       fprint(stderr, "Squaring:       ");
+       fprint(std::cerr, "Squaring:       ");
        { CL_TIMING;
          for (int rep = repetitions; rep > 0; rep--)
            { cl_I p = a * a; }
        }
-       fprint(stderr, "Multiplication: ");
+       fprint(std::cerr, "Multiplication: ");
        { CL_TIMING;
          for (int rep = repetitions; rep > 0; rep--)
            { cl_I p = a * b; }