r34771 - in /branches/upstream/libmath-random-mt-perl: ./ current/ current/t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Mon May 4 17:08:40 UTC 2009
Author: jawnsy-guest
Date: Mon May 4 17:08:23 2009
New Revision: 34771
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=34771
Log:
[svn-inject] Installing original source of libmath-random-mt-perl
Added:
branches/upstream/libmath-random-mt-perl/
branches/upstream/libmath-random-mt-perl/current/
branches/upstream/libmath-random-mt-perl/current/Changes
branches/upstream/libmath-random-mt-perl/current/MANIFEST
branches/upstream/libmath-random-mt-perl/current/META.yml
branches/upstream/libmath-random-mt-perl/current/MT.pm
branches/upstream/libmath-random-mt-perl/current/MT.xs
branches/upstream/libmath-random-mt-perl/current/Makefile.PL
branches/upstream/libmath-random-mt-perl/current/README
branches/upstream/libmath-random-mt-perl/current/_mt.c
branches/upstream/libmath-random-mt-perl/current/mt.h
branches/upstream/libmath-random-mt-perl/current/ppport.h
branches/upstream/libmath-random-mt-perl/current/t/
branches/upstream/libmath-random-mt-perl/current/t/1.t
branches/upstream/libmath-random-mt-perl/current/t/2.t
branches/upstream/libmath-random-mt-perl/current/t/3.t
branches/upstream/libmath-random-mt-perl/current/t/4.t
branches/upstream/libmath-random-mt-perl/current/t/5.t
branches/upstream/libmath-random-mt-perl/current/typemap
Added: branches/upstream/libmath-random-mt-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/Changes?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/Changes (added)
+++ branches/upstream/libmath-random-mt-perl/current/Changes Mon May 4 17:08:23 2009
@@ -1,0 +1,32 @@
+1.07 2007-01-12 Abhijit Menon-Sen <ams at toroid.org>
+
+ * Add the Changes file to the MANIFEST, in addition to editing it
+ each time. (Thanks to John M. Gamble.)
+
+ There have been no changes in functionality since 1.03.
+
+
+1.06 2007-01-11 Abhijit Menon-Sen <ams at toroid.org>
+
+ * Minor POD fix from Steven Schubiger.
+
+
+1.05 2007-01-11 Abhijit Menon-Sen <ams at toroid.org>
+
+ * Mingw compile fix from Steffen Mueller.
+
+
+1.04 2004-10-09 Abhijit Menon-Sen <ams at wiw.org>
+
+ * Incorporated some compile fixes from Gordon Lack.
+
+
+1.02 2004-05-07 Abhijit Menon-Sen <ams at wiw.org>
+
+ * Added support for seeding the random number generator with an
+ array of numbers, as suggested by Philip M. Feldman.
+
+
+1.00 2002-02-09 Abhijit Menon-Sen <ams at wiw.org>
+
+ * First stable release.
Added: branches/upstream/libmath-random-mt-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/MANIFEST?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/MANIFEST (added)
+++ branches/upstream/libmath-random-mt-perl/current/MANIFEST Mon May 4 17:08:23 2009
@@ -1,0 +1,16 @@
+MANIFEST
+MT.pm
+MT.xs
+Makefile.PL
+README
+Changes
+_mt.c
+mt.h
+ppport.h
+t/1.t
+t/2.t
+t/3.t
+t/4.t
+t/5.t
+typemap
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libmath-random-mt-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/META.yml?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/META.yml (added)
+++ branches/upstream/libmath-random-mt-perl/current/META.yml Mon May 4 17:08:23 2009
@@ -1,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Math-Random-MT
+version: 1.07
+version_from: MT.pm
+installdirs: site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
Added: branches/upstream/libmath-random-mt-perl/current/MT.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/MT.pm?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/MT.pm (added)
+++ branches/upstream/libmath-random-mt-perl/current/MT.pm Mon May 4 17:08:23 2009
@@ -1,0 +1,143 @@
+# Math::Random::MT
+# Copyright 2001 Abhijit Menon-Sen <ams at wiw.org>
+
+package Math::Random::MT;
+
+use strict;
+use Carp;
+use DynaLoader;
+use vars qw( @ISA $VERSION );
+
+my $gen = undef;
+ at ISA = qw( DynaLoader );
+($VERSION) = q$Revision: 1.07 $ =~ /([\d.]+)/;
+
+bootstrap Math::Random::MT $VERSION;
+
+sub new
+{
+ my $class = shift;
+
+ if ( @_ == 1 ) {
+ return Math::Random::MT::setup( shift );
+ }
+ else {
+ return Math::Random::MT::setup_array( @_ );
+ }
+}
+
+sub rand
+{
+ my ($self, $N) = @_;
+ if (ref $self) {
+ return ($N || 1) * $self->genrand();
+ }
+ else {
+ $N = $self;
+ Math::Random::MT::srand() unless defined $gen;
+ return ($N || 1) * $gen->genrand();
+ }
+}
+
+# Don't rely on the default seed.
+sub srand { $gen = new Math::Random::MT (shift || time); }
+
+sub import
+{
+ no strict 'refs';
+ my $pkg = caller;
+
+ foreach my $sym (@_) {
+ if ($sym eq "srand" || $sym eq "rand") {
+ *{"${pkg}::$sym"} = \&$sym;
+ }
+ }
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Math::Random::MT - The Mersenne Twister PRNG
+
+=head1 SYNOPSIS
+
+ use Math::Random::MT;
+
+ $gen = Math::Random::MT->new($seed); # OR...
+ $gen = Math::Random::MT->new(@seed);
+
+ print $gen->rand(3);
+
+ OR
+
+ use Math::Random::MT qw(srand rand);
+
+ # now srand and rand behave as usual.
+
+=head1 DESCRIPTION
+
+The Mersenne Twister is a pseudorandom number generator developed by
+Makoto Matsumoto and Takuji Nishimura. It is described in their paper at
+<URL:http://www.math.keio.ac.jp/~nisimura/random/doc/mt.ps>.
+
+This module implements two interfaces, as described in the synopsis
+above. It defines the following functions.
+
+=head2 Functions
+
+=over
+
+=item new($seed)
+
+Creates a new generator seeded with an unsigned 32-bit integer.
+
+=item new(@seed)
+
+Creates a new generator seeded with an array of (up to 624) unsigned
+32-bit integers.
+
+=item rand($num)
+
+Behaves exactly like Perl's builtin rand(), returning a number uniformly
+distributed in [0, $num) ($num defaults to 1).
+
+=item srand($seed)
+
+This is an alternative interface to the module's functionality. It
+behaves just like Perl's builtin srand(). If you use this interface, it
+is strongly recommended that you call I<srand()> explicitly, rather than
+relying on I<rand()> to call it the first time it is used.
+
+=back
+
+=head1 SEE ALSO
+
+<URL:http://www.math.keio.ac.jp/~matumoto/emt.html>
+
+Math::TrulyRandom
+
+=head1 ACKNOWLEDGEMENTS
+
+=over 4
+
+=item Sean M. Burke
+
+For giving me the idea to write this module.
+
+=item Philip Newton
+
+For several useful patches.
+
+=back
+
+=head1 AUTHOR
+
+Abhijit Menon-Sen <ams at wiw.org>
+
+Copyright 2001 Abhijit Menon-Sen. All rights reserved.
+
+This software is distributed under the terms of the Artistic License
+<URL:http://ams.wiw.org/code/artistic.txt>.
Added: branches/upstream/libmath-random-mt-perl/current/MT.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/MT.xs?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/MT.xs (added)
+++ branches/upstream/libmath-random-mt-perl/current/MT.xs Mon May 4 17:08:23 2009
@@ -1,0 +1,56 @@
+/*
+ * Math::Random::MT
+ * Copyright 2001 Abhijit Menon-Sen <ams at wiw.org>
+ */
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include "ppport.h"
+
+#include "mt.h"
+
+typedef struct mt * Math__Random__MT;
+
+void * U32ArrayPtr ( int n ) {
+ SV * sv = sv_2mortal( NEWSV( 0, n*sizeof(U32) ) );
+ return SvPVX(sv);
+}
+
+MODULE = Math::Random::MT PACKAGE = Math::Random::MT PREFIX = mt_
+PROTOTYPES: DISABLE
+
+Math::Random::MT
+mt_setup(seed)
+ U32 seed
+ CODE:
+ RETVAL = mt_setup(seed);
+ OUTPUT:
+ RETVAL
+
+Math::Random::MT
+mt_setup_array( array, ... )
+ CODE:
+ U32 * array = U32ArrayPtr( items );
+ U32 ix_array = 0;
+ while (items--) {
+ array[ix_array] = (U32)SvIV(ST(ix_array));
+ ix_array++;
+ }
+ RETVAL = mt_setup_array( (uint32_t*)array, ix_array );
+ OUTPUT:
+ RETVAL
+
+void
+mt_DESTROY(self)
+ Math::Random::MT self
+ CODE:
+ mt_free(self);
+
+double
+mt_genrand(self)
+ Math::Random::MT self
+ CODE:
+ RETVAL = mt_genrand(self);
+ OUTPUT:
+ RETVAL
Added: branches/upstream/libmath-random-mt-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/Makefile.PL?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/Makefile.PL (added)
+++ branches/upstream/libmath-random-mt-perl/current/Makefile.PL Mon May 4 17:08:23 2009
@@ -1,0 +1,8 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Math::Random::MT',
+ OBJECT => 'MT.o _mt.o',
+ VERSION_FROM => 'MT.pm',
+ ABSTRACT_FROM => 'MT.pm',
+);
Added: branches/upstream/libmath-random-mt-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/README?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/README (added)
+++ branches/upstream/libmath-random-mt-perl/current/README Mon May 4 17:08:23 2009
@@ -1,0 +1,68 @@
+NAME
+ Math::Random::MT - The Mersenne Twister PRNG
+
+SYNOPSIS
+ use Math::Random::MT;
+
+ $gen = Math::Random::MT->new($seed); # OR...
+ $gen = Math::Random::MT->new(@seed);
+
+ print $gen->rand(3);
+
+ OR
+
+ use Math::Random::MT qw(srand rand);
+
+ # now srand and rand behave as usual.
+
+DESCRIPTION
+ The Mersenne Twister is a pseudorandom number generator
+ developed by Makoto Matsumoto and Takuji Nishimura. It is
+ described in their paper at
+ <URL:http://www.math.keio.ac.jp/~nisimura/random/doc/mt.ps>.
+
+ This module implements two interfaces, as described in the
+ synopsis above. It defines the following functions.
+
+ Functions
+
+ new($seed)
+ Creates a new generator seeded with an unsigned 32-bit
+ integer.
+
+ new(@seed)
+ Creates a new generator seeded with an array of (up to 624)
+ unsigned 32-bit integers.
+
+ rand($num)
+ Behaves exactly like Perl's builtin rand(), returning a
+ number uniformly distributed in [0, $num) ($num defaults to
+ 1).
+
+ srand($seed)
+ This is an alternative interface to the module's
+ functionality. It behaves just like Perl's builtin srand().
+ If you use this interface, it is strongly recommended that
+ you call *srand()* explicitly, rather than relying on
+ *rand()* to call it the first time it is used.
+
+SEE ALSO
+ <URL:http://www.math.keio.ac.jp/~matumoto/emt.html>
+
+ Math::TrulyRandom
+
+ACKNOWLEDGEMENTS
+ Sean M. Burke
+ For giving me the idea to write this module.
+
+ Philip Newton
+ For several useful patches.
+
+AUTHOR
+ Abhijit Menon-Sen <ams at wiw.org>
+
+ Copyright 2001 Abhijit Menon-Sen. All rights reserved.
+
+ This software is distributed under the terms of the Artistic
+ License <URL:http://ams.wiw.org/code/artistic.txt>.
+
Added: branches/upstream/libmath-random-mt-perl/current/_mt.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/_mt.c?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/_mt.c (added)
+++ branches/upstream/libmath-random-mt-perl/current/_mt.c Mon May 4 17:08:23 2009
@@ -1,0 +1,113 @@
+/*
+ * Math::Random::MT
+ * Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura.
+ * Copyright 2001 Abhijit Menon-Sen <ams at wiw.org>
+ */
+
+#include "mt.h"
+
+#include <stdio.h>
+
+/* This code is based on mt19937ar.c, written by Takuji Nishimura and
+ Makoto Matsumoto (20020126). Further details are available at
+ <URL:http://www.math.keio.ac.jp/matumoto/emt.html>.
+
+ REFERENCE
+ M. Matsumoto and T. Nishimura,
+ "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform
+ Pseudo-Random Number Generator",
+ ACM Transactions on Modeling and Computer Simulation,
+ Vol. 8, No. 1, January 1998, pp 3--30. */
+
+void mt_init_seed( struct mt *m, uint32_t seed )
+{
+ int i;
+ uint32_t *mt;
+
+ mt = m->mt;
+ mt[0] = seed & 0xffffffff;
+ for ( i = 1; i < N; i++ )
+ mt[i] = 1812433253 * (mt[i-1]^(mt[i-1]>>30)) + i;
+ m->mti = N;
+}
+
+struct mt *mt_setup(uint32_t seed)
+{
+ struct mt *self = malloc(sizeof(struct mt));
+
+ if (self)
+ mt_init_seed( self, seed );
+
+ return self;
+}
+
+struct mt *mt_setup_array( uint32_t *array, int n )
+{
+ int i, j, k;
+ struct mt *self = malloc(sizeof(struct mt));
+ uint32_t *mt;
+
+ if (self) {
+ mt_init_seed( self, 19650218UL );
+
+ i = 1; j = 0;
+ k = ( N > n ? N : n );
+ mt = self->mt;
+
+ for (; k; k--) {
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
+ + array[j] + j;
+ i++; j++;
+ if (i>=N) { mt[0] = mt[N-1]; i=1; }
+ if (j>=n) j=0;
+ }
+ for (k=N-1; k; k--) {
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL)) - i;
+ i++;
+ if (i>=N) { mt[0] = mt[N-1]; i=1; }
+ }
+
+ mt[0] = 0x80000000UL;
+ }
+
+ return self;
+}
+
+void mt_free(struct mt *self)
+{
+ free(self);
+}
+
+/* Returns a pseudorandom number which is uniformly distributed in [0,1) */
+double mt_genrand(struct mt *self)
+{
+ int kk;
+ uint32_t y;
+ static uint32_t mag01[2] = {0x0, 0x9908b0df};
+ static const uint32_t UP_MASK = 0x80000000, LOW_MASK = 0x7fffffff;
+
+ if (self->mti >= N) {
+ for (kk = 0; kk < N-M; kk++) {
+ y = (self->mt[kk] & UP_MASK) | (self->mt[kk+1] & LOW_MASK);
+ self->mt[kk] = self->mt[kk+M] ^ (y >> 1) ^ mag01[y & 1];
+ }
+
+ for (; kk < N-1; kk++) {
+ y = (self->mt[kk] & UP_MASK) | (self->mt[kk+1] & LOW_MASK);
+ self->mt[kk] = self->mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 1];
+ }
+
+ y = (self->mt[N-1] & UP_MASK) | (self->mt[0] & LOW_MASK);
+ self->mt[N-1] = self->mt[M-1] ^ (y >> 1) ^ mag01[y & 1];
+
+ self->mti = 0;
+ }
+
+ y = self->mt[self->mti++];
+ y ^= y >> 11;
+ y ^= y << 7 & 0x9d2c5680;
+ y ^= y << 15 & 0xefc60000;
+ y ^= y >> 18;
+
+ return y*(1.0/4294967296.0);
+}
Added: branches/upstream/libmath-random-mt-perl/current/mt.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/mt.h?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/mt.h (added)
+++ branches/upstream/libmath-random-mt-perl/current/mt.h Mon May 4 17:08:23 2009
@@ -1,0 +1,32 @@
+/*
+ * $Id: mt.h,v 1.00 2002/02/08 19:22:46 ams Exp $
+ * Copyright 2001 Abhijit Menon-Sen <ams at wiw.org>
+ */
+
+#include <stdlib.h>
+
+#if defined(__linux__) || defined(__WIN32__)
+#include <stdint.h>
+#elif defined(__osf__)
+#include <inttypes.h>
+#else
+#include <sys/types.h>
+#endif
+
+#ifndef _MATH_MT_H_
+#define _MATH_MT_H_
+
+/* Period parameters */
+enum { N = 624, M = 397 };
+
+struct mt {
+ uint32_t mt[N];
+ int mti;
+};
+
+struct mt *mt_setup(uint32_t seed);
+struct mt *mt_setup_array(uint32_t *array, int n);
+void mt_free(struct mt *self);
+double mt_genrand(struct mt *self);
+
+#endif
Added: branches/upstream/libmath-random-mt-perl/current/ppport.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/ppport.h?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/ppport.h (added)
+++ branches/upstream/libmath-random-mt-perl/current/ppport.h Mon May 4 17:08:23 2009
@@ -1,0 +1,286 @@
+
+#ifndef _P_P_PORTABILITY_H_
+#define _P_P_PORTABILITY_H_
+
+/* Perl/Pollution/Portability Version 1.0007 */
+
+/* Copyright (C) 1999, Kenneth Albanowski. This code may be used and
+ distributed under the same license as any version of Perl. */
+
+/* For the latest version of this code, please retreive the Devel::PPPort
+ module from CPAN, contact the author at <kjahds at kjahds.com>, or check
+ with the Perl maintainers. */
+
+/* If you needed to customize this file for your project, please mention
+ your changes, and visible alter the version number. */
+
+
+/*
+ In order for a Perl extension module to be as portable as possible
+ across differing versions of Perl itself, certain steps need to be taken.
+ Including this header is the first major one, then using dTHR is all the
+ appropriate places and using a PL_ prefix to refer to global Perl
+ variables is the second.
+*/
+
+
+/* If you use one of a few functions that were not present in earlier
+ versions of Perl, please add a define before the inclusion of ppport.h
+ for a static include, or use the GLOBAL request in a single module to
+ produce a global definition that can be referenced from the other
+ modules.
+
+ Function: Static define: Extern define:
+ newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
+
+*/
+
+
+/* To verify whether ppport.h is needed for your module, and whether any
+ special defines should be used, ppport.h can be run through Perl to check
+ your source code. Simply say:
+
+ perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
+
+ The result will be a list of patches suggesting changes that should at
+ least be acceptable, if not necessarily the most efficient solution, or a
+ fix for all possible problems. It won't catch where dTHR is needed, and
+ doesn't attempt to account for global macro or function definitions,
+ nested includes, typemaps, etc.
+
+ In order to test for the need of dTHR, please try your module under a
+ recent version of Perl that has threading compiled-in.
+
+*/
+
+
+/*
+#!/usr/bin/perl
+ at ARGV = ("*.xs") if !@ARGV;
+%badmacros = %funcs = %macros = (); $replace = 0;
+foreach (<DATA>) {
+ $funcs{$1} = 1 if /Provide:\s+(\S+)/;
+ $macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/;
+ $replace = $1 if /Replace:\s+(\d+)/;
+ $badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/;
+ $badmacros{$1}=$2 if /Replace (\S+) with (\S+)/;
+}
+foreach $filename (map(glob($_), at ARGV)) {
+ unless (open(IN, "<$filename")) {
+ warn "Unable to read from $file: $!\n";
+ next;
+ }
+ print "Scanning $filename...\n";
+ $c = ""; while (<IN>) { $c .= $_; } close(IN);
+ $need_include = 0; %add_func = (); $changes = 0;
+ $has_include = ($c =~ /#.*include.*ppport/m);
+
+ foreach $func (keys %funcs) {
+ if ($c =~ /#.*define.*\bNEED_$func(_GLOBAL)?\b/m) {
+ if ($c !~ /\b$func\b/m) {
+ print "If $func isn't needed, you don't need to request it.\n" if
+ $changes += ($c =~ s/^.*#.*define.*\bNEED_$func\b.*\n//m);
+ } else {
+ print "Uses $func\n";
+ $need_include = 1;
+ }
+ } else {
+ if ($c =~ /\b$func\b/m) {
+ $add_func{$func} =1 ;
+ print "Uses $func\n";
+ $need_include = 1;
+ }
+ }
+ }
+
+ if (not $need_include) {
+ foreach $macro (keys %macros) {
+ if ($c =~ /\b$macro\b/m) {
+ print "Uses $macro\n";
+ $need_include = 1;
+ }
+ }
+ }
+
+ foreach $badmacro (keys %badmacros) {
+ if ($c =~ /\b$badmacro\b/m) {
+ $changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm);
+ print "Uses $badmacros{$badmacro} (instead of $badmacro)\n";
+ $need_include = 1;
+ }
+ }
+
+ if (scalar(keys %add_func) or $need_include != $has_include) {
+ if (!$has_include) {
+ $inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
+ "#include \"ppport.h\"\n";
+ $c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
+ } elsif (keys %add_func) {
+ $inc = join('',map("#define NEED_$_\n", sort keys %add_func));
+ $c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m;
+ }
+ if (!$need_include) {
+ print "Doesn't seem to need ppport.h.\n";
+ $c =~ s/^.*#.*include.*ppport.*\n//m;
+ }
+ $changes++;
+ }
+
+ if ($changes) {
+ open(OUT,">/tmp/ppport.h.$$");
+ print OUT $c;
+ close(OUT);
+ open(DIFF, "diff -u $filename /tmp/ppport.h.$$|");
+ while (<DIFF>) { s!/tmp/ppport\.h\.$$!$filename.patched!; print STDOUT; }
+ close(DIFF);
+ unlink("/tmp/ppport.h.$$");
+ } else {
+ print "Looks OK\n";
+ }
+}
+__DATA__
+*/
+
+#ifndef PERL_REVISION
+# ifndef __PATCHLEVEL_H_INCLUDED__
+# include "patchlevel.h"
+# endif
+# ifndef PERL_REVISION
+# define PERL_REVISION (5)
+ /* Replace: 1 */
+# define PERL_VERSION PATCHLEVEL
+# define PERL_SUBVERSION SUBVERSION
+ /* Replace PERL_PATCHLEVEL with PERL_VERSION */
+ /* Replace: 0 */
+# endif
+#endif
+
+#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
+
+#ifndef ERRSV
+# define ERRSV perl_get_sv("@",FALSE)
+#endif
+
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
+/* Replace: 1 */
+# define PL_sv_undef sv_undef
+# define PL_sv_yes sv_yes
+# define PL_sv_no sv_no
+# define PL_na na
+# define PL_stdingv stdingv
+# define PL_hints hints
+# define PL_curcop curcop
+# define PL_curstash curstash
+# define PL_copline copline
+# define PL_Sv Sv
+/* Replace: 0 */
+#endif
+
+#ifndef dTHR
+# ifdef WIN32
+# define dTHR extern int Perl___notused
+# else
+# define dTHR extern int errno
+# endif
+#endif
+
+#ifndef boolSV
+# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
+#endif
+
+#ifndef gv_stashpvn
+# define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
+#endif
+
+#ifndef newSVpvn
+# define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
+#endif
+
+#ifndef newRV_inc
+/* Replace: 1 */
+# define newRV_inc(sv) newRV(sv)
+/* Replace: 0 */
+#endif
+
+#ifndef newRV_noinc
+# ifdef __GNUC__
+# define newRV_noinc(sv) \
+ ({ \
+ SV *nsv = (SV*)newRV(sv); \
+ SvREFCNT_dec(sv); \
+ nsv; \
+ })
+# else
+# if defined(CRIPPLED_CC) || defined(USE_THREADS)
+static SV * newRV_noinc (SV * sv)
+{
+ SV *nsv = (SV*)newRV(sv);
+ SvREFCNT_dec(sv);
+ return nsv;
+}
+# else
+# define newRV_noinc(sv) \
+ ((PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
+# endif
+# endif
+#endif
+
+/* Provide: newCONSTSUB */
+
+/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))
+
+#if defined(NEED_newCONSTSUB)
+static
+#else
+extern void newCONSTSUB _((HV * stash, char * name, SV *sv));
+#endif
+
+#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
+void
+newCONSTSUB(stash,name,sv)
+HV *stash;
+char *name;
+SV *sv;
+{
+ U32 oldhints = PL_hints;
+ HV *old_cop_stash = PL_curcop->cop_stash;
+ HV *old_curstash = PL_curstash;
+ line_t oldline = PL_curcop->cop_line;
+ PL_curcop->cop_line = PL_copline;
+
+ PL_hints &= ~HINT_BLOCK_SCOPE;
+ if (stash)
+ PL_curstash = PL_curcop->cop_stash = stash;
+
+ newSUB(
+
+#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
+ /* before 5.003_22 */
+ start_subparse(),
+#else
+# if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
+ /* 5.003_22 */
+ start_subparse(0),
+# else
+ /* 5.003_23 onwards */
+ start_subparse(FALSE, 0),
+# endif
+#endif
+
+ newSVOP(OP_CONST, 0, newSVpv(name,0)),
+ newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */
+ newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+ );
+
+ PL_hints = oldhints;
+ PL_curcop->cop_stash = old_cop_stash;
+ PL_curstash = old_curstash;
+ PL_curcop->cop_line = oldline;
+}
+#endif
+
+#endif /* newCONSTSUB */
+
+
+#endif /* _P_P_PORTABILITY_H_ */
Added: branches/upstream/libmath-random-mt-perl/current/t/1.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/t/1.t?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/t/1.t (added)
+++ branches/upstream/libmath-random-mt-perl/current/t/1.t Mon May 4 17:08:23 2009
@@ -1,0 +1,14 @@
+use strict;
+
+use Test;
+use vars qw($loaded);
+use Benchmark qw(timediff timestr);
+
+BEGIN { plan tests => 4 }
+END { print "not ok 1\n" unless $loaded }
+
+use Math::Random::MT;
+ok($loaded = 1);
+ok(my $gen = Math::Random::MT->new(5489));
+ok(0.814723691903055, $gen->rand());
+ok(0.135477004107088, $gen->rand());
Added: branches/upstream/libmath-random-mt-perl/current/t/2.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/t/2.t?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/t/2.t (added)
+++ branches/upstream/libmath-random-mt-perl/current/t/2.t Mon May 4 17:08:23 2009
@@ -1,0 +1,21 @@
+use strict;
+
+use Test;
+use vars qw($loaded $num1 $num2);
+use Benchmark qw(timediff timestr);
+
+BEGIN { plan tests => 7 }
+END { print "not ok 1\n" unless $loaded }
+
+# Check that it's possible to call rand() without srand()
+
+use Math::Random::MT qw(srand rand);
+ok($loaded = 1);
+eval { $num1 = rand; };
+ok($@, '', '$@ should be empty after rand() but it\'s: '.$@);
+ok(defined($num1));
+ok(0 <= $num1);
+ok($num1 < 1); # rand without argument is like rand(1)
+eval { $num2 = rand; };
+ok($@, '', '$@ should also be empty the second time rand() is called');
+ok($num1 != $num2);
Added: branches/upstream/libmath-random-mt-perl/current/t/3.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/t/3.t?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/t/3.t (added)
+++ branches/upstream/libmath-random-mt-perl/current/t/3.t Mon May 4 17:08:23 2009
@@ -1,0 +1,20 @@
+use strict;
+
+use Test;
+use vars qw($loaded $num1 $num2);
+use Benchmark qw(timediff timestr);
+
+BEGIN { plan tests => 7 }
+END { print "not ok 1\n" unless $loaded }
+
+use Math::Random::MT qw(srand rand);
+ok($loaded = 1);
+srand; # explicit srand, but without number
+eval { $num1 = rand; };
+ok($@, '', '$@ should be empty after rand()');
+ok(defined($num1));
+ok(0 <= $num1);
+ok($num1 < 1); # rand without argument is like rand(1)
+eval { $num2 = rand; };
+ok($@, '', '$@ should also be empty the second time rand() is called');
+ok($num1 != $num2);
Added: branches/upstream/libmath-random-mt-perl/current/t/4.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/t/4.t?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/t/4.t (added)
+++ branches/upstream/libmath-random-mt-perl/current/t/4.t Mon May 4 17:08:23 2009
@@ -1,0 +1,17 @@
+use strict;
+
+use Test;
+use vars qw($loaded);
+use Benchmark qw(timediff timestr);
+
+BEGIN { plan tests => 3 }
+END { print "not ok 1\n" unless $loaded }
+
+# Check that the results are the same with the function-call interface
+# as with the OO interface
+
+use Math::Random::MT qw(srand rand);
+ok($loaded = 1);
+srand(5489);
+ok(0.814723691903055, rand());
+ok(0.135477004107088, rand());
Added: branches/upstream/libmath-random-mt-perl/current/t/5.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/t/5.t?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/t/5.t (added)
+++ branches/upstream/libmath-random-mt-perl/current/t/5.t Mon May 4 17:08:23 2009
@@ -1,0 +1,17 @@
+use strict;
+
+use Test;
+use vars qw($loaded);
+use Benchmark qw(timediff timestr);
+
+BEGIN { plan tests => 3 }
+END { print "not ok 1\n" unless $loaded }
+
+# Check that we can use an array to seed the generator.
+
+use Math::Random::MT;
+
+my $gen;
+ok($loaded = 1);
+ok( $gen = Math::Random::MT->new(1, 2, 3, 4) );
+ok( $gen->rand(1), 0.67886575916782 );
Added: branches/upstream/libmath-random-mt-perl/current/typemap
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-random-mt-perl/current/typemap?rev=34771&op=file
==============================================================================
--- branches/upstream/libmath-random-mt-perl/current/typemap (added)
+++ branches/upstream/libmath-random-mt-perl/current/typemap Mon May 4 17:08:23 2009
@@ -1,0 +1,1 @@
+Math::Random::MT T_PTROBJ
More information about the Pkg-perl-cvs-commits
mailing list