Show
Ignore:
Timestamp:
11/21/08 01:20:38 (6 years ago)
Author:
daisuke
Message:

slowly progressing...

Location:
lang/perl/DateTime-Lite/trunk/tools
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/DateTime-Lite/trunk/tools/benchmark/simple_create.pl

    r24502 r24525  
    99cmpthese(10000, { 
    1010    dt => sub { 
    11         DateTime->new(year => 2000, month => 1, day => 1); # , time_zone => 'Asia/Tokyo') 
     11        DateTime->new(year => 2000, month => 1, day => 1, time_zone => 'Asia/Tokyo') 
    1212    }, 
    1313    dt_lite => sub { 
    14         DateTime::Lite->new(year => 2000, month => 1, day => 1); # , time_zone => 'Asia/Tokyo') 
     14        DateTime::Lite->new(year => 2000, month => 1, day => 1, time_zone => 'Asia/Tokyo') 
    1515    } 
    1616}); 
  • lang/perl/DateTime-Lite/trunk/tools/lib/DateTime/Lite/Tool/Locale/Generator.pm

    r24516 r24525  
    99use File::Temp (); 
    1010use LWP::UserAgent; 
     11use Carp::Always; 
    1112 
    12 use LWP::UserAgent; 
     13our $VERSION = '0.00001'; 
    1314 
    1415with 'MooseX::Getopt'; 
     
    107108 
    108109sub generate_dat_file { 
    109     my $ldml = shift; 
     110    my ($self, $ldml) = @_; 
    110111 
    111     my $dat_file = file( qw( misc locale ), $ldml->id() . q{.dat} ); 
     112    my $dat_file = Path::Class::File->new( qw( misc locale ), $ldml->id() . q{.dat} ); 
    112113#    write_to_manifest($dat_file); 
     114 
     115    my $parent = $dat_file->parent; 
     116    if (! -d $parent) { 
     117        $parent->mkpath() or die; 
     118    } 
    113119 
    114120    open my $fh, '>:utf8', $dat_file 
    115121        or die "Cannot write to $dat_file: $!"; 
    116122 
    117     write_pm_header( $fh, $ldml ); 
    118     write_pm_inheritance( $fh, $ldml ); 
    119     write_pm_cldr_version( $fh ); 
    120     write_pm_subs( $fh, $ldml ); 
    121     write_pm_footer( $fh, $ldml ); 
     123#    write_pm_header( $fh, $ldml ); 
     124#    write_pm_inheritance( $fh, $ldml ); 
     125#    write_pm_cldr_version( $fh ); 
     126#    write_pm_subs( $fh, $ldml ); 
     127#    write_pm_footer( $fh, $ldml ); 
     128#} 
     129 
     130    print $fh <<EOF; 
     131########################################################################### 
     132# 
     133# This file is auto-generated by the Perl DateTime Suite time locale 
     134# generator ($VERSION).  This code generator comes with the 
     135# DateTime::Locale distribution in the tools/ directory, and is called 
     136# $0. 
     137# 
     138# This file as generated from the CLDR XML locale data.  See the 
     139# LICENSE.cldr file included in this distribution for license details. 
     140# 
     141# Do not edit this file directly. 
     142# 
     143########################################################################### 
     144EOF 
     145    my %data = ( 
     146        cldr_version => $self->version 
     147    ); 
     148 
     149    foreach my $attr ( sort { $a->name() cmp $b->name() } 
     150                       DateTime::Lite::Tool::Locale::LDML->meta()->compute_all_applicable_attributes() ) 
     151    { 
     152        next unless $attr->name() =~ 
     153            /^(?:day_|month_|quarter_|am_pm|era_|date_|time_|datetime_|first_day_)/; 
     154 
     155        next if make_alias( $fh, $ldml, $attr->name() ); 
     156 
     157        my $type = $attr->type_constraint(); 
     158 
     159        if ( $type->is_a_type_of('ArrayRef') ) 
     160        { 
     161            write_arrayref_sub( $fh, $ldml, $attr->name() ); 
     162        } 
     163        elsif ( $type->is_a_type_of('HashRef') ) 
     164        { 
     165            write_hashref_sub( $fh, $ldml, $attr->name() ); 
     166        } 
     167        elsif ( $type->is_a_type_of('Str') ) 
     168        { 
     169            write_string_sub( $fh, $ldml, $attr->name() ); 
     170        } 
     171        elsif ( $type->is_a_type_of('Int') ) 
     172        { 
     173            write_int_sub( $fh, $ldml, $attr->name() ); 
     174        } 
     175        else 
     176        { 
     177            die "Cannot handle type: " . $type->name(); 
     178        } 
     179    } 
     180 
    122181} 
    123182 
  • lang/perl/DateTime-Lite/trunk/tools/lib/DateTime/Lite/Tool/Locale/LDML.pm

    r24516 r24525  
    507507    # alias for the entire file, so they can be investigated as 
    508508    # needed. 
     509 
    509510    my $path = $node->getAttribute('path') || $node->parentNode()->nodePath(); 
     511 
     512    if (! $path) { 
     513        printf STDERR "TODO: alias node has source (%s), but we don't know to do with it\n", $node->getAttribute('source'); 
     514        return; 
     515    } 
    510516 
    511517    $class->_replace_alias_with_path( $node, $path, $doc, $target_file );