fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. use encoding 'utf8';
  4. use integer;
  5.  
  6. my $filename = shift || 'liu-uni.tab';
  7. open F, '<:raw', $filename or die $!;
  8. {
  9. use bytes;
  10. local $/;
  11. @b = map ord, split //,<F>;
  12. }
  13. close F;
  14.  
  15. $i1 = getint16(0);
  16. $words = getint16(4);
  17. $i2 = $i1 + getint16(2); # or + ($words*2+7)/8
  18. $i3 = $i2 + getint16(6); # or + ($words*1+7)/8
  19. $i4 = $i3 + getint16(6); # or + ($words*1+7)/8
  20.  
  21. #printf "words %d 0x%x\n", $words, $words;
  22. #printf "i1=0x%x, i2=0x%x, i3=0x%x, i4=0x%x\n", $i1, $i2, $i3, $i4;
  23.  
  24. my @rootkey = (split //," abcdefghijklmnopqrstuvwxyz,.'[]");
  25. for my$i(0 .. 1023) {
  26. my @key; $key[0] = $rootkey[$i/32];
  27. $key[1] = $rootkey[$i%32];
  28. next if $key[0] eq ' ';
  29.  
  30. for $ci(getint16($i*2) .. getint16($i*2+2)-1) {
  31. my $bit24 = getbits($i4, 24, $ci);
  32. my $hi = getbits($i1, 2, $ci);
  33. my $lo = $bit24 & 0x3fff;
  34. #printf "%x %04x\t", $hi, $lo;
  35.  
  36. $key[2] = $rootkey[$bit24>>19];
  37. $key[3] = $rootkey[$bit24>>14 & 0x1f];
  38.  
  39. my $flag_unknown = getbits($i2, 1, $ci);
  40. my $flag_sp = getbits($i3, 1, $ci);
  41.  
  42. print join '', @key;
  43. $char = chr($hi<<14 | $lo);
  44. printf "\t%s", $char;
  45. printf "\t%s", $flag_sp?' ':'*';
  46. printf "%s", $flag_unknown?' ':'+';
  47. print "\n";
  48. }
  49. }
  50.  
  51. sub getint16 {
  52. my($addr)[email protected]_;
  53. return $b[$addr] | $b[$addr+1]<<8;
  54. }
  55.  
  56. sub getbits {
  57. my($start, $nbit, $i) = @_;
  58. if($nbit==1 || $nbit==2 || $nbit==4) {
  59. my($byte)=$b[$start+$i*$nbit /8];
  60. my $ovalue = $byte>>(8-$nbit - $i*$nbit %8);
  61. return $ovalue & ((1<<$nbit)-1);
  62. } elsif($nbit>0 && $nbit%8==0) {
  63. my $nbyte = $nbit / 8;
  64. my $value = 0;
  65. my $a = $start + $i * $nbyte;
  66. while($nbyte--) {
  67. $value = $value<<8 | $b[$a++];
  68. }
  69. return $value;
  70. } else {
  71. die;
  72. }
  73. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: class, interface, or enum expected
use encoding 'utf8';
^
Main.java:3: error: unclosed character literal
use encoding 'utf8';
             ^
Main.java:3: error: unclosed character literal
use encoding 'utf8';
                  ^
Main.java:6: error: class, interface, or enum expected
my $filename = shift || 'liu-uni.tab';
^
Main.java:6: error: unclosed character literal
my $filename = shift || 'liu-uni.tab';
                        ^
Main.java:6: error: unclosed character literal
my $filename = shift || 'liu-uni.tab';
                                    ^
Main.java:7: error: unclosed character literal
open F, '<:raw', $filename or die $!;
        ^
Main.java:7: error: unclosed character literal
open F, '<:raw', $filename or die $!;
              ^
Main.java:8: error: class, interface, or enum expected
{
^
Main.java:10: error: class, interface, or enum expected
  local $/;
  ^
Main.java:11: error: class, interface, or enum expected
  @b = map ord, split //,<F>;
     ^
Main.java:15: error: class, interface, or enum expected
$i1 = getint16(0);
^
Main.java:16: error: class, interface, or enum expected
$words = getint16(4);
^
Main.java:17: error: class, interface, or enum expected
$i2 = $i1 + getint16(2); # or + ($words*2+7)/8
^
Main.java:17: error: illegal character: '#'
$i2 = $i1 + getint16(2); # or + ($words*2+7)/8
                         ^
Main.java:17: error: class, interface, or enum expected
$i2 = $i1 + getint16(2); # or + ($words*2+7)/8
                              ^
Main.java:18: error: illegal character: '#'
$i3 = $i2 + getint16(6); # or + ($words*1+7)/8
                         ^
Main.java:18: error: class, interface, or enum expected
$i3 = $i2 + getint16(6); # or + ($words*1+7)/8
                              ^
Main.java:19: error: illegal character: '#'
$i4 = $i3 + getint16(6); # or + ($words*1+7)/8
                         ^
Main.java:19: error: class, interface, or enum expected
$i4 = $i3 + getint16(6); # or + ($words*1+7)/8
                              ^
Main.java:21: error: illegal character: '#'
#printf "words %d 0x%x\n", $words, $words;
^
Main.java:22: error: illegal character: '#'
#printf "i1=0x%x, i2=0x%x, i3=0x%x, i4=0x%x\n", $i1, $i2, $i3, $i4;
^
Main.java:22: error: class, interface, or enum expected
#printf "i1=0x%x, i2=0x%x, i3=0x%x, i4=0x%x\n", $i1, $i2, $i3, $i4;
        ^
Main.java:24: error: class, interface, or enum expected
my @rootkey = (split //," abcdefghijklmnopqrstuvwxyz,.'[]");
^
Main.java:24: error: class, interface, or enum expected
my @rootkey = (split //," abcdefghijklmnopqrstuvwxyz,.'[]");
            ^
Main.java:25: error: illegal '.'
for my$i(0 .. 1023) {
            ^
Main.java:26: error: class, interface, or enum expected
  my @key; $key[0] = $rootkey[$i/32];
         ^
Main.java:26: error: class, interface, or enum expected
  my @key; $key[0] = $rootkey[$i/32];
           ^
Main.java:27: error: class, interface, or enum expected
  $key[1] = $rootkey[$i%32];
  ^
Main.java:28: error: class, interface, or enum expected
  next if $key[0] eq ' ';
  ^
Main.java:30: error: class, interface, or enum expected
  for $ci(getint16($i*2) .. getint16($i*2+2)-1) {
  ^
Main.java:30: error: illegal '.'
  for $ci(getint16($i*2) .. getint16($i*2+2)-1) {
                          ^
Main.java:32: error: class, interface, or enum expected
    my $hi = getbits($i1, 2, $ci);
    ^
Main.java:33: error: class, interface, or enum expected
    my $lo = $bit24 & 0x3fff;
    ^
Main.java:34: error: illegal character: '#'
    #printf "%x %04x\t", $hi, $lo;
    ^
Main.java:34: error: class, interface, or enum expected
    #printf "%x %04x\t", $hi, $lo;
            ^
Main.java:36: error: class, interface, or enum expected
    $key[2] = $rootkey[$bit24>>19];
    ^
Main.java:37: error: class, interface, or enum expected
    $key[3] = $rootkey[$bit24>>14 & 0x1f];
    ^
Main.java:39: error: class, interface, or enum expected
    my $flag_unknown = getbits($i2, 1, $ci);
    ^
Main.java:40: error: class, interface, or enum expected
    my $flag_sp = getbits($i3, 1, $ci);
    ^
Main.java:42: error: class, interface, or enum expected
    print join '', @key;
    ^
Main.java:42: error: empty character literal
    print join '', @key;
               ^
Main.java:42: error: unclosed character literal
    print join '', @key;
                ^
Main.java:42: error: class, interface, or enum expected
    print join '', @key;
                       ^
Main.java:43: error: class, interface, or enum expected
    $char = chr($hi<<14 | $lo);
    ^
Main.java:44: error: class, interface, or enum expected
    printf "\t%s", $char;
    ^
Main.java:45: error: class, interface, or enum expected
    printf "\t%s", $flag_sp?' ':'*';
    ^
Main.java:46: error: class, interface, or enum expected
    printf "%s", $flag_unknown?' ':'+';
    ^
Main.java:47: error: class, interface, or enum expected
    print "\n";
    ^
Main.java:48: error: class, interface, or enum expected
  }
  ^
Main.java:53: error: class, interface, or enum expected
  return $b[$addr] | $b[$addr+1]<<8;
  ^
Main.java:54: error: class, interface, or enum expected
}
^
Main.java:57: warning: '_' used as an identifier
  my($start, $nbit, $i) = @_;
                           ^
  (use of '_' as an identifier might not be supported in releases after Java SE 8)
Main.java:57: error: class, interface, or enum expected
  my($start, $nbit, $i) = @_;
                            ^
Main.java:58: error: class, interface, or enum expected
  if($nbit==1 || $nbit==2 || $nbit==4) {
  ^
Main.java:60: error: class, interface, or enum expected
    my $ovalue = $byte>>(8-$nbit - $i*$nbit %8);
    ^
Main.java:61: error: class, interface, or enum expected
    return $ovalue & ((1<<$nbit)-1);
    ^
Main.java:62: error: class, interface, or enum expected
  } elsif($nbit>0 && $nbit%8==0) {
  ^
Main.java:64: error: class, interface, or enum expected
    my $value = 0;
    ^
Main.java:65: error: class, interface, or enum expected
    my $a = $start + $i * $nbyte;
    ^
Main.java:66: error: class, interface, or enum expected
    while($nbyte--) {
    ^
Main.java:68: error: class, interface, or enum expected
    }
    ^
Main.java:70: error: class, interface, or enum expected
  } else {
  ^
Main.java:72: error: class, interface, or enum expected
  }
  ^
63 errors
1 warning
stdout
Standard output is empty