diff --git a/lib/App/FrameUtils.pm b/lib/App/FrameUtils.pm index 7d6b4cccf8b021bbf022315bed346ffd81ec46ba..8ed5becfe0229adfe0810afeb5a78f01b9c4be0f 100644 --- a/lib/App/FrameUtils.pm +++ b/lib/App/FrameUtils.pm @@ -48,7 +48,7 @@ sub hassya_hyou my %sta_info = %{ MasterUtils::sta_from_id $master, $eki }; - sub process_ressya_list + my sub process_ressya_list { my $rosen_id = $_[0]; my $rosen = MasterUtils::get_rosen_frame $master, $rosen_id; @@ -75,7 +75,7 @@ sub hassya_hyou if ($ts{'mode'} != 1) { next; } # Format: time (tab) destination (tab) type (with eventual name) my $syubetsu = get_syubetsu $master, $rosen_id, $data{'syubetsu'}; - print ((TimeUtils::format_time_simple $time) + print( (TimeUtils::format_time_simple $time) . "\tfor " . (get_destination $master, $rosen_id, \@jikoku, $target_relative, $is_down) . "\t$syubetsu") diff --git a/lib/App/Navi.pm b/lib/App/Navi.pm index 093c3b91f4fd6de83a6fb13681c64a9b183a2bb8..f52eedd68106bb5709326c8d7b1fedd0d616a21d 100644 --- a/lib/App/Navi.pm +++ b/lib/App/Navi.pm @@ -18,7 +18,7 @@ use App::TimeUtils; use List::Util qw(min); use Data::Printer; -our $MAX_LEGS = 5; +our $MAX_LEGS = 9; sub Raptor_simple { @@ -45,7 +45,7 @@ sub Raptor_simple # and one to save the station used to board this last used service my %from; - sub earliest_trip + my sub earliest_trip { my $k = $_[0]; my $r = $_[1]; @@ -187,7 +187,16 @@ sub Raptor_simple } else { - Log::d "Found earliest departure is later than the current earliest departure, or is later than the current ETA @ $to_id ($taustar{$to_id})"; + if (defined $trip && defined (Ressya::arr_time $trip, $index_rel)) + { + my $trip_arrival = Ressya::arr_time $trip, $index_rel; + Log::d "Found earliest departure arrives @ $trip_arrival, which is later than the current earliest departure ($taustar{$pi}), or is later than the current ETA @ $to_id ($taustar{$to_id})" + } + else + { + Log::d "No earliest departure, or departure is later than the current earliest departure ($taustar{$pi}) / the current ETA @ $to_id ($taustar{$to_id})" + } + } @@ -266,7 +275,7 @@ sub Raptor_simple my $to_what = MasterUtils::get_ekimei $master, $path[$i+1]; my $to_arr = $jikoku[$i+1]->{'chaku'}; - print ((TimeUtils::format_time $from_dep) + print( (TimeUtils::format_time $from_dep) . "\t$from_what\n" . "\t|\n" . '(' . (TimeUtils::format_time_simple (TimeUtils::subtract_from $from_dep, $to_arr)) . ')' @@ -284,7 +293,7 @@ sub Raptor_simple if ($i != $#path - 1) { my $to_dep = $jikoku[$i+1]->{'hatsu'}; - print ('(' + print( '(' . TimeUtils::format_time_simple (TimeUtils::subtract_from $to_arr, $to_dep) . ")\n" ) diff --git a/src/oud2_parser.pl b/src/oud2_parser.pl index 85716e30b2934cec55bf6a8114ab161fb61f3e10..5a9fc91ee13c8f34d07eb52ee9ad2f88233fc048 100644 --- a/src/oud2_parser.pl +++ b/src/oud2_parser.pl @@ -164,20 +164,29 @@ TS_TIMESTAMP_WITHT ::= TS_MODE TS_SEP_PLATFORM TS_INT action => Dia::hash_of_ts_nil # Arrival / departure - || TS_MODE TS_SEP_MODE TS_INT TS_SEP_CHAKU TS_INT TS_SEP_PLATFORM TS_INT + | TS_MODE TS_SEP_MODE TS_INT TS_SEP_CHAKU TS_INT TS_SEP_PLATFORM TS_INT action => Dia::hash_of_ts_ad # Simple departure - || TS_MODE TS_SEP_MODE TS_INT TS_SEP_PLATFORM TS_INT + | TS_MODE TS_SEP_MODE TS_INT TS_SEP_PLATFORM TS_INT action => Dia::hash_of_ts_dep # Simple arrival - || TS_TIMESTAMP_FINAL action => ::first - -TS_TIMESTAMP_FINAL ::= TS_MODE TS_SEP_MODE TS_INT TS_SEP_CHAKU TS_SEP_PLATFORM TS_INT + | TS_MODE TS_SEP_MODE TS_INT TS_SEP_CHAKU TS_SEP_PLATFORM TS_INT + action => Dia::hash_of_ts_arr + +# TODO this will break on some diagrams +TS_TIMESTAMP_FINAL ::= TS_MODE_STOP TS_SEP_MODE TS_INT TS_SEP_CHAKU TS_SEP_PLATFORM TS_INT + action => Dia::hash_of_ts_arr + || TS_MODE_PASS TS_SEP_MODE TS_INT TS_SEP_CHAKU TS_SEP_PLATFORM TS_INT action => Dia::hash_of_ts_arr + TS_TIMESTAMP_NOT ::= action => Dia::hash_of_ts_not :lexeme ~ TS_MODE priority => 7 TS_MODE ~ [12] +:lexeme ~ TS_MODE_STOP priority => 7 +TS_MODE_STOP ~ [1] +:lexeme ~ TS_MODE_PASS priority => 7 +TS_MODE_PASS ~ [2] :lexeme ~ COMMA priority => 7 COMMA ~ [,] @@ -192,7 +201,8 @@ NAME ~ [^\v]* :lexeme ~ GARBAGE_LINE priority => -99999999 GARBAGE_LINES ::= GARBAGE_LINE* GARBAGE_LINE ~ [^\v]* -:discard ~ [\s] +:discard ~ NEWLINE +NEWLINE ~ [\s]+ endrule ; @@ -240,11 +250,13 @@ foreach my $file (@trains) print "Route id will be $basename\n"; read $dia_file, my $contents, -s $dia_file; - + try { print $recce->read(\$contents) . ' bytes read.'; } - catch ($e) { print "Malformation in .oud file.\n$e\n" } + catch ($e) { print "Malformation in .oud file.\n$e\n"; } print "\n"; - + + print $recce->show_progress(); + my %frame = %{ ${$recce->value()} }; $frame{'id'} = $basename; Frame::frame_info \%frame; @@ -329,4 +341,4 @@ foreach my $frame (values %{ $master{'rosen'} }) # MasterUtils::get_routes \%master, 'konpoku_9'; # FrameUtils::hassya_hyou \%master, 'konpoku_9'; -Navi::Raptor_simple \%master, 'konpoku_3', 'senmo_21', 1111; +Navi::Raptor_simple \%master, 'sekihoku1_0', 'sekihoku1_10', 1330;