r3288 - in /packages/libbit-vector-minimal-perl: ./ branches/ branches/upstream/ branches/upstream/current/ branches/upstream/current/lib/ branches/upstream/current/lib/Bit/ branches/upstream/current/lib/Bit/Vector/ branches/upstream/current/t/ tags/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Fri Jul 14 21:35:43 UTC 2006


Author: gregoa-guest
Date: Fri Jul 14 21:35:42 2006
New Revision: 3288

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3288
Log:
[svn-inject] Installing original source of libbit-vector-minimal-perl

Added:
    packages/libbit-vector-minimal-perl/
    packages/libbit-vector-minimal-perl/branches/
    packages/libbit-vector-minimal-perl/branches/upstream/
    packages/libbit-vector-minimal-perl/branches/upstream/current/
    packages/libbit-vector-minimal-perl/branches/upstream/current/Changes
    packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST
    packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST.SKIP
    packages/libbit-vector-minimal-perl/branches/upstream/current/META.yml
    packages/libbit-vector-minimal-perl/branches/upstream/current/Makefile.PL
    packages/libbit-vector-minimal-perl/branches/upstream/current/README
    packages/libbit-vector-minimal-perl/branches/upstream/current/lib/
    packages/libbit-vector-minimal-perl/branches/upstream/current/lib/Bit/
    packages/libbit-vector-minimal-perl/branches/upstream/current/lib/Bit/Vector/
    packages/libbit-vector-minimal-perl/branches/upstream/current/lib/Bit/Vector/Minimal.pm
    packages/libbit-vector-minimal-perl/branches/upstream/current/t/
    packages/libbit-vector-minimal-perl/branches/upstream/current/t/1.t
    packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod-coverage.t
    packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod.t
    packages/libbit-vector-minimal-perl/tags/

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/Changes?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/Changes (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/Changes Fri Jul 14 21:35:42 2006
@@ -1,0 +1,17 @@
+Revision history for Perl extension Bit::Vector::Minimal.
+
+1.3 Tue Oct  4 11:07:43 UTC 2005
+  - Minor minor tweaks
+  - Document 'display' method
+
+1.2 Thu Sep  1 07:57:25 UTC 2005
+  - Properly initialise pattern where size is not a multiple of 8
+    (Marvin Humphrey)
+
+1.1 Sun Oct 10 09:04:02 UTC 2004
+  - Tony Bowden now maintainer
+
+1.0  Tue Nov  4 16:09:08 2003
+  - original version; created by h2xs 1.22 with options
+    -b 5.6.0 -AX -n Bit::Vector::Minimal
+

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST Fri Jul 14 21:35:42 2006
@@ -1,0 +1,10 @@
+Changes
+lib/Bit/Vector/Minimal.pm
+Makefile.PL
+MANIFEST
+MANIFEST.SKIP
+META.yml			Module meta-data (added by MakeMaker)
+README
+t/1.t
+t/pod-coverage.t
+t/pod.t

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST.SKIP?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST.SKIP (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/MANIFEST.SKIP Fri Jul 14 21:35:42 2006
@@ -1,0 +1,32 @@
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+,v$
+,B$
+,D$
+\B\.svn\b
+aegis.log$
+\bconfig$
+\bbuild$
+
+# Avoid Makemaker generated and utility files.
+\bMakefile$
+\bblib
+\bMakeMaker-\d
+\bpm_to_blib$
+\bblibdirs$
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build
+
+# Avoid temp and backup files.
+~$
+\.gz$
+\.old$
+\.bak$
+\.swp$
+\.tdy$
+\#$
+\b\.#
+

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/META.yml?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/META.yml (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/META.yml Fri Jul 14 21:35:42 2006
@@ -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:         Bit-Vector-Minimal
+version:      1.3
+version_from: lib/Bit/Vector/Minimal.pm
+installdirs:  site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/Makefile.PL?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/Makefile.PL Fri Jul 14 21:35:42 2006
@@ -1,0 +1,10 @@
+use 5.006;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+	NAME          => 'Bit::Vector::Minimal',
+	VERSION_FROM  => 'lib/Bit/Vector/Minimal.pm',
+	ABSTRACT_FROM => 'lib/Bit/Vector/Minimal.pm',
+	PREREQ_PM     => {},
+	AUTHOR        => 'Tony Bowden <tmtm at cpan.org>',
+);

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/README?rev=3288&op=file
==============================================================================
    (empty)

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/lib/Bit/Vector/Minimal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/lib/Bit/Vector/Minimal.pm?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/lib/Bit/Vector/Minimal.pm (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/lib/Bit/Vector/Minimal.pm Fri Jul 14 21:35:42 2006
@@ -1,0 +1,131 @@
+package Bit::Vector::Minimal;
+
+use 5.006;
+
+use strict;
+use warnings;
+
+use Carp;
+
+our $VERSION = '1.3';
+
+=head1 NAME
+
+Bit::Vector::Minimal - Object-oriented wrapper around vec()
+
+=head1 SYNOPSIS
+
+  use Bit::Vector::Minimal;
+  my $vec = Bit::Vector->new(size => 8, width => 1, endianness => "little");
+  # These are the defaults
+
+  $vec->set(1); # $vec's internal vector now looks like "00000010"
+  $vec->get(3); # 0
+
+=head1 DESCRIPTION
+
+This is a much simplified, lightweight version of L<Bit::Vector>, and
+wraps Perl's (sometimes confusing) C<vec> function in an object-oriented
+abstraction.
+
+=head1 METHODS
+
+=head2 new
+
+Creates a new bit vector. By default, this creates a one-byte vector
+with 8 one-bit "slots", with bit zero on the right of the bit pattern.
+These settings can be changed by passing parameters to the constructor:
+C<size> will alter the size in bits of the vector; C<width> will alter
+the width of the slots. The module will die if C<width> is not an
+integer divisor of C<size>. C<endianness> controls whether the zeroth
+place is on the right or the left of the bit vector.
+
+=cut
+
+sub new {
+	my $class = shift;
+	my $self = bless {
+		width      => 1,
+		size       => 8,
+		endianness => "little",
+		@_
+	}, $class;
+	croak "Don't know what endianness $self->{endianness} is meant to be"
+		unless $self->{endianness} =~ /^(little|big)$/i;
+
+	croak "Width ought to be a power of two"
+		if !$self->{width}
+		or (($self->{width} - 1) & $self->{width});
+
+	my $slots = $self->{size} / $self->{width};
+	croak "Cowardly refusing to store $slots items in a vector"
+		unless $slots == int($slots);
+	my $num_bytes =
+		$self->{size} % 8
+		? (($self->{size} + (8 - $self->{size} % 8)) / 8)
+		: ($self->{size} / 8);
+	$self->{pattern} = "\0" x $num_bytes;
+	return $self;
+}
+
+=head2 set(POS[, VALUE])
+
+Sets the bit or slot at position C<POS> to value C<VALUE> or "all bits
+on" if C<VALUE> is not given.
+
+=cut
+
+sub set {
+	my ($self, $pos, $value) = @_;
+	$value = 2**$self->{width} - 1 unless defined $value;
+	$pos = 1 + $self->{width} - $pos if $self->{endianness} eq "big";
+	vec($self->{pattern}, $pos, $self->{width}) = $value;
+}
+
+=head2 get(POS)
+
+Returns the bit or slot at position C<POS>.
+
+=cut
+
+sub get {
+	my ($self, $pos) = @_;
+	$pos = 1 + $self->{width} - $pos if $self->{endianness} eq "big";
+	return vec($self->{pattern}, $pos, $self->{width});
+}
+
+=head2 display
+
+Display the vector. For debugging purposes.
+
+=cut
+
+sub display { 
+	my $self = shift;
+	return join "", map sprintf("%08b", ord $_), split //, $self->{pattern};
+}
+
+=head1 AUTHOR
+
+Current maintainer: Tony Bowden
+
+Original author: Simon Cozens
+
+=head1 BUGS and QUERIES
+
+Please direct all correspondence regarding this module to:
+  bug-Bit-Vector-Minimal at rt.cpan.org
+
+=head1 SEE ALSO
+
+L<Bit::Vector>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2003, 2004 by Kasei
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself. 
+
+=cut
+

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/t/1.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/t/1.t?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/t/1.t (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/t/1.t Fri Jul 14 21:35:42 2006
@@ -1,0 +1,36 @@
+# vim:ft=perl
+
+use Test::More tests => 10;
+
+use_ok("Bit::Vector::Minimal");
+
+{
+	my $vec = Bit::Vector::Minimal->new;
+	isa_ok $vec => "Bit::Vector::Minimal";
+
+	$vec->set(2);
+	is $vec->display(), "00000100", "pattern set correctly for default LE";
+	is $vec->get(2), 1, "Bit two set";
+	is $vec->get(3), 0, "Bit three not set";
+}
+
+{
+	my $vec = Bit::Vector::Minimal->new(
+		size       => 32,
+		width      => 2,
+		endianness => "big"
+	);
+	isa_ok $vec => "Bit::Vector::Minimal";
+	$vec->set(2, 0b10);
+	is $vec->display(), "00001000000000000000000000000000",
+		"pattern set correctly for BE";
+}
+
+{
+	for (19 .. 21) {
+		my $vec = Bit::Vector::Minimal->new(size => $_);
+		is $vec->display(), "000000000000000000000000",
+			"pattern initialized correctly when size not divisible by 8";
+	}
+}
+

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod-coverage.t?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod-coverage.t (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod-coverage.t Fri Jul 14 21:35:42 2006
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Added: packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod.t?rev=3288&op=file
==============================================================================
--- packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod.t (added)
+++ packages/libbit-vector-minimal-perl/branches/upstream/current/t/pod.t Fri Jul 14 21:35:42 2006
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();




More information about the Pkg-perl-cvs-commits mailing list