-
Notifications
You must be signed in to change notification settings - Fork 6
/
gmp_random.idl
66 lines (53 loc) · 2.78 KB
/
gmp_random.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* -*- mode: c -*- */
/* This file is part of the MLGmpIDL interface, released under LGPL license
with an exception allowing the redistribution of statically linked
executables.
Please read the COPYING file packaged in the distribution */
quote(C, "\n\
#include \"caml/custom.h\"\n\
#include \"gmp_caml.h\"\n\
")
import "mpz.idl";
import "mpf.idl";
import "mpfr.idl";
/* OUTOUTOUT is a reserved variable name ! (see Makefile) */
typedef [abstract,c2ml(camlidl_gmp_randstate_ptr_c2ml),ml2c(camlidl_gmp_randstate_ptr_ml2c)] struct __gmp_randstate_struct* gmp_randstate_ptr;
quote(MLMLI,"(** GMP random generation functions *)\n\n")
quote(MLMLI,"(** {2 Random State Initialization} *)")
quote(MLMLI,"(** {{:http://gmplib.org/manual/Random-State-Initialization.html#Random-State-Initialization}C documentation} *)\n")
void gmp_randinit_default([out]gmp_randstate_ptr OUTOUTOUT);
void gmp_randinit_lc_2exp ([out]gmp_randstate_ptr OUTOUTOUT, mpz_ptr A, unsigned long C, unsigned long M2EXP);
void gmp_randinit_lc_2exp_size ([out]gmp_randstate_ptr OUTOUTOUT, unsigned long SIZE)
quote(call,"\
{\n\
int n = gmp_randinit_lc_2exp_size(OUTOUTOUT,SIZE);\n\
if (n==0) caml_invalid_argument(\"Argument not supported\");\n\
}");
quote(MLMLI,"(** {2 Random State Seeding} *)")
quote(MLMLI,"(** {{:http://gmplib.org/manual/Random-State-Seeding.html#Random-State-Seeding}C documentation} *)\n")
void gmp_randseed (gmp_randstate_ptr STATE, mpz_ptr SEED);
void gmp_randseed_ui (gmp_randstate_ptr STATE, unsigned long int SEED);
quote(MLMLI,"(** {2 Random Number Functions} *)\n")
quote(MLMLI,"(** {3 Integers ({!Mpz})} *)")
quote(MLMLI,"(** {{:http://gmplib.org/manual/Integer-Random-Numbers.html#Integer-Random-Numbers}C documentation} *)\n")
quote(MLI,"module Mpz : sig")
quote(ML,"module Mpz = struct")
void mpz_urandomb (mpz_ptrm ROP, gmp_randstate_ptr STATE, unsigned long int N);
void mpz_urandomm (mpz_ptrm ROP, gmp_randstate_ptr STATE, mpz_ptr N);
void mpz_rrandomb (mpz_ptrm ROP, gmp_randstate_ptr STATE, unsigned long int N);
quote(MLMLI,"end\n")
quote(MLMLI,"(** {3 Floating-point ({!Mpf})} *)")
quote(MLMLI,"(** {{:http://gmplib.org/manual/Miscellaneous-Float-Functions.html#Miscellaneous-Float-Functions}C documentation} *)\n")
quote(MLI,"module Mpf : sig")
quote(ML,"module Mpf = struct")
void mpf_urandomb (mpf_ptrm ROP, gmp_randstate_ptr STATE, unsigned long int N);
quote(MLMLI,"end\n")
quote(MLMLI,"(** {3 Floating-point ({!Mpfr})} *)")
quote(MLMLI,"(** {{:http://www.mpfr.org/mpfr-current/mpfr.html#Miscellaneous-Functions}C documentation} *)\n")
quote(MLI,"module Mpfr : sig")
quote(ML,"module Mpfr = struct")
void mpfr_urandomb (mpfr_ptrm ROP, gmp_randstate_ptr STATE);
#if MPFR_VERSION_MAJOR >= 3
void mpfr_urandom (mpfr_ptr ROP, gmp_randstate_ptr STATE, mpfr_rnd_t rnd);
#endif
quote(MLMLI,"end\n")