home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 December (Special)
/
PCWorld_2005-12_Special_cd.bin
/
Bezpecnost
/
lsti
/
lsti.exe
/
framework-2.5.exe
/
assemble
< prev
next >
Wrap
Text File
|
2005-01-27
|
648b
|
31 lines
use B::Assembler qw(assemble_fh);
use FileHandle;
my ($filename, $fh, $out);
if ($ARGV[0] eq "-d") {
B::Assembler::debug(1);
shift;
}
$out = \*STDOUT;
if (@ARGV == 0) {
$fh = \*STDIN;
$filename = "-";
} elsif (@ARGV == 1) {
$filename = $ARGV[0];
$fh = new FileHandle "<$filename";
} elsif (@ARGV == 2) {
$filename = $ARGV[0];
$fh = new FileHandle "<$filename";
$out = new FileHandle ">$ARGV[1]";
} else {
die "Usage: assemble [filename] [outfilename]\n";
}
binmode $out;
$SIG{__WARN__} = sub { warn "$filename:@_" };
$SIG{__DIE__} = sub { die "$filename: @_" };
assemble_fh($fh, sub { print $out @_ });