Class AwkTuples
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AwkExpression,AwkProgram,SandboxedAwkTuples
AwkTuples class.
- Author:
- Danny Daglas
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd()add.voidaddGlobalVariableNameToOffsetMapping(String varname, int offset, boolean isArray) Accept a {variable_name -> offset} mapping such that global variables can be assigned while processing name=value and filename command-line arguments.address.voidapplyRS()applyRS.voidapplySubsep(int count) applySubsep.voidargcOffset(int offset) argcOffset.voidargvOffset(int offset) argvOffset.voidassign(int offset, boolean isGlobal) assign.voidAssigns the top-of-stack value toARGC.voidEmits the tuple assigning the top of the stack to ARGIND, managed by the JRT.voidassignArray(int offset, boolean isGlobal) assignArray.voidassignAsInput.voidassignAsInputField.voidAssigns the top-of-stack value toCONVFMT.voidEmits the tuple assigning the top of the stack to ERRNO, managed by the JRT.voidAssigns the top-of-stack value toFILENAME.voidAssigns the top-of-stack value toFNR.voidassignFS()Assigns the top-of-stack value toFS.voidEmits a tuple assigning the top of the stack to IGNORECASE.voidAssigns a value to a stack-provided associative-array element.voidassignNF()Assigns the top-of-stack value toNF.voidassignNR()Assigns the top-of-stack value toNR.voidAssigns the top-of-stack value toOFMT.voidAssigns the top-of-stack value toOFS.voidAssigns the top-of-stack value toORS.voidAssigns the top-of-stack value toRLENGTH.voidassignRS()Assigns the top-of-stack value toRS.voidAssigns the top-of-stack value toRSTART.voidAssigns the top-of-stack value toSUBSEP.voidatan2()atan2.voidEmits the tuple that runs the extension beforeStart hooks, placed at the end of the preamble.voidcallFunction(Supplier<Address> addressSupplier, String funcName, int numFormalParams, int numActualParams) callFunction.booleancheckClass(Class<?> cls) checkClass.voidclose()close.voidcmpEq()cmpEq.voidcmpGt()cmpGt.voidcmpLt()cmpLt.voidconcat()concat.voidDeprecated.Evaluates both range conditions on every record, which is incorrect when the conditions have side effects.voidconditionPairEnter(long id) Marks the specified range pattern as active, after its start condition matched the current record.voidconditionPairInRange(long id) Pushes whether the specified range pattern is currently active, i.e. its start condition matched a previous record and its end condition hasn't matched yet.voidconditionPairLeave(long id) Marks the specified range pattern as inactive, after its end condition matched the current record.voidconsumeFileInput(Address address) Emits the tuple consuming one record of the current input file only, jumping to the given address at end of the current file.voidconsumeInput(Address address) consumeInput.voidconvfmtOffset(int offset) convfmtOffset.voidcos()cos.createAddress(String label) createAddress.voiddec(int offset, boolean isGlobal) dec.voiddecArrayRef(int offset, boolean isGlobal) decArrayRef.voiddecDollarRef.voidDecrements a stack-provided associative-array element reference.voiddeleteArray(int offset, boolean isGlobal) deleteArray.voiddeleteArrayElement(int offset, boolean isGlobal) deleteArrayElement.voidDeletes a stack-provided associative-array element.voiddereference(int offset, boolean isArray, boolean isGlobal) dereference.voiddereferenceArray.voiddivEq(int offset, boolean isGlobal) divEq.voiddivEqArray(int offset, boolean isGlobal) divEqArray.voiddivEqInputField.voidApplies/=to a stack-provided associative-array element.voiddivide()divide.voiddump(PrintStream ps) Dumps the queued tuples to the providedPrintStream.voiddup()dup.voidDereferences an associative-array element as a nested array, creating it if needed.voidenvironOffset(int offset) environOffset.voidEmits the tuple executing thenextfilestatement at runtime.voidexitWithCode.voidexitWithCode.voidexp()exp.voidextension(ExtensionFunction function, int paramCount, boolean isInitial) Emits an extension invocation tuple.voidfilenameOffset(int offset) filenameOffset.voidfnrOffset(int offset) fnrOffset.voidFreezes the tuple metadata after compilation so execution can reuse the published maps and sets without creating fresh unmodifiable wrappers.voidfsOffset(int offset) fsOffset.voidfunction.Returns the address of the ENDFILE section, ornullwhen the program has no BEGINFILE/ENDFILE rules.Returns the address of the END blocks section, ornullwhen the tuple stream is an expression stream with no END blocks.voidgetFirstAndRemoveFromList.getFunctionNameSet.getGlobalVariableAarrayMap.getGlobalVariableOffsetMap.voidgetInputField.voidgetInputField(long fieldIndex) getInputField.voidgetlineInput.voidgetlineInputToTarget.Returns the address of theNEXT_FILEtuple that opens each input file, ornullwhen the program does not use per-file input stepping.Returns the description of the primary script source.voidgotoAddress(Address address) gotoAddress.voidifFalse.voidifTrue.voidinc(int offset, boolean isGlobal) inc.voidincArrayRef(int offset, boolean isGlobal) incArrayRef.voidincDollarRef.voidIncrements a stack-provided associative-array element reference.voidindex()index.voidindirectCall(Map<String, Tuple.IndirectFunctionTarget> userFunctions, Map<String, ExtensionFunction> extensionFunctions, int numActualParams, String sourceName, int lineNumber) Emits a call whose function name is evaluated at runtime.voidintFunc()intFunc.voidisEmptyList(Address address) isEmptyList.voidisIn()isIn.voidkeylist()key list.voidlength(int numExprs) length.voidlog()log.voidMarks this tuple stream as an expression-eval program rather than a full AWK script.voidmatch()match.voidmatches()matches.voidminusEq(int offset, boolean isGlobal) minusEq.voidminusEqArray(int offset, boolean isGlobal) minusEqArray.voidminusEqInputField.voidApplies-=to a stack-provided associative-array element.voidmod()mod.voidmodEq(int offset, boolean isGlobal) modEq.voidmodEqArray(int offset, boolean isGlobal) modEqArray.voidmodEqInputField.voidApplies%=to a stack-provided associative-array element.voidmultEq(int offset, boolean isGlobal) multEq.voidmultEqArray(int offset, boolean isGlobal) multEqArray.voidmultEqInputField.voidApplies*=to a stack-provided associative-array element.voidmultiply()multiply.voidnegate()negate.voidEmits the tuple advancing the main input to the next input file, or jumping to the given address when no input file remains.voidnfOffset(int offset) nfOffset.voidnop()nop.voidnot()not.voidnrOffset(int offset) nrOffset.voidofmtOffset(int offset) ofmtOffset.voidofsOffset(int offset) ofsOffset.voidoptimize()Performs tuple queue optimizations such as reachability pruning, redundant eval-global setup removal, and NOP collapsing.voidorsOffset(int offset) orsOffset.voidLooks up an associative-array element without creating a blank entry when the key is missing.voidpeekDereference(int offset, boolean isGlobal) Emits a variable read that does not assign a blank value when the variable is still untyped.voidplusEq(int offset, boolean isGlobal) plusEq.voidplusEqArray(int offset, boolean isGlobal) plusEqArray.voidplusEqInputField.voidApplies+=to a stack-provided associative-array element.voidpop()pop.voidDiscards a value that was evaluated in scalar context.voidpopSourceLineNumber(int lineno) popSourceLineNumber.voidpostDec(int offset, boolean isGlobal) postDec.voidpostInc(int offset, boolean isGlobal) postInc.voidExecuted after all tuples are entered in the queue.voidpow()pow.voidpowEq(int offset, boolean isGlobal) powEq.voidpowEqArray(int offset, boolean isGlobal) powEqArray.voidpowEqInputField.voidApplies exponentiation assignment to a stack-provided associative-array element.voidprint(int numExprs) print.voidprintf(int numExprs) printf.voidprintfToFile(int numExprs, boolean append) printfToFile.voidprintfToPipe(int numExprs) printfToPipe.voidprintToFile(int numExprs, boolean append) printToFile.voidprintToPipe(int numExprs) printToPipe.voidpush.voidpushARGC()Pushes the current value ofARGConto the operand stack.voidEmits the tuple pushing the value of ARGIND, managed by the JRT.voidPushes the current value ofCONVFMTonto the operand stack.voidEmits the tuple pushing the value of ERRNO, managed by the JRT.voidPushes the current value ofFILENAMEonto the operand stack.voidpushFNR()Pushes the current value ofFNRonto the operand stack.voidpushFS()Pushes the current value ofFSonto the operand stack.voidEmits a tuple pushing the value of IGNORECASE.voidpushIndirectArgument(int offset, boolean isGlobal) Emits a variable reference whose scalar value is captured immediately while retaining the variable location for a runtime-selected array parameter.voidEmits an indirect-call subarray argument after its containing map and key.voidpushNF()Pushes the current value ofNFonto the operand stack.voidpushNR()Pushes the current value ofNRonto the operand stack.voidpushOFMT()Pushes the current value ofOFMTonto the operand stack.voidpushOFS()Pushes the current value ofOFSonto the operand stack.voidpushORS()Pushes the current value ofORSonto the operand stack.voidPushes the current value ofRLENGTHonto the operand stack.voidpushRS()Pushes the current value ofRSonto the operand stack.voidPushes the current value ofRSTARTonto the operand stack.voidpushSourceLineNumber(int lineno) Push the current line number onto the line number stack.voidPushes the current value ofSUBSEPonto the operand stack.voidrand()rand.voidregexp.voidreturnFromFunction.voidrlengthOffset(int offset) rlengthOffset.voidrsOffset(int offset) rsOffset.voidrstartOffset(int offset) rstartOffset.voidEmits a tuple that pushes the current script context onto the stack.voidsetEndFileAddress(Address addr) Registers the address of the ENDFILE section, so that a runtimenextfilestatement can jump to it.voidsetExitAddress(Address addr) Registers the address of the END blocks section, so that a runtimeexitstatement can jump to it.voidsetFunctionNameSet(Set<String> names) Accept a set of function names from the parser.voidsetNextFileAddress(Address addr) Registers the address of theNEXT_FILEtuple that opens each input file, so that a runtimenextfilestatement can bypass the ENDFILE rules for input files that could not be opened.voidsetNumGlobals(int numGlobals) setNumGlobals.voidsetReturnResult.voidsetSourceDescription(String sourceDescriptionParam) Records the description of the primary script source (typically its file name) so runtime diagnostics can point at it.voidsetWithinEndBlocks(boolean b) setWithinEndBlocks.voidsin()sin.voidsplit(int numargs) split.voidsprintf(int numExprs) sprintf.voidsqrt()sqrt.voidsrand(int num) srand.voidsubForArrayReference(int offset, boolean isGlobal, boolean isGsub) subForArrayReference.voidsubForDollar0(boolean isGsub) subForDollar0.voidsubForDollarReference(boolean isGsub) subForDollarReference.voidsubForMapReference(boolean isGsub) Appliessub/gsubto a stack-provided associative-array element.voidsubForVariable(int offset, boolean isGlobal, boolean isGsub) subForVariable.voidsubsepOffset(int offset) subsepOffset.voidsubstr(int numargs) substr.voidsubtract()subtract.voidswap()swap.voidsystem()system.voidtolower()tolower.voidtoNumber()toNumber.static StringtoOpcodeString(int opcode) toOpcodeString.top()top.voidtoupper()toupper.voidunary plus.voidupdateFunctab(int offset) Emits the tuple populating the FUNCTAB array.voidupdateSymtab(int offset) Emits the tuple populating the SYMTAB array.voiduseAsCommandInput.voiduseAsFileInput.voidEmits a tuple that prints a diagnostic message to the warning stream when executed.
-
Constructor Details
-
AwkTuples
public AwkTuples()
-
-
Method Details
-
setSourceDescription
Records the description of the primary script source (typically its file name) so runtime diagnostics can point at it.- Parameters:
sourceDescriptionParam- script source description
-
getSourceDescription
Returns the description of the primary script source.- Returns:
- script source description, or
nullwhen unknown
-
toOpcodeString
toOpcodeString.
- Parameters:
opcode- a int- Returns:
- a
Stringobject
-
pop
public void pop()pop.
-
popScalar
public void popScalar()Discards a value that was evaluated in scalar context. -
push
push.
- Parameters:
o- aObjectobject
-
ifFalse
ifFalse.
- Parameters:
address- aAddressobject
-
toNumber
public void toNumber()toNumber.
-
ifTrue
ifTrue.
- Parameters:
address- aAddressobject
-
gotoAddress
gotoAddress.
- Parameters:
address- aAddressobject
-
createAddress
createAddress.
-
address
address.
-
nop
public void nop()nop.
-
print
public void print(int numExprs) print.
- Parameters:
numExprs- a int
-
printToFile
public void printToFile(int numExprs, boolean append) printToFile.
- Parameters:
numExprs- a intappend- a boolean
-
printToPipe
public void printToPipe(int numExprs) printToPipe.
- Parameters:
numExprs- a int
-
printf
public void printf(int numExprs) printf.
- Parameters:
numExprs- a int
-
printfToFile
public void printfToFile(int numExprs, boolean append) printfToFile.
- Parameters:
numExprs- a intappend- a boolean
-
printfToPipe
public void printfToPipe(int numExprs) printfToPipe.
- Parameters:
numExprs- a int
-
sprintf
public void sprintf(int numExprs) sprintf.
- Parameters:
numExprs- a int
-
length
public void length(int numExprs) length.
- Parameters:
numExprs- a int
-
concat
public void concat()concat.
-
assign
public void assign(int offset, boolean isGlobal) assign.
- Parameters:
offset- a intisGlobal- a boolean
-
assignArray
public void assignArray(int offset, boolean isGlobal) assignArray.
- Parameters:
offset- a intisGlobal- a boolean
-
assignMapElement
public void assignMapElement()Assigns a value to a stack-provided associative-array element. -
assignAsInput
public void assignAsInput()assignAsInput.
-
markEvalTupleStream
public void markEvalTupleStream()Marks this tuple stream as an expression-eval program rather than a full AWK script. Eval tuple streams can use small tuple-level optimizations that are unsafe for the general case. -
assignAsInputField
public void assignAsInputField()assignAsInputField.
-
dereference
public void dereference(int offset, boolean isArray, boolean isGlobal) dereference.
- Parameters:
offset- a intisArray- a booleanisGlobal- a boolean
-
peekDereference
public void peekDereference(int offset, boolean isGlobal) Emits a variable read that does not assign a blank value when the variable is still untyped.This is used by extension functions such as gawk's
typeof()that need the current lvalue state, not AWK's normal scalar autovivification side effect.- Parameters:
offset- variable offsetisGlobal- whether the variable is global
-
pushIndirectArgument
public void pushIndirectArgument(int offset, boolean isGlobal) Emits a variable reference whose scalar value is captured immediately while retaining the variable location for a runtime-selected array parameter.- Parameters:
offset- variable offsetisGlobal- whether the variable is global
-
pushIndirectArrayArgument
public void pushIndirectArrayArgument()Emits an indirect-call subarray argument after its containing map and key. -
plusEq
public void plusEq(int offset, boolean isGlobal) plusEq.
- Parameters:
offset- a intisGlobal- a boolean
-
minusEq
public void minusEq(int offset, boolean isGlobal) minusEq.
- Parameters:
offset- a intisGlobal- a boolean
-
multEq
public void multEq(int offset, boolean isGlobal) multEq.
- Parameters:
offset- a intisGlobal- a boolean
-
divEq
public void divEq(int offset, boolean isGlobal) divEq.
- Parameters:
offset- a intisGlobal- a boolean
-
modEq
public void modEq(int offset, boolean isGlobal) modEq.
- Parameters:
offset- a intisGlobal- a boolean
-
powEq
public void powEq(int offset, boolean isGlobal) powEq.
- Parameters:
offset- a intisGlobal- a boolean
-
plusEqArray
public void plusEqArray(int offset, boolean isGlobal) plusEqArray.
- Parameters:
offset- a intisGlobal- a boolean
-
plusEqMapElement
public void plusEqMapElement()Applies+=to a stack-provided associative-array element. -
minusEqArray
public void minusEqArray(int offset, boolean isGlobal) minusEqArray.
- Parameters:
offset- a intisGlobal- a boolean
-
minusEqMapElement
public void minusEqMapElement()Applies-=to a stack-provided associative-array element. -
multEqArray
public void multEqArray(int offset, boolean isGlobal) multEqArray.
- Parameters:
offset- a intisGlobal- a boolean
-
multEqMapElement
public void multEqMapElement()Applies*=to a stack-provided associative-array element. -
divEqArray
public void divEqArray(int offset, boolean isGlobal) divEqArray.
- Parameters:
offset- a intisGlobal- a boolean
-
divEqMapElement
public void divEqMapElement()Applies/=to a stack-provided associative-array element. -
modEqArray
public void modEqArray(int offset, boolean isGlobal) modEqArray.
- Parameters:
offset- a intisGlobal- a boolean
-
modEqMapElement
public void modEqMapElement()Applies%=to a stack-provided associative-array element. -
powEqArray
public void powEqArray(int offset, boolean isGlobal) powEqArray.
- Parameters:
offset- a intisGlobal- a boolean
-
powEqMapElement
public void powEqMapElement()Applies exponentiation assignment to a stack-provided associative-array element. -
plusEqInputField
public void plusEqInputField()plusEqInputField.
-
minusEqInputField
public void minusEqInputField()minusEqInputField.
-
multEqInputField
public void multEqInputField()multEqInputField.
-
divEqInputField
public void divEqInputField()divEqInputField.
-
modEqInputField
public void modEqInputField()modEqInputField.
-
powEqInputField
public void powEqInputField()powEqInputField.
-
srand
public void srand(int num) srand.
- Parameters:
num- a int
-
rand
public void rand()rand.
-
intFunc
public void intFunc()intFunc.
-
sqrt
public void sqrt()sqrt.
-
log
public void log()log.
-
exp
public void exp()exp.
-
sin
public void sin()sin.
-
cos
public void cos()cos.
-
atan2
public void atan2()atan2.
-
match
public void match()match.
-
index
public void index()index.
-
subForDollar0
public void subForDollar0(boolean isGsub) subForDollar0.
- Parameters:
isGsub- a boolean
-
subForDollarReference
public void subForDollarReference(boolean isGsub) subForDollarReference.
- Parameters:
isGsub- a boolean
-
subForVariable
public void subForVariable(int offset, boolean isGlobal, boolean isGsub) subForVariable.
- Parameters:
offset- a intisGlobal- a booleanisGsub- a boolean
-
subForArrayReference
public void subForArrayReference(int offset, boolean isGlobal, boolean isGsub) subForArrayReference.
- Parameters:
offset- a intisGlobal- a booleanisGsub- a boolean
-
subForMapReference
public void subForMapReference(boolean isGsub) Appliessub/gsubto a stack-provided associative-array element.- Parameters:
isGsub-trueforgsub,falseforsub
-
split
public void split(int numargs) split.
- Parameters:
numargs- a int
-
substr
public void substr(int numargs) substr.
- Parameters:
numargs- a int
-
tolower
public void tolower()tolower.
-
toupper
public void toupper()toupper.
-
system
public void system()system.
-
swap
public void swap()swap.
-
add
public void add()add.
-
subtract
public void subtract()subtract.
-
multiply
public void multiply()multiply.
-
divide
public void divide()divide.
-
mod
public void mod()mod.
-
pow
public void pow()pow.
-
inc
public void inc(int offset, boolean isGlobal) inc.
- Parameters:
offset- a intisGlobal- a boolean
-
dec
public void dec(int offset, boolean isGlobal) dec.
- Parameters:
offset- a intisGlobal- a boolean
-
postInc
public void postInc(int offset, boolean isGlobal) postInc.
- Parameters:
offset- a intisGlobal- a boolean
-
postDec
public void postDec(int offset, boolean isGlobal) postDec.
- Parameters:
offset- a intisGlobal- a boolean
-
incArrayRef
public void incArrayRef(int offset, boolean isGlobal) incArrayRef.
- Parameters:
offset- a intisGlobal- a boolean
-
incMapRef
public void incMapRef()Increments a stack-provided associative-array element reference. -
decArrayRef
public void decArrayRef(int offset, boolean isGlobal) decArrayRef.
- Parameters:
offset- a intisGlobal- a boolean
-
decMapRef
public void decMapRef()Decrements a stack-provided associative-array element reference. -
incDollarRef
public void incDollarRef()incDollarRef.
-
decDollarRef
public void decDollarRef()decDollarRef.
-
dup
public void dup()dup.
-
not
public void not()not.
-
negate
public void negate()negate.
-
unaryPlus
public void unaryPlus()unary plus.
-
cmpEq
public void cmpEq()cmpEq.
-
cmpLt
public void cmpLt()cmpLt.
-
cmpGt
public void cmpGt()cmpGt.
-
matches
public void matches()matches.
-
dereferenceArray
public void dereferenceArray()dereferenceArray.
-
peekArrayElement
public void peekArrayElement()Looks up an associative-array element without creating a blank entry when the key is missing. -
ensureArrayElement
public void ensureArrayElement()Dereferences an associative-array element as a nested array, creating it if needed. -
keylist
public void keylist()key list.
-
isEmptyList
isEmptyList.
- Parameters:
address- aAddressobject
-
getFirstAndRemoveFromList
public void getFirstAndRemoveFromList()getFirstAndRemoveFromList.
-
checkClass
checkClass.
- Parameters:
cls- aClassobject- Returns:
- a boolean
-
getInputField
public void getInputField()getInputField.
-
getInputField
public void getInputField(long fieldIndex) getInputField.
- Parameters:
fieldIndex- a long
-
consumeInput
consumeInput.
- Parameters:
address- aAddressobject
-
getlineInput
public void getlineInput()getlineInput.
-
getlineInputToTarget
public void getlineInputToTarget()getlineInputToTarget.
-
useAsFileInput
public void useAsFileInput()useAsFileInput.
-
useAsCommandInput
public void useAsCommandInput()useAsCommandInput.
-
nfOffset
public void nfOffset(int offset) nfOffset.
- Parameters:
offset- a int
-
nrOffset
public void nrOffset(int offset) nrOffset.
- Parameters:
offset- a int
-
fnrOffset
public void fnrOffset(int offset) fnrOffset.
- Parameters:
offset- a int
-
fsOffset
public void fsOffset(int offset) fsOffset.
- Parameters:
offset- a int
-
rsOffset
public void rsOffset(int offset) rsOffset.
- Parameters:
offset- a int
-
ofsOffset
public void ofsOffset(int offset) ofsOffset.
- Parameters:
offset- a int
-
orsOffset
public void orsOffset(int offset) orsOffset.
- Parameters:
offset- a int
-
rstartOffset
public void rstartOffset(int offset) rstartOffset.
- Parameters:
offset- a int
-
rlengthOffset
public void rlengthOffset(int offset) rlengthOffset.
- Parameters:
offset- a int
-
filenameOffset
public void filenameOffset(int offset) filenameOffset.
- Parameters:
offset- a int
-
subsepOffset
public void subsepOffset(int offset) subsepOffset.
- Parameters:
offset- a int
-
convfmtOffset
public void convfmtOffset(int offset) convfmtOffset.
- Parameters:
offset- a int
-
ofmtOffset
public void ofmtOffset(int offset) ofmtOffset.
- Parameters:
offset- a int
-
environOffset
public void environOffset(int offset) environOffset.
- Parameters:
offset- a int
-
beforeStartHooks
public void beforeStartHooks()Emits the tuple that runs the extension beforeStart hooks, placed at the end of the preamble. -
updateSymtab
public void updateSymtab(int offset) Emits the tuple populating the SYMTAB array.- Parameters:
offset- offset of the SYMTAB global
-
updateFunctab
public void updateFunctab(int offset) Emits the tuple populating the FUNCTAB array.- Parameters:
offset- offset of the FUNCTAB global
-
argcOffset
public void argcOffset(int offset) argcOffset.
- Parameters:
offset- a int
-
argvOffset
public void argvOffset(int offset) argvOffset.
- Parameters:
offset- a int
-
pushNF
public void pushNF()Pushes the current value ofNFonto the operand stack. -
assignNF
public void assignNF()Assigns the top-of-stack value toNF. -
pushNR
public void pushNR()Pushes the current value ofNRonto the operand stack. -
assignNR
public void assignNR()Assigns the top-of-stack value toNR. -
pushFNR
public void pushFNR()Pushes the current value ofFNRonto the operand stack. -
assignFNR
public void assignFNR()Assigns the top-of-stack value toFNR. -
pushFS
public void pushFS()Pushes the current value ofFSonto the operand stack. -
assignFS
public void assignFS()Assigns the top-of-stack value toFS. -
pushIGNORECASE
public void pushIGNORECASE()Emits a tuple pushing the value of IGNORECASE. -
assignIGNORECASE
public void assignIGNORECASE()Emits a tuple assigning the top of the stack to IGNORECASE. -
pushERRNO
public void pushERRNO()Emits the tuple pushing the value of ERRNO, managed by the JRT. -
assignERRNO
public void assignERRNO()Emits the tuple assigning the top of the stack to ERRNO, managed by the JRT. -
pushARGIND
public void pushARGIND()Emits the tuple pushing the value of ARGIND, managed by the JRT. -
assignARGIND
public void assignARGIND()Emits the tuple assigning the top of the stack to ARGIND, managed by the JRT. -
pushRS
public void pushRS()Pushes the current value ofRSonto the operand stack. -
assignRS
public void assignRS()Assigns the top-of-stack value toRS. -
pushOFS
public void pushOFS()Pushes the current value ofOFSonto the operand stack. -
assignOFS
public void assignOFS()Assigns the top-of-stack value toOFS. -
pushORS
public void pushORS()Pushes the current value ofORSonto the operand stack. -
assignORS
public void assignORS()Assigns the top-of-stack value toORS. -
pushRSTART
public void pushRSTART()Pushes the current value ofRSTARTonto the operand stack. -
assignRSTART
public void assignRSTART()Assigns the top-of-stack value toRSTART. -
pushRLENGTH
public void pushRLENGTH()Pushes the current value ofRLENGTHonto the operand stack. -
assignRLENGTH
public void assignRLENGTH()Assigns the top-of-stack value toRLENGTH. -
pushFILENAME
public void pushFILENAME()Pushes the current value ofFILENAMEonto the operand stack. -
assignFILENAME
public void assignFILENAME()Assigns the top-of-stack value toFILENAME. -
pushSUBSEP
public void pushSUBSEP()Pushes the current value ofSUBSEPonto the operand stack. -
assignSUBSEP
public void assignSUBSEP()Assigns the top-of-stack value toSUBSEP. -
pushCONVFMT
public void pushCONVFMT()Pushes the current value ofCONVFMTonto the operand stack. -
assignCONVFMT
public void assignCONVFMT()Assigns the top-of-stack value toCONVFMT. -
pushOFMT
public void pushOFMT()Pushes the current value ofOFMTonto the operand stack. -
assignOFMT
public void assignOFMT()Assigns the top-of-stack value toOFMT. -
pushARGC
public void pushARGC()Pushes the current value ofARGConto the operand stack. -
assignARGC
public void assignARGC()Assigns the top-of-stack value toARGC. -
applyRS
public void applyRS()applyRS.
-
function
function.
- Parameters:
funcName- aStringobjectnumFormalParams- a int
-
callFunction
public void callFunction(Supplier<Address> addressSupplier, String funcName, int numFormalParams, int numActualParams) callFunction.
- Parameters:
addressSupplier- supplier resolving the function's entry pointfuncName- aStringobjectnumFormalParams- a intnumActualParams- a int
-
indirectCall
public void indirectCall(Map<String, Tuple.IndirectFunctionTarget> userFunctions, Map<String, ExtensionFunction> extensionFunctions, int numActualParams, String sourceName, int lineNumber) Emits a call whose function name is evaluated at runtime.- Parameters:
userFunctions- available user-defined function targetsextensionFunctions- available extension function targetsnumActualParams- number of evaluated actual parameterssourceName- source name for runtime diagnosticslineNumber- source line for runtime diagnostics
-
warning
Emits a tuple that prints a diagnostic message to the warning stream when executed. Planted by the parser just before the instruction it describes, so the warning appears in runtime order, exactly where gawk emits it.- Parameters:
message- warning text to print
-
setReturnResult
public void setReturnResult()setReturnResult.
-
returnFromFunction
public void returnFromFunction()returnFromFunction.
-
setNumGlobals
public void setNumGlobals(int numGlobals) setNumGlobals.
- Parameters:
numGlobals- a int
-
close
public void close()close.
-
applySubsep
public void applySubsep(int count) applySubsep.
- Parameters:
count- a int
-
deleteArrayElement
public void deleteArrayElement(int offset, boolean isGlobal) deleteArrayElement.
- Parameters:
offset- a intisGlobal- a boolean
-
deleteMapElement
public void deleteMapElement()Deletes a stack-provided associative-array element. -
deleteArray
public void deleteArray(int offset, boolean isGlobal) deleteArray.
- Parameters:
offset- a intisGlobal- a boolean
-
setExitAddress
Registers the address of the END blocks section, so that a runtimeexitstatement can jump to it. A property of the tuple stream rather than a tuple: the interpreter reads it once when it installs the program.- Parameters:
addr- address of the END blocks section
-
getExitAddress
Returns the address of the END blocks section, ornullwhen the tuple stream is an expression stream with no END blocks.- Returns:
- address of the END blocks section, or
null
-
setWithinEndBlocks
public void setWithinEndBlocks(boolean b) setWithinEndBlocks.
- Parameters:
b- a boolean
-
setEndFileAddress
Registers the address of the ENDFILE section, so that a runtimenextfilestatement can jump to it. A property of the tuple stream rather than a tuple: the interpreter reads it once when it installs the program.- Parameters:
addr- address of the ENDFILE section
-
getEndFileAddress
Returns the address of the ENDFILE section, ornullwhen the program has no BEGINFILE/ENDFILE rules.- Returns:
- address of the ENDFILE section, or
null
-
setNextFileAddress
Registers the address of theNEXT_FILEtuple that opens each input file, so that a runtimenextfilestatement can bypass the ENDFILE rules for input files that could not be opened. A property of the tuple stream rather than a tuple: the interpreter reads it once when it installs the program.- Parameters:
addr- address of the NEXT_FILE tuple
-
getNextFileAddress
Returns the address of theNEXT_FILEtuple that opens each input file, ornullwhen the program does not use per-file input stepping.- Returns:
- address of the NEXT_FILE tuple, or
null
-
nextFile
Emits the tuple advancing the main input to the next input file, or jumping to the given address when no input file remains.- Parameters:
address- address to jump to when no more input files remain
-
consumeFileInput
Emits the tuple consuming one record of the current input file only, jumping to the given address at end of the current file.- Parameters:
address- address to jump to at end of the current input file
-
execNextfile
public void execNextfile()Emits the tuple executing thenextfilestatement at runtime. -
exitWithCode
public void exitWithCode()exitWithCode.
-
exitWithoutCode
public void exitWithoutCode()exitWithCode.
-
regexp
regexp.
- Parameters:
regexpStr- aStringobject
-
conditionPair
Deprecated.Evaluates both range conditions on every record, which is incorrect when the conditions have side effects. UseconditionPairInRange(long),conditionPairEnter(long)andconditionPairLeave(long)with conditional jumps instead.regexpPair.
-
conditionPairInRange
public void conditionPairInRange(long id) Pushes whether the specified range pattern is currently active, i.e. its start condition matched a previous record and its end condition hasn't matched yet.- Parameters:
id- unique identifier of the range pattern within the script
-
conditionPairEnter
public void conditionPairEnter(long id) Marks the specified range pattern as active, after its start condition matched the current record.- Parameters:
id- unique identifier of the range pattern within the script
-
conditionPairLeave
public void conditionPairLeave(long id) Marks the specified range pattern as inactive, after its end condition matched the current record.- Parameters:
id- unique identifier of the range pattern within the script
-
isIn
public void isIn()isIn.
-
scriptThis
public void scriptThis()Emits a tuple that pushes the current script context onto the stack. -
extension
Emits an extension invocation tuple.- Parameters:
function- metadata describing the extension method to invokeparamCount- number of arguments supplied for the callisInitial-truewhen this tuple opens an extension call sequence
-
dump
Dumps the queued tuples to the providedPrintStream.- Parameters:
ps- destination stream for the tuple listing
-
top
top.
- Returns:
- a
PositionTrackerobject
-
postProcess
public void postProcess()Executed after all tuples are entered in the queue. Its main functions are:- Assign queue.next to the next element in the queue.
- Calls touch(...) per Tuple so that addresses can be normalized/assigned/allocated properly.
-
optimize
public void optimize()Performs tuple queue optimizations such as reachability pruning, redundant eval-global setup removal, and NOP collapsing.This method is idempotent. Repeated invocations after a successful optimization run will have no additional effect.
Peephole optimization happens at the tuple layer instead of during AST construction. Folding after parsing guarantees that any tuple-level transformations (for example, address resolution and extension hooks) have already run, and it keeps a single optimization toggle (
optimize()) for callers. Performing the work at the tuple layer also lets us recurse until no more changes occur without complicating the parser. -
addGlobalVariableNameToOffsetMapping
Accept a {variable_name -> offset} mapping such that global variables can be assigned while processing name=value and filename command-line arguments.- Parameters:
varname- Name of the global variableoffset- What offset to use for the variableisArray- Whether the variable is actually an array
-
setFunctionNameSet
Accept a set of function names from the parser. This is useful for invalidating name=value assignments from the command line parameters, either via -v arguments or passed into ARGV.- Parameters:
names- A set of function name strings.
-
freezeMetadata
public void freezeMetadata()Freezes the tuple metadata after compilation so execution can reuse the published maps and sets without creating fresh unmodifiable wrappers. Repeated calls are ignored. -
getGlobalVariableOffsetMap
getGlobalVariableOffsetMap.
- Returns:
- a
Mapobject
-
getGlobalVariableAarrayMap
getGlobalVariableAarrayMap.
- Returns:
- a
Mapobject
-
getFunctionNameSet
getFunctionNameSet.
- Returns:
- a
Setobject
-
pushSourceLineNumber
public void pushSourceLineNumber(int lineno) Push the current line number onto the line number stack. This is called by the parser to keep track of the current source line number. Keeping track of line numbers this way allows the runtime to report more meaningful errors by providing source line numbers within error reports.- Parameters:
lineno- The current source line number.
-
popSourceLineNumber
public void popSourceLineNumber(int lineno) popSourceLineNumber.
- Parameters:
lineno- a int
-