Skip to content

Flows

Flows

Import

import "_IVLS/source/nodes/Flows.ksp"

Node: Ivls.Flows

Uses: Init, FirstLoad

Overview

Flows

LIBRARY MODULE

Manages IVLS voice flows: ordered sequences of nodes and sub-flows that define playback routing for a voice.

  • Flow data structures: entry arrays, entry type arrays, per-entry argument slots
  • Runtime helpers: ivls.new_flow, ivls.reflow_voice
  • Registration macros: ivls.register_node, ivls.register_move, ivls.register_arg
  • Code-generation macros: ivls.MakeRegister, ivls.MakeArgs

API

Nodes

Name Description
node Ivls.Flows IVLS node that owns all flow data structures and the flow management API.

Defines

Name Description
define IVLS.ARGS_PER_NODE Maximum number of integer arguments stored per node entry in a flow.
define IVLS.MAX_FLOWS Maximum number of distinct flows that may be registered.
define IVLS.NODES_PER_FLOW Maximum number of node slots per flow.
define node_arg(#arg#) Expands to the argument array slot for the given index on the current voice's ac...

Const Blocks

Name Description
const args Enumerates the argument names declared for this node.
const flow_entry Discriminates the two kinds of entry that can occupy a slot in a flow array.

Macros

Name Description
ivls.MakeArgs(#node#) Generates an args const block for a node, enumerating the node's declared argume...
ivls.MakeRegister(#node#) Generates a typed registration function for a node so it can be appended to a fl...
ivls.register_arg(#flow#, #idx#, #value#) Sets an integer argument at a specific index for the most recently registered no...
ivls.register_move(#flow#, #target#) Appends a redirect to another flow as the next entry in the given flow, validati...
ivls.register_node(#flow#, #node_name#) Appends a node entry to the given flow, storing the node's enum index as the nex...

Functions

Name Description
ivls.new_flow() -> flow Allocates the next available flow index and returns it, or returns -1 if the max...
ivls.reflow_voice(v, fl) Assigns the voice to a new flow, resets its stage to -1, and follows any leading...
ivls.register_node.#node#(___register_flow, #node#.Args) Appends the node to the given flow and stores each argument value into the corre...

Nodes

node Ivls.Flows

Callbacks: Init, FirstLoad

IVLS node that owns all flow data structures and the flow management API.


Defines

define IVLS.ARGS_PER_NODE

Maximum number of integer arguments stored per node entry in a flow.


define IVLS.MAX_FLOWS

Maximum number of distinct flows that may be registered.


define IVLS.NODES_PER_FLOW

Maximum number of node slots per flow.


define node_arg(#arg#)

Expands to the argument array slot for the given index on the current voice's active flow stage.

Parameter Description
#arg# zero-based argument index within the current stage

Const Blocks

const args

Enumerates the argument names declared for this node.


const flow_entry

Discriminates the two kinds of entry that can occupy a slot in a flow array.


Macros

ivls.MakeArgs(#node#)

Generates an args const block for a node, enumerating the node's declared argument names so they can be iterated at compile time.

Parameter Description
#node# name token of the node to generate the args const block for

ivls.MakeRegister(#node#)

Generates a typed registration function for a node so it can be appended to a flow together with all of its declared arguments in a single call.

Parameter Description
#node# name token of the node to generate a registration function for

ivls.register_arg(#flow#, #idx#, #value#)

Sets an integer argument at a specific index for the most recently registered node entry in the given flow.

Parameter Description
#flow# flow variable whose last node entry receives the argument
#idx# zero-based argument index (must be in range 0..IVLS.ARGS_PER_NODE-1)
#value# integer value to store at that argument slot

ivls.register_move(#flow#, #target#)

Appends a redirect to another flow as the next entry in the given flow, validating that the target flow index is in range.

Parameter Description
#flow# flow variable to append the move entry to
#target# flow index to redirect to

ivls.register_node(#flow#, #node_name#)

Appends a node entry to the given flow, storing the node's enum index as the next stage in the sequence.

Parameter Description
#flow# flow variable to append the node entry to
#node_name# name token of the node to register

Functions

ivls.new_flow() -> flow

Allocates the next available flow index and returns it, or returns -1 if the maximum flow count has been reached.

Returns: flow — the newly allocated flow index, or -1 on failure


ivls.reflow_voice(v, fl)

Assigns the voice to a new flow, resets its stage to -1, and follows any leading FLOW-type redirects until the first NODE-type entry is reached.

Parameter Type Description
v integer voice index to reassign
fl integer target flow index

ivls.register_node.#node#(___register_flow, #node#.Args)

Appends the node to the given flow and stores each argument value into the corresponding flow argument slot.

Parameter Type Description
___register_flow integer the flow index to register this node into
#node#.Args argument values to store, one per declared node arg

Example

// TODO: Add usage example

See Also