Tested in the 'noautopack' branch. Passed all pre- and post-configuration tests; built correctly; passed all tests in 'make test'.
If no one objects, I'll apply this patch after tomorrow's release. Thank you very much. kid51
Index: lib/Parrot/Configure/Step/List.pm =================================================================== --- lib/Parrot/Configure/Step/List.pm (.../trunk) (revision 29453) +++ lib/Parrot/Configure/Step/List.pm (.../branches/noautopack) (revision 29456) @@ -39,7 +39,6 @@ auto::sizes auto::byteorder auto::va_ptr - auto::pack auto::format auto::isreg auto::arch Index: MANIFEST =================================================================== --- MANIFEST (.../trunk) (revision 29453) +++ MANIFEST (.../branches/noautopack) (revision 29456) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Sun Jul 13 15:49:36 2008 UT +# generated by tools/dev/mk_manifest_and_skip.pl Tue Jul 15 01:38:38 2008 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -271,7 +271,6 @@ config/auto/opengl.pm [] config/auto/opengl/opengl.in [] config/auto/ops.pm [] -config/auto/pack.pm [] config/auto/pcre.pm [] config/auto/pcre/pcre.in [] config/auto/perldoc.pm [] @@ -3739,7 +3738,6 @@ t/steps/auto_opengl-02.t [] t/steps/auto_opengl-03.t [] t/steps/auto_ops-01.t [] -t/steps/auto_pack-01.t [] t/steps/auto_pcre-01.t [] t/steps/auto_pcre-02.t [] t/steps/auto_pcre-03.t [] Index: MANIFEST.SKIP =================================================================== --- MANIFEST.SKIP (.../trunk) (revision 29453) +++ MANIFEST.SKIP (.../branches/noautopack) (revision 29456) @@ -1,6 +1,6 @@ # ex: set ro: # $Id$ -# generated by tools/dev/mk_manifest_and_skip.pl Sun Jul 13 22:02:26 2008 UT +# generated by tools/dev/mk_manifest_and_skip.pl Tue Jul 15 01:38:38 2008 UT # # This file should contain a transcript of the svn:ignore properties # of the directories in the Parrot subversion repository. (Needed for @@ -1430,6 +1430,8 @@ ^lib/Parrot/Jit\.pm/ ^lib/Parrot/Makefile$ ^lib/Parrot/Makefile/ +^lib/Parrot/OpLib$ +^lib/Parrot/OpLib/ ^lib/Parrot/PMC\.pm$ ^lib/Parrot/PMC\.pm/ ^lib/Parrot/PakFile2\.bs$ @@ -1941,3 +1943,7 @@ ^tools/build/dynoplibs\.pl/ ^tools/build/dynpmc\.pl$ ^tools/build/dynpmc\.pl/ +# Local variables: +# mode: text +# buffer-read-only: t +# End: Index: t/steps/auto_pack-01.t =================================================================== --- t/steps/auto_pack-01.t (.../trunk) (revision 29453) +++ t/steps/auto_pack-01.t (.../branches/noautopack) (revision 29456) @@ -1,302 +0,0 @@ -#! perl -# Copyright (C) 2007, The Perl Foundation. -# $Id$ -# auto_pack-01.t - -use strict; -use warnings; -use Test::More tests => 33; -use Carp; -use lib qw( lib t/configure/testlib ); -use_ok('config::init::defaults'); -use_ok('config::auto::pack'); -use Parrot::BuildUtil; -use Parrot::Configure; -use Parrot::Configure::Options qw( process_options ); -use Parrot::Configure::Test qw( test_step_thru_runstep); -use IO::CaptureOutput qw( capture ); - -my $args = process_options( { - argv => [], - mode => q{configure}, -} ); - -my $conf = Parrot::Configure->new(); - -test_step_thru_runstep($conf, q{init::defaults}, $args); - -my ($task, $step_name, $step, $ret); -my $pkg = q{auto::pack}; - -$conf->add_steps($pkg); -$conf->options->set(%{$args}); - -$task = $conf->steps->[-1]; -$step_name = $task->step; - -$step = $step_name->new(); -ok(defined $step, "$step_name constructor returned defined value"); -isa_ok($step, $step_name); -ok($step->description(), "$step_name has description"); - -my $longsize_orig = $conf->data->get_p5('longsize'); -my $use64bitint_orig = $conf->data->get_p5('use64bitint'); - -##### _set_format() ##### - -{ - my $type = q{intvalsize}; - my $size = 8; - my $longsize = 8; - $conf->data->set_p5( longsize => 8 ); - my $format = auto::pack::_set_format( $conf, $type, $size, $longsize ); - is( $format, q{l!}, "Got expected format size: $format" ); - $conf->data->set_p5( longsize => $longsize_orig ); -} - -{ - my $type = q{intvalsize}; - my $size = 4; - my $longsize = 8; - $conf->data->set_p5( longsize => 8 ); - my $format = auto::pack::_set_format( $conf, $type, $size, $longsize ); - is( $format, q{l}, "Got expected format size: $format" ); - $conf->data->set_p5( longsize => $longsize_orig ); -} - -{ - my $type = q{intvalsize}; - my $size = 8; - my $longsize = 16; - $conf->data->set_p5( longsize => 16 ); - my $format = auto::pack::_set_format( $conf, $type, $size, $longsize ); - is( $format, q{q}, "Got expected format size: $format" ); - $conf->data->set_p5( longsize => $longsize_orig ); -} - -{ - my $type = q{intvalsize}; - my $size = 16; - my $longsize = 8; - $conf->data->set_p5( longsize => undef ); - $conf->data->set_p5( use64bitint => 'define'); - my $format = auto::pack::_set_format( $conf, $type, $size, $longsize ); - is( $format, q{q}, "Got expected format size: $format" ); - $conf->data->set_p5( longsize => $longsize_orig ); - $conf->data->set_p5( use64bitint => $use64bitint_orig ); -} - -{ - my ($stdout, $stderr); - my $type = q{intvalsize}; - my $size = 23; - my $longsize = 8; - my $format; - capture( - sub { $format = - auto::pack::_set_format( $conf, $type, $size, $longsize ); }, - \$stdout, - \$stderr, - ); - ok( ! defined $format, "Format size undef, as expected"); - like($stderr, - qr/Configure\.pl: Unable to find a suitable packtype for $type/, - "Got expected warning re format size" - ); -} - -{ - my ($stdout, $stderr); - my $type = q{intvalsize}; - my $size = 16; - my $longsize = 16; - $conf->data->set_p5( longsize => 32 ); - my $format; - capture( - sub { $format = - auto::pack::_set_format( $conf, $type, $size, $longsize ); }, - \$stdout, - \$stderr, - ); - ok( ! defined $format, "Format size undef, as expected"); - like($stderr, - qr/Configure\.pl: Unable to find a suitable packtype for $type/, - "Got expected warning re format size" - ); - $conf->data->set_p5( longsize => $longsize_orig ); -} - -##### _pack_test() ##### - -{ - my $format = q{Y}; - my $type = q{intvalsize}; - my $size = 4; - my $test; - my ($stdout, $stderr); - capture( - sub { $format = - auto::pack::_pack_test( $format, $type, $size, $test ); }, - \$stdout, - \$stderr, - ); - like($stderr, - qr/Configure\.pl: Unable to find a functional packtype for $type/, - "Got expected warning from _pack_test()" - ); -} - -{ - my $format = q{l!}; - my $type = q{intvalsize}; - my $size = 4; - my $test = q{abcd}; - my ($stdout, $stderr, $ret); - capture( - sub { $ret = auto::pack::_pack_test( $format, $type, $size, $test ) }, - \$stdout, - \$stderr, - ); - is( $ret, $format, "Got expected format" ); - ok(! $stderr, "Nothing on STDERR, as expected" ); -} - -{ - my $format = q{l!}; - my $type = q{intvalsize}; - my $size = 4; - my $test = q{abcde}; - my ($stdout, $stderr, $ret); - capture( - sub { $ret = auto::pack::_pack_test( $format, $type, $size, $test ) }, - \$stdout, - \$stderr, - ); - like($stderr, - qr/Configure\.pl: Unable to find a functional packtype for $type/, - "Got expected warning in _pack_test()." - ); -} - -{ - my $format = q{l!}; - my $type = q{intvalsize}; - my $size = 4; - my $test = q{}; - my ($stdout, $stderr, $ret); - capture( - sub { $ret = auto::pack::_pack_test( $format, $type, $size, $test ) }, - \$stdout, - \$stderr, - ); - is( $ret, q{?}, "Got expected format" ); - ok(! $stderr, "Nothing on STDERR, as expected" ); -} - -##### _set_packtypes() ##### - -{ - my $current_numvalsize = $conf->data->get('numvalsize'); - $conf->data->set( numvalsize => 12 ); - auto::pack::_set_packtypes($conf); - is($conf->data->get('packtype_b'), 'C', - "Got expected value for packtype_b"); - is($conf->data->get('packtype_n'), 'D', - "Got expected value for packtype_n"); - - # prepare for next test - $conf->data->set( numvalsize => $current_numvalsize ); - $conf->data->set( packtype_b => undef ); - $conf->data->set( packtype_n => undef ); -} - -{ - my $current_numvalsize = $conf->data->get('numvalsize'); - $conf->data->set( numvalsize => 72 ); - auto::pack::_set_packtypes($conf); - is($conf->data->get('packtype_b'), 'C', - "Got expected value for packtype_b"); - is($conf->data->get('packtype_n'), 'd', - "Got expected value for packtype_n"); - - # prepare for next test - $conf->data->set( numvalsize => $current_numvalsize ); - $conf->data->set( packtype_b => undef ); - $conf->data->set( packtype_n => undef ); -} - -##### _set_ptrconst() ##### - -{ - my ($ptrsize, $intsize, $longsize); - $ptrsize = $intsize = 2; - $longsize = 4; - auto::pack::_set_ptrconst($conf, $ptrsize, $intsize, $longsize); - is($conf->data->get( 'ptrconst' ), "u", - "Got expected value for ptrconst" ); -} - -{ - my ($ptrsize, $intsize, $longsize); - $intsize = 2; - $ptrsize = $longsize = 4; - auto::pack::_set_ptrconst($conf, $ptrsize, $intsize, $longsize); - is($conf->data->get( 'ptrconst' ), "ul", - "Got expected value for ptrconst" ); - $conf->data->set( 'ptrconst' => undef ); # prepare for next test -} - -{ - my ($ptrsize, $intsize, $longsize); - $intsize = 2; - $ptrsize = 4; - $longsize = 8; - my ($stdout, $stderr); - capture( - sub { auto::pack::_set_ptrconst($conf, $ptrsize, $intsize, $longsize); }, - \$stdout, - \$stderr, - ); - ok(! defined $conf->data->get( 'ptrconst' ), - "ptrconst not set, as expected"); - ok(! $stdout, "As expected, nothing on STDOUT"); - like($stderr, qr/Unable to find an integer type/, - "Got expected warning"); - $conf->data->set( 'ptrconst' => undef ); # prepare for next test -} - -pass("Completed all tests in $0"); - -################### DOCUMENTATION ################### - -=head1 NAME - -auto_pack-01.t - test config::auto::pack - -=head1 SYNOPSIS - - % prove t/steps/auto_pack-01.t - -=head1 DESCRIPTION - -The files in this directory test functionality used by F<Configure.pl>. - -The tests in this file test auto::pack internal subroutines C<_set_packtypes()> -and C<_set_ptrcons()>. - -=head1 AUTHOR - -James E Keenan - -=head1 SEE ALSO - -config::auto::pack, F<Configure.pl>. - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: Index: config/auto/pack.pm =================================================================== --- config/auto/pack.pm (.../trunk) (revision 29453) +++ config/auto/pack.pm (.../branches/noautopack) (revision 29456) @@ -1,146 +0,0 @@ -# Copyright (C) 2001-2008, The Perl Foundation. -# $Id$ - -=head1 NAME - -config/auto/pack.pm - Packing - -=head1 DESCRIPTION - -Figures out how to C<pack()> Parrot's types. - -=cut - -package auto::pack; - -use strict; -use warnings; - -use base qw(Parrot::Configure::Step); - -sub _init { - my $self = shift; - - return { description => q{Figuring out how to pack() Parrot's types}, - result => q{}, - }; -} - -sub runstep { - my ( $self, $conf ) = @_; - - # - # Alas perl5.7.2 doesn't have an INTVAL flag for pack(). - # The ! modifier only works for perl 5.6.x or greater. - # - - my $intsize = $conf->data->get('intsize'); - my $longsize = $conf->data->get('longsize'); - my $ptrsize = $conf->data->get('ptrsize'); - - foreach my $type ( 'intvalsize', 'opcode_t_size' ) { - my $size = $conf->data->get($type); - my $format = _set_format( $conf, $type, $size, $longsize ); - - my $test = eval { pack $format, 0 }; - $format = _pack_test($format, $type, $size, $test); - - my $which = $type eq 'intvalsize' ? 'packtype_i' : 'packtype_op'; - $conf->data->set( $which => $format ); - } - - _set_packtypes($conf); - - # Find out what integer constant type we can use - # for pointers. - _set_ptrconst($conf, $ptrsize, $intsize, $longsize); - - return 1; -} - -##################### INTERNAL SUBROUTINES ##################### - -sub _set_format { - my ( $conf, $type, $size, $longsize ) = @_; - my $format; - if ( - ( $size == $longsize ) - and - ( $size == $conf->data->get_p5('longsize') ) - ) { - $format = 'l!'; - } - elsif ( $size == 4 ) { - $format = 'l'; - } - elsif ( - $size == 8 - or - $conf->data->get_p5('use64bitint') eq 'define' - ) { - # pp_pack is annoying, and this won't work unless sizeof(UV) >= 8 - $format = 'q'; - } - else { - warn "Configure.pl: Unable to find a suitable packtype for $type.\n" - } - return $format; -} - -sub _pack_test { - my ($format, $type, $size, $test) = @_; - if ( ! defined $test ) { - warn <<"AARGH" -Configure.pl: Unable to find a functional packtype for $type. - '$format' failed: $@ -AARGH - } - else { - if ($test) { - unless ( length $test == $size ) { - warn sprintf <<"AARGH", $size, length $test; -Configure.pl: Unable to find a functional packtype for $type. - Need a format for %d bytes, but '$format' gave %d bytes. -AARGH - } - } - else { - $format = '?'; - } - } - return $format; -} - -sub _set_packtypes { - my $conf = shift; - - $conf->data->set( - packtype_b => 'C', - packtype_n => ( $conf->data->get('numvalsize') == 12 ? 'D' : 'd' ) - ); -} - -sub _set_ptrconst { - my ($conf, $ptrsize, $intsize, $longsize) = @_; - - if ( $intsize == $ptrsize ) { - $conf->data->set( ptrconst => "u" ); - } - elsif ( $longsize == $ptrsize ) { - $conf->data->set( ptrconst => "ul" ); - } - else { - warn <<"AARGH"; -Configure.pl: Unable to find an integer type that fits a pointer. -AARGH - } -} - -1; - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: