[BACK]Return to Mpz.pm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / demos / perl / GMP

Annotation of OpenXM_contrib/gmp/demos/perl/GMP/Mpz.pm, Revision 1.1

1.1     ! ohara       1: # GMP mpz module.
        !             2:
        !             3: # Copyright 2001 Free Software Foundation, Inc.
        !             4: #
        !             5: # This file is part of the GNU MP Library.
        !             6: #
        !             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.
        !            11: #
        !            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.
        !            16: #
        !            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,
        !            20: # MA 02111-1307, USA.
        !            21:
        !            22:
        !            23: package GMP::Mpz;
        !            24:
        !            25: require GMP;
        !            26: require Exporter;
        !            27: @ISA = qw(GMP Exporter);
        !            28: @EXPORT = qw();
        !            29: @EXPORT_OK = qw();
        !            30: %EXPORT_TAGS = ('all' => [qw(
        !            31:                             bin cdiv cdiv_2exp clrbit congruent_p
        !            32:                             congruent_2exp_p divexact divisible_p
        !            33:                             divisible_2exp_p even_p fac fdiv fdiv_2exp fib
        !            34:                             fib2 gcd gcdext hamdist invert jacobi kronecker
        !            35:                             lcm lucnum lucnum2 mod mpz nextprime odd_p
        !            36:                             perfect_power_p perfect_square_p popcount powm
        !            37:                             probab_prime_p realloc remove root roote scan0
        !            38:                             scan1 setbit sizeinbase sqrtrem tdiv tdiv_2exp
        !            39:                             tstbit)],
        !            40:                'constants'   => [@EXPORT],
        !            41:                'noconstants' => [@EXPORT]);
        !            42: Exporter::export_ok_tags('all');
        !            43:
        !            44: use overload
        !            45:     '+'    => \&overload_add,     '+='   => \&overload_addeq,
        !            46:     '-'    => \&overload_sub,     '-='   => \&overload_subeq,
        !            47:     '*'    => \&overload_mul,     '*='   => \&overload_muleq,
        !            48:     '/'    => \&overload_div,     '/='   => \&overload_diveq,
        !            49:     '%'    => \&overload_rem,     '%='   => \&overload_remeq,
        !            50:     '<<'   => \&overload_lshift,  '<<='  => \&overload_lshifteq,
        !            51:     '>>'   => \&overload_rshift,  '>>='  => \&overload_rshifteq,
        !            52:     '**'   => \&overload_pow,     '**='  => \&overload_poweq,
        !            53:     '&'    => \&overload_and,     '&='   => \&overload_andeq,
        !            54:     '|'    => \&overload_ior,     '|='   => \&overload_ioreq,
        !            55:     '^'    => \&overload_xor,     '^='   => \&overload_xoreq,
        !            56:
        !            57:     'bool' => \&overload_bool,
        !            58:     'not'  => \&overload_not,
        !            59:     '!'    => \&overload_not,
        !            60:     '~'    => \&overload_com,
        !            61:     '<=>'  => \&overload_spaceship,
        !            62:     '++'   => \&overload_inc,
        !            63:     '--'   => \&overload_dec,
        !            64:     '='    => \&overload_copy,
        !            65:     'abs'  => \&overload_abs,
        !            66:     'neg'  => \&overload_neg,
        !            67:     'sqrt' => \&overload_sqrt,
        !            68:     '""'   => \&overload_string;
        !            69:
        !            70: sub import {
        !            71:   foreach (@_) {
        !            72:     if ($_ eq ':constants') {
        !            73:       overload::constant ('integer' => \&overload_constant,
        !            74:                          'binary'  => \&overload_constant,
        !            75:                          'float'   => \&overload_constant);
        !            76:     } elsif ($_ eq ':noconstants') {
        !            77:       overload::remove_constant ('integer' => \&overload_constant,
        !            78:                                 'binary'  => \&overload_constant,
        !            79:                                 'float'   => \&overload_constant);
        !            80:     }
        !            81:   }
        !            82:   goto &Exporter::import;
        !            83: }
        !            84:
        !            85: 1;
        !            86: __END__
        !            87:
        !            88:
        !            89: # Local variables:
        !            90: # perl-indent-level: 2
        !            91: # End:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>