Interface JawkExtension
- All Known Implementing Classes:
AbstractExtension,GawkExtension
Instances of this interface are eligible for insertion into Jawk as an extension to the language. Extensions appear within a Jawk script as function calls.
Extensions introduce native Java modules into the Jawk language. This enables special services into Jawk, such as Sockets, GUIs, databases, etc. natively into Jawk.
Extension functions can be used anywhere an AWK function, builtin or user-defined, can be used.
Extensions introduce keywords into the Jawk parser. Keywords are of type _EXTENSION_ tokens. As a result, extension keywords cannot collide with other Jawk keywords, variables, or function names. The extension mechanism also guards against keyword collision with other extensions. The Jawk lexer expects extension keywords to match as _ID_'s.
- Author:
- Danny Daglas
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbeforeStart(AVM avm, JRT jrt) Called after the runtime global variable slots have been allocated and before the first executable tuple runs.Returns the mapping between Awk keywords and the functions implemented by this extension.getExtensionName.voidinit(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.
-
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.
- Parameters:
vm- Reference to the Variable Managerjrt- Reference to the Runtimesettings- Reference to the settings
-
beforeStart
Called after the runtime global variable slots have been allocated and before the first executable tuple runs.- Parameters:
avm- interpreter instance about to execute the tuple streamjrt- runtime services associated withavm
-
getExtensionName
String getExtensionName()getExtensionName.
- Returns:
- name of the extension package.
-
getExtensionFunctions
Map<String,ExtensionFunction> getExtensionFunctions()Returns the mapping between Awk keywords and the functions implemented by this extension. The returned map must be unmodifiable.- Returns:
- mapping from keyword to
ExtensionFunction
-