infinite_state_machine 1.0.0
Infinite State Machine Library
Loading...
Searching...
No Matches
Functions
infinite_state.c File Reference

Implementation of infinite state machine topology traversal. More...

#include "infinite_state.h"
#include <stddef.h>
Include dependency graph for infinite_state.c:

Go to the source code of this file.

Functions

struct infinite_state ** infinite_state_topology (struct infinite_state *state, int depth, struct infinite_state **topology)
 Get the topology of the infinite state machine.
 

Detailed Description

Implementation of infinite state machine topology traversal.

The infinite_state_topology() function performs a depth-limited upward traversal of the state hierarchy, collecting unique super-states (including the starting state) into the supplied topology array. The function returns a pointer to the next free slot after the last written state. Duplicate suppression (to avoid loops) is compiled in only when DEBUG is defined.

Preconditions:

Postconditions:

Notes:

Definition in file infinite_state.c.

Function Documentation

◆ infinite_state_topology()

struct infinite_state ** infinite_state_topology ( struct infinite_state state,
int  depth,
struct infinite_state **  topology 
)

Get the topology of the infinite state machine.

Compute a state's forward topological vector. This function fills the topology vector with the state's sub-states in "forward" order (from the outer state down to the inner). The function returns a pointer to the end of the filled vector.

This is a recursive implementation limited in depth.

Parameters
stateThe current state.
depthThe current depth.
topologyThe topology array to fill.
Returns
The updated topology array.

Definition at line 32 of file infinite_state.c.