1
# GMP module external subroutine type mappings.
3
# Copyright 2001, 2003 Free Software Foundation, Inc.
5
# This file is part of the GNU MP Library.
7
# The GNU MP Library is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU Lesser General Public License as published
9
# by the Free Software Foundation; either version 2.1 of the License, or (at
10
# your option) any later version.
12
# The GNU MP Library is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15
# License for more details.
17
# You should have received a copy of the GNU Lesser General Public License
18
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
19
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25
const_string_assume CONST_STRING_ASSUME
34
mpf_coerce_st0 MPF_COERCE_ST0
35
mpf_coerce_def MPF_COERCE_DEF
37
ulong_coerce ULONG_COERCE
38
malloced_string MALLOCED_STRING
39
order_noswap ORDER_NOSWAP
41
# perl 5.005 doesn't have UV in its standard typemap, so use this instead
47
class_or_croak ($arg, mpz_class); $var = SvMPZ($arg);
49
class_or_croak ($arg, mpq_class); $var = SvMPQ($arg);
51
class_or_croak ($arg, mpf_class); $var = SvMPF($arg);
53
MPZ_ASSUME ($var, $arg)
55
MPQ_ASSUME ($var, $arg)
57
MPF_ASSUME ($var, $arg)
59
$var = coerce_mpz (tmp_mpz_${(my $stnum=$arg)=~s/[^0-9]//g;\$stnum}, $arg)
61
$var = coerce_mpq (tmp_mpq_${(my $stnum=$arg)=~s/[^0-9]//g;\$stnum}, $arg)
63
/* precision follows ST(0) */
64
assert (sv_derived_from (ST(0), mpf_class));
65
$var = coerce_mpf (tmp_mpf_${(my $stnum=$arg)=~s/[^0-9]//g;\$stnum},
66
$arg, mpf_get_prec (SvMPF(ST(0))))
68
/* default precision used */
69
$var = coerce_mpf (tmp_mpf_${(my $stnum=$arg)=~s/[^0-9]//g;\$stnum},
70
$arg, mpf_get_default_prec())
72
class_or_croak ($arg, rand_class); $var = SvRANDSTATE($arg);
74
$var = coerce_ulong ($arg)
76
assert ($arg != &PL_sv_yes);
80
/* No need to check for SvPOKp and use SvPV, this mapping is
81
only used for overload_constant, which always gets literal
83
assert (SvPOK ($arg));
89
sv_bless (sv_setref_pv ($arg, NULL, $var), mpz_class_hv);
91
sv_bless (sv_setref_pv ($arg, NULL, $var), mpq_class_hv);
93
sv_bless (sv_setref_pv ($arg, NULL, $var), mpf_class_hv);
95
sv_setref_pv ($arg, rand_class, $var);
97
sv_usepvn_mg ($arg, $var, strlen($var));
99
sv_setuv ($arg, (UV) ($var));