Lists¶
Reference FIFO linked-list implementation with direct single-callback execution.
Import¶
import "_IVLS/std-library/nodes/components/lists.ksp"Node: Stl.Lists¶
Uses: Init
Overview¶
Reference FIFO linked-list implementation with direct single-callback execution.
Provides a doubly-linked FIFO (First-In-First-Out) list abstraction with Entry and FIFO ADT types. Unlike the optimized variant, all operations execute inline within a single callback context without global variable dispatch or internal helper splits.
Each operation is a self-contained function that reads its arguments directly from parameters and operates on the shared FIFO and Entry type pools. This implementation is simpler to read and suitable for contexts where all FIFO operations occur within the same callback.
API¶
Nodes¶
| Name | Description |
|---|---|
node Stl.Lists |
Declares the FIFO linked-list node, registering Entry and FIFO types and exposin... |
Defines¶
| Name | Description |
|---|---|
define Entry.MEMBERS |
Member name list for the Entry ADT type, enumerating prev, next, and data fields. |
define FIFO.MEMBERS |
Member name list for the FIFO ADT type, enumerating front and back pointer field... |
Macros¶
| Name | Description |
|---|---|
end_for_each_fifo(#entry_obj#) |
Closes a for_each_in_fifo loop, advancing the iterator and ending the while. |
Entry.def |
Defines the Entry ADT type structure, declaring its member layout and initial va... |
Entry.Destructor(ref) |
Destructor for Entry instances; relinks adjacent entries to preserve list integr... |
FIFO.def |
Defines the FIFO ADT type structure, declaring its member layout and initial val... |
FIFO.Destructor(ref) |
Destructor for FIFO instances; traverses and deletes all contained Entry objects. |
for_each_in_fifo(#ref#, #entry_obj#, #data_name#) |
Begins a for-each iteration over all entries in a FIFO list; must be paired with... |
interrupt_for_fifo(#entry_obj#) |
Interrupts an enclosing for_each_in_fifo loop early. |
Functions¶
| Name | Description |
|---|---|
FIFO.delete_entry(ref, entry) |
Removes a specific entry by reference from the specified FIFO list. |
FIFO.peek_entry(ref) -> result |
Returns the entry reference at the front of the specified FIFO list without remo... |
FIFO.pop(ref) -> data |
Removes and returns the front entry's data from the specified FIFO list. |
FIFO.print_list(ref) |
Prints a human-readable representation of the specified FIFO list to the Kontakt... |
FIFO.push(ref, data) -> entry |
Pushes a new data value onto the back of the specified FIFO list. |
Nodes¶
node Stl.Lists¶
Callbacks: Init
Declares the FIFO linked-list node, registering Entry and FIFO types and exposing their operation functions.
Defines¶
define Entry.MEMBERS¶
Member name list for the Entry ADT type, enumerating prev, next, and data fields.
define FIFO.MEMBERS¶
Member name list for the FIFO ADT type, enumerating front and back pointer fields.
Macros¶
end_for_each_fifo(#entry_obj#)¶
Closes a for_each_in_fifo loop, advancing the iterator and ending the while.
| Parameter | Description |
|---|---|
#entry_obj# |
Name of the entry iterator variable used in the matching for_each_in_fifo |
Entry.def¶
Defines the Entry ADT type structure, declaring its member layout and initial values.
Side effects:
| Name | Type | Purpose |
|---|---|---|
| Entry.MEMBERS | define | Declares the member names for the Entry type (prev, next, data) |
| Entry.INIT[] | integer_array | Declares the initial values array for Entry instances |
Entry.Destructor(ref)¶
Destructor for Entry instances; relinks adjacent entries to preserve list integrity.
| Parameter | Type | Description |
|---|---|---|
ref |
integer | Reference handle of the Entry instance to clean up |
Side effects:
| Name | Type | Purpose |
|---|---|---|
| prev | integer | Holds the previous Entry reference for pointer fixup |
| next | integer | Holds the next Entry reference for pointer fixup |
FIFO.def¶
Defines the FIFO ADT type structure, declaring its member layout and initial values.
Side effects:
| Name | Type | Purpose |
|---|---|---|
| FIFO.MEMBERS | define | Declares the member names for the FIFO type (front, back) |
| FIFO.INIT[] | integer_array | Declares the initial values array for FIFO instances |
FIFO.Destructor(ref)¶
Destructor for FIFO instances; traverses and deletes all contained Entry objects.
| Parameter | Type | Description |
|---|---|---|
ref |
integer | Reference handle of the FIFO instance to clean up |
Side effects:
| Name | Type | Purpose |
|---|---|---|
| n | integer | Iterator holding current Entry reference during traversal |
| nn | integer | Lookahead holding next Entry reference before deletion |
for_each_in_fifo(#ref#, #entry_obj#, #data_name#)¶
Begins a for-each iteration over all entries in a FIFO list; must be paired with end_for_each_fifo.
| Parameter | Description |
|---|---|
#ref# |
Reference handle of the FIFO to iterate |
#entry_obj# |
Name to use for the entry iterator variable |
#data_name# |
Name to use for the current entry's data variable |
Side effects:
| Name | Type | Purpose |
|---|---|---|
| #entry_obj# | integer | Iterator variable holding current Entry reference |
| #data_name# | integer | Variable holding current Entry's data value |
| next_#entry_obj# | integer | Lookahead variable holding next Entry reference |
interrupt_for_fifo(#entry_obj#)¶
Interrupts an enclosing for_each_in_fifo loop early.
| Parameter | Description |
|---|---|
#entry_obj# |
Name of the entry iterator variable used in the enclosing for_each_in_fifo |
Functions¶
FIFO.delete_entry(ref, entry)¶
Removes a specific entry by reference from the specified FIFO list.
| Parameter | Type | Description |
|---|---|---|
ref |
integer | Reference handle identifying the target FIFO instance |
entry |
integer | Reference handle of the Entry to remove |
FIFO.peek_entry(ref) -> result¶
Returns the entry reference at the front of the specified FIFO list without removing it.
| Parameter | Type | Description |
|---|---|---|
ref |
integer | Reference handle identifying the target FIFO instance |
Returns: result — Entry reference at the front of the FIFO, or -1 if empty
FIFO.pop(ref) -> data¶
Removes and returns the front entry's data from the specified FIFO list.
| Parameter | Type | Description |
|---|---|---|
ref |
integer | Reference handle identifying the target FIFO instance |
Returns: data — Data value from the removed front entry
Side effects: | Name | Type | Purpose | |------|------|---------| | returning | integer | Holds the front Entry reference being removed |
FIFO.print_list(ref)¶
Prints a human-readable representation of the specified FIFO list to the Kontakt message console.
| Parameter | Type | Description |
|---|---|---|
ref |
integer | Reference handle identifying the target FIFO instance |
Side effects: | Name | Type | Purpose | |------|------|---------| | n | integer | Iterator variable holding current Entry reference during traversal |
FIFO.push(ref, data) -> entry¶
Pushes a new data value onto the back of the specified FIFO list.
| Parameter | Type | Description |
|---|---|---|
ref |
integer | Reference handle identifying the target FIFO instance |
data |
integer | Data value to store in the new entry |
Returns: entry — Reference handle to the newly created Entry
Side effects: | Name | Type | Purpose | |------|------|---------| | new | integer | Holds the newly allocated Entry reference during linking |
Example¶
// TODO: Add usage example