The aot_path can be used to track the position of a Lua entity in nested tables.
This is obsolete! Use aot_references_module instead. Please note that this module might be removed in future versions of Aotus.
The idea is to initialize the path in the very beginning and then append a node whenever a table is opened. Thus you pass down the growing path object and store at in the level, to which you might need to return later.
Taking care of the linked list in a copying routine for the assignment of aot_path_type.
Copy a given path object, this is the implementation of the assignment left = right.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | left | Object to assign a path to |
||
type(aot_path_type), | intent(in) | :: | right | Path to be copied |
Re-open a previously recorded path through nested Lua tables.
This subroutine opens all the tables on the way to the final head node, which ought to be a function.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
type(aot_fun_type), | intent(out) | :: | fun | The opened function |
||
logical, | intent(in), | optional | :: | openLua | A flag to indicate, wether to open the Lua script, default is false, in which case the conf argument has to link to an actual Lua state handle. |
This subroutine opens all the tables on the way to the final head node of the given path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
integer, | intent(out) | :: | thandle | return handle of the last opened table |
||
logical, | intent(in), | optional | :: | openLua | A flag to indicate, wether to open the Lua script, default is false, in which case the conf argument has to link to an actual Lua state handle. |
This routine closes function and all other tables opened along the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
type(aot_fun_type), | intent(inout) | :: | fun | The opened function |
||
logical, | intent(in), | optional | :: | closeLua | A flag to indicate, wether to close the Lua script, default is false. |
This routine closes all the table opened in aot_path_open_table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
logical, | intent(in), | optional | :: | closeLua | A flag to indicate, wether to close the Lua script, default is false. |
This type is the main data structure of the module and describes the path.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=256), | private | :: | LuaFilename | Name of the file where this path object is found in. |
|||
integer, | private | :: | rootHandle | Handle to the topmost table opened for the path. |
|||
type(aot_path_node_type), | private, | pointer | :: | GlobalNode | => | NULL() | Entry level of the path on the global scope of the Lua script. |
type(aot_path_node_type), | private, | pointer | :: | head | => | NULL() | Moving head through the linked list of path nodes. |
This data structure describes a node in the path through nested tables.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=16), | private | :: | NodeType | What type of node is this? Currently supported are function and table |
|||
character(len=16), | private | :: | ID_kind | How to look up this node, by key or position? |
|||
character(len=80), | private | :: | key | Identifying key |
|||
integer, | private | :: | pos | Identifying position |
|||
type(aot_path_node_type), | private, | pointer | :: | child | => | NULL() | Link to possible child of this node |
This subroutine initializes a path object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(out) | :: | me | Path object to initialize |
||
character(len=*), | intent(in), | optional | :: | Filename | Filename of the Lua script, this path is located in |
This subroutine finalizes a path object and deallocates all its nodes.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | Path to destroy |
With this subroutine a node is appended to the end of the list of nodes of the given path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | Path to append the node to |
||
character(len=*), | intent(in) | :: | NodeType | Type of the node (table of function) |
||
integer, | intent(in), | optional | :: | pos | Position in the parenting table |
|
character(len=*), | intent(in), | optional | :: | key | Key within the parenting table |
The delNode removes the last node from the list of nodes of the given path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | Path to delet the last node from |
||
logical, | intent(out), | optional | :: | isEmpty | Flag, if resulting path is empty (contains no nodes anymore) |
Dumps the complete path into a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(in) | :: | path | The path which information should be printed |
||
character(len=*), | intent(out) | :: | pathAsString | The path represented as string |
Dumps the complete path to the given output unit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(in) | :: | path | The path which information should be printed |
||
integer, | intent(in) | :: | outputUnit | The unit to use to write the path data |
Copy a given path object, this is the implementation of the assignment left = right.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | left | Object to assign a path to |
||
type(aot_path_type), | intent(in) | :: | right | Path to be copied |
This subroutine opens all the tables on the way to the final head node, which ought to be a function.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
type(aot_fun_type), | intent(out) | :: | fun | The opened function |
||
logical, | intent(in), | optional | :: | openLua | A flag to indicate, wether to open the Lua script, default is false, in which case the conf argument has to link to an actual Lua state handle. |
This subroutine opens all the tables on the way to the final head node of the given path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
integer, | intent(out) | :: | thandle | return handle of the last opened table |
||
logical, | intent(in), | optional | :: | openLua | A flag to indicate, wether to open the Lua script, default is false, in which case the conf argument has to link to an actual Lua state handle. |
This routine closes function and all other tables opened along the path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
type(aot_fun_type), | intent(inout) | :: | fun | The opened function |
||
logical, | intent(in), | optional | :: | closeLua | A flag to indicate, wether to close the Lua script, default is false. |
This routine closes all the table opened in aot_path_open_table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_path_type), | intent(inout) | :: | me | The path object to open as a function |
||
type(flu_State) | :: | conf | The flu_state handle, which is either opened according to the path, or used to open the path in. |
|||
logical, | intent(in), | optional | :: | closeLua | A flag to indicate, wether to close the Lua script, default is false. |