- Add upstream patch to build with gcc-4.4

This commit is contained in:
Deji Akingunola 2009-02-04 19:49:44 +00:00
parent 469839e62e
commit ae8b5422d2
2 changed files with 461 additions and 1 deletions

View File

@ -0,0 +1,455 @@
diff --git a/doc/cln.texi b/doc/cln.texi
index 546d788..8434cb1 100644
--- a/doc/cln.texi
+++ b/doc/cln.texi
@@ -2661,30 +2661,7 @@ In Common Lisp notation: @code{#C(@var{realpart} @var{imagpart})}.
@node Input functions
@section 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 (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 (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
-
-Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
-@code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
-defines, in @code{<cln/@var{type}_io.h>}, the following input function:
-
-@table @code
-@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
-
-The most flexible input functions, defined in @code{<cln/@var{type}_io.h>},
-are the following:
+Including @code{<cln/io.h>} defines flexible input functions:
@table @code
@item cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
diff --git a/examples/perfnum.cc b/examples/perfnum.cc
index 50d8a0d..08d7b7b 100644
--- a/examples/perfnum.cc
+++ b/examples/perfnum.cc
@@ -8,8 +8,9 @@ using namespace cln;
int main ()
{
- // previous ones were 1257787, 1398269, 2976221, 3021377, 6972593, 13466917, 20996011, 24036583, 25964951, 30402457
- int p = 32582657;
+ // previous ones were 1257787, 1398269, 2976221, 3021377, 6972593,
+ // 13466917, 20996011, 24036583, 25964951, 30402457, 32582657, 37156667
+ int p = 43112609;
cl_I x = (((cl_I)1 << p) - 1) << (p-1);
cout << x << endl;
}
diff --git a/include/cln/io.h b/include/cln/io.h
index 435490e..43a5f10 100644
--- a/include/cln/io.h
+++ b/include/cln/io.h
@@ -24,27 +24,6 @@ typedef std::ostream& cl_ostream;
extern std::ostream* cl_debugout_stream;
#define cl_debugout (*cl_debugout_stream)
-// Elementary operations on std::istream&
-
-#define cl_EOF (-1)
-
-inline int freadchar (std::istream& stream)
-{
- char c;
- if (stream.get(c))
- return c;
- else
- // EOF or error
- return cl_EOF;
-}
-
-inline int funreadchar (std::istream& stream, int c)
-{
- if (c != cl_EOF)
- stream.putback((char)c);
- return c;
-}
-
// Elementary operations on std::ostream&
inline void fprintchar (std::ostream& stream, char c)
diff --git a/src/base/string/input/cl_st_get1.cc b/src/base/string/input/cl_st_get1.cc
index 917ecc4..b0e445a 100644
--- a/src/base/string/input/cl_st_get1.cc
+++ b/src/base/string/input/cl_st_get1.cc
@@ -17,11 +17,11 @@ namespace cln {
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).
+ // Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.eof()).
while (stream.good()) {
var int c = stream.get();
- if (c==EOF)
- break; // std::ios::eofbit already set
+ if (stream.eof())
+ break;
if (c==delim) {
stream.unget();
break;
diff --git a/src/base/string/input/cl_st_get2.cc b/src/base/string/input/cl_st_get2.cc
index d89f3e4..52b0afc 100644
--- a/src/base/string/input/cl_st_get2.cc
+++ b/src/base/string/input/cl_st_get2.cc
@@ -17,11 +17,11 @@ namespace cln {
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).
+ // Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.eof()).
while (stream.good()) {
var int c = stream.get();
- if (c==EOF)
- break; // ios::eofbit already set
+ if (stream.eof())
+ break;
if (c==delim) {
stream.unget();
break;
diff --git a/src/base/string/input/cl_st_getline1.cc b/src/base/string/input/cl_st_getline1.cc
index 5f9ac88..da0f0d0 100644
--- a/src/base/string/input/cl_st_getline1.cc
+++ b/src/base/string/input/cl_st_getline1.cc
@@ -17,11 +17,11 @@ namespace cln {
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).
+ // Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.eof()).
while (stream.good()) {
var int c = stream.get();
- if (c==EOF)
- break; // std::ios::eofbit already set
+ if (stream.eof())
+ break;
if (c==delim)
break;
buffer.push(c);
diff --git a/src/base/string/input/cl_st_getline2.cc b/src/base/string/input/cl_st_getline2.cc
index d2316e0..5f56169 100644
--- a/src/base/string/input/cl_st_getline2.cc
+++ b/src/base/string/input/cl_st_getline2.cc
@@ -17,11 +17,11 @@ namespace cln {
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).
+ // Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.eof()).
while (stream.good()) {
var int c = stream.get();
- if (c==EOF)
- break; // std::ios::eofbit already set
+ if (stream.eof())
+ break;
if (c==delim)
break;
if (--n <= 0) {
diff --git a/src/base/string/input/cl_st_gettoken.cc b/src/base/string/input/cl_st_gettoken.cc
index 30e7817..9361ee7 100644
--- a/src/base/string/input/cl_st_gettoken.cc
+++ b/src/base/string/input/cl_st_gettoken.cc
@@ -19,12 +19,12 @@ std::istream& operator>> (std::istream& stream, cl_string& str)
{
var cl_spushstring buffer;
var int n = stream.width();
- // Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.get()==EOF).
+ // Handling of eofp is tricky: EOF is reached when (!stream.good()) || (stream.eof()).
int c;
// Skip whitespace.
while (stream.good()) {
c = stream.get();
- if (c==EOF)
+ if (stream.eof())
break;
if (!isspace(c)) {
if (--n == 0) {
@@ -40,7 +40,7 @@ std::istream& operator>> (std::istream& stream, cl_string& str)
// Read non-whitespace.
while (stream.good()) {
c = stream.get();
- if (c==EOF)
+ if (stream.eof())
break;
if (isspace(c)) {
stream.unget();
diff --git a/src/complex/input/cl_N_read_stream.cc b/src/complex/input/cl_N_read_stream.cc
index fa1f594..139af04 100644
--- a/src/complex/input/cl_N_read_stream.cc
+++ b/src/complex/input/cl_N_read_stream.cc
@@ -46,8 +46,8 @@ const cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
var int c;
// Skip whitespace at the beginning.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
if ((c == ' ') || (c == '\t') || (c == '\n'))
continue;
else
@@ -62,8 +62,8 @@ const cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
buffer.push(c);
// Read some digits, then a letter, then a list or token.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
buffer.push(c);
if ((c >= '0') && (c <= '9'))
continue;
@@ -72,8 +72,8 @@ const cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
}
if (!(((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))))
goto syntax1;
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
if (c == '(') {
var uintL paren_level = 0;
loop {
@@ -81,8 +81,8 @@ const cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
if (c == '(') paren_level++;
else if (c == ')') paren_level--;
if (paren_level == 0) goto done;
- c = freadchar(stream);
- if ((c == cl_EOF) || (c == '\n')) goto syntax;
+ c = stream.get();
+ if (stream.eof() || stream.fail() || c == '\n') goto syntax;
}
}
}
@@ -91,11 +91,11 @@ const cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
goto syntax1;
loop {
buffer.push(c);
- c = freadchar(stream);
- if (c == cl_EOF)
+ c = stream.get();
+ if (stream.eof() || stream.fail())
break;
if (!number_char_p(c)) {
- funreadchar(stream,c);
+ stream.putback(c);
break;
}
}
diff --git a/src/float/input/cl_F_read_stream.cc b/src/float/input/cl_F_read_stream.cc
index cd49e97..baafc3b 100644
--- a/src/float/input/cl_F_read_stream.cc
+++ b/src/float/input/cl_F_read_stream.cc
@@ -48,8 +48,8 @@ const cl_F read_float (std::istream& stream, const cl_read_flags& flags)
var int c;
// Skip whitespace at the beginning.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
if ((c == ' ') || (c == '\t') || (c == '\n'))
continue;
else
@@ -64,8 +64,8 @@ const cl_F read_float (std::istream& stream, const cl_read_flags& flags)
buffer.push(c);
// Read some digits, then a letter, then a token.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
buffer.push(c);
if ((c >= '0') && (c <= '9'))
continue;
@@ -74,19 +74,19 @@ const cl_F read_float (std::istream& stream, const cl_read_flags& flags)
}
if (!(((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))))
goto syntax1;
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
}
// Read a number token.
if (!number_char_p(c))
goto syntax1;
loop {
buffer.push(c);
- c = freadchar(stream);
- if (c == cl_EOF)
+ c = stream.get();
+ if (stream.eof() || stream.fail())
break;
if (!number_char_p(c)) {
- funreadchar(stream,c);
+ stream.putback(c);
break;
}
}
diff --git a/src/integer/input/cl_I_read_stream.cc b/src/integer/input/cl_I_read_stream.cc
index 2f4e3db..227d845 100644
--- a/src/integer/input/cl_I_read_stream.cc
+++ b/src/integer/input/cl_I_read_stream.cc
@@ -48,8 +48,8 @@ const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
var int c;
// Skip whitespace at the beginning.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
if ((c == ' ') || (c == '\t') || (c == '\n'))
continue;
else
@@ -64,8 +64,8 @@ const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
buffer.push(c);
// Read some digits, then a letter, then a token.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
buffer.push(c);
if ((c >= '0') && (c <= '9'))
continue;
@@ -74,19 +74,19 @@ const cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
}
if (!(((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))))
goto syntax1;
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
}
// Read a number token.
if (!number_char_p(c))
goto syntax1;
loop {
buffer.push(c);
- c = freadchar(stream);
- if (c == cl_EOF)
+ c = stream.get();
+ if (stream.eof() || stream.fail())
break;
if (!number_char_p(c)) {
- funreadchar(stream,c);
+ stream.putback(c);
break;
}
}
diff --git a/src/rational/input/cl_RA_read_stream.cc b/src/rational/input/cl_RA_read_stream.cc
index d283095..bba1d03 100644
--- a/src/rational/input/cl_RA_read_stream.cc
+++ b/src/rational/input/cl_RA_read_stream.cc
@@ -49,8 +49,8 @@ const cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
var int c;
// Skip whitespace at the beginning.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
if ((c == ' ') || (c == '\t') || (c == '\n'))
continue;
else
@@ -65,8 +65,8 @@ const cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
buffer.push(c);
// Read some digits, then a letter, then a token.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
buffer.push(c);
if ((c >= '0') && (c <= '9'))
continue;
@@ -75,19 +75,19 @@ const cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
}
if (!(((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))))
goto syntax1;
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
}
// Read a number token.
if (!number_char_p(c))
goto syntax1;
loop {
buffer.push(c);
- c = freadchar(stream);
- if (c == cl_EOF)
+ c = stream.get();
+ if (stream.eof() || stream.fail())
break;
if (!number_char_p(c)) {
- funreadchar(stream,c);
+ stream.putback(c);
break;
}
}
diff --git a/src/real/input/cl_R_read_stream.cc b/src/real/input/cl_R_read_stream.cc
index 873bad7..56b01d3 100644
--- a/src/real/input/cl_R_read_stream.cc
+++ b/src/real/input/cl_R_read_stream.cc
@@ -48,8 +48,8 @@ const cl_R read_real (std::istream& stream, const cl_read_flags& flags)
var int c;
// Skip whitespace at the beginning.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
if ((c == ' ') || (c == '\t') || (c == '\n'))
continue;
else
@@ -64,8 +64,8 @@ const cl_R read_real (std::istream& stream, const cl_read_flags& flags)
buffer.push(c);
// Read some digits, then a letter, then a token.
loop {
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
buffer.push(c);
if ((c >= '0') && (c <= '9'))
continue;
@@ -74,19 +74,19 @@ const cl_R read_real (std::istream& stream, const cl_read_flags& flags)
}
if (!(((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))))
goto syntax1;
- c = freadchar(stream);
- if (c == cl_EOF) goto eof;
+ c = stream.get();
+ if (stream.eof() || stream.fail()) goto eof;
}
// Read a number token.
if (!number_char_p(c))
goto syntax1;
loop {
buffer.push(c);
- c = freadchar(stream);
- if (c == cl_EOF)
+ c = stream.get();
+ if (stream.eof() || stream.fail())
break;
if (!number_char_p(c)) {
- funreadchar(stream,c);
+ stream.putback(c);
break;
}
}

View File

@ -1,12 +1,13 @@
Name: cln
Version: 1.2.2
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Class Library for Numbers
Group: System Environment/Libraries
License: GPLv2+
URL: http://www.ginac.de/CLN/
Source0: http://www.ginac.de/CLN/%{name}-%{version}.tar.bz2
Patch0: cln-upstream_gcc44_fix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires(post): /sbin/install-info
@ -33,6 +34,7 @@ the CLN library.
%prep
%setup -q
%patch0 -p1 -b .gcc44
%build
%configure --disable-static
@ -75,6 +77,9 @@ fi
%exclude %{_libdir}/*.la
%changelog
* Wed Feb 04 2009 Deji Akingunola <dakingun@gmail.com> - 1.2.2-3
- Add upstream patch to build with gcc-4.4
* Fri Jan 16 2009 Rakesh Pandit <rakesh@fedoraproject.org> 1.2.2-2
- Bump to solve dependency for ginac-devel