question about older mamer program compilation , written in c++

G

Giancarlo Bassi

Hi all,

On the internet there's the downloadable tarball mamer.tgz, for chess
server.

Mamer is a program to MAnage ME R,
i.e. to manage chess players in Internet Chess Servers (FICS, ICC, and so
on...) , written in c++ (no experience with it from me).

Trying to compile mamer from sources, I got this:

g++ -Wall -ggdb -c Tourney.cc
In file included from
/usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/backward/fstream.h:31,
from Tourney.hh:19,
from Tourney.cc:44:
/usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/backward/backward_warning.h:32:2:
warning: #warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in
section 17.4.1.2 of the C++ standard. Examples include substituting the
<X> header for the <X.h> header for C++ includes, or <iostream> instead of
the deprecated header <iostream.h>. To disable this warning use
-Wno-deprecated.
In file included from /usr/include/math.h:65,
from Tourney.hh:35,
from Tourney.cc:44:
/usr/include/bits/mathcalls.h:145: error: expected `)' before '/' token
make: *** [Tourney.o] Error 1


So I couldn't achieve the binaries files.

About error message I could only retrieve this:

/* Compute base-2 logarithm of X. */
__MATHCALL (log2,, (_Mdouble_ __x)); <- line 145 of /usr/include/bits/mathcalls.h
__END_NAMESPACE_C99
#endif

---------------------------------------------------------------------

Mamer looks very old:

// Mamer.cc - Source file for the Mamer class
//
// Matthew E. Moses & Michael A. Long
//
// $Revision: 1.17 $
// $Date: 1998/09/10 19:57:17 $
//
// $Author: mlong $
// $Locker: $
//
---------------------------------------------------------------------

Can someone give me some hint to overcome this issue ?

Thanks a lot,
Giancarlo Bassi
 
V

Victor Bazarov

Giancarlo said:
On the internet there's the downloadable tarball mamer.tgz, for chess
server.
[..]
Trying to compile mamer from sources, I got this:

g++ -Wall -ggdb -c Tourney.cc
[..]
In file included from /usr/include/math.h:65,
from Tourney.hh:35,
from Tourney.cc:44:
/usr/include/bits/mathcalls.h:145: error: expected `)' before '/'
token make: *** [Tourney.o] Error 1


So I couldn't achieve the binaries files.

About error message I could only retrieve this:

/* Compute base-2 logarithm of X. */
__MATHCALL (log2,, (_Mdouble_ __x)); <- line 145 of

Without knowing what that line expands into it's rather impossible
to tell why the error is there. What the definition of __MATHCALL
macro looks like?

Also, the two consecutive commas look suspicious (at least to me).
/usr/include/bits/mathcalls.h __END_NAMESPACE_C99
#endif

---------------------------------------------------------------------

Mamer looks very old:

// Mamer.cc - Source file for the Mamer class
//
// Matthew E. Moses & Michael A. Long
//
// $Revision: 1.17 $
// $Date: 1998/09/10 19:57:17 $

You think 1998 is old?

It's not old. It's just non-portable.
//
// $Author: mlong $
// $Locker: $
//

V
 
T

Tomás Ó hÉilidhe

Giancarlo Bassi:
/* Compute base-2 logarithm of X. */ __MATHCALL (log2,, (_Mdouble_
__x));


Is that supposed to be two commas or could it possibly be a typo? Just
one thought.
 
G

Giancarlo Bassi

Thanks Victor and Tomás,

About the call of log2 function, on Mamer.cc included in sources of
mamer.tgz, I have this:
----------------------------------------------------------------------------

if(params.rounds == 0) {
switch(params.style) {
case 'r':
params.rounds = GetPlayerCount() - 1;
break;
case 's':
params.rounds = (int)ceil(log2(GetPlayerCount())); ** <---- here **
break;
default:
params.rounds = DEFAULT_ROUNDS;
break;
}
}

------------------------------------------------------------
while in /usr/include/bits/mathcalls.h

#ifdef __USE_ISOC99
__BEGIN_NAMESPACE_C99
/* Compute base-2 exponential of X. */
__MATHCALL (exp2,, (_Mdouble_ __x));

/* Compute base-2 logarithm of X. */
__MATHCALL (log2,, (_Mdouble_ __x)); ** <--- here **
__END_NAMESPACE_C99
#endif
---------------------------------------------------------

At the start of the mathcalls,h there's this note:

/* NOTE: Because of the special way this file is used by <math.h>, this
file must NOT be protected from multiple inclusion as header files
usually are.

This file provides prototype declarations for the math functions.
Most functions are declared using the macro:

__MATHCALL (NAME,[_r], (ARGS...));

This means there is a function `NAME' returning `double' and a function
`NAMEf' returning `float'. Each place `_Mdouble_' appears in the
prototype, that is actually `double' in the prototype for `NAME' and
`float' in the prototype for `NAMEf'. Reentrant variant functions are
called `NAME_r' and `NAMEf_r'.

Functions returning other types like `int' are declared using the
macro:

__MATHDECL (TYPE, NAME,[_r], (ARGS...));

This is just like __MATHCALL but for a function returning `TYPE'
instead of `_Mdouble_'. In all of these cases, there is still
both a `NAME' and a `NAMEf' that takes `float' arguments.

Note that there must be no whitespace before the argument passed for
NAME, to make token pasting work with -traditional. */

---------------------------------------------------------------------------
Furthermore in Tourney.hh , on sources, there's

#define log2(x) (log(x)/log(2))
---------------------------------------------------------------------------

Is There simply unmatching of argument numbers, or more ?

thx,
GB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top