chiark / gitweb /
make AADEPTH configurable
[ypp-sc-tools.web-live.git] / pctb / dictionary-update-receiver
index 99a580e46888280c1c589a442edff38c6ea662cc..d80ab216b338220049d8ab6387061cf1c0d4386f 100755 (executable)
@@ -19,6 +19,8 @@ use CGI qw/:standard -private_tempfiles/;
 use IO::Pipe;
 use IO::Handle;
 
 use IO::Pipe;
 use IO::Handle;
 
+my $aadepth=3;
+
 #---------- pixmaps ----------
 
 sub parseentryin__pixmap ($) {
 #---------- pixmaps ----------
 
 sub parseentryin__pixmap ($) {
@@ -78,9 +80,12 @@ print STDERR ">@d<\n";
 
     my $w= @d;
 
 
     my $w= @d;
 
-    my $pgm= "P2\n$h $w\n7\n";
+    my $maxval= (1<<$aadepth)-1;
+    die 'cannot do [^0...$maxval]!' if $maxval>9;
+
+    my $pgm= "P2\n$h $w\n$maxval\n";
     map { # x, left to right
     map { # x, left to right
-       m/[^0-7]/ and die "$_ ?";
+       m/[^0-$maxval]/ and die "$_ ?";
        my $l= $_;
        $l =~ s/./ $&/g;
        $pgm .= "$l\n";
        my $l= $_;
        $l =~ s/./ $&/g;
        $pgm .= "$l\n";
@@ -257,7 +262,7 @@ open F, "> $fn_t" or die "$fn_t $!";
 (stat F) or die $!;
 my $fn_i= sprintf "_update.$$-%016x.rdy", (stat _)[1];
 
 (stat F) or die $!;
 my $fn_i= sprintf "_update.$$-%016x.rdy", (stat _)[1];
 
-print F "ypp-sc-tools dictionary update v2\n";
+print F "ypp-sc-tools dictionary update v3 depth=$aadepth\n";
 
 foreach my $v ($pirate,$caller,$dict,$ctx,$def,$image,$key,$val) {
     printf F "%d\n", length($v) or die $!;
 
 foreach my $v ($pirate,$caller,$dict,$ctx,$def,$image,$key,$val) {
     printf F "%d\n", length($v) or die $!;