B::JVM::Emit - Package used by B::JVM to emit Java Bytecode
use B::JVM::Jasmin::Emit; my $emitter = new B::JVM::Emit(FILEHANDLE); # ... $emitter->DIRECTIVE_NAME([@ARGS]); # ... $emitter->OPCODE_NAME([@ARGS]); # ... $emitter->OPCODE_NAME([@ARGS]);
This class is used Java bytcodes on a file handle. Until someone actually creates a module that truely emits Java bytecodes, the interesting stuff is all happening in the subclass, B::JVM::Jasmin::Emit. The method names used here were built up from the jasmin syntax. There was no reason for this other than the implementor was most familar with that manner of thinking about Java bytecode. However, the set should cover every opcode available.
The user of this module must send opcodes in the order desired and is responsible for emitting a sensible JVM program. All this module provides is a consistent way to emit JVM opcodes from Perl, since there is no universal assembler syntax. Someone who wants to emit opcodes need only subclass this module and implement all the methods.
Bradley M. Kuhn, email@example.com, http://www.ebb.org/bkuhn
Copyright (C) 1999, Bradley M. Kuhn, All Rights Reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the LICENSE file that was shipped with this distribution.
Version number of B::JVM::Emit. For now, it should always match the version of B::JVM::Jasmin
Used for error reporting
Creates a new object of the class. It assumes that FILEHANDLE is a lexically scoped file handle open for writing.
Clears the current method name.
Sets the current name of the method being emitted.
Returns true (in particular, the current method name) if we are currently in method, and returns false otherwise.
Sets the name of the class being emitted.