+2000-12-14 Richard Kreckel <kreckel@ginac.de>
+
+ * Version 1.1 released.
+
+2000-12-13 Richard Kreckel <kreckel@ginac.de>
+
+ * */*: cl_istream -> std::istream, cl_ostream -> std::ostream.
+
2000-12-05 Richard Kreckel <kreckel@ginac.de>
* Makefile.in, src/Makefile.in, doc/Makefile.in: Use mkdir -p.
- Linux/x86, gcc-2.8.0, egcs-1.1, gcc-2.95.x
- Solaris 2.4 (sparc), egcs-1.1, gcc-2.95
- OSF/1 V4.0 (alpha), egcs-1.1, gcc-2.95
- - Irix 5.3, CC 4
+ - Irix 6.5, gcc-2.95
The "make" step takes about 1 hour, on a P-II / 400 MHz / 64 MB.
egcs-1.1.1 or older on Sparc, you must specify --disable-shared because g++
would miscompile parts of the library.
-On MIPS (SGI Irix 6), pass option "--without-gmp" to configure. gmp does
-not work when compiled in "n32" binary format on Irix.
-
More detailed installation instructions can be found in the documentation,
in the doc/ directory.
-2000-11-xx, version 1.1.0
+2000-12-14, version 1.1.0
=========================
Functional changes
better match present-day CPUs.
* Fix several errors for architectures with 64-bit wide words.
- (Others than Alpha.)
+ (Others than Alpha, which worked already.)
* Fix compilation errors with current GCC-3.0 snapshots.
dnl
dnl check for build configuration
dnl
-LIBS=-lm
dnl libcln depends on libm
PACKAGE=cln
dnl libtool wants PACKAGE
@end iftex
@c %**end of header
+@direntry
+* CLN: (cln). Class Library for Numbers (C++).
+@end direntry
@c My own index.
@defindex my
@section Input functions
-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&}.
-
-These are the simple input functions:
+Including @code{<cln/io.h>} defines a number of simple input functions
+that read from @code{std::istream&}:
@table @code
-@item int freadchar (cl_istream stream)
+@item int freadchar (std::istream& stream)
Reads a character from @code{stream}. Returns @code{cl_EOF} (not a @samp{char}!)
if the end of stream was encountered or an error occurred.
-@item int funreadchar (cl_istream stream, int c)
+@item int funreadchar (std::istream& stream, int c)
Puts back @code{c} onto @code{stream}. @code{c} must be the result of the
last @code{freadchar} operation on @code{stream}.
@end table
defines, in @code{<cln/@var{type}_io.h>}, the following input function:
@table @code
-@item cl_istream operator>> (cl_istream stream, @var{type}& result)
+@item std::istream& operator>> (std::istream& stream, @var{type}& result)
Reads a number from @code{stream} and stores it in the @code{result}.
@end table
are the following:
@table @code
-@item cl_N read_complex (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_R read_real (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_F read_float (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_RA read_rational (cl_istream stream, const cl_read_flags& flags)
-@itemx cl_I read_integer (cl_istream stream, const cl_read_flags& flags)
+@item cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_R read_real (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_F read_float (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
+@itemx cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
Reads a number from @code{stream}. The @code{flags} are parameters which
affect the input syntax. Whitespace before the number is silently skipped.
@section Output functions
-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&}.
-
-These are the simple output functions:
+Including @code{<cln/io.h>} defines a number of simple output functions
+that write to @code{std::ostream&}:
@table @code
-@item void fprintchar (cl_ostream stream, char c)
+@item void fprintchar (std::ostream& stream, char c)
Prints the character @code{x} literally on the @code{stream}.
-@item void fprint (cl_ostream stream, const char * string)
+@item void fprint (std::ostream& stream, const char * string)
Prints the @code{string} literally on the @code{stream}.
-@item void fprintdecimal (cl_ostream stream, int x)
-@itemx void fprintdecimal (cl_ostream stream, const cl_I& x)
+@item void fprintdecimal (std::ostream& stream, int x)
+@itemx void fprintdecimal (std::ostream& stream, const cl_I& x)
Prints the integer @code{x} in decimal on the @code{stream}.
-@item void fprintbinary (cl_ostream stream, const cl_I& x)
+@item void fprintbinary (std::ostream& stream, const cl_I& x)
Prints the integer @code{x} in binary (base 2, without prefix)
on the @code{stream}.
-@item void fprintoctal (cl_ostream stream, const cl_I& x)
+@item void fprintoctal (std::ostream& stream, const cl_I& x)
Prints the integer @code{x} in octal (base 8, without prefix)
on the @code{stream}.
-@item void fprinthexadecimal (cl_ostream stream, const cl_I& x)
+@item void fprinthexadecimal (std::ostream& stream, const cl_I& x)
Prints the integer @code{x} in hexadecimal (base 16, without prefix)
on the @code{stream}.
@end table
defines, in @code{<cln/@var{type}_io.h>}, the following output functions:
@table @code
-@item void fprint (cl_ostream stream, const @var{type}& x)
-@itemx cl_ostream operator<< (cl_ostream stream, const @var{type}& x)
+@item void fprint (std::ostream& stream, const @var{type}& x)
+@itemx std::ostream& operator<< (std::ostream& stream, const @var{type}& x)
Prints the number @code{x} on the @code{stream}. The output may depend
on the global printer settings in the variable @code{default_print_flags}.
The @code{ostream} flags and settings (flags, width and locale) are
The most flexible output function, defined in @code{<cln/@var{type}_io.h>},
are the following:
@example
-void print_complex (cl_ostream stream, const cl_print_flags& flags,
+void print_complex (std::ostream& stream, const cl_print_flags& flags,
const cl_N& z);
-void print_real (cl_ostream stream, const cl_print_flags& flags,
+void print_real (std::ostream& stream, const cl_print_flags& flags,
const cl_R& z);
-void print_float (cl_ostream stream, const cl_print_flags& flags,
+void print_float (std::ostream& stream, const cl_print_flags& flags,
const cl_F& z);
-void print_rational (cl_ostream stream, const cl_print_flags& flags,
+void print_rational (std::ostream& stream, const cl_print_flags& flags,
const cl_RA& z);
-void print_integer (cl_ostream stream, const cl_print_flags& flags,
+void print_integer (std::ostream& stream, const cl_print_flags& flags,
const cl_I& z);
@end example
Prints the number @code{x} on the @code{stream}. The @code{flags} are
Given a ring @code{R}, the following members can be used.
@table @code
-@item void R->fprint (cl_ostream stream, const cl_ring_element& x)
+@item void R->fprint (std::ostream& stream, const cl_ring_element& x)
@cindex @code{fprint ()}
@itemx cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y)
@cindex @code{equal ()}
input/output).
@table @code
-@item void fprint (cl_ostream stream, const cl_MI& x)
+@item void fprint (std::ostream& stream, const cl_MI& x)
@cindex @code{fprint ()}
-@itemx cl_ostream operator<< (cl_ostream stream, const cl_MI& x)
+@itemx std::ostream& operator<< (std::ostream& stream, const cl_MI& x)
@cindex @code{operator << ()}
Prints the modular integer @code{x} on the @code{stream}. The output may depend
on the global printer settings in the variable @code{default_print_flags}.
input/output).
@table @code
-@item void fprint (cl_ostream stream, const cl_UP& x)
+@item void fprint (std::ostream& stream, const cl_UP& x)
@cindex @code{fprint ()}
-@itemx cl_ostream operator<< (cl_ostream stream, const cl_UP& x)
+@itemx std::ostream& operator<< (std::ostream& stream, const cl_UP& x)
@cindex @code{operator << ()}
Prints the univariate polynomial @code{x} on the @code{stream}. The output may
depend on the global printer settings in the variable
}
// Output.
-inline void fprint (cl_ostream stream, const cl_GV_N& x)
+inline void fprint (std::ostream& stream, const cl_GV_N& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
- extern void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
+ extern void print_complex (std::ostream& stream, const cl_print_flags& flags, const cl_N& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_N&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_N&))
&print_complex,
x);
}
extern const cl_GV_I copy (const cl_GV_I&);
// Output.
-inline void fprint (cl_ostream stream, const cl_GV_I& x)
+inline void fprint (std::ostream& stream, const cl_GV_I& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
- extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
+ extern void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_I&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_I&))
&print_integer,
x);
}
}
// Output.
-inline void fprint (cl_ostream stream, const cl_GV_RA& x)
+inline void fprint (std::ostream& stream, const cl_GV_RA& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
- extern void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
+ extern void print_rational (std::ostream& stream, const cl_print_flags& flags, const cl_RA& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_RA&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_RA&))
&print_rational,
x);
}
}
// Output.
-inline void fprint (cl_ostream stream, const cl_GV_R& x)
+inline void fprint (std::ostream& stream, const cl_GV_R& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
- extern void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
+ extern void print_real (std::ostream& stream, const cl_print_flags& flags, const cl_R& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_R&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_R&))
&print_real,
x);
}
}
// Output.
-inline void fprint (cl_ostream stream, const cl_SV_N& x)
+inline void fprint (std::ostream& stream, const cl_SV_N& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
- extern void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
+ extern void print_complex (std::ostream& stream, const cl_print_flags& flags, const cl_N& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_N&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_N&))
&print_complex,
x);
}
}
// Output.
-inline void fprint (cl_ostream stream, const cl_SV_I& x)
+inline void fprint (std::ostream& stream, const cl_SV_I& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
- extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
+ extern void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_I&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_I&))
&print_integer,
x);
}
}
// Output.
-inline void fprint (cl_ostream stream, const cl_SV_RA& x)
+inline void fprint (std::ostream& stream, const cl_SV_RA& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
- extern void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
+ extern void print_rational (std::ostream& stream, const cl_print_flags& flags, const cl_RA& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_RA&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_RA&))
&print_rational,
x);
}
}
// Output.
-inline void fprint (cl_ostream stream, const cl_SV_R& x)
+inline void fprint (std::ostream& stream, const cl_SV_R& x)
{
extern cl_print_flags default_print_flags;
- extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
- extern void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z);
+ extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
+ extern void print_real (std::ostream& stream, const cl_print_flags& flags, const cl_R& z);
print_vector(stream, default_print_flags,
- (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
- (void (*) (cl_ostream, const cl_print_flags&, const cl_R&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
+ (void (*) (std::ostream&, const cl_print_flags&, const cl_R&))
&print_real,
x);
}
{ return The(cl_SV_ringelt) (copy((const cl_SV_any&) vector)); }
// Output.
-extern void fprint (cl_ostream stream, const cl_ring& R, const cl_SV_ringelt& x);
+extern void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& x);
// Debugging support.
#ifdef CL_DEBUG
// Undocumented input functions
extern const cl_N read_complex (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse);
-extern const cl_N read_complex (cl_istream stream, const cl_read_flags& flags);
+extern const cl_N read_complex (std::istream& stream, const cl_read_flags& flags);
// Documented input functions
-inline cl_istream operator>> (cl_istream stream, cl_N& result)
+inline std::istream& operator>> (std::istream& stream, cl_N& result)
{
extern cl_read_flags cl_N_read_flags;
result = read_complex(stream,cl_N_read_flags);
// print_complex(stream,z);
// > z: komplexe Zahl
// > stream: Stream
-extern void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z);
-extern void print_complex (cl_ostream stream, const cl_print_number_flags& flags, const cl_N& z);
+extern void print_complex (std::ostream& stream, const cl_print_flags& flags, const cl_N& z);
+extern void print_complex (std::ostream& stream, const cl_print_number_flags& flags, const cl_N& z);
-inline void fprint (cl_ostream stream, const cl_N& x)
+inline void fprint (std::ostream& stream, const cl_N& x)
{
extern cl_print_flags default_print_flags;
print_complex(stream,default_print_flags,x);
// Name.
virtual const char * name () const = 0;
// Print.
- virtual void print (cl_ostream) const = 0;
+ virtual void print (std::ostream&) const = 0;
// Virtual destructor.
virtual ~cl_condition () = 0;
private:
namespace cln {
-inline cl_istream operator>> (cl_istream stream, cl_DF& result)
+inline std::istream& operator>> (std::istream& stream, cl_DF& result)
{
extern cl_read_flags cl_DF_read_flags;
- extern const cl_F read_float (cl_istream, const cl_read_flags&);
+ extern const cl_F read_float (std::istream&, const cl_read_flags&);
result = As(cl_DF)(read_float(stream,cl_DF_read_flags));
return stream;
}
// The following does strictly the same as the general `fprint' for floats.
// It is here only so that people don't need to include <cln/float_io.h>.
-inline void fprint (cl_ostream stream, const cl_DF& x)
+inline void fprint (std::ostream& stream, const cl_DF& x)
{
- extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z);
+ extern void print_float (std::ostream& stream, const cl_print_flags& flags, const cl_F& z);
extern cl_print_flags default_print_flags;
print_float(stream,default_print_flags,x);
}
namespace cln {
-inline cl_istream operator>> (cl_istream stream, cl_FF& result)
+inline std::istream& operator>> (std::istream& stream, cl_FF& result)
{
extern cl_read_flags cl_FF_read_flags;
- extern const cl_F read_float (cl_istream, const cl_read_flags&);
+ extern const cl_F read_float (std::istream&, const cl_read_flags&);
result = As(cl_FF)(read_float(stream,cl_FF_read_flags));
return stream;
}
// The following does strictly the same as the general `fprint' for floats.
// It is here only so that people don't need to include <cln/float_io.h>.
-inline void fprint (cl_ostream stream, const cl_FF& x)
+inline void fprint (std::ostream& stream, const cl_FF& x)
{
- extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z);
+ extern void print_float (std::ostream& stream, const cl_print_flags& flags, const cl_F& z);
extern cl_print_flags default_print_flags;
print_float(stream,default_print_flags,x);
}
// It is here only so that you don't need the complex and rational number
// readers in order to read a float number. ("Treeshaking")
extern const cl_F read_float (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse);
-extern const cl_F read_float (cl_istream stream, const cl_read_flags& flags);
+extern const cl_F read_float (std::istream& stream, const cl_read_flags& flags);
// Documented input functions
-inline cl_istream operator>> (cl_istream stream, cl_F& result)
+inline std::istream& operator>> (std::istream& stream, cl_F& result)
{
extern cl_read_flags cl_F_read_flags;
result = read_float(stream,cl_F_read_flags);
// print_float(stream,z);
// > z: Float
// > stream: Stream
-extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z);
-extern void print_float (cl_ostream stream, const cl_print_number_flags& flags, const cl_F& z);
-extern void print_float (cl_ostream stream, const cl_print_real_flags& flags, const cl_F& z);
-extern void print_float (cl_ostream stream, const cl_print_float_flags& flags, const cl_F& z);
+extern void print_float (std::ostream& stream, const cl_print_flags& flags, const cl_F& z);
+extern void print_float (std::ostream& stream, const cl_print_number_flags& flags, const cl_F& z);
+extern void print_float (std::ostream& stream, const cl_print_real_flags& flags, const cl_F& z);
+extern void print_float (std::ostream& stream, const cl_print_float_flags& flags, const cl_F& z);
// Gibt ein Float binär (sehr primitiv) aus.
// print_float_binary(stream,z);
// > z: Float
// > stream: Stream
-extern void print_float_binary (cl_ostream stream, const cl_F& z);
+extern void print_float_binary (std::ostream& stream, const cl_F& z);
// The following does strictly the same as the general `fprint' for numbers.
// It is here only so that you don't need the complex printer
// in order to print a float. ("Treeshaking")
-inline void fprint (cl_ostream stream, const cl_F& x)
+inline void fprint (std::ostream& stream, const cl_F& x)
{
extern cl_print_flags default_print_flags;
print_float(stream,default_print_flags,x);
// It is here only so that you don't need the rational, complex and float number
// readers in order to read an integer. ("Treeshaking")
extern const cl_I read_integer (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse);
-extern const cl_I read_integer (cl_istream stream, const cl_read_flags& flags);
+extern const cl_I read_integer (std::istream& stream, const cl_read_flags& flags);
// Documented input functions
-inline cl_istream operator>> (cl_istream stream, cl_I& result)
+inline std::istream& operator>> (std::istream& stream, cl_I& result)
{
extern cl_read_flags cl_I_read_flags;
result = read_integer(stream,cl_I_read_flags);
// > z: Integer
// > base: Basis (>=2, <=36)
// > stream: Stream
-extern void print_integer (cl_ostream stream, unsigned int base, const cl_I& z);
+extern void print_integer (std::ostream& stream, unsigned int base, const cl_I& z);
// Dasselbe als String. Mit malloc_hook() alloziert, mit free_hook() freizugeben.
extern char * print_integer_to_string (unsigned int base, const cl_I& z);
// Documented output functions
-inline void fprintdecimal (cl_ostream stream, const cl_I& x)
+inline void fprintdecimal (std::ostream& stream, const cl_I& x)
{
print_integer(stream,10,x);
}
-inline void fprintbinary (cl_ostream stream, const cl_I& x)
+inline void fprintbinary (std::ostream& stream, const cl_I& x)
{
print_integer(stream,2,x);
}
-inline void fprintoctal (cl_ostream stream, const cl_I& x)
+inline void fprintoctal (std::ostream& stream, const cl_I& x)
{
print_integer(stream,8,x);
}
-inline void fprinthexadecimal (cl_ostream stream, const cl_I& x)
+inline void fprinthexadecimal (std::ostream& stream, const cl_I& x)
{
print_integer(stream,16,x);
}
// > z: Zahl
// > stream: Stream
// > flags: Ausgabe-Parameter
-extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z);
-extern void print_integer (cl_ostream stream, const cl_print_number_flags& flags, const cl_I& z);
-extern void print_integer (cl_ostream stream, const cl_print_real_flags& flags, const cl_I& z);
-extern void print_integer (cl_ostream stream, const cl_print_rational_flags& flags, const cl_I& z);
+extern void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z);
+extern void print_integer (std::ostream& stream, const cl_print_number_flags& flags, const cl_I& z);
+extern void print_integer (std::ostream& stream, const cl_print_real_flags& flags, const cl_I& z);
+extern void print_integer (std::ostream& stream, const cl_print_rational_flags& flags, const cl_I& z);
// The following does strictly the same as the general `fprint' for numbers.
// It is here only so that you don't need the rational number printer
// in order to print an integer. ("Treeshaking")
-inline void fprint (cl_ostream stream, const cl_I& x)
+inline void fprint (std::ostream& stream, const cl_I& x)
{
extern cl_print_flags default_print_flags;
print_integer(stream,default_print_flags,x);
namespace cln {
+// compatibility:
typedef std::istream& cl_istream;
typedef std::ostream& cl_ostream;
extern std::ostream* cl_debugout_stream;
#define cl_debugout (*cl_debugout_stream)
-// Elementary operations on cl_istream
+// Elementary operations on std::istream&
#define cl_EOF (-1)
-inline int freadchar (cl_istream stream)
+inline int freadchar (std::istream& stream)
{
char c;
if (stream.get(c))
return cl_EOF;
}
-inline int funreadchar (cl_istream stream, int c)
+inline int funreadchar (std::istream& stream, int c)
{
if (c != cl_EOF)
stream.putback((char)c);
return c;
}
-// Elementary operations on cl_ostream
+// Elementary operations on std::ostream&
-inline void fprintchar (cl_ostream stream, char c)
+inline void fprintchar (std::ostream& stream, char c)
{
stream.put(c);
}
-inline void fprint (cl_ostream stream, const char * string)
+inline void fprint (std::ostream& stream, const char * string)
{
stream << string;
}
-extern void fprintdecimal (cl_ostream stream, unsigned long x);
-extern void fprintdecimal (cl_ostream stream, long x);
+extern void fprintdecimal (std::ostream& stream, unsigned long x);
+extern void fprintdecimal (std::ostream& stream, long x);
-inline void fprintdecimal (cl_ostream stream, unsigned int x)
+inline void fprintdecimal (std::ostream& stream, unsigned int x)
{
fprintdecimal(stream,(unsigned long)x);
}
-inline void fprintdecimal (cl_ostream stream, int x)
+inline void fprintdecimal (std::ostream& stream, int x)
{
fprintdecimal(stream,(long)x);
}
-extern void fprinthexadecimal (cl_ostream stream, unsigned long x);
-extern void fprinthexadecimal (cl_ostream stream, long x);
+extern void fprinthexadecimal (std::ostream& stream, unsigned long x);
+extern void fprinthexadecimal (std::ostream& stream, long x);
-inline void fprinthexadecimal (cl_ostream stream, unsigned int x)
+inline void fprinthexadecimal (std::ostream& stream, unsigned int x)
{
fprinthexadecimal(stream,(unsigned long)x);
}
-inline void fprinthexadecimal (cl_ostream stream, int x)
+inline void fprinthexadecimal (std::ostream& stream, int x)
{
fprinthexadecimal(stream,(long)x);
}
// Define the customary << and >> operators.
#define CL_DEFINE_PRINT_OPERATOR(_class_) \
-inline cl_ostream operator<< (cl_ostream stream, const _class_& x) \
+inline std::ostream& operator<< (std::ostream& stream, const _class_& x) \
{ \
fprint(stream,x); \
return stream; \
namespace cln {
-inline cl_istream operator>> (cl_istream stream, cl_LF& result)
+inline std::istream& operator>> (std::istream& stream, cl_LF& result)
{
extern cl_read_flags cl_LF_read_flags;
- extern const cl_F read_float (cl_istream, const cl_read_flags&);
+ extern const cl_F read_float (std::istream&, const cl_read_flags&);
result = As(cl_LF)(read_float(stream,cl_LF_read_flags));
return stream;
}
// The following does strictly the same as the general `fprint' for floats.
// It is here only so that people don't need to include <cln/float_io.h>.
-inline void fprint (cl_ostream stream, const cl_LF& x)
+inline void fprint (std::ostream& stream, const cl_LF& x)
{
- extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z);
+ extern void print_float (std::ostream& stream, const cl_print_flags& flags, const cl_F& z);
extern cl_print_flags default_print_flags;
print_float(stream,default_print_flags,x);
}
{ print(std::cerr); }
// Implement general condition methods.
const char * name () const;
- void print (cl_ostream) const;
+ void print (std::ostream&) const;
~cl_composite_condition () {}
};
struct _cl_modint_setops /* cf. _cl_ring_setops */ {
// print
- void (* fprint) (cl_heap_modint_ring* R, cl_ostream stream, const _cl_MI& x);
+ void (* fprint) (cl_heap_modint_ring* R, std::ostream& stream, const _cl_MI& x);
// equality
cl_boolean (* equal) (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y);
// random number
cl_I modulus; // m, normalized to be >= 0
public:
// Low-level operations.
- void _fprint (cl_ostream stream, const _cl_MI& x)
+ void _fprint (std::ostream& stream, const _cl_MI& x)
{ setops->fprint(this,stream,x); }
cl_boolean _equal (const _cl_MI& x, const _cl_MI& y)
{ return setops->equal(this,x,y); }
const cl_I _retract (const _cl_MI& x)
{ return mulops->retract(this,x); }
// High-level operations.
- void fprint (cl_ostream stream, const cl_MI& x)
+ void fprint (std::ostream& stream, const cl_MI& x)
{
if (!(x.ring() == this)) cl_abort();
_fprint(stream,x);
// Operations on modular integers.
// Output.
-inline void fprint (cl_ostream stream, const cl_MI& x)
+inline void fprint (std::ostream& stream, const cl_MI& x)
{ x.ring()->fprint(stream,x); }
CL_DEFINE_PRINT_OPERATOR(cl_MI)
// It is here only so that you don't need the complex and float number
// readers in order to read an rational number. ("Treeshaking")
extern const cl_RA read_rational (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse);
-extern const cl_RA read_rational (cl_istream stream, const cl_read_flags& flags);
+extern const cl_RA read_rational (std::istream& stream, const cl_read_flags& flags);
// Documented input functions
-inline cl_istream operator>> (cl_istream stream, cl_RA& result)
+inline std::istream& operator>> (std::istream& stream, cl_RA& result)
{
extern cl_read_flags cl_RA_read_flags;
result = read_rational(stream,cl_RA_read_flags);
// > z: rationale Zahl
// > base: Basis (>=2, <=36)
// > stream: Stream
-extern void print_rational (cl_ostream stream, unsigned int base, const cl_RA& z);
+extern void print_rational (std::ostream& stream, unsigned int base, const cl_RA& z);
// Documented output functions
// > z: Zahl
// > stream: Stream
// > flags: Ausgabe-Parameter
-extern void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z);
-extern void print_rational (cl_ostream stream, const cl_print_number_flags& flags, const cl_RA& z);
-extern void print_rational (cl_ostream stream, const cl_print_real_flags& flags, const cl_RA& z);
-extern void print_rational (cl_ostream stream, const cl_print_rational_flags& flags, const cl_RA& z);
+extern void print_rational (std::ostream& stream, const cl_print_flags& flags, const cl_RA& z);
+extern void print_rational (std::ostream& stream, const cl_print_number_flags& flags, const cl_RA& z);
+extern void print_rational (std::ostream& stream, const cl_print_real_flags& flags, const cl_RA& z);
+extern void print_rational (std::ostream& stream, const cl_print_rational_flags& flags, const cl_RA& z);
// The following does strictly the same as the general `fprint' for numbers.
// It is here only so that you don't need the complex and long-float number
// printers in order to print an integer. ("Treeshaking")
-inline void fprint (cl_ostream stream, const cl_RA& x)
+inline void fprint (std::ostream& stream, const cl_RA& x)
{
extern cl_print_flags default_print_flags;
print_rational(stream,default_print_flags,x);
// It is here only so that you don't need the complex number reader
// in order to read an rational number. ("Treeshaking")
extern const cl_R read_real (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse);
-extern const cl_R read_real (cl_istream stream, const cl_read_flags& flags);
+extern const cl_R read_real (std::istream& stream, const cl_read_flags& flags);
// Documented input functions
-inline cl_istream operator>> (cl_istream stream, cl_R& result)
+inline std::istream& operator>> (std::istream& stream, cl_R& result)
{
extern cl_read_flags cl_R_read_flags;
result = read_real(stream,cl_R_read_flags);
// > z: Zahl
// > stream: Stream
// > flags: Ausgabe-Parameter
-extern void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z);
-extern void print_real (cl_ostream stream, const cl_print_number_flags& flags, const cl_R& z);
-extern void print_real (cl_ostream stream, const cl_print_real_flags& flags, const cl_R& z);
+extern void print_real (std::ostream& stream, const cl_print_flags& flags, const cl_R& z);
+extern void print_real (std::ostream& stream, const cl_print_number_flags& flags, const cl_R& z);
+extern void print_real (std::ostream& stream, const cl_print_real_flags& flags, const cl_R& z);
// The following does strictly the same as the general `fprint' for numbers.
// It is here only so that you don't need the complex number printer
// in order to print an integer. ("Treeshaking")
-inline void fprint (cl_ostream stream, const cl_R& x)
+inline void fprint (std::ostream& stream, const cl_R& x)
{
extern cl_print_flags default_print_flags;
print_real(stream,default_print_flags,x);
struct _cl_ring_setops {
// print
- void (* fprint) (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x);
+ void (* fprint) (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x);
// equality
cl_boolean (* equal) (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y);
// ...
// ...
public:
// Low-level operations.
- void _fprint (cl_ostream stream, const _cl_ring_element& x)
+ void _fprint (std::ostream& stream, const _cl_ring_element& x)
{ setops->fprint(this,stream,x); }
cl_boolean _equal (const _cl_ring_element& x, const _cl_ring_element& y)
{ return setops->equal(this,x,y); }
const _cl_ring_element _expt_pos (const _cl_ring_element& x, const cl_I& y)
{ return mulops->expt_pos(this,x,y); }
// High-level operations.
- void fprint (cl_ostream stream, const cl_ring_element& x)
+ void fprint (std::ostream& stream, const cl_ring_element& x)
{
if (!(x.ring() == this)) cl_abort();
_fprint(stream,x);
// Operations on ring elements.
// Output.
-inline void fprint (cl_ostream stream, const cl_ring_element& x)
+inline void fprint (std::ostream& stream, const cl_ring_element& x)
{ x.ring()->fprint(stream,x); }
CL_DEFINE_PRINT_OPERATOR(cl_ring_element)
namespace cln {
-inline cl_istream operator>> (cl_istream stream, cl_SF& result)
+inline std::istream& operator>> (std::istream& stream, cl_SF& result)
{
extern cl_read_flags cl_SF_read_flags;
- extern const cl_F read_float (cl_istream, const cl_read_flags&);
+ extern const cl_F read_float (std::istream&, const cl_read_flags&);
result = As(cl_SF)(read_float(stream,cl_SF_read_flags));
return stream;
}
// The following does strictly the same as the general `fprint' for floats.
// It is here only so that people don't need to include <cln/float_io.h>.
-inline void fprint (cl_ostream stream, const cl_SF& x)
+inline void fprint (std::ostream& stream, const cl_SF& x)
{
- extern void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z);
+ extern void print_float (std::ostream& stream, const cl_print_flags& flags, const cl_F& z);
extern cl_print_flags default_print_flags;
print_float(stream,default_print_flags,x);
}
extern unsigned long hashcode (const cl_string& str);
// Output.
-extern void fprint (cl_ostream stream, const cl_string& str);
+extern void fprint (std::ostream& stream, const cl_string& str);
CL_DEFINE_PRINT_OPERATOR(cl_string)
// Input.
// Reads a line. Up to delim. The delimiter character is not placed in the
// resulting string. The delimiter character is kept in the input stream.
// If EOF is encountered, the stream's eofbit is set.
-extern const cl_string cl_fget (cl_istream stream, char delim = '\n');
+extern const cl_string cl_fget (std::istream& stream, char delim = '\n');
// Reads a line. Up to delim. The delimiter character is not placed in the
// resulting string. The delimiter character is extracted from the input stream.
// If EOF is encountered, the stream's eofbit is set.
-extern const cl_string cl_fgetline (cl_istream stream, char delim = '\n');
+extern const cl_string cl_fgetline (std::istream& stream, char delim = '\n');
// Like above, but only up to n-1 characters. If n-1 characters were read
// before the delimiter character was seen, the stream's failbit is set.
-extern const cl_string cl_fget (cl_istream stream, int n, char delim = '\n');
-extern const cl_string cl_fgetline (cl_istream stream, int n, char delim = '\n');
+extern const cl_string cl_fget (std::istream& stream, int n, char delim = '\n');
+extern const cl_string cl_fgetline (std::istream& stream, int n, char delim = '\n');
// Skips whitespace and then reads a non-whitespace string.
// If stream.width() is greater than 0, at most stream.width()-1 non-whitespace
// characters are read. When done, stream.width(0) is called.
// If EOF is encountered, the stream's eofbit is set.
-extern cl_istream operator>> (cl_istream stream, cl_string& str);
+extern std::istream& operator>> (std::istream& stream, cl_string& str);
// Runtime typing support.
extern cl_class cl_class_string;
// Report a time consumption.
// (Should better be a virtual member function of `cl_time_consumption').
-extern void cl_timing_report (cl_ostream, const cl_time_consumption&);
+extern void cl_timing_report (std::ostream&, const cl_time_consumption&);
struct cl_timing {
// Constructor, starts the time interval.
cl_timing (cl_time_consumption& accumulator);
- cl_timing (cl_ostream destination = std::cerr);
- cl_timing (const char *, cl_ostream destination = std::cerr);
+ cl_timing (std::ostream& destination = std::cerr);
+ cl_timing (const char *, std::ostream& destination = std::cerr);
// Destructor, closes the time interval and does a report.
~cl_timing ();
//private:
struct _cl_univpoly_setops /* cf. _cl_ring_setops */ {
// print
- void (* fprint) (cl_heap_univpoly_ring* R, cl_ostream stream, const _cl_UP& x);
+ void (* fprint) (cl_heap_univpoly_ring* R, std::ostream& stream, const _cl_UP& x);
// equality
// (Be careful: This is not well-defined for polynomials with
// floating-point coefficients.)
const cl_ring& basering () const { return _basering; }
public:
// Low-level operations.
- void _fprint (cl_ostream stream, const _cl_UP& x)
+ void _fprint (std::ostream& stream, const _cl_UP& x)
{ setops->fprint(this,stream,x); }
cl_boolean _equal (const _cl_UP& x, const _cl_UP& y)
{ return setops->equal(this,x,y); }
const cl_ring_element _eval (const _cl_UP& x, const cl_ring_element& y)
{ return polyops->eval(this,x,y); }
// High-level operations.
- void fprint (cl_ostream stream, const cl_UP& x)
+ void fprint (std::ostream& stream, const cl_UP& x)
{
if (!(x.ring() == this)) cl_abort();
_fprint(stream,x);
// Operations on polynomials.
// Output.
-inline void fprint (cl_ostream stream, const cl_UP& x)
+inline void fprint (std::ostream& stream, const cl_UP& x)
{ x.ring()->fprint(stream,x); }
CL_DEFINE_PRINT_OPERATOR(cl_UP)
class cl_heap_univpoly_specialized_ring : public cl_heap_univpoly_ring {
SUBCLASS_cl_heap_univpoly_ring()
// High-level operations.
- void fprint (cl_ostream stream, const cl_UP_specialized<T>& x)
+ void fprint (std::ostream& stream, const cl_UP_specialized<T>& x)
{
cl_heap_univpoly_ring::fprint(stream,x);
}
class cl_heap_univpoly_complex_ring : public cl_heap_univpoly_ring {
SUBCLASS_cl_heap_univpoly_ring()
// High-level operations.
- void fprint (cl_ostream stream, const cl_UP_N& x)
+ void fprint (std::ostream& stream, const cl_UP_N& x)
{
cl_heap_univpoly_ring::fprint(stream,x);
}
class cl_heap_univpoly_integer_ring : public cl_heap_univpoly_ring {
SUBCLASS_cl_heap_univpoly_ring()
// High-level operations.
- void fprint (cl_ostream stream, const cl_UP_I& x)
+ void fprint (std::ostream& stream, const cl_UP_I& x)
{
cl_heap_univpoly_ring::fprint(stream,x);
}
SUBCLASS_cl_heap_univpoly_ring()
const cl_modint_ring& basering () const { return The(cl_modint_ring)(_basering); }
// High-level operations.
- void fprint (cl_ostream stream, const cl_UP_MI& x)
+ void fprint (std::ostream& stream, const cl_UP_MI& x)
{
cl_heap_univpoly_ring::fprint(stream,x);
}
class cl_heap_univpoly_rational_ring : public cl_heap_univpoly_ring {
SUBCLASS_cl_heap_univpoly_ring()
// High-level operations.
- void fprint (cl_ostream stream, const cl_UP_RA& x)
+ void fprint (std::ostream& stream, const cl_UP_RA& x)
{
cl_heap_univpoly_ring::fprint(stream,x);
}
class cl_heap_univpoly_real_ring : public cl_heap_univpoly_ring {
SUBCLASS_cl_heap_univpoly_ring()
// High-level operations.
- void fprint (cl_ostream stream, const cl_UP_R& x)
+ void fprint (std::ostream& stream, const cl_UP_R& x)
{
cl_heap_univpoly_ring::fprint(stream,x);
}
--- /dev/null
+// Version information (cf. cln.m4)
+
+#ifndef _CL_VERSION_H
+#define _CL_VERSION_H
+
+/* These definitions are adjusted by `configure' automatically. */
+
+
+#define CL_VERSION_MAJOR 1
+#define CL_VERSION_MINOR 1
+#define CL_VERSION_PATCHLEVEL 0
+#define CL_VERSION 1.1.0
+
+namespace cln {
+
+extern const int version_major;
+extern const int version_minor;
+extern const int version_patchlevel;
+
+} // namespace cln
+
+#endif /* _CL_VERSION_H */
--- /dev/null
+// Version string buried into the library
+
+// General includes.
+#include "cl_sysdep.h"
+
+// Specification.
+#include "cln/version.h"
+
+
+// Implementation.
+
+namespace cln {
+
+const int version_major = CL_VERSION_MAJOR;
+const int version_minor = CL_VERSION_MINOR;
+const int version_patchlevel = CL_VERSION_PATCHLEVEL;
+
+} // namespace cln
// We don't use `stream << x' or `stream << dec << x', because an ostream
// carries so many attributes, and we don't want to modifies these attributes.
-void fprintdecimal (cl_ostream stream, unsigned long x)
+void fprintdecimal (std::ostream& stream, unsigned long x)
{
#define bufsize 20
var char buf[bufsize+1];
#undef bufsize
}
-void fprintdecimal (cl_ostream stream, long x)
+void fprintdecimal (std::ostream& stream, long x)
{
if (x >= 0)
fprintdecimal(stream,(unsigned long)x);
namespace cln {
-void fprinthexadecimal (cl_ostream stream, unsigned long x)
+void fprinthexadecimal (std::ostream& stream, unsigned long x)
{
#define bufsize 16
var char buf[bufsize+1];
#undef bufsize
}
-void fprinthexadecimal (cl_ostream stream, long x)
+void fprinthexadecimal (std::ostream& stream, long x)
{
if (x >= 0)
fprintdecimal(stream,(unsigned long)x);
uninitialized_error(x); uninitialized_error(y); RETDUMMY;
}
-static void dummy_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x)
+static void dummy_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
{
unused R;
unused stream;
namespace cln {
-const cl_string cl_fget (cl_istream stream, char delim)
+const cl_string cl_fget (std::istream& stream, char delim)
{
var cl_spushstring buffer;
// Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.get()==EOF).
namespace cln {
-const cl_string cl_fget (cl_istream stream, int n, char delim)
+const cl_string cl_fget (std::istream& stream, int n, char delim)
{
var cl_spushstring buffer;
// Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.get()==EOF).
namespace cln {
-const cl_string cl_fgetline (cl_istream stream, char delim)
+const cl_string cl_fgetline (std::istream& stream, char delim)
{
var cl_spushstring buffer;
// Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.get()==EOF).
namespace cln {
-const cl_string cl_fgetline (cl_istream stream, int n, char delim)
+const cl_string cl_fgetline (std::istream& stream, int n, char delim)
{
var cl_spushstring buffer;
// Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.get()==EOF).
namespace cln {
-cl_istream operator>> (cl_istream stream, cl_string& str)
+std::istream& operator>> (std::istream& stream, cl_string& str)
{
var cl_spushstring buffer;
var int n = stream.width();
namespace cln {
-void fprint (cl_ostream stream, const cl_string& str)
+void fprint (std::ostream& stream, const cl_string& str)
{
stream.write(str.asciz(),str.length());
}
}
}
-const cl_N read_complex (cl_istream stream, const cl_read_flags& flags)
+const cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
{
// One pre-allocated buffer. This reduces the allocation/free cost.
static pushstring_hack buffer;
namespace cln {
-void print_complex (cl_ostream stream, const cl_print_flags& flags, const cl_N& z)
+void print_complex (std::ostream& stream, const cl_print_flags& flags, const cl_N& z)
{
print_complex(stream,(const cl_print_number_flags&)flags,z);
}
namespace cln {
-void print_complex (cl_ostream stream, const cl_print_number_flags& flags, const cl_N& z)
+void print_complex (std::ostream& stream, const cl_print_number_flags& flags, const cl_N& z)
{
if (realp(z)) {
DeclareType(cl_R,z);
namespace cln {
-static void N_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x)
+static void N_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
{
unused R;
fprint(stream,The(cl_N)(x));
}
}
-const cl_F read_float (cl_istream stream, const cl_read_flags& flags)
+const cl_F read_float (std::istream& stream, const cl_read_flags& flags)
{
// One pre-allocated buffer. This reduces the allocation/free cost.
static pushstring_hack buffer;
namespace cln {
-void print_float (cl_ostream stream, const cl_print_flags& flags, const cl_F& z)
+void print_float (std::ostream& stream, const cl_print_flags& flags, const cl_F& z)
{
print_float(stream,(const cl_print_number_flags&)flags,z);
}
namespace cln {
-void print_float (cl_ostream stream, const cl_print_number_flags& flags, const cl_F& z)
+void print_float (std::ostream& stream, const cl_print_number_flags& flags, const cl_F& z)
{
print_float(stream,(const cl_print_real_flags&)flags,z);
}
namespace cln {
-void print_float (cl_ostream stream, const cl_print_real_flags& flags, const cl_F& z)
+void print_float (std::ostream& stream, const cl_print_real_flags& flags, const cl_F& z)
{
print_float(stream,(const cl_print_float_flags&)flags,z);
}
}
// Ausgabefunktion:
-void print_float (cl_ostream stream, const cl_print_float_flags& flags, const cl_F& z)
+void print_float (std::ostream& stream, const cl_print_float_flags& flags, const cl_F& z)
{
var cl_decimal_decoded_float z_decoded = decode_float_decimal(z);
var char * & mantstring = z_decoded.a;
namespace cln {
-void print_float_binary (cl_ostream stream, const cl_F& z)
+void print_float_binary (std::ostream& stream, const cl_F& z)
{
// Vorzeichen, Punkt, Mantisse (binär), (Zweiersystem-)Exponent (dezimal)
cl_idecoded_float m_e_s = integer_decode_float(z);
}
}
-const cl_I read_integer (cl_istream stream, const cl_read_flags& flags)
+const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
{
// One pre-allocated buffer. This reduces the allocation/free cost.
static pushstring_hack buffer;
namespace cln {
-void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z)
+void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z)
{
print_integer(stream,(const cl_print_number_flags&)flags,z);
}
namespace cln {
-void print_integer (cl_ostream stream, const cl_print_number_flags& flags, const cl_I& z)
+void print_integer (std::ostream& stream, const cl_print_number_flags& flags, const cl_I& z)
{
print_integer(stream,(const cl_print_real_flags&)flags,z);
}
namespace cln {
-void print_integer (cl_ostream stream, const cl_print_real_flags& flags, const cl_I& z)
+void print_integer (std::ostream& stream, const cl_print_real_flags& flags, const cl_I& z)
{
print_integer(stream,(const cl_print_rational_flags&)flags,z);
}
namespace cln {
-void print_integer (cl_ostream stream, const cl_print_rational_flags& flags, const cl_I& z)
+void print_integer (std::ostream& stream, const cl_print_rational_flags& flags, const cl_I& z)
{
var unsigned int base = flags.rational_base;
if (flags.rational_readably)
namespace cln {
-void print_integer (cl_ostream stream, unsigned int base, const cl_I& z)
+void print_integer (std::ostream& stream, unsigned int base, const cl_I& z)
{
var cl_I abs_z;
if (minusp(z)) {
return _cl_ring_element(R, (cl_I)0);
}
-static void null_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x)
+static void null_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
{
unused R;
unused x;
namespace cln {
-static void I_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x)
+static void I_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
{
unused R;
fprint(stream,The(cl_I)(x));
const char * cl_composite_condition::name () const
{ return "cl_composite_condition"; }
-void cl_composite_condition::print (cl_ostream strm) const
+void cl_composite_condition::print (std::ostream& strm) const
{
fprint(strm, "Exception <cl_composite_condition> occurred: p = ");
fprint(strm, p);
namespace cln {
-static void int_fprint (cl_heap_modint_ring* R, cl_ostream stream, const _cl_MI &x)
+static void int_fprint (cl_heap_modint_ring* R, std::ostream& stream, const _cl_MI &x)
{
fprint(stream,R->_retract(x));
}
namespace cln {
-static void std_fprint (cl_heap_modint_ring* R, cl_ostream stream, const _cl_MI &x)
+static void std_fprint (cl_heap_modint_ring* R, std::ostream& stream, const _cl_MI &x)
{
fprint(stream,R->_retract(x));
fprint(stream," mod ");
}
}
-static void modint_fprint (cl_heap_univpoly_ring* UPR, cl_ostream stream, const _cl_UP& x)
+static void modint_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const _cl_UP& x)
{{
DeclarePoly(cl_GV_MI,x);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
}
}
-static void gen_fprint (cl_heap_univpoly_ring* UPR, cl_ostream stream, const _cl_UP& x)
+static void gen_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const _cl_UP& x)
{{
DeclarePoly(cl_SV_ringelt,x);
var cl_heap_ring* R = TheRing(UPR->basering());
uninitialized_error(x); uninitialized_error(y); RETDUMMY;
}
-static void dummy_fprint (cl_heap_univpoly_ring* R, cl_ostream stream, const _cl_UP& x)
+static void dummy_fprint (cl_heap_univpoly_ring* R, std::ostream& stream, const _cl_UP& x)
{
unused R;
unused stream;
}
}
-static void num_fprint (cl_heap_univpoly_ring* UPR, cl_ostream stream, const _cl_UP& x)
+static void num_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const _cl_UP& x)
{{
DeclarePoly(cl_SV_number,x);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
}
}
-const cl_RA read_rational (cl_istream stream, const cl_read_flags& flags)
+const cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
{
// One pre-allocated buffer. This reduces the allocation/free cost.
static pushstring_hack buffer;
namespace cln {
-void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z)
+void print_rational (std::ostream& stream, const cl_print_flags& flags, const cl_RA& z)
{
print_rational(stream,(const cl_print_number_flags&)flags,z);
}
namespace cln {
-void print_rational (cl_ostream stream, const cl_print_number_flags& flags, const cl_RA& z)
+void print_rational (std::ostream& stream, const cl_print_number_flags& flags, const cl_RA& z)
{
print_rational(stream,(const cl_print_real_flags&)flags,z);
}
namespace cln {
-void print_rational (cl_ostream stream, const cl_print_real_flags& flags, const cl_RA& z)
+void print_rational (std::ostream& stream, const cl_print_real_flags& flags, const cl_RA& z)
{
print_rational(stream,(const cl_print_rational_flags&)flags,z);
}
namespace cln {
-void print_rational (cl_ostream stream, const cl_print_rational_flags& flags, const cl_RA& z)
+void print_rational (std::ostream& stream, const cl_print_rational_flags& flags, const cl_RA& z)
{
var unsigned int base = flags.rational_base;
if (flags.rational_readably)
namespace cln {
-void print_rational (cl_ostream stream, unsigned int base, const cl_RA& z)
+void print_rational (std::ostream& stream, unsigned int base, const cl_RA& z)
{
if (integerp(z)) {
DeclareType(cl_I,z);
namespace cln {
-static void RA_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x)
+static void RA_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
{
unused R;
fprint(stream,The(cl_RA)(x));
// gibt eine ganze Zahl >0, <1000 im Klartext auf englisch auf den stream aus.
// (arg=0 -> gibt nichts aus.)
-static void format_small_cardinal (cl_ostream stream, uintL arg)
+static void format_small_cardinal (std::ostream& stream, uintL arg)
{
var uintL hundreds = floor(arg,100);
var uintL tens_and_ones = arg % 100;
}
}
-void format_cardinal (cl_ostream stream, const cl_I& argument)
+void format_cardinal (std::ostream& stream, const cl_I& argument)
{
if (zerop(argument))
fprint(stream,"zero");
namespace cln {
-void format_integer (cl_ostream stream, const cl_I& arg,
+void format_integer (std::ostream& stream, const cl_I& arg,
unsigned int base, sintL mincol, char padchar,
char commachar, uintL commainterval, cl_boolean commaflag,
cl_boolean positive_sign_flag)
namespace cln {
-void format_new_roman (cl_ostream stream, const cl_I& arg)
+void format_new_roman (std::ostream& stream, const cl_I& arg)
{
if (!(0 < arg && arg < 4000)) {
fprint(std::cerr, "format_new_roman: argument should be in the range 1 - 3999, not ");
namespace cln {
-void format_old_roman (cl_ostream stream, const cl_I& arg)
+void format_old_roman (std::ostream& stream, const cl_I& arg)
{
if (!(0 < arg && arg < 5000)) {
fprint(std::cerr, "format_old_roman: argument should be in the range 1 - 4999, not ");
"ninetieth",
};
-void format_ordinal (cl_ostream stream, const cl_I& argument)
+void format_ordinal (std::ostream& stream, const cl_I& argument)
{
if (zerop(argument))
fprint(stream,"zeroth");
namespace cln {
-void format_padded_string (cl_ostream stream, sintL mincol, sintL colinc, sintL minpad, char padchar, cl_boolean padleftflag, const char * str)
+void format_padded_string (std::ostream& stream, sintL mincol, sintL colinc, sintL minpad, char padchar, cl_boolean padleftflag, const char * str)
{
var sintL need = ::strlen(str) + minpad; // so viele Zeichen mindestens
var uintL auxpad = (need < mincol
namespace cln {
// gibt arg als römische Zahl auf stream aus, z.B. 4 als IIII.
-extern void format_old_roman (cl_ostream stream, const cl_I& arg);
+extern void format_old_roman (std::ostream& stream, const cl_I& arg);
// gibt arg als römische Zahl auf stream aus, z.B. 4 als IV.
-extern void format_new_roman (cl_ostream stream, const cl_I& arg);
+extern void format_new_roman (std::ostream& stream, const cl_I& arg);
extern const char * const cl_format_tens [10];
// gibt die ganze Zahl arg im Klartext auf englisch auf den Stream aus.
-extern void format_cardinal (cl_ostream stream, const cl_I& arg);
+extern void format_cardinal (std::ostream& stream, const cl_I& arg);
// gibt eine ganze Zahl arg als Abzählnummer im Klartext auf englisch
// auf den stream aus.
-extern void format_ordinal (cl_ostream stream, const cl_I& arg);
+extern void format_ordinal (std::ostream& stream, const cl_I& arg);
// gibt count (>=0) Zeichen ch auf stream aus.
-inline void format_padding (cl_ostream stream, sintL count, char ch)
+inline void format_padding (std::ostream& stream, sintL count, char ch)
{
for (; count >= 0; count--)
fprintchar(stream,ch);
// werden mindestens minpad Zeichen eingefügt, eventuelle weitere dann in
// Blöcken à colinc Zeichen. Falls padleftflag, werden sie links eingefügt,
// sonst rechts vom String.
-extern void format_padded_string (cl_ostream stream, sintL mincol, sintL colinc, sintL minpad, char padchar, cl_boolean padleftflag, const char * str);
+extern void format_padded_string (std::ostream& stream, sintL mincol, sintL colinc, sintL minpad, char padchar, cl_boolean padleftflag, const char * str);
// gibt den Integer arg auf den Stream aus:
// in Zahlenbasis base, mit Vorzeichen (+ nur falls >0 und positive-sign-flag),
// bei commaflag alle drei Stellen unterbrochen durch ein Zeichen commachar.
// Das Ganze links aufgefüllt mit padchar's, so daß die Gesamtbreite mindestens
// mincol ist.
-extern void format_integer (cl_ostream stream, const cl_I& arg, unsigned int base, sintL mincol, char padchar, char commachar, uintL commainterval, cl_boolean commaflag, cl_boolean positive_sign_flag);
+extern void format_integer (std::ostream& stream, const cl_I& arg, unsigned int base, sintL mincol, char padchar, char commachar, uintL commainterval, cl_boolean commaflag, cl_boolean positive_sign_flag);
// format_scale_exponent(arg) liefert zur Floating-Point-Zahl arg
// drei Werte: mantissa und n, mit
}
}
-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;
namespace cln {
-void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z)
+void print_real (std::ostream& stream, const cl_print_flags& flags, const cl_R& z)
{
print_real(stream,(const cl_print_number_flags&)flags,z);
}
namespace cln {
-void print_real (cl_ostream stream, const cl_print_number_flags& flags, const cl_R& z)
+void print_real (std::ostream& stream, const cl_print_number_flags& flags, const cl_R& z)
{
print_real(stream,(const cl_print_real_flags&)flags,z);
}
namespace cln {
-void print_real (cl_ostream stream, const cl_print_real_flags& flags, const cl_R& z)
+void print_real (std::ostream& stream, const cl_print_real_flags& flags, const cl_R& z)
{
if (rationalp(z)) {
DeclareType(cl_RA,z);
namespace cln {
-static void R_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x)
+static void R_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
{
unused R;
fprint(stream,The(cl_R)(x));
-// constructor cl_timing(cl_ostream).
+// constructor cl_timing(std::ostream&).
// General includes.
#include "cl_sysdep.h"
usage.realtime = usage_end.realtime - usage_start.realtime;
usage.usertime = usage_end.usertime - usage_start.usertime;
- var cl_ostream destination = *(std::ostream*) t.report_destination;
+ var std::ostream& destination = *(std::ostream*) t.report_destination;
if (t.comment)
fprint(destination,t.comment);
cl_timing_report(destination,usage);
fprint(destination,"\n");
}
-cl_timing::cl_timing (cl_ostream destination)
+cl_timing::cl_timing (std::ostream& destination)
{
report_fn = report_stream;
report_destination = &destination;
tmp = cl_current_time_consumption();
}
-cl_timing::cl_timing (const char * msg, cl_ostream destination)
+cl_timing::cl_timing (const char * msg, std::ostream& destination)
{
report_fn = report_stream;
report_destination = &destination;
#define CL_HZ 1000
#define CL_HZ_NSECS (1000000000/CL_HZ)
-void cl_timing_report (cl_ostream stream, const cl_time_consumption& t)
+void cl_timing_report (std::ostream& stream, const cl_time_consumption& t)
{
var uintL real_sec = t.realtime.tv_sec;
var uintL real_msec = (t.realtime.tv_nsec + (CL_HZ_NSECS-1)/2) / CL_HZ_NSECS;
// > flags: Flags
// > fun: Ausgabefunktion für die einzelnen Elemente
// > vector: Vektor
-extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
+extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
} // namespace cln
namespace cln {
-static void print_for_debug (cl_ostream stream, const cl_print_flags& flags, const cl_number& z)
+static void print_for_debug (std::ostream& stream, const cl_print_flags& flags, const cl_number& z)
{
unused stream; // must be cl_debugout
unused flags; // must be default_print_flags
// > flags: Flags
// > fun: Ausgabefunktion für die einzelnen Elemente
// > vector: Vektor
-extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
+extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
} // namespace cln
namespace cln {
-static void print_for_debug (cl_ostream stream, const cl_print_flags& flags, const cl_number& z)
+static void print_for_debug (std::ostream& stream, const cl_print_flags& flags, const cl_number& z)
{
unused stream; // must be cl_debugout
unused flags; // must be default_print_flags
namespace cln {
-void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* printfun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector)
+void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector)
{
var uintL len = vector.length();
if (flags.vector_syntax == vsyntax_commonlisp) {
namespace cln {
-void fprint (cl_ostream stream, const cl_ring& R, const cl_SV_ringelt& vector)
+void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& vector)
{
var const cl_print_flags& flags = default_print_flags;
var uintL len = vector.length();
namespace cln {
-void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* printfun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector)
+void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector)
{
var uintL len = vector.length();
if (flags.vector_syntax == vsyntax_commonlisp) {