]> bicyclesonthemoon.info Git - ott/bsta/blobdiff - update.1.pl
static GOTO
[ott/bsta] / update.1.pl
index fb6766cb5985047f79f8dab4b8235ad257d60594..1cc780342f24fcf482d8e6b8dda0ca640fe85f3f 100644 (file)
@@ -1,4 +1,4 @@
-###RUN_PERL: #!/usr/bin/perl
+#!/usr/bin/perl
 
 # update.pl is generated from update.1.pl.
 #
@@ -24,7 +24,7 @@ use utf8;
 use Encode::Locale ('decode_argv');
 use Encode ('encode', 'decode');
 
-###PERL_LIB: use lib /botm/lib/bsta
+use lib '/botm/lib/test-bsta';
 use botm_common (
        'read_data_file',
        'join_path'
@@ -32,7 +32,7 @@ use botm_common (
 use bsta_lib (
        'STATE',
        'ong',
-       'write_index', 'write_static_viewer_page'
+       'write_index', 'write_static_viewer_page', 'write_static_goto'
 );
 
 ###PERL_PATH_SEPARATOR:     PATH_SEPARATOR     = /
@@ -57,6 +57,8 @@ my %state     = read_data_file(DATA_STATE_PATH());
 my %all_frame_data = ();
 my %all_words_data = ();
 
+my $update_goto = 0;
+
 my $ong_state  = int($state{'state'});
 my $last_frame = ($ong_state > STATE->{'inactive'}) ? 
        int($state{'last'}) :
@@ -70,6 +72,7 @@ print $time."\n";
 
 foreach my $id (@ARGV) {
        if ($id eq 'all') {
+               $update_goto = 1;
                push @list, 'i';
                push @list, 'c';
                for (my $f=0; $f<=$last_frame; $f+=1) {
@@ -77,6 +80,7 @@ foreach my $id (@ARGV) {
                }
        }
        elsif ($id =~ /^[0-9]+$/) {
+               $update_goto = 1;
                my $f = int($&);
                if ($f <= $last_frame) {
                        push @list, $f
@@ -114,6 +118,22 @@ foreach my $id (@list) {
        }
        make_static_pages($id);
 }
+if ($update_goto) {
+       print 'static GOTO';
+       my $r = write_static_goto(
+               \%state,
+               \%settings,
+               '' # \%goto_list
+       );
+       if ($r) {
+               print " OK\n";
+       }
+       else {
+               print " FAIL\n";
+               $fail += 1;
+       }
+}
+
 print "\n";
 
 
@@ -175,7 +195,17 @@ sub make_static_page {
                return;
        }
        my $f = int($id);
-       unless (($f >= 0) && ($f <= $last_frame)) {
+       unless (
+               ($f >= 0) && (
+                       ($f < $last_frame-1) || (
+                               ($ong_state >= STATE->{'ready'}) &&
+                               ($f <= $last_frame-1)
+                       ) || (
+                               ($ong_state >= STATE->{'end'}) &&
+                               ($f <= $last_frame)
+                       )
+               )
+       ) {
                return;
        }
        my $r;