Disassembler.pm revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# Copyright (c) 1996 Malcolm Beattie
#
# You may distribute under the terms of either the GNU General Public
# License or the Artistic License, as specified in the README file.
package B::Disassembler::BytecodeStream;
use FileHandle;
use Carp;
@ISA = qw(FileHandle);
sub readn {
my $data;
return $data;
}
sub GET_U8 {
my $fh = shift;
my $c = $fh->getc;
croak "reached EOF while reading U8" unless defined($c);
return ord($c);
}
sub GET_U16 {
my $fh = shift;
return unpack("n", $str);
}
sub GET_NV {
my $fh = shift;
return unpack("N", $str);
}
sub GET_U32 {
my $fh = shift;
return unpack("N", $str);
}
sub GET_I32 {
my $fh = shift;
}
sub GET_objindex {
my $fh = shift;
return unpack("N", $str);
}
sub GET_opindex {
my $fh = shift;
return unpack("N", $str);
}
sub GET_svindex {
my $fh = shift;
return unpack("N", $str);
}
sub GET_strconst {
my $fh = shift;
my ($str, $c);
while (defined($c = $fh->getc) && $c ne "\0") {
$str .= $c;
}
croak "reached EOF while reading strconst" unless defined($c);
}
sub GET_pvcontents {}
sub GET_PV {
my $fh = shift;
my $str;
if ($len) {
} else {
return '""';
}
}
sub GET_comment_t {
my $fh = shift;
my ($str, $c);
while (defined($c = $fh->getc) && $c ne "\n") {
$str .= $c;
}
croak "reached EOF while reading comment" unless defined($c);
}
sub GET_double {
my $fh = shift;
my ($str, $c);
while (defined($c = $fh->getc) && $c ne "\0") {
$str .= $c;
}
croak "reached EOF while reading double" unless defined($c);
return $str;
}
sub GET_none {}
sub GET_op_tr_array {
my $fh = shift;
return join(",", @ary);
}
sub GET_IV64 {
my $fh = shift;
}
package B::Disassembler;
use Exporter;
@EXPORT_OK = qw(disassemble_fh);
use Carp;
use strict;
sub disassemble_fh {
bless $fh, "B::Disassembler::BytecodeStream";
while (defined($c = $fh->getc)) {
$c = ord($c);
die "Illegal instruction code $c at stream offset $pos\n";
}
if (defined($arg)) {
} else {
}
}
}
1;
=head1 NAME
B::Disassembler - Disassemble Perl bytecode
=head1 SYNOPSIS
use Disassembler;
=head1 DESCRIPTION
See F<ext/B/B/Disassembler.pm>.
=head1 AUTHOR
Malcolm Beattie, C<mbeattie@sable.ox.ac.uk>
=cut