Author: jkeenan
Date: Sat Jul 26 14:43:24 2008
New Revision: 29776

Modified:
   branches/parallel/config/gen/platform.pm
   branches/parallel/t/steps/gen_platform-01.t

Log:
[configure] Refactor one hard-coded file name from inside runstep() to
_init().  Test appropriately.  Delete commented-out code.


Modified: branches/parallel/config/gen/platform.pm
==============================================================================
--- branches/parallel/config/gen/platform.pm    (original)
+++ branches/parallel/config/gen/platform.pm    Sat Jul 26 14:43:24 2008
@@ -26,6 +26,7 @@
     my %data;
     $data{description} = q{Moving platform files into place};
     $data{result}      = q{};
+    $data{platform_interface} = q{config/gen/platform/platform_interface.h};
     return \%data;
 }
 
@@ -46,220 +47,9 @@
 CODA
 
     # headers are merged into platform.h
-#    my @headers = qw/
-#        io.h
-#        math.h
-#        misc.h
-#        dl.h
-#        signal.h
-#        stat.h
-#        threads.h
-#        string.h
-#        /;
-#
-#    my $plat_h = q{include/parrot/platform.h};
-#    $conf->append_configure_log($plat_h);
-#    open my $PLATFORM_H, ">", $plat_h
-#        or die "Can't open $plat_h: $!";
-#
-#    print {$PLATFORM_H} <<"END_HERE";
-#/* ex: set ro:
-#** !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
-#**
-#** This file is generated automatically by config/gen/platform.pm
-#*/
-##ifndef PARROT_PLATFORM_H_GUARD
-##define PARROT_PLATFORM_H_GUARD
-#
-#/*
-#** platform.h [$platform version]
-#**
-#** DO NOT EDIT THIS FILE
-#**
-#** Generated by config/gen/platform.pm
-#*/
-#
-#END_HERE
-#
-#    foreach (@headers) {
-#        my $header_file = "config/gen/platform/generic/$_";
-#        if ( -e "config/gen/platform/$platform/$_" ) {
-#            $header_file = "config/gen/platform/$platform/$_";
-#        }
-#
-#        if ( -e $header_file ) {
-#            local $/ = undef;
-#            print("\t$header_file\n") if $verbose;
-#            open my $IN_H, "<", "$header_file"
-#                or die "Can't open $header_file: $!";
-#
-#            # slurp in the header file
-#            my $in_h = <$IN_H>;
-#
-#            # remove the (in this case) superfluous coda
-#            $in_h =~ s{\Q$coda\E\n*\z}{}xgs;
-#
-#            print {$PLATFORM_H} <<"END_HERE";
-#/*
-#** $header_file:
-#*/
-##line 1 "$header_file"
-#END_HERE
-#            print {$PLATFORM_H} $in_h, "\n\n";
-#            close $IN_H;
-#        }
-#
-#        # just fall through if file is missing; means neither this platform 
nor
-#        # generic has anything to contribute for this feature.  this might not
-#        # be desirable if porters don't see the appropriate file in generic/ 
and
-#        # shoehorn their function into the wrong file rather than creating the
-#        # correct one from the above list in their $platform/ dir (e.g. 
misc.c).
-#    }
-#
-#    # finally append generated
-#    @headers = grep { /\.h$/ } split( m/,/, $generated );
-#    for (@headers) {
-#        if ( -e $_ ) {
-#            local $/ = undef;
-#            print("\t$_\n") if $verbose;
-#            open my $IN_H, "<", "$_" or die "Can't open $_: $!";
-#            print {$PLATFORM_H} <<"END_HERE";
-#/*
-#** $_
-#*/
-##line 1 "$_"
-#END_HERE
-#            print {$PLATFORM_H} <$IN_H>, "\n\n";
-#            close $IN_H;
-#        }
-#        else {
-#            warn("Header file '$_' listed in TEMP_generated but not found\n");
-#        }
-#    }
-#
-#    # Add the C-coda
-#    print $PLATFORM_H <<"END_HERE";
-##endif /* PARROT_PLATFORM_H_GUARD */
-#
-#$coda
-#END_HERE
-#
-#    close $PLATFORM_H;
     _set_headers($conf, $verbose, $platform, $generated, $coda);
 
     # implementation files are merged into platform.c
-#    my @impls = qw/
-#        time.c
-#        env.c
-#        dl.c
-#        stat.c
-#        math.c
-#        memalign.c
-#        signal.c
-#        itimer.c
-#        memexec.c
-#        exec.c
-#        misc.c
-#        /;
-#
-#    my $plat_c = q{src/platform.c};
-#    $conf->append_configure_log($plat_c);
-#    open my $PLATFORM_C, ">", $plat_c
-#        or die "Can't open $plat_c: $!";
-#
-#    print {$PLATFORM_C} <<"END_HERE";
-#/*
-#** platform.c [$platform version]
-#**
-#** DO NOT EDIT THIS FILE
-#**
-#** Generated by config/gen/platform.pm
-#*/
-#
-#/* HEADERIZER HFILE: none */
-#/* HEADERIZER STOP */
-#END_HERE
-#
-#    # We need to put things from begin.c before the parrot.h include.
-#    if ( -e "config/gen/platform/$platform/begin.c" ) {
-#        local $/ = undef;
-#        open my $IN_C, "<", "config/gen/platform/$platform/begin.c" or die 
"Can't open begin.c: $!";
-#
-#        # slurp in the C file
-#        my $in_c = <$IN_C>;
-#
-#        # remove the (in this case) superfluous coda
-#        $in_c =~ s{\Q$coda\E\n*\z}{}xgs;
-#
-#        print {$PLATFORM_C} <<"END_HERE";
-#/*
-#** begin.c
-#*/
-##line 1 "config/gen/platform/$platform/begin.c"
-#END_HERE
-#        print {$PLATFORM_C} $in_c, "\n\n";
-#        close $IN_C;
-#    }
-#
-#    # Copy the rest.
-#    print {$PLATFORM_C} <<'END_HERE';
-##include "parrot/parrot.h"
-#
-#END_HERE
-#
-#    for (@impls) {
-#        my $impl_file = "config/gen/platform/generic/$_";
-#        if ( -e "config/gen/platform/$platform/$_" ) {
-#            $impl_file = "config/gen/platform/$platform/$_";
-#        }
-#
-#        if ( -e $impl_file ) {
-#            local $/ = undef;
-#            print("\t$impl_file\n") if $verbose;
-#            open my $IN_C, "<", "$impl_file" or die "Can't open $impl_file: 
$!";
-#
-#            # slurp in the C file
-#            my $in_c = <$IN_C>;
-#
-#            # remove the (in this case) superfluous coda
-#            $in_c =~ s{\Q$coda\E\n*\z}{}xgs;
-#
-#            print {$PLATFORM_C} <<"END_HERE";
-#/*
-#** $impl_file:
-#*/
-##line 1 "$impl_file"
-#END_HERE
-#            print {$PLATFORM_C} $in_c, "\n\n";
-#            close $IN_C;
-#        }
-#    }
-#
-#    # append generated c files
-#    @impls = grep { /\.c$/ } split( m/,/, $generated );
-#    for (@impls) {
-#        if ( -e $_ ) {
-#            local $/ = undef;
-#            print("\t$_\n") if $verbose;
-#            open my $IN_C, "<", "$_" or die "Can't open $_: $!";
-#            print {$PLATFORM_C} <<"END_HERE";
-#/*
-#** $_:
-#*/
-##line 1 "$_"
-#END_HERE
-#            print {$PLATFORM_C} <$IN_C>, "\n\n";
-#            close $IN_C;
-#        }
-#    }
-#
-#    # append the C code coda to the generated file
-#    print {$PLATFORM_C} <<"END_HERE";
-#
-#$coda
-#END_HERE
-#
-#    close $PLATFORM_C;
     _set_implementations($conf, $verbose, $platform, $generated, $coda);
 
     if ( $conf->data->get('platform_asm') ) {
@@ -270,7 +60,7 @@
     }
 
     # interface is the same for all platforms
-    copy_if_diff( "config/gen/platform/platform_interface.h",
+    copy_if_diff( $self->{platform_interface},
         "include/parrot/platform_interface.h" );
 
     return 1;

Modified: branches/parallel/t/steps/gen_platform-01.t
==============================================================================
--- branches/parallel/t/steps/gen_platform-01.t (original)
+++ branches/parallel/t/steps/gen_platform-01.t Sat Jul 26 14:43:24 2008
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More qw(no_plan); # tests =>  2;
+use Test::More tests => 16;
 use Carp;
 use lib qw( lib );
 use_ok('config::gen::platform');
@@ -30,6 +30,9 @@
 $conf->options->set( %{$args} );
 my $step = test_step_constructor_and_description($conf);
 
+ok(-f $step->{platform_interface},
+    "Located required platform interface header");
+
 my $platform_orig = $conf->data->get_p5('OSNAME');
 my $archname_orig = $conf->data->get_p5('archname');
 $conf->data->set_p5( archname => 'foo-bar' );

Reply via email to