Package org.sentrysoftware.jawk.ext
Class AbstractExtension
java.lang.Object
org.sentrysoftware.jawk.ext.AbstractExtension
- All Implemented Interfaces:
JawkExtension
- Direct Known Subclasses:
CoreExtension
,StdinExtension
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionint[]
getAssocArrayParameterPositions
(String extensionKeyword, int argCount) Define the parameters which are expected to be associative arrays.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.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.sentrysoftware.jawk.ext.JawkExtension
extensionKeywords, getExtensionName, invoke
-
Constructor Details
-
AbstractExtension
public AbstractExtension()
-
-
Method Details
-
init
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 interfaceJawkExtension
- Parameters:
vm
- Reference to the Variable Managerjrt
- Reference to the Runtimesettings
- Reference to the settings
-
getAssocArrayParameterPositions
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 interfaceJawkExtension
- 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.
-