diff --git a/lib/App/Dia.pm b/lib/App/Dia.pm index 6da98cb47324e22ae3b8fcdaf8c17bbd093e309a..5c5be6eee943b2ffff3dc9535a8d6ac5bc8a7a80 100644 --- a/lib/App/Dia.pm +++ b/lib/App/Dia.pm @@ -76,7 +76,7 @@ sub format_syubetsu my %syubetsu; $syubetsu{'name'} = $_[0]; - $syubetsu{'ryaku'} = $_[1]; + # $syubetsu{'ryaku'} = $_[1]; return \%syubetsu; } diff --git a/lib/App/MasterUtils.pm b/lib/App/MasterUtils.pm index 48c19173c7628bee45bdb7839c44f8a079242bea..c74110b1035d540fcb3d4893f86159772866cf4e 100644 --- a/lib/App/MasterUtils.pm +++ b/lib/App/MasterUtils.pm @@ -72,6 +72,32 @@ sub sta_from_index return sta_from_id $master, @{ $rosen->{'eki'} }[$index]; } +sub search_eki +{ + # For now the query must be strictly equal to the target. + my ($master, $query) = @_; + my $all = $master->{'eki_index'}; + my @results; + + foreach my $index (keys %$all) + { + if ($all->{$index}->{'ekimei'} eq $query) + { + push @results, { index => $index, frame => $all->{$index} }; + } + } + + if (scalar @results == 0) + { + Log::i "No station matching the query $query was found."; + } + else + { + my $final = @results[0]; + return $final->{'index'}; + } +} + sub get_routes { my $master = $_[0]; diff --git a/lib/App/Navi.pm b/lib/App/Navi.pm index bf7c11486e19495a3e6f1a1e8b74657b78bf750f..08489d923d5903f7612ce7b474ad15546e138008 100644 --- a/lib/App/Navi.pm +++ b/lib/App/Navi.pm @@ -125,7 +125,7 @@ sub Raptor_simple } } } - if (!$substituted && $visited{$p} < 2 * scalar @rosens) + if (!$substituted && $visited{$p} <= 2 * scalar @rosens) { push @Q, [$r, $d, $p]; } diff --git a/src/oud2_parser.pl b/src/oud2_parser.pl index 96dab04d339b19cc044eb4c49a9853f1aba48fa7..c72ed24f567730b49568e9c3bcedad39665f8f88 100644 --- a/src/oud2_parser.pl +++ b/src/oud2_parser.pl @@ -100,13 +100,13 @@ SYUBETSU_STRUCT ::= SYUBETSU_BEGIN GARBAGE_LINES action => Dia::second SYUBETSU_SUB ::= SYUBETSU_NAME - SYUBETSU_RYAKU + # SYUBETSU_RYAKU action => Dia::format_syubetsu SYUBETSU_BEGIN ~ 'Ressyasyubetsu.' SYUBETSU_NAME ::= 'Syubetsumei=' NAME action => Dia::second -SYUBETSU_RYAKU ::= 'Ryakusyou=' NAME - action => Dia::second +#SYUBETSU_RYAKU ::= 'Ryakusyou=' NAME +# action => Dia::second DIA_BEGIN ::= 'Dia.' action => Dia::begin_dia_section @@ -343,4 +343,8 @@ foreach my $frame (values %{ $master{'rosen'} }) } # FrameUtils::hassya_hyou \%master, 'sekihoku1_28'; -Navi::Raptor_simple \%master, 'sibetu_9', 'sibetu_34', 800; + +my $d = MasterUtils::search_eki \%master, '幾寅'; +my $a = MasterUtils::search_eki \%master, '音別'; + +Navi::Raptor_simple \%master, $d, $a, 334;