File Coverage

File:config/inter/types.pm
Coverage:100.0%

linestmtbrancondsubcode
1# Copyright (C) 2001-2011, Parrot Foundation.
2
3 - 12
=head1 NAME

config/inter/types.pm - Sizes for Parrot Types

=head1 DESCRIPTION

Asks the user which size integer, floating-point number and opcode types should
be.

=cut
13
14package inter::types;
15
16
2
2
2
use strict;
17
2
2
2
use warnings;
18
19
2
2
2
use base qw(Parrot::Configure::Step);
20
21
2
2
2
use Parrot::Configure::Utils ':inter';
22
23
24sub _init {
25
3
    my $self = shift;
26
3
    my %data;
27
3
    $data{description} = q{What types should Parrot use};
28
3
    $data{result} = q{};
29
3
    return \%data;
30}
31
32sub runstep {
33
3
    my ( $self, $conf ) = @_;
34
35
3
    my $intval = $conf->options->get('intval') || 'long';
36
3
    my $floatval = $conf->options->get('floatval') || 'double';
37
3
    my $opcode = $intval;
38
39
3
    if ( $conf->options->get('ask') ) {
40
1
        $intval = prompt( "\n\nHow big would you like your integers to be?", $intval );
41
1
        $floatval = prompt( "And your floats?", $floatval );
42
1
        print "\n";
43    }
44
45    $conf->data->set(
46
3
        iv => $intval,
47        nv => $floatval,
48        opcode_t => $opcode
49    );
50
51
3
    return 1;
52}
53
541;
55
56# Local Variables:
57# mode: cperl
58# cperl-indent-level: 4
59# fill-column: 100
60# End:
61# vim: expandtab shiftwidth=4: