Class AbstractExtension

java.lang.Object
org.sentrysoftware.jawk.ext.AbstractExtension
All Implemented Interfaces:
JawkExtension
Direct Known Subclasses:
CoreExtension, StdinExtension

public abstract class AbstractExtension extends Object implements JawkExtension
Base class of various extensions.

Provides functionality common to most extensions, such as VM and JRT variable management, and convenience methods such as checkNumArgs() and toAwkString().

Author:
Danny Daglas
  • Constructor Details

    • AbstractExtension

      public AbstractExtension()
  • Method Details

    • init

      public void init(VariableManager vm, JRT jrt, AwkSettings settings)
      Called after the creation and before normal processing of the extension, pass in the Jawk Runtime Manager and the Variable Manager once.

      It is guaranteed init() is called before invoke() is called.

      Specified by:
      init in interface JawkExtension
      Parameters:
      vm - Reference to the Variable Manager
      jrt - Reference to the Runtime
      settings - Reference to the settings
    • getAssocArrayParameterPositions

      public int[] getAssocArrayParameterPositions(String extensionKeyword, int argCount)
      Define the parameters which are expected to be associative arrays. This is used by the semantic analyzer to enforce type checking and correct Jawk variable allocation (which is done at the beginning of script execution). Assume no guarantee of any extension parameter being an associative array.
      Specified by:
      getAssocArrayParameterPositions in interface JawkExtension
      Parameters:
      extensionKeyword - The extension keyword to check.
      argCount - How many actual parameters are used in the call.
      Returns:
      An array of parameter indexes containing associative arrays. Note: non-inclusion of a parameter index into this array makes no implication as to whether the parameter is a scalar or an associative array. It means that its type is not guaranteed to be an associative array.