ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.71 by root, Sat Feb 7 21:40:54 2009 UTC vs.
Revision 1.74 by root, Wed Oct 28 04:10:46 2009 UTC

12my $OPTIPNG = "@OPTIPNG@"; 12my $OPTIPNG = "@OPTIPNG@";
13my $RSYNC = "@RSYNC@"; 13my $RSYNC = "@RSYNC@";
14my $PNGNQ = "@PNGNQ@"; 14my $PNGNQ = "@PNGNQ@";
15 15
16use Getopt::Long; 16use Getopt::Long;
17use File::Temp;
18use POSIX ();
19use Carp;
20
17use Coro::EV; 21use Coro::EV;
18use AnyEvent; 22use AnyEvent;
19use YAML (); 23use YAML::XS ();
20use JSON::XS (); 24use JSON::XS ();
21use IO::AIO (); 25use IO::AIO ();
22use File::Temp; 26
23use Deliantra;
24use Coro 5.12; 27use Coro 5.12;
25use Coro::AIO; 28use Coro::AIO;
26use Coro::Util; 29use Coro::Util;
27use POSIX ();
28use Carp;
29use Coro::Channel; 30use Coro::Channel;
30use Coro::Storable; $Storable::canonical = 1; 31use Coro::Storable; $Storable::canonical = 1;
32
33use Deliantra;
31 34
32$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 35$SIG{QUIT} = sub { Carp::cluck "QUIT" };
33 36
34sub usage { 37sub usage {
35 warn <<EOF; 38 warn <<EOF;
534 537
535 substr $dir, 0, 1 + length $PATH, ""; 538 substr $dir, 0, 1 + length $PATH, "";
536 539
537 if (my $filter = $meta->{cfutil_filter}) { 540 if (my $filter = $meta->{cfutil_filter}) {
538 if ($filter eq "yaml2json") { 541 if ($filter eq "yaml2json") {
539 $data = JSON::XS::encode_json YAML::Load $data; 542 $data = JSON::XS::encode_json YAML::XS::Load $data;
540 } elsif ($filter eq "json2json") { 543 } elsif ($filter eq "json2json") {
541 $data = JSON::XS::encode_json JSON::XS->relaxed->utf8->decode ($data); 544 $data = JSON::XS::encode_json JSON::XS->relaxed->utf8->decode ($data);
542 } elsif ($filter eq "perl2json") { 545 } elsif ($filter eq "perl2json") {
543 $data = eval $data; die if $@; 546 $data = eval $data; die if $@;
544 $data = JSON::XS::encode_json $data; 547 $data = JSON::XS::encode_json $data;
599 } else { 602 } else {
600 warn "ignoring $path/$file\n" if $VERBOSE >= 3; 603 warn "ignoring $path/$file\n" if $VERBOSE >= 3;
601 } 604 }
602 } 605 }
603 }; 606 };
607 }
608
609 sub generate_plurals {
610# use Lingua::EN::Inflect ();
611# Lingua::EN::Inflect::classical;
612# Lingua::EN::Inflect::def_noun '(.*)staff' => '$1staves'; # policy
613# Lingua::EN::Inflect::def_noun '(.*)boots' => '$1boots'; # hack
614#
615# for my $a (@ARC) {
616# my $name = $a->{name} || $a->{_name};
617#
618# next unless $a->{name_pl};
619# next if $a->{invisible};
620# next if $a->{is_floor};
621# next if $a->{no_pick};
622#
623# my $test = Lingua::EN::Inflect::PL_N_eq $name, Lingua::EN::Inflect::PL $name;
624# my $pl = $test =~ /^(?:eq|p:.)$/
625# ? $name
626# : Lingua::EN::Inflect::PL $name;
627#
628# if ($pl ne $a->{name_pl}) {
629# warn "$a->{_name}: plural differs, $pl vs $a->{name_pl}\n";
630# }
631# }
604 } 632 }
605 633
606 sub inst_arch($) { 634 sub inst_arch($) {
607 my (undef, $path) = @_; 635 my (undef, $path) = @_;
608 636
688 } 716 }
689 717
690 # remove base classes (by naming scheme, should use something like "baseclass xxx" to inherit 718 # remove base classes (by naming scheme, should use something like "baseclass xxx" to inherit
691 @ARC = grep $_->{_name} !~ /^(?:type|class)_/, @ARC; 719 @ARC = grep $_->{_name} !~ /^(?:type|class)_/, @ARC;
692 720
721 print "generating plurals...\n" if $VERBOSE;
722 generate_plurals;
723
693 print "writing archetypes...\n" if $VERBOSE; 724 print "writing archetypes...\n" if $VERBOSE;
694 open my $fh, ">:utf8", "$DATADIR/archetypes~" 725 open my $fh, ">:utf8", "$DATADIR/archetypes~"
695 or die "$DATADIR/archetypes~: $!"; 726 or die "$DATADIR/archetypes~: $!";
696 print $fh Deliantra::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; 727 print $fh Deliantra::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC];
697 } 728 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines