|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jawk.backend.AVM
public class AVM
The Jawk interpreter.
It takes tuples constructed by the intermediate step and executes each tuple in accordance to their instruction semantics. The tuples correspond to the Awk script compiled by the parser. The interpreter consists of an instruction processor (interpreter), a runtime stack, and machinery to support the instruction set contained within the tuples.
The interpreter runs completely independent of the frontend/intermediate step. In fact, an intermediate file produced by Jawk is sufficient to execute on this interpreter. The binding datastructure is the AwkParameters, which can contain options pertinent to the interpreter. For example, the interpreter must know about the -v command line arguments, as well as the file/variable list parameters (ARGC/ARGV) after the script on the command line. However, if programmatic access to the AVM is required, meaningful AwkParameters are not required.
Semantic analysis has occurred prior to execution of the interpreter. Therefore, the interpreter throws AwkRuntimeExceptions upon most errors/conditions. It can also throw a java.lang.Error if an interpreter error is encountered.
Field Summary | |
---|---|
static int |
NULL_OFFSET
The value of an address which is not yet assigned a tuple index. |
Constructor Summary | |
---|---|
AVM()
Construct the interpreter. |
|
AVM(AwkParameters parameters,
java.util.Map<java.lang.String,JawkExtension> extensions)
Construct the interpreter, accepting parameters which may have been set on the command-line arguments to the JVM. |
Method Summary | |
---|---|
void |
assignVariable(java.lang.String name,
java.lang.Object obj)
Set the contents of a user-defined AWK variable. |
java.lang.Object |
getARGC()
Retrieve the contents of the ARGC variable. |
java.lang.Object |
getARGV()
Retrieve the contents of the ARGV variable. |
java.lang.Object |
getCONVFMT()
Retrieve the contents of the CONVFMT variable. |
java.lang.Object |
getFS()
Retrieve the contents of the FS variable. |
java.lang.Object |
getOFS()
Retrieve the contents of the OFS variable. |
java.lang.Object |
getRS()
Retrieve the contents of the RS variable. |
java.lang.Object |
getSUBSEP()
Retrieve the contents of the SUBSEP variable. |
void |
incFNR()
Increases the FNR variable by 1. |
void |
incNR()
Increases the NR variable by 1. |
int |
interpret(AwkTuples tuples)
Traverse the tuples, executing their associated opcodes to provide an execution platform for Jawk scripts. |
void |
resetFNR()
Resets the FNR variable to 0. |
void |
setFILENAME(java.lang.String filename)
Set the contents of the FILENAME variable. |
void |
setNF(java.lang.Integer I)
Set the contents of the NF variable. |
void |
waitForIO()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NULL_OFFSET
Constructor Detail |
---|
public AVM()
Provided to allow programmatic construction of the interpreter outside of the framework which is used by Jawk.
public AVM(AwkParameters parameters, java.util.Map<java.lang.String,JawkExtension> extensions) throws java.lang.IllegalArgumentException
parameters
- The parameters affecting the behavior of the
interpreter.
java.lang.IllegalArgumentException
Method Detail |
---|
public int interpret(AwkTuples tuples)
interpret
in interface AwkInterpreter
tuples
- The tuples to interpret.
public void waitForIO()
public final java.lang.Object getRS()
VariableManager
getRS
in interface VariableManager
public final java.lang.Object getOFS()
VariableManager
getOFS
in interface VariableManager
public final java.lang.Object getSUBSEP()
VariableManager
getSUBSEP
in interface VariableManager
public final void assignVariable(java.lang.String name, java.lang.Object obj)
VariableManager
assignVariable
in interface VariableManager
name
- The AWK variable name.obj
- The new contents of the variable.public java.lang.Object getFS()
VariableManager
getFS
in interface VariableManager
public java.lang.Object getCONVFMT()
VariableManager
getCONVFMT
in interface VariableManager
public void resetFNR()
VariableManager
resetFNR
in interface VariableManager
public void incFNR()
VariableManager
incFNR
in interface VariableManager
public void incNR()
VariableManager
incNR
in interface VariableManager
public void setNF(java.lang.Integer I)
VariableManager
setNF
in interface VariableManager
public void setFILENAME(java.lang.String filename)
VariableManager
setFILENAME
in interface VariableManager
public java.lang.Object getARGV()
VariableManager
getARGV
in interface VariableManager
public java.lang.Object getARGC()
VariableManager
getARGC
in interface VariableManager
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |