#!perl -w use strict; use IO::File; use Compress::Zlib; my $filenr=0; my $fn= shift or die "need fn\n"; my $fh= IO::File->new($fn) or die "$fn: $!\n"; binmode $fh; my $hdrdata= read_sisx_header($fh); my $hdr= parse_sisx_header($hdrdata); my $blockdata= read_sisx_block($fh); my $sisx= parse_sisx_block($blockdata); use Dumpvalue; my $d= new Dumpvalue; $d->dumpValue($sisx); sub read_sisx_header { my ($fh)= @_; my $hdrdata; $fh->read($hdrdata, 20); return $hdrdata; } sub parse_sisx_header { my ($hdrdata)= @_; my %hdr; ( $hdr{dw1}, $hdr{dw2}, $hdr{dw3}, $hdr{dw4}, $hdr{dw5}, ) = unpack("VVVVV", $hdrdata); return \%hdr; } sub read_sisx_block { my ($fh) = @_; my $hdr; $fh->read($hdr, 4); my ($len)= unpack("V", $hdr); my $data; $fh->read($data, $len); return $hdr.$data; } sub parse_sisx_block { my ($blockdata)= @_; my $ofs= 0; my @blocks; while ($ofs$ofs, block=>\%block, }; $ofs += rounddw($len)+4; } return \@blocks; } sub rounddw { if ($_[0]&3) { return ($_[0]|3)+1; } else { return $_[0]; } } sub savefile { my ($data)= @_; my $fn= sprintf("sisxblock-%d.nb", $filenr++); my $fh= IO::File->new($fn, "w") or die "$fn: $!\n"; binmode $fh; $fh->print($data); $fh->close(); }