Permalink
Browse files

Fix disasm.pl

  • Loading branch information...
1 parent b665c05 commit e0d967a0dc880da3ec96b1b111092cbac014633d Fuji Goro committed Aug 30, 2011
Showing with 14 additions and 4 deletions.
  1. +14 −4 tool/disasm.pl
View
@@ -1,16 +1,26 @@
#!perl -w
use strict;
-use Text::Xslate;
+use Data::MessagePack;
use Data::Dumper;
-my $tx = Text::Xslate->new(cache => 2);
+use File::Slurp qw(slurp);
$Data::Dumper::Indent = 0;
$Data::Dumper::Terse = 1;
$Data::Dumper::Useqq = 1;
foreach my $file(@ARGV) {
- my $asm = $tx->load_file($file);
- foreach my $c(@{$asm}) {
+ my $data = slurp($file);
+ my $unpacker = Data::MessagePack::Unpacker->new();
+
+ my $offset = $unpacker->execute($data);
+ my $is_utf8 = $unpacker->data();
+ $unpacker->reset();
+ $unpacker->utf8($is_utf8);
+
+ while($offset < length($data)) {
+ $offset = $unpacker->execute($data, $offset);
+ my $c = $unpacker->data();
+ $unpacker->reset();
print Dumper($c), "\n";
}
}

0 comments on commit e0d967a

Please sign in to comment.