
8 Nov
2002
8 Nov
'02
3:13 p.m.
Kevin Ryde wrote:
- extern "C" typedef void GMP_RANDINIT_DEFAULT(gmp_randstate_t);
Can this be private to gmp_randclass, or given within the definitions of the constructors?
No, unfortunately it cannot.
If not then they'll want to be prefixed like __gmp_randinit_default_t, or some such.
The patch below implements this idea. Tested with G++ 3.2, Comeau C/C++ 4.3.0.1 (both with and without --strict) and Intel(R) C++ Compiler for 32-bit applications, Version 6.0.1, Build 20020822Z (the latest version, both with and without -Xc). All the best
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it
*** gmpxx.h.orig Mon Nov 4 10:00:43 2002
--- gmpxx.h Fri Nov 8 16:08:23 2002
***************
*** 4968,4973 ****
--- 4968,4981 ----
}
};
+ extern "C" typedef void __gmp_randinit_default_t(gmp_randstate_t);
+ extern "C" typedef void __gmp_randinit_lc_2exp_t(gmp_randstate_t,
+ mpz_srcptr,
+ unsigned long int,
+ unsigned long int);
+ extern "C" typedef void __gmp_randinit_lc_2exp_size_t(gmp_randstate_t,
+ unsigned long int);
+
class gmp_randclass
{
private:
***************
*** 4988,5004 ****
}
// gmp_randinit_default
! gmp_randclass(void (*f)(gmp_randstate_t))
{ f(state); }
// gmp_randinit_lc_2exp
! gmp_randclass(void (*f)(gmp_randstate_t, mpz_srcptr,
! unsigned long int, unsigned long int),
mpz_class z, unsigned long int l1, unsigned long int l2)
{ f(state, z.get_mpz_t(), l1, l2); }
// gmp_randinit_lc_2exp_size
! gmp_randclass(int (*f)(gmp_randstate_t, unsigned long int),
unsigned long int size)
{ f(state, size); }
--- 4996,5011 ----
}
// gmp_randinit_default
! gmp_randclass(__gmp_randinit_default_t* f)
{ f(state); }
// gmp_randinit_lc_2exp
! gmp_randclass(__gmp_randinit_lc_2exp_t* f,
mpz_class z, unsigned long int l1, unsigned long int l2)
{ f(state, z.get_mpz_t(), l1, l2); }
// gmp_randinit_lc_2exp_size
! gmp_randclass(__gmp_randinit_lc_2exp_size_t* f,
unsigned long int size)
{ f(state, size); }