Class AwkTuples

java.lang.Object
org.metricshub.jawk.intermediate.AwkTuples
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SandboxedAwkTuples

public class AwkTuples extends Object implements Serializable

AwkTuples class.

Author:
Danny Daglas
See Also:
  • Constructor Details

    • AwkTuples

      public AwkTuples()
  • Method Details

    • toOpcodeString

      public static String toOpcodeString(int opcode)

      toOpcodeString.

      Parameters:
      opcode - a int
      Returns:
      a String object
    • pop

      public void pop()

      pop.

    • push

      public void push(Object o)

      push.

      Parameters:
      o - a Object object
    • ifFalse

      public void ifFalse(Address address)

      ifFalse.

      Parameters:
      address - a Address object
    • toNumber

      public void toNumber()

      toNumber.

    • ifTrue

      public void ifTrue(Address address)

      ifTrue.

      Parameters:
      address - a Address object
    • gotoAddress

      public void gotoAddress(Address address)

      gotoAddress.

      Parameters:
      address - a Address object
    • createAddress

      public Address createAddress(String label)

      createAddress.

      Parameters:
      label - a String object
      Returns:
      a Address object
    • address

      public AwkTuples address(Address address)

      address.

      Parameters:
      address - a Address object
      Returns:
      a AwkTuples object
    • 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 int
      append - 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 int
      append - 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 int
      isGlobal - a boolean
    • assignArray

      public void assignArray(int offset, boolean isGlobal)

      assignArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • assignAsInput

      public void assignAsInput()

      assignAsInput.

    • setInputForEval

      public void setInputForEval()
      Use this only in initialization for simple evaluation
    • assignAsInputField

      public void assignAsInputField()

      assignAsInputField.

    • dereference

      public void dereference(int offset, boolean isArray, boolean isGlobal)

      dereference.

      Parameters:
      offset - a int
      isArray - a boolean
      isGlobal - a boolean
    • plusEq

      public void plusEq(int offset, boolean isGlobal)

      plusEq.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • minusEq

      public void minusEq(int offset, boolean isGlobal)

      minusEq.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • multEq

      public void multEq(int offset, boolean isGlobal)

      multEq.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • divEq

      public void divEq(int offset, boolean isGlobal)

      divEq.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • modEq

      public void modEq(int offset, boolean isGlobal)

      modEq.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • powEq

      public void powEq(int offset, boolean isGlobal)

      powEq.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • plusEqArray

      public void plusEqArray(int offset, boolean isGlobal)

      plusEqArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • minusEqArray

      public void minusEqArray(int offset, boolean isGlobal)

      minusEqArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • multEqArray

      public void multEqArray(int offset, boolean isGlobal)

      multEqArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • divEqArray

      public void divEqArray(int offset, boolean isGlobal)

      divEqArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • modEqArray

      public void modEqArray(int offset, boolean isGlobal)

      modEqArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • powEqArray

      public void powEqArray(int offset, boolean isGlobal)

      powEqArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • 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 int
      isGlobal - a boolean
      isGsub - a boolean
    • subForArrayReference

      public void subForArrayReference(int offset, boolean isGlobal, boolean isGsub)

      subForArrayReference.

      Parameters:
      offset - a int
      isGlobal - a boolean
      isGsub - a boolean
    • 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.

    • exec

      public void exec()

      exec.

    • 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 int
      isGlobal - a boolean
    • dec

      public void dec(int offset, boolean isGlobal)

      dec.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • postInc

      public void postInc(int offset, boolean isGlobal)

      postInc.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • postDec

      public void postDec(int offset, boolean isGlobal)

      postDec.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • incArrayRef

      public void incArrayRef(int offset, boolean isGlobal)

      incArrayRef.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • decArrayRef

      public void decArrayRef(int offset, boolean isGlobal)

      decArrayRef.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • 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.

    • keylist

      public void keylist()

      key list.

    • isEmptyList

      public void isEmptyList(Address address)

      isEmptyList.

      Parameters:
      address - a Address object
    • getFirstAndRemoveFromList

      public void getFirstAndRemoveFromList()

      getFirstAndRemoveFromList.

    • checkClass

      public boolean checkClass(Class<?> cls)

      checkClass.

      Parameters:
      cls - a Class object
      Returns:
      a boolean
    • getInputField

      public void getInputField()

      getInputField.

    • consumeInput

      public void consumeInput(Address address)

      consumeInput.

      Parameters:
      address - a Address object
    • getlineInput

      public void getlineInput()

      getlineInput.

    • 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
    • argcOffset

      public void argcOffset(int offset)

      argcOffset.

      Parameters:
      offset - a int
    • argvOffset

      public void argvOffset(int offset)

      argvOffset.

      Parameters:
      offset - a int
    • applyRS

      public void applyRS()

      applyRS.

    • function

      public void function(String funcName, int numFormalParams)

      function.

      Parameters:
      funcName - a String object
      numFormalParams - a int
    • callFunction

      public void callFunction(Supplier<Address> addressSupplier, String funcName, int numFormalParams, int numActualParams)

      callFunction.

      Parameters:
      addressSupplier - supplier resolving the function's entry point
      funcName - a String object
      numFormalParams - a int
      numActualParams - a int
    • 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 int
      isGlobal - a boolean
    • deleteArray

      public void deleteArray(int offset, boolean isGlobal)

      deleteArray.

      Parameters:
      offset - a int
      isGlobal - a boolean
    • setExitAddress

      public void setExitAddress(Address addr)

      setExitAddress.

      Parameters:
      addr - a Address object
    • setWithinEndBlocks

      public void setWithinEndBlocks(boolean b)

      setWithinEndBlocks.

      Parameters:
      b - a boolean
    • exitWithCode

      public void exitWithCode()

      exitWithCode.

    • exitWithoutCode

      public void exitWithoutCode()

      exitWithCode.

    • regexp

      public void regexp(String regexpStr)

      regexp.

      Parameters:
      regexpStr - a String object
    • conditionPair

      public void conditionPair()

      regexpPair.

    • isIn

      public void isIn()

      isIn.

    • scriptThis

      public void scriptThis()
      Emits a tuple that pushes the current script context onto the stack.
    • extension

      public void extension(ExtensionFunction function, int paramCount, boolean isInitial)
      Emits an extension invocation tuple.
      Parameters:
      function - metadata describing the extension method to invoke
      paramCount - number of arguments supplied for the call
      isInitial - true when this tuple opens an extension call sequence
    • dump

      public void dump(PrintStream ps)
      Dumps the queued tuples to the provided PrintStream.
      Parameters:
      ps - destination stream for the tuple listing
    • top

      public PositionTracker top()

      top.

      Returns:
      a PositionTracker object
    • 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.
    • addGlobalVariableNameToOffsetMapping

      public void addGlobalVariableNameToOffsetMapping(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.
      Parameters:
      varname - Name of the global variable
      offset - What offset to use for the variable
      isArray - Whether the variable is actually an array
    • setFunctionNameSet

      public void setFunctionNameSet(Set<String> names)
      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.
    • getGlobalVariableOffsetMap

      public Map<String,Integer> getGlobalVariableOffsetMap()

      getGlobalVariableOffsetMap.

      Returns:
      a Map object
    • getGlobalVariableAarrayMap

      public Map<String,Boolean> getGlobalVariableAarrayMap()

      getGlobalVariableAarrayMap.

      Returns:
      a Map object
    • getFunctionNameSet

      public Set<String> getFunctionNameSet()

      getFunctionNameSet.

      Returns:
      a Set object
    • 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