Class AwkTuples

java.lang.Object
org.sentrysoftware.jawk.intermediate.AwkTuples
All Implemented Interfaces:
Serializable

public class AwkTuples extends Object implements Serializable

AwkTuples class.

Author:
Danny Daglas
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Numerically adds the top two elements of the stack with the result pushed onto the stack.
    static final int
    Apply the RS variable by notifying the partitioning reader that there is a new regular expression to use when partitioning input records.
    static final int
    Convert a list of array indices to a concatenated string with SUBSEP.
    static final int
    Assign the ARGC variable offset.
    static final int
    Assign the ARGV variable offset.
    static final int
    Assigns the top-of-stack to a variable.
    static final int
    Assigns an item to an array element.
    static final int
    Assigns the top-of-stack to $0.
    static final int
    Assigns an item as a particular input field; the field number can be 0.
    static final int
    Built-in function that pops the first two items off the stack, calls the java.lang.Math.atan2 method with these as arguments, and places the result onto the stack.
    static final int
    Call a user function.
    static final int
    Cast to double
    static final int
    Cast to integer
    static final int
    Cast to string
    static final int
    Checks whether the top-of-stack is of a particular class type; if not, an AwkRuntimeException is thrown.
    static final int
    Close the specified file.
    static final int
    Compares the top two stack elements; pushes 1 onto the stack if equal, 0 if not equal.
    static final int
    Compares the top two stack elements; pushes 1 onto the stack if x1 > x2, 0 if not equal.
    static final int
    Compares the top two stack elements; pushes 1 onto the stack if x1 < x2, 0 if not equal.
    static final int
    Pop and concatenate two strings from the top-of-stack; push the result onto the stack.
    static final int
    Returns a pair of regex patterns.
    static final int
    Consume next line of input; assigning $0 and recalculating $1, $2, etc.
    static final int
    Assign the CONVFMT variable offset.
    static final int
    Built-in function that pops the top-of-stack, calls the java.lang.Math.cos method with the top-of-stack as the argument, and places the result onto the stack.
    static final int
    Decreases the variable reference by one; pushes the result onto the stack.
    static final int
    Decreases the array element reference by one; pushes the result onto the stack.
    static final int
    Decreases the input field variable by one; pushes the result onto the stack.
    static final int
    Delete the specified array.
    static final int
    Deletes an entry in an array.
    static final int
    Constant _DEREF_ARRAY_=338
    static final int
    Obtains an item from the variable manager and push it onto the stack.
    static final int
    Divides the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.
    static final int
    Divides the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.
    static final int
    Divides the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.
    static final int
    Numerically divides the top two elements of the stack with the result pushed onto the stack.
    static final int
    Constant _DUMP_=337
    static final int
    Duplicates the top-of-stack on the stack.
    static final int
    Assign the ENVIRON variable offset.
    static final int
    Execute the specified AWK code
    static final int
    Terminates execution and returns specified exit code.
    static final int
    Terminates execution without specifying an exit code.
    static final int
    Built-in function that pops the top-of-stack, calls the java.lang.Math.exp method with the top-of-stack as the argument, and places the result onto the stack.
    static final int
    Call a function from an extension
    static final int
    Assign the FILENAME variable offset.
    static final int
    Assign the FNR variable offset.
    static final int
    Assign the FS variable offset.
    static final int
    Define a user function.
    static final int
    Removes an item from the KeyList (set) and pushes it onto the operand stack.
    static final int
    Push an input field onto the stack.
    static final int
    Obtains input from stdin/filename-args and pushes input line and status code onto the stack.
    static final int
    Jumps to a specified address.
    static final int
    Pops and evaluates the top-of-stack; if false, it jumps to a specified address.
    static final int
    Pops and evaluates the top-of-stack; if true, it jumps to a specified address.
    static final int
    Increases the variable reference by one; pushes the result onto the stack.
    static final int
    Increases the array element reference by one; pushes the result onto the stack.
    static final int
    Increases the input field variable by one; pushes the result onto the stack.
    static final int
    Built-in function that locates a substring within a source string and pushes the location onto the stack.
    static final int
    Built-in function that pops the top-of-stack, removes its fractional part, if any, and places the result onto the stack.
    static final int
    Tests whether the KeyList (set) is empty; jumps to the argument address if empty, steps to the next instruction if not.
    static final int
    Returns whether the specified key is in the array.
    static final int
    Retrieves and pushes a Set of keys from an associative array onto the stack.
    static final int
    Depending on the argument, pop and evaluate the string length of the top-of-stack or evaluate the string length of $0; in either case, push the result onto the stack.
    static final int
    Built-in function that pops the top-of-stack, calls the java.lang.Math.log method with the top-of-stack as the argument, and places the result onto the stack.
    static final int
    Built-in function that searches a string as input to a regular expression, the location of the match is pushed onto the stack.
    static final int
    Applies a regular expression to the top stack element; pushes 1 if it matches, 0 if it does not match.
    static final int
    Decreases the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.
    static final int
    Decreases the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.
    static final int
    Decreases the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.
    static final int
    Numerically takes the modulus of the top two elements of the stack with the result pushed onto the stack.
    static final int
    Takes the modules of the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.
    static final int
    Takes the modulus of the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.
    static final int
    Takes the modulus of the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.
    static final int
    Multiplies the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.
    static final int
    Multiplies the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.
    static final int
    Multiplies the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.
    static final int
    Numerically multiplies the top two elements of the stack with the result pushed onto the stack.
    static final int
    Evaluates the numerical NEGATION of the top stack element; pushes the result onto the stack.
    static final int
    Assign the NF variable offset.
    static final int
    A no-operation.
    static final int
    Evaluates the logical NOT of the top stack element; pushes the result onto the stack.
    static final int
    Assign the NR variable offset.
    static final int
    Assign the OFMT variable offset.
    static final int
    Assign the OFS variable offset.
    static final int
    Assign the ORS variable offset.
    static final int
    Increase the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.
    static final int
    Increase the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.
    static final int
    Increases the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.
    static final int
    Pops an item off the operand stack.
    static final int
    Decreases the variable reference by one; pushes the original value onto the stack.
    static final int
    Increases the variable reference by one; pushes the original value onto the stack.
    static final int
    Numerically raises the top element to the power of the next element with the result pushed onto the stack.
    static final int
    Raises the contents of the variable to the power of the adjustment value; assigns the result to the variable and pushes the result onto the stack.
    static final int
    Raises the contents of an indexed array to the power of an adjustment value; assigns the result to the array and pushes the result onto the stack.
    static final int
    Raises the contents of an input field to the power of an adjustment value; assigns the result to the input field and pushes the result onto the stack.
    static final int
    Prints N number of items that are on the operand stack.
    static final int
    Prints N number of items that are on the operand stack to a specified file.
    static final int
    Prints N number of items that are on the operand stack to a process executing a specified command (via a pipe).
    static final int
    Performs a formatted print of N items that are on the operand stack.
    static final int
    Performs a formatted print of N items that are on the operand stack to a specified file.
    static final int
    Performs a formatted print of N items that are on the operand stack to a process executing a specified command (via a pipe).
    static final int
    Pushes an item onto the operand stack.
    static final int
    Obtains the next random number from the random number generator and push it onto the stack.
    static final int
    Returns a regex pattern.
    static final int
    Get the return value of the user function that was called
    static final int
    Assign the RLENGTH variable offset.
    static final int
    Assign the RS variable offset.
    static final int
    Assign the RSTART variable offset.
    static final int
    Internal.
    static final int
    Internal: sets the number of global variables
    static final int
    Sets the return value of a user function.
    static final int
    Internal.
    static final int
    Built-in function that pops the top-of-stack, calls the java.lang.Math.sin method with the top-of-stack as the argument, and places the result onto the stack.
    static final int
    Extension: Pauses the execution thread by N number of seconds.
    static final int
    Built-in function to split a string by a regexp and put the components into an array.
    static final int
    Constant _SPRINTF_=270
    static final int
    Built-in function that pops the top-of-stack, takes its square root, and places the result onto the stack.
    static final int
    Seeds the random number generator.
    static final int
    Built-in function that substitutes an occurrence (or all occurrences) of a string in a particular array cell and replaces it with another.
    static final int
    Built-in function that substitutes an occurrence (or all occurrences) of a string in $0 and replaces it with another.
    static final int
    Built-in function that substitutes an occurrence (or all occurrences) of a string in a field reference and replaces it with another.
    static final int
    Built-in function that substitutes an occurrence (or all occurrences) of a string in a particular variable and replaces it with another.
    static final int
    Assign the SUBSEP variable offset.
    static final int
    Built-in function that pushes a substring of the top-of-stack onto the stack.
    static final int
    Numerically subtracts the top two elements of the stack with the result pushed onto the stack.
    static final int
    Swaps the top two elements of the stack.
    static final int
    Built-in function that executes the top-of-stack as a system command and pushes the return code onto the stack.
    static final int
    Deprecated.
    static final int
    Converts the top-of-stack to a number.
    static final int
    Built-in function that converts all the letters in the top-of-stack to lower case and pushes the result onto the stack.
    static final int
    Built-in function that converts all the letters in the top-of-stack to upper case and pushes the result onto the stack.
    static final int
    Converts the top stack element to a number; pushes the result onto the stack.
    static final int
    Obtains input from a command (process) and pushes input line and status code onto the stack.
    static final int
    Obtains input from a file and pushes input line and status code onto the stack.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add()
    add.
    void
    addGlobalVariableNameToOffsetMapping(String varname, int offset, boolean is_array)
    Accept a {variable_name -> offset} mapping such that global variables can be assigned while processing name=value and filename command-line arguments.
    address(Address address)
    address.
    void
    applyRS.
    void
    applySubsep(int count)
    applySubsep.
    void
    argcOffset(int offset)
    argcOffset.
    void
    argvOffset(int offset)
    argvOffset.
    void
    assign(int offset, boolean is_global)
    assign.
    void
    assignArray(int offset, boolean is_global)
    assignArray.
    void
    assignAsInput.
    void
    assignAsInputField.
    void
    atan2.
    void
    callFunction(HasFunctionAddress has_func_addr, String func_name, int num_formal_params, int num_actual_params)
    callFunction.
    void
    castDouble.
    void
    castInt.
    void
    castString.
    boolean
    checkClass(Class<?> cls)
    checkClass.
    void
    close.
    void
    cmpEq.
    void
    cmpGt.
    void
    cmpLt.
    void
    concat.
    void
    regexpPair.
    void
    consumeInput.
    void
    convfmtOffset(int offset)
    convfmtOffset.
    void
    cos()
    cos.
    createAddress.
    void
    dec(int offset, boolean is_global)
    dec.
    void
    decArrayRef(int offset, boolean is_global)
    decArrayRef.
    void
    decDollarRef.
    void
    deleteArray(int offset, boolean is_global)
    deleteArray.
    void
    deleteArrayElement(int offset, boolean is_global)
    deleteArrayElement.
    void
    dereference(int offset, boolean is_array, boolean is_global)
    dereference.
    void
    dereferenceArray.
    void
    divEq(int offset, boolean is_global)
    divEq.
    void
    divEqArray(int offset, boolean is_global)
    divEqArray.
    void
    divEqInputField.
    void
    divide.
    void
    dump(int num_args)
    dump.
    void
    dump.
    void
    dup()
    dup.
    void
    environOffset(int offset)
    environOffset.
    void
    exec.
    void
    exitWithCode.
    void
    exitWithCode.
    void
    exp()
    exp.
    void
    extension(String extension_keyword, int param_count, boolean is_initial)
    extension.
    void
    filenameOffset(int offset)
    filenameOffset.
    void
    fnrOffset(int offset)
    fnrOffset.
    void
    fsOffset(int offset)
    fsOffset.
    void
    function(String func_name, int num_formal_params)
    function.
    void
    getFirstAndRemoveFromList.
    getFunctionNameSet.
    getGlobalVariableAarrayMap.
    getGlobalVariableOffsetMap.
    void
    getInputField.
    void
    getlineInput.
    void
    gotoAddress.
    void
    ifFalse(Address address)
    ifFalse.
    void
    ifTrue(Address address)
    ifTrue.
    void
    inc(int offset, boolean is_global)
    inc.
    void
    incArrayRef(int offset, boolean is_global)
    incArrayRef.
    void
    incDollarRef.
    void
    index.
    void
    intFunc.
    void
    isEmptyList.
    void
    isIn.
    void
    keylist.
    void
    length(int num_exprs)
    length.
    void
    log()
    log.
    void
    match.
    void
    matches.
    void
    minusEq(int offset, boolean is_global)
    minusEq.
    void
    minusEqArray(int offset, boolean is_global)
    minusEqArray.
    void
    minusEqInputField.
    void
    mod()
    mod.
    void
    modEq(int offset, boolean is_global)
    modEq.
    void
    modEqArray(int offset, boolean is_global)
    modEqArray.
    void
    modEqInputField.
    void
    multEq(int offset, boolean is_global)
    multEq.
    void
    multEqArray(int offset, boolean is_global)
    multEqArray.
    void
    multEqInputField.
    void
    multiply.
    void
    negate.
    void
    nfOffset(int offset)
    nfOffset.
    void
    nop()
    nop.
    void
    not()
    not.
    void
    nrOffset(int offset)
    nrOffset.
    void
    ofmtOffset(int offset)
    ofmtOffset.
    void
    ofsOffset(int offset)
    ofsOffset.
    void
    orsOffset(int offset)
    orsOffset.
    void
    plusEq(int offset, boolean is_global)
    plusEq.
    void
    plusEqArray(int offset, boolean is_global)
    plusEqArray.
    void
    plusEqInputField.
    void
    pop()
    pop.
    void
    popSourceLineNumber(int lineno)
    popSourceLineNumber.
    void
    postDec(int offset, boolean is_global)
    postDec.
    void
    postInc(int offset, boolean is_global)
    postInc.
    void
    Executed after all tuples are entered in the queue.
    void
    pow()
    pow.
    void
    powEq(int offset, boolean is_global)
    powEq.
    void
    powEqArray(int offset, boolean is_global)
    powEqArray.
    void
    powEqInputField.
    void
    print(int num_exprs)
    print.
    void
    printf(int num_exprs)
    printf.
    void
    printfToFile(int num_exprs, boolean append)
    printfToFile.
    void
    printfToPipe(int num_exprs)
    printfToPipe.
    void
    printToFile(int num_exprs, boolean append)
    printToFile.
    void
    printToPipe(int num_exprs)
    printToPipe.
    void
    push.
    void
    Push the current line number onto the line number stack.
    void
    rand.
    void
    regexp(String regexp_str)
    regexp.
    void
    returnFromFunction.
    void
    rlengthOffset(int offset)
    rlengthOffset.
    void
    rsOffset(int offset)
    rsOffset.
    void
    rstartOffset(int offset)
    rstartOffset.
    void
    scriptThis.
    void
    setExitAddress.
    void
    setFunctionNameSet(Set<String> function_names)
    Accept a set of function names from the parser.
    void
    setNumGlobals(int num_globals)
    setNumGlobals.
    void
    setReturnResult.
    void
    setWithinEndBlocks(boolean b)
    setWithinEndBlocks.
    void
    sin()
    sin.
    void
    sleep(int num_args)
    sleep.
    void
    split(int numargs)
    split.
    void
    sprintf(int num_exprs)
    sprintf.
    void
    sqrt.
    void
    srand(int num)
    srand.
    void
    subForArrayReference(int offset, boolean is_global, boolean is_gsub)
    subForArrayReference.
    void
    subForDollar0(boolean is_gsub)
    subForDollar0.
    void
    subForDollarReference(boolean is_gsub)
    subForDollarReference.
    void
    subForVariable(int offset, boolean is_global, boolean is_gsub)
    subForVariable.
    void
    subsepOffset(int offset)
    subsepOffset.
    void
    substr(int numargs)
    substr.
    void
    subtract.
    void
    swap.
    void
    system.
    void
    tolower.
    void
    toNumber.
    static String
    toOpcodeString(int opcode)
    toOpcodeString.
    top()
    top.
    void
    toupper.
    void
    unary plus.
    void
    useAsCommandInput.
    void
    useAsFileInput.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _POP_

      public static final int _POP_
      Pops an item off the operand stack.

      Stack before: x ...
      Stack after: ...

      See Also:
    • _PUSH_

      public static final int _PUSH_
      Pushes an item onto the operand stack.

      Stack before: ...
      Stack after: x ...

      See Also:
    • _IFFALSE_

      public static final int _IFFALSE_
      Pops and evaluates the top-of-stack; if false, it jumps to a specified address.

      Argument: address

      Stack before: x ...
      Stack after: ...

      See Also:
    • _TO_NUMBER_

      public static final int _TO_NUMBER_
      Converts the top-of-stack to a number.

      Stack before: x ...
      Stack after: x (as a number)

      See Also:
    • _IFTRUE_

      public static final int _IFTRUE_
      Pops and evaluates the top-of-stack; if true, it jumps to a specified address.

      Argument: address

      Stack before: x ...
      Stack after: ...

      See Also:
    • _GOTO_

      public static final int _GOTO_
      Jumps to a specified address. The operand stack contents are unaffected.
      See Also:
    • _NOP_

      public static final int _NOP_
      A no-operation. The operand stack contents are unaffected.
      See Also:
    • _PRINT_

      public static final int _PRINT_
      Prints N number of items that are on the operand stack. The number of items are passed in as a tuple argument.

      Argument: # of items (N)

      Stack before: x1 x2 x3 .. xN ...
      Stack after: ...

      See Also:
    • _PRINT_TO_FILE_

      public static final int _PRINT_TO_FILE_
      Prints N number of items that are on the operand stack to a specified file. The file is passed in on the stack. The number of items are passed in as a tuple argument, as well as whether to overwrite the file or not (append mode).

      Argument 1: # of items (N)
      Argument 2: true = append, false = overwrite

      Stack before: x1 x2 x3 .. xN filename ...
      Stack after: ...

      See Also:
    • _PRINT_TO_PIPE_

      public static final int _PRINT_TO_PIPE_
      Prints N number of items that are on the operand stack to a process executing a specified command (via a pipe). The command string is passed in on the stack. The number of items are passed in as a tuple argument.

      Argument: # of items (N)

      Stack before: x1 x2 x3 .. xN command-string ...
      Stack after: ...

      See Also:
    • _PRINTF_

      public static final int _PRINTF_
      Performs a formatted print of N items that are on the operand stack. The number of items are passed in as a tuple argument.

      Argument: # of items (N)

      Stack before: x1 x2 x3 .. xN ...
      Stack after: ...

      See Also:
    • _PRINTF_TO_FILE_

      public static final int _PRINTF_TO_FILE_
      Performs a formatted print of N items that are on the operand stack to a specified file. The file is passed in on the stack. The number of items are passed in as a tuple argument, as well as whether to overwrite the file or not (append mode).

      Argument 1: # of items (N)
      Argument 2: true = append, false = overwrite

      Stack before: x1 x2 x3 .. xN filename ...
      Stack after: ...

      See Also:
    • _PRINTF_TO_PIPE_

      public static final int _PRINTF_TO_PIPE_
      Performs a formatted print of N items that are on the operand stack to a process executing a specified command (via a pipe). The command string is passed in on the stack. The number of items are passed in as a tuple argument.

      Argument: # of items (N)

      Stack before: x1 x2 x3 .. xN command-string ...
      Stack after: ...

      See Also:
    • _SPRINTF_

      public static final int _SPRINTF_
      Constant _SPRINTF_=270
      See Also:
    • _LENGTH_

      public static final int _LENGTH_
      Depending on the argument, pop and evaluate the string length of the top-of-stack or evaluate the string length of $0; in either case, push the result onto the stack.

      The input field length evaluation mode is provided to support backward compatibility with the deprecated usage of length (i.e., no arguments).

      Argument: 0 to use $0, use top-of-stack otherwise

      If argument is 0:

      Stack before: ...
      Stack after: length-of-$0 ...
      else
      Stack before: x ...
      Stack after: length-of-x ...
      See Also:
    • _CONCAT_

      public static final int _CONCAT_
      Pop and concatenate two strings from the top-of-stack; push the result onto the stack.

      Stack before: x y ...
      Stack after: x-concatenated-with-y ...

      See Also:
    • _ASSIGN_

      public static final int _ASSIGN_
      Assigns the top-of-stack to a variable. The contents of the stack are unaffected.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: x ...
      Stack after: x ...

      See Also:
    • _ASSIGN_ARRAY_

      public static final int _ASSIGN_ARRAY_
      Assigns an item to an array element. The item remains on the stack.

      Argument 1: offset of the particular associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: index-into-array item ...
      Stack after: item ...

      See Also:
    • _ASSIGN_AS_INPUT_

      public static final int _ASSIGN_AS_INPUT_
      Assigns the top-of-stack to $0. The contents of the stack are unaffected. Upon assignment, individual field variables are recalculated.

      Stack before: x ...
      Stack after: x ...

      See Also:
    • _ASSIGN_AS_INPUT_FIELD_

      public static final int _ASSIGN_AS_INPUT_FIELD_
      Assigns an item as a particular input field; the field number can be 0. Upon assignment, associating input fields are affected. For example, if the following assignment were made:
       $3 = "hi"
       
      $0 would be recalculated. Likewise, if the following assignment were made:
       $0 = "hello there"
       
      $1, $2, ... would be recalculated.

      Stack before: field-num x ...
      Stack after: x ...

      See Also:
    • _DEREFERENCE_

      public static final int _DEREFERENCE_
      Obtains an item from the variable manager and push it onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: ...
      Stack after: x ...

      See Also:
    • _PLUS_EQ_

      public static final int _PLUS_EQ_
      Increase the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: n ...
      Stack after: x+n ...

      See Also:
    • _MINUS_EQ_

      public static final int _MINUS_EQ_
      Decreases the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: n ...
      Stack after: x-n ...

      See Also:
    • _MULT_EQ_

      public static final int _MULT_EQ_
      Multiplies the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: n ...
      Stack after: x*n ...

      See Also:
    • _DIV_EQ_

      public static final int _DIV_EQ_
      Divides the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: n ...
      Stack after: x/n ...

      See Also:
    • _MOD_EQ_

      public static final int _MOD_EQ_
      Takes the modules of the contents of the variable by an adjustment value; assigns the result to the variable and pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: n ...
      Stack after: x%n ...

      See Also:
    • _POW_EQ_

      public static final int _POW_EQ_
      Raises the contents of the variable to the power of the adjustment value; assigns the result to the variable and pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: n ...
      Stack after: x^n ...

      See Also:
    • _PLUS_EQ_ARRAY_

      public static final int _PLUS_EQ_ARRAY_
      Increase the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx n ...
      Stack after: x+n ...

      See Also:
    • _MINUS_EQ_ARRAY_

      public static final int _MINUS_EQ_ARRAY_
      Decreases the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx n ...
      Stack after: x-n ...

      See Also:
    • _MULT_EQ_ARRAY_

      public static final int _MULT_EQ_ARRAY_
      Multiplies the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx n ...
      Stack after: x*n ...

      See Also:
    • _DIV_EQ_ARRAY_

      public static final int _DIV_EQ_ARRAY_
      Divides the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx n ...
      Stack after: x/n ...

      See Also:
    • _MOD_EQ_ARRAY_

      public static final int _MOD_EQ_ARRAY_
      Takes the modulus of the contents of an indexed array by an adjustment value; assigns the result to the array and pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx n ...
      Stack after: x%n ...

      See Also:
    • _POW_EQ_ARRAY_

      public static final int _POW_EQ_ARRAY_
      Raises the contents of an indexed array to the power of an adjustment value; assigns the result to the array and pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx n ...
      Stack after: x^n ...

      See Also:
    • _PLUS_EQ_INPUT_FIELD_

      public static final int _PLUS_EQ_INPUT_FIELD_
      Increases the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.

      Stack before: input-field_number n ...
      Stack after: x+n ...

      See Also:
    • _MINUS_EQ_INPUT_FIELD_

      public static final int _MINUS_EQ_INPUT_FIELD_
      Decreases the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.

      Stack before: input-field_number n ...
      Stack after: x-n ...

      See Also:
    • _MULT_EQ_INPUT_FIELD_

      public static final int _MULT_EQ_INPUT_FIELD_
      Multiplies the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.

      Stack before: input-field_number n ...
      Stack after: x*n ...

      See Also:
    • _DIV_EQ_INPUT_FIELD_

      public static final int _DIV_EQ_INPUT_FIELD_
      Divides the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.

      Stack before: input-field_number n ...
      Stack after: x/n ...

      See Also:
    • _MOD_EQ_INPUT_FIELD_

      public static final int _MOD_EQ_INPUT_FIELD_
      Takes the modulus of the contents of an input field by an adjustment value; assigns the result to the input field and pushes the result onto the stack.

      Stack before: input-field_number n ...
      Stack after: x%n ...

      See Also:
    • _POW_EQ_INPUT_FIELD_

      public static final int _POW_EQ_INPUT_FIELD_
      Raises the contents of an input field to the power of an adjustment value; assigns the result to the input field and pushes the result onto the stack.

      Stack before: input-field_number n ...
      Stack after: x^n ...

      See Also:
    • _SRAND_

      public static final int _SRAND_
      Seeds the random number generator. If there are no arguments, the current time (as a long value) is used as the seed. Otherwise, the top-of-stack is popped and used as the seed value.

      Argument: # of arguments

      If # of arguments is 0:

      Stack before: ...
      Stack after: old-seed ...
      else
      Stack before: x ...
      Stack after: old-seed ...
      See Also:
    • _RAND_

      public static final int _RAND_
      Obtains the next random number from the random number generator and push it onto the stack.

      Stack before: ...
      Stack after: random-number ...

      See Also:
    • _INTFUNC_

      public static final int _INTFUNC_
      Built-in function that pops the top-of-stack, removes its fractional part, if any, and places the result onto the stack.

      Stack before: x ...
      Stack after: (int)x ...

      See Also:
    • _SQRT_

      public static final int _SQRT_
      Built-in function that pops the top-of-stack, takes its square root, and places the result onto the stack.

      Stack before: x ...
      Stack after: sqrt(x) ...

      See Also:
    • _LOG_

      public static final int _LOG_
      Built-in function that pops the top-of-stack, calls the java.lang.Math.log method with the top-of-stack as the argument, and places the result onto the stack.

      Stack before: x ...
      Stack after: log(x) ...

      See Also:
    • _EXP_

      public static final int _EXP_
      Built-in function that pops the top-of-stack, calls the java.lang.Math.exp method with the top-of-stack as the argument, and places the result onto the stack.

      Stack before: x ...
      Stack after: exp(x) ...

      See Also:
    • _SIN_

      public static final int _SIN_
      Built-in function that pops the top-of-stack, calls the java.lang.Math.sin method with the top-of-stack as the argument, and places the result onto the stack.

      Stack before: x ...
      Stack after: sin(x) ...

      See Also:
    • _COS_

      public static final int _COS_
      Built-in function that pops the top-of-stack, calls the java.lang.Math.cos method with the top-of-stack as the argument, and places the result onto the stack.

      Stack before: x ...
      Stack after: cos(x) ...

      See Also:
    • _ATAN2_

      public static final int _ATAN2_
      Built-in function that pops the first two items off the stack, calls the java.lang.Math.atan2 method with these as arguments, and places the result onto the stack.

      Stack before: x1 x2 ...
      Stack after: atan2(x1,x2) ...

      See Also:
    • _MATCH_

      public static final int _MATCH_
      Built-in function that searches a string as input to a regular expression, the location of the match is pushed onto the stack. The RSTART and RLENGTH variables are set as a side effect. If a match is found, RSTART and function return value are set to the location of the match and RLENGTH is set to the length of the substring matched against the regular expression. If no match is found, RSTART (and return value) is set to 0 and RLENGTH is set to -1.

      Stack before: string regexp ...
      Stack after: RSTART ...

      See Also:
    • _INDEX_

      public static final int _INDEX_
      Built-in function that locates a substring within a source string and pushes the location onto the stack. If the substring is not found, 0 is pushed onto the stack.

      Stack before: string substring ...
      Stack after: location-index ...

      See Also:
    • _SUB_FOR_DOLLAR_0_

      public static final int _SUB_FOR_DOLLAR_0_
      Built-in function that substitutes an occurrence (or all occurrences) of a string in $0 and replaces it with another.

      Argument: true if global sub, false otherwise.

      Stack before: regexp replacement-string ...
      Stack after: ...

      See Also:
    • _SUB_FOR_DOLLAR_REFERENCE_

      public static final int _SUB_FOR_DOLLAR_REFERENCE_
      Built-in function that substitutes an occurrence (or all occurrences) of a string in a field reference and replaces it with another.

      Argument: true if global sub, false otherwise.

      Stack before: field-num regexp replacement-string ...
      Stack after: ...

      See Also:
    • _SUB_FOR_VARIABLE_

      public static final int _SUB_FOR_VARIABLE_
      Built-in function that substitutes an occurrence (or all occurrences) of a string in a particular variable and replaces it with another.

      Argument 1: variable offset in variable manager
      Argument 2: is global variable
      Argument 3: is global sub

      Stack before: regexp replacement-string orig-string ...
      Stack after: ...

      See Also:
    • _SUB_FOR_ARRAY_REFERENCE_

      public static final int _SUB_FOR_ARRAY_REFERENCE_
      Built-in function that substitutes an occurrence (or all occurrences) of a string in a particular array cell and replaces it with another.

      Argument 1: array map offset in variable manager
      Argument 2: is global array map
      Argument 3: is global sub

      Stack before: array-index regexp replacement-string orig-string ...
      Stack after: ...

      See Also:
    • _SPLIT_

      public static final int _SPLIT_
      Built-in function to split a string by a regexp and put the components into an array.

      Argument: # of arguments (parameters on stack)

      If # of arguments is 2:

      Stack before: string array ...
      Stack after: n ...
      else
      Stack before: string array regexp ...
      Stack after: n ...
      See Also:
    • _SUBSTR_

      public static final int _SUBSTR_
      Built-in function that pushes a substring of the top-of-stack onto the stack. The tuple argument indicates whether to limit the substring to a particular end position, or to take the substring up to the end-of-string.

      Argument: # of arguments

      If # of arguments is 2:

      Stack before: string start-pos ...
      Stack after: substring ...
      else
      Stack before: string start-pos end-pos ...
      Stack after: substring ...
      See Also:
    • _TOLOWER_

      public static final int _TOLOWER_
      Built-in function that converts all the letters in the top-of-stack to lower case and pushes the result onto the stack.

      Stack before: STRING-ARGUMENT ...
      Stack after: string-argument ...

      See Also:
    • _TOUPPER_

      public static final int _TOUPPER_
      Built-in function that converts all the letters in the top-of-stack to upper case and pushes the result onto the stack.

      Stack before: string-argument ...
      Stack after: STRING-ARGUMENT ...

      See Also:
    • _SYSTEM_

      public static final int _SYSTEM_
      Built-in function that executes the top-of-stack as a system command and pushes the return code onto the stack.

      Stack before: cmd ...
      Stack after: return-code ...

      See Also:
    • _SWAP_

      public static final int _SWAP_
      Swaps the top two elements of the stack.

      Stack before: x1 x2 ...
      Stack after: x2 x1 ...

      See Also:
    • _ADD_

      public static final int _ADD_
      Numerically adds the top two elements of the stack with the result pushed onto the stack.

      Stack before: x1 x2 ...
      Stack after: x1+x2 ...

      See Also:
    • _SUBTRACT_

      public static final int _SUBTRACT_
      Numerically subtracts the top two elements of the stack with the result pushed onto the stack.

      Stack before: x1 x2 ...
      Stack after: x1-x2 ...

      See Also:
    • _MULTIPLY_

      public static final int _MULTIPLY_
      Numerically multiplies the top two elements of the stack with the result pushed onto the stack.

      Stack before: x1 x2 ...
      Stack after: x1*x2 ...

      See Also:
    • _DIVIDE_

      public static final int _DIVIDE_
      Numerically divides the top two elements of the stack with the result pushed onto the stack.

      Stack before: x1 x2 ...
      Stack after: x1/x2 ...

      See Also:
    • _MOD_

      public static final int _MOD_
      Numerically takes the modulus of the top two elements of the stack with the result pushed onto the stack.

      Stack before: x1 x2 ...
      Stack after: x1%x2 ...

      See Also:
    • _POW_

      public static final int _POW_
      Numerically raises the top element to the power of the next element with the result pushed onto the stack.

      Stack before: x1 x2 ...
      Stack after: x1^x2 ...

      See Also:
    • _INC_

      public static final int _INC_
      Increases the variable reference by one; pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: ...
      Stack after: x+1 ...

      See Also:
    • _DEC_

      public static final int _DEC_
      Decreases the variable reference by one; pushes the result onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: ...
      Stack after: x-1 ...

      See Also:
    • _INC_ARRAY_REF_

      public static final int _INC_ARRAY_REF_
      Increases the array element reference by one; pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx ...
      Stack after: x+1 ...

      See Also:
    • _DEC_ARRAY_REF_

      public static final int _DEC_ARRAY_REF_
      Decreases the array element reference by one; pushes the result onto the stack.

      Argument 1: offset of the associative array into the variable manager
      Argument 2: whether the associative array is global or local

      Stack before: array-idx ...
      Stack after: x-1 ...

      See Also:
    • _INC_DOLLAR_REF_

      public static final int _INC_DOLLAR_REF_
      Increases the input field variable by one; pushes the result onto the stack.

      Stack before: field-idx ...
      Stack after: x+1

      See Also:
    • _DEC_DOLLAR_REF_

      public static final int _DEC_DOLLAR_REF_
      Decreases the input field variable by one; pushes the result onto the stack.

      Stack before: field-idx ...
      Stack after: x-1

      See Also:
    • _DUP_

      public static final int _DUP_
      Duplicates the top-of-stack on the stack.

      Stack before: x ...
      Stack after: x x ...

      See Also:
    • _NOT_

      public static final int _NOT_
      Evaluates the logical NOT of the top stack element; pushes the result onto the stack.

      Stack before: x ...
      Stack after: !x ...

      See Also:
    • _NEGATE_

      public static final int _NEGATE_
      Evaluates the numerical NEGATION of the top stack element; pushes the result onto the stack.

      Stack before: x ...
      Stack after: -x ...

      See Also:
    • _CMP_EQ_

      public static final int _CMP_EQ_
      Compares the top two stack elements; pushes 1 onto the stack if equal, 0 if not equal.

      Stack before: x1 x2 ...
      Stack after: x1==x2

      See Also:
    • _CMP_LT_

      public static final int _CMP_LT_
      Compares the top two stack elements; pushes 1 onto the stack if x1 < x2, 0 if not equal.

      Stack before: x1 x2 ...
      Stack after: x1<x2

      See Also:
    • _CMP_GT_

      public static final int _CMP_GT_
      Compares the top two stack elements; pushes 1 onto the stack if x1 > x2, 0 if not equal.

      Stack before: x1 x2 ...
      Stack after: x1>x2

      See Also:
    • _MATCHES_

      public static final int _MATCHES_
      Applies a regular expression to the top stack element; pushes 1 if it matches, 0 if it does not match.

      Stack before: x1 x2 ...
      Stack after: (x1 ~ /x2/) ...

      See Also:
    • _SLEEP_

      public static final int _SLEEP_
      Extension: Pauses the execution thread by N number of seconds.

      Stack before: N ...
      Stack after: ...

      See Also:
    • _DUMP_

      public static final int _DUMP_
      Constant _DUMP_=337
      See Also:
    • _DEREF_ARRAY_

      public static final int _DEREF_ARRAY_
      Constant _DEREF_ARRAY_=338
      See Also:
    • _KEYLIST_

      public static final int _KEYLIST_
      Retrieves and pushes a Set of keys from an associative array onto the stack. The Set is tagged with a KeyList interface.

      Stack before: associative-array ...
      Stack after: key-list-set ...

      See Also:
    • _IS_EMPTY_KEYLIST_

      public static final int _IS_EMPTY_KEYLIST_
      Tests whether the KeyList (set) is empty; jumps to the argument address if empty, steps to the next instruction if not.

      Argument: jump-address-if-empty

      Stack before: key-list ...
      Stack after: ...

      See Also:
    • _GET_FIRST_AND_REMOVE_FROM_KEYLIST_

      public static final int _GET_FIRST_AND_REMOVE_FROM_KEYLIST_
      Removes an item from the KeyList (set) and pushes it onto the operand stack.

      Stack before: key-list ...
      Stack after: 1st-item ...

      See Also:
    • _CHECK_CLASS_

      public static final int _CHECK_CLASS_
      Checks whether the top-of-stack is of a particular class type; if not, an AwkRuntimeException is thrown. The stack remains unchanged upon a successful check.

      Argument: class-type (i.e., KeyList.class)

      Stack before: obj ...
      Stack after: obj ...

      See Also:
    • _GET_INPUT_FIELD_

      public static final int _GET_INPUT_FIELD_
      Push an input field onto the stack.

      Stack before: field-id ...
      Stack after: x ...

      See Also:
    • _CONSUME_INPUT_

      public static final int _CONSUME_INPUT_
      Consume next line of input; assigning $0 and recalculating $1, $2, etc. The input can come from the following sources:
      • stdin
      • filename arguments
      The operand stack is unaffected.
      See Also:
    • _GETLINE_INPUT_

      public static final int _GETLINE_INPUT_
      Obtains input from stdin/filename-args and pushes input line and status code onto the stack. The input is partitioned into records based on the RS variable assignment as a regular expression.

      If there is input available, the input string and a return code of 1 is pushed. If EOF is reached, a blank (null) string ("") is pushed along with a 0 return code. Upon an IO error, a blank string and a -1 is pushed onto the operand stack.

      Stack before: ...
      Stack after: input-string return-code ...

      See Also:
    • _USE_AS_FILE_INPUT_

      public static final int _USE_AS_FILE_INPUT_
      Obtains input from a file and pushes input line and status code onto the stack. The input is partitioned into records based on the RS variable assignment as a regular expression.

      Upon initial execution, the file is opened and the handle is maintained until it is explicitly closed, or until the VM exits. Subsequent calls will obtain subsequent lines (records) of input until no more records are available.

      If there is input available, the input string and a return code of 1 is pushed. If EOF is reached, a blank (null) string ("") is pushed along with a 0 return code. Upon an IO error, a blank string and a -1 is pushed onto the operand stack.

      Stack before: filename ...
      Stack after: input-string return-code ...

      See Also:
    • _USE_AS_COMMAND_INPUT_

      public static final int _USE_AS_COMMAND_INPUT_
      Obtains input from a command (process) and pushes input line and status code onto the stack. The input is partitioned into records based on the RS variable assignment as a regular expression.

      Upon initial execution, the a process is spawned to execute the specified command and the process reference is maintained until it is explicitly closed, or until the VM exits. Subsequent calls will obtain subsequent lines (records) of input until no more records are available.

      If there is input available, the input string and a return code of 1 is pushed. If EOF is reached, a blank (null) string ("") is pushed along with a 0 return code. Upon an IO error, a blank string and a -1 is pushed onto the operand stack.

      Stack before: command-line ...
      Stack after: input-string return-code ...

      See Also:
    • _NF_OFFSET_

      public static final int _NF_OFFSET_
      Assign the NF variable offset. This is important for the AVM to set the variables as new input lines are processed.

      The operand stack is unaffected.

      See Also:
    • _NR_OFFSET_

      public static final int _NR_OFFSET_
      Assign the NR variable offset. This is important for the AVM to increase the record number as new input lines received.

      The operand stack is unaffected.

      See Also:
    • _FNR_OFFSET_

      public static final int _FNR_OFFSET_
      Assign the FNR variable offset. This is important for the AVM to increase the "file" record number as new input lines are received.

      The operand stack is unaffected.

      See Also:
    • _FS_OFFSET_

      public static final int _FS_OFFSET_
      Assign the FS variable offset. This is important for the AVM to know how to split fields upon incoming records of input.

      The operand stack is unaffected.

      See Also:
    • _RS_OFFSET_

      public static final int _RS_OFFSET_
      Assign the RS variable offset. This is important for the AVM to know how to create records from the stream(s) of input.

      The operand stack is unaffected.

      See Also:
    • _OFS_OFFSET_

      public static final int _OFS_OFFSET_
      Assign the OFS variable offset. This is important for the AVM to use when outputting expressions via PRINT.

      The operand stack is unaffected.

      See Also:
    • _RSTART_OFFSET_

      public static final int _RSTART_OFFSET_
      Assign the RSTART variable offset. The AVM sets this variable while executing the match() builtin function.

      The operand stack is unaffected.

      See Also:
    • _RLENGTH_OFFSET_

      public static final int _RLENGTH_OFFSET_
      Assign the RLENGTH variable offset. The AVM sets this variable while executing the match() builtin function.

      The operand stack is unaffected.

      See Also:
    • _FILENAME_OFFSET_

      public static final int _FILENAME_OFFSET_
      Assign the FILENAME variable offset. The AVM sets this variable while processing files from the command-line for input.

      The operand stack is unaffected.

      See Also:
    • _SUBSEP_OFFSET_

      public static final int _SUBSEP_OFFSET_
      Assign the SUBSEP variable offset. The AVM uses this variable while building an index of a multi-dimensional array.

      The operand stack is unaffected.

      See Also:
    • _CONVFMT_OFFSET_

      public static final int _CONVFMT_OFFSET_
      Assign the CONVFMT variable offset. The AVM uses this variable while converting numbers to strings.

      The operand stack is unaffected.

      See Also:
    • _OFMT_OFFSET_

      public static final int _OFMT_OFFSET_
      Assign the OFMT variable offset. The AVM uses this variable while converting numbers to strings for printing.

      The operand stack is unaffected.

      See Also:
    • _ENVIRON_OFFSET_

      public static final int _ENVIRON_OFFSET_
      Assign the ENVIRON variable offset. The AVM provides environment variables through this array.

      The operand stack is unaffected.

      See Also:
    • _ARGC_OFFSET_

      public static final int _ARGC_OFFSET_
      Assign the ARGC variable offset. The AVM provides the number of arguments via this variable.

      The operand stack is unaffected.

      See Also:
    • _ARGV_OFFSET_

      public static final int _ARGV_OFFSET_
      Assign the ARGV variable offset. The AVM provides command-line arguments via this variable.

      The operand stack is unaffected.

      See Also:
    • _APPLY_RS_

      public static final int _APPLY_RS_
      Apply the RS variable by notifying the partitioning reader that there is a new regular expression to use when partitioning input records.

      The stack remains unaffected.

      See Also:
    • _CALL_FUNCTION_

      public static final int _CALL_FUNCTION_
      Call a user function.

      Stack before: x1, x2, ..., xn
      Stack after: f(x1, x2, ..., xn)

      See Also:
    • _FUNCTION_

      public static final int _FUNCTION_
      Define a user function.

      Stack remains unchanged

      See Also:
    • _SET_RETURN_RESULT_

      public static final int _SET_RETURN_RESULT_
      Sets the return value of a user function.

      Stack before: x
      Stack after: ...

      See Also:
    • _RETURN_FROM_FUNCTION_

      public static final int _RETURN_FROM_FUNCTION_
      Get the return value of the user function that was called

      Stack before: ...
      Stack after: x

      See Also:
    • _SET_NUM_GLOBALS_

      public static final int _SET_NUM_GLOBALS_
      Internal: sets the number of global variables
      See Also:
    • _CLOSE_

      public static final int _CLOSE_
      Close the specified file.

      Stack before: file name
      Stack after: result of the close operation

      See Also:
    • _APPLY_SUBSEP_

      public static final int _APPLY_SUBSEP_
      Convert a list of array indices to a concatenated string with SUBSEP. This is used for multidimensional arrays.

      Stack before: i1, i2, ..., in
      Stack after: "i1SUBSEPi2SUBSEP...in"

      See Also:
    • _DELETE_ARRAY_ELEMENT_

      public static final int _DELETE_ARRAY_ELEMENT_
      Deletes an entry in an array.

      Stack before: i
      Stack after: ...

      See Also:
    • _SET_EXIT_ADDRESS_

      public static final int _SET_EXIT_ADDRESS_
      Internal.

      Stack remains unchanged.

      See Also:
    • _SET_WITHIN_END_BLOCKS_

      public static final int _SET_WITHIN_END_BLOCKS_
      Internal.

      Stack remains unchanged.

      See Also:
    • _EXIT_WITH_CODE_

      public static final int _EXIT_WITH_CODE_
      Terminates execution and returns specified exit code.

      Stack before: integer
      Stack after: N/A

      See Also:
    • _REGEXP_

      public static final int _REGEXP_
      Returns a regex pattern.

      Stack before: ...
      Stack after: the regex pattern object

      See Also:
    • _CONDITION_PAIR_

      public static final int _CONDITION_PAIR_
      Returns a pair of regex patterns.

      Stack before: pattern1, pattern2
      Stack after: regex pair object

      See Also:
    • _IS_IN_

      public static final int _IS_IN_
      Returns whether the specified key is in the array.

      Stack before: key, array
      Stack after: true|false

      See Also:
    • _CAST_INT_

      public static final int _CAST_INT_
      Cast to integer

      Stack before: object
      Stack after: integer

      See Also:
    • _CAST_DOUBLE_

      public static final int _CAST_DOUBLE_
      Cast to double

      Stack before: object
      Stack after: double

      See Also:
    • _CAST_STRING_

      public static final int _CAST_STRING_
      Cast to string

      Stack before: object
      Stack after: string

      See Also:
    • _THIS_

      public static final int _THIS_
      Deprecated.
      See Also:
    • _EXTENSION_

      public static final int _EXTENSION_
      Call a function from an extension

      Stack before: x1, x2, ..., xn
      Stack after: f(x1, x2, ..., xn)

      See Also:
    • _EXEC_

      public static final int _EXEC_
      Execute the specified AWK code

      Stack before: script
      Stack after: exit code of the script, or zero when successful, -1 when failed

      See Also:
    • _DELETE_ARRAY_

      public static final int _DELETE_ARRAY_
      Delete the specified array.

      Stack remains unchanged.

      See Also:
    • _UNARY_PLUS_

      public static final int _UNARY_PLUS_
      Converts the top stack element to a number; pushes the result onto the stack.

      Stack before: x ...
      Stack after: x ... (as a number)

      See Also:
    • _EXIT_WITHOUT_CODE_

      public static final int _EXIT_WITHOUT_CODE_
      Terminates execution without specifying an exit code.

      Stack before: N/A
      Stack after: N/A

      See Also:
    • _ORS_OFFSET_

      public static final int _ORS_OFFSET_
      Assign the ORS variable offset. This is important for the AVM to use when outputting expressions via PRINT.

      The operand stack is unaffected.

      See Also:
    • _POSTINC_

      public static final int _POSTINC_
      Increases the variable reference by one; pushes the original value onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: ...
      Stack after: x ... or 0 if uninitialized

      See Also:
    • _POSTDEC_

      public static final int _POSTDEC_
      Decreases the variable reference by one; pushes the original value onto the stack.

      Argument 1: offset of the particular variable into the variable manager
      Argument 2: whether the variable is global or local

      Stack before: ...
      Stack after: x ... or 0 if uninitialized

      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 num_exprs)

      print.

      Parameters:
      num_exprs - a int
    • printToFile

      public void printToFile(int num_exprs, boolean append)

      printToFile.

      Parameters:
      num_exprs - a int
      append - a boolean
    • printToPipe

      public void printToPipe(int num_exprs)

      printToPipe.

      Parameters:
      num_exprs - a int
    • printf

      public void printf(int num_exprs)

      printf.

      Parameters:
      num_exprs - a int
    • printfToFile

      public void printfToFile(int num_exprs, boolean append)

      printfToFile.

      Parameters:
      num_exprs - a int
      append - a boolean
    • printfToPipe

      public void printfToPipe(int num_exprs)

      printfToPipe.

      Parameters:
      num_exprs - a int
    • sprintf

      public void sprintf(int num_exprs)

      sprintf.

      Parameters:
      num_exprs - a int
    • length

      public void length(int num_exprs)

      length.

      Parameters:
      num_exprs - a int
    • concat

      public void concat()

      concat.

    • assign

      public void assign(int offset, boolean is_global)

      assign.

      Parameters:
      offset - a int
      is_global - a boolean
    • assignArray

      public void assignArray(int offset, boolean is_global)

      assignArray.

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

      public void assignAsInput()

      assignAsInput.

    • assignAsInputField

      public void assignAsInputField()

      assignAsInputField.

    • dereference

      public void dereference(int offset, boolean is_array, boolean is_global)

      dereference.

      Parameters:
      offset - a int
      is_array - a boolean
      is_global - a boolean
    • plusEq

      public void plusEq(int offset, boolean is_global)

      plusEq.

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

      public void minusEq(int offset, boolean is_global)

      minusEq.

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

      public void multEq(int offset, boolean is_global)

      multEq.

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

      public void divEq(int offset, boolean is_global)

      divEq.

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

      public void modEq(int offset, boolean is_global)

      modEq.

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

      public void powEq(int offset, boolean is_global)

      powEq.

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

      public void plusEqArray(int offset, boolean is_global)

      plusEqArray.

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

      public void minusEqArray(int offset, boolean is_global)

      minusEqArray.

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

      public void multEqArray(int offset, boolean is_global)

      multEqArray.

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

      public void divEqArray(int offset, boolean is_global)

      divEqArray.

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

      public void modEqArray(int offset, boolean is_global)

      modEqArray.

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

      public void powEqArray(int offset, boolean is_global)

      powEqArray.

      Parameters:
      offset - a int
      is_global - 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 is_gsub)

      subForDollar0.

      Parameters:
      is_gsub - a boolean
    • subForDollarReference

      public void subForDollarReference(boolean is_gsub)

      subForDollarReference.

      Parameters:
      is_gsub - a boolean
    • subForVariable

      public void subForVariable(int offset, boolean is_global, boolean is_gsub)

      subForVariable.

      Parameters:
      offset - a int
      is_global - a boolean
      is_gsub - a boolean
    • subForArrayReference

      public void subForArrayReference(int offset, boolean is_global, boolean is_gsub)

      subForArrayReference.

      Parameters:
      offset - a int
      is_global - a boolean
      is_gsub - 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 is_global)

      inc.

      Parameters:
      offset - a int
      is_global - a boolean
    • dec

      public void dec(int offset, boolean is_global)

      dec.

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

      public void postInc(int offset, boolean is_global)

      postInc.

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

      public void postDec(int offset, boolean is_global)

      postDec.

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

      public void incArrayRef(int offset, boolean is_global)

      incArrayRef.

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

      public void decArrayRef(int offset, boolean is_global)

      decArrayRef.

      Parameters:
      offset - a int
      is_global - 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.

    • sleep

      public void sleep(int num_args)

      sleep.

      Parameters:
      num_args - a int
    • dump

      public void dump(int num_args)

      dump.

      Parameters:
      num_args - a int
    • dereferenceArray

      public void dereferenceArray()

      dereferenceArray.

    • keylist

      public void keylist()

      keylist.

    • 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 func_name, int num_formal_params)

      function.

      Parameters:
      func_name - a String object
      num_formal_params - a int
    • callFunction

      public void callFunction(HasFunctionAddress has_func_addr, String func_name, int num_formal_params, int num_actual_params)

      callFunction.

      Parameters:
      has_func_addr - a HasFunctionAddress object
      func_name - a String object
      num_formal_params - a int
      num_actual_params - a int
    • setReturnResult

      public void setReturnResult()

      setReturnResult.

    • returnFromFunction

      public void returnFromFunction()

      returnFromFunction.

    • setNumGlobals

      public void setNumGlobals(int num_globals)

      setNumGlobals.

      Parameters:
      num_globals - 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 is_global)

      deleteArrayElement.

      Parameters:
      offset - a int
      is_global - a boolean
    • deleteArray

      public void deleteArray(int offset, boolean is_global)

      deleteArray.

      Parameters:
      offset - a int
      is_global - 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 regexp_str)

      regexp.

      Parameters:
      regexp_str - a String object
    • conditionPair

      public void conditionPair()

      regexpPair.

    • isIn

      public void isIn()

      isIn.

    • castInt

      public void castInt()

      castInt.

    • castDouble

      public void castDouble()

      castDouble.

    • castString

      public void castString()

      castString.

    • scriptThis

      public void scriptThis()

      scriptThis.

    • extension

      public void extension(String extension_keyword, int param_count, boolean is_initial)

      extension.

      Parameters:
      extension_keyword - a String object
      param_count - a int
      is_initial - a boolean
    • dump

      public void dump(PrintStream ps)

      dump.

      Parameters:
      ps - a PrintStream object
    • top

      public Position top()

      top.

      Returns:
      a Position 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 is_array)
      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
      is_array - Whether the variable is actually an array
    • setFunctionNameSet

      public void setFunctionNameSet(Set<String> function_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:
      function_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