View Source cure_fsm_builtins (cure v0.1.0)

Cure Programming Language - FSM Built-in Functions

This module provides built-in FSM functions that interface directly with the cure_fsm_runtime module. These functions are called from Cure programs via the FFI (Foreign Function Interface) to provide FSM functionality.

Features

FSM Lifecycle Management

  • FSM Spawning: Create new FSM instances with type validation
  • FSM Termination: Graceful shutdown of FSM processes

FSM Operations

  • Event Sending: Asynchronous event dispatch to FSMs
  • State Inspection: Query current FSM state and information
  • Batch Operations: Efficient batch event processing

FSM Utilities

  • Process Monitoring: Monitor FSM processes for termination
  • Process Linking: Bidirectional crash propagation
  • Timeout Management: Set and clear FSM timeouts

API Design

All functions are designed to be called from Cure programs via FFI. They provide a clean interface to the underlying Erlang FSM runtime.

Summary

Functions

fsm_clear_timeout/1

fsm_get_performance_stats/1

fsm_get_registered_types()

fsm_history/1

fsm_info/1

fsm_is_alive/1

fsm_link/1

fsm_lookup_definition/1

fsm_monitor/1

fsm_reset_stats/1

fsm_send/2

fsm_send/3

fsm_send_batch/2

fsm_set_data/2

fsm_set_timeout/3

fsm_spawn/2

fsm_spawn_with_options/3

fsm_state/1

fsm_stop/1

fsm_unlink/1

fsm_validate_event/2

fsm_validate_type/1

register_fsm_builtins(Env)

validate_fsm_event(FSMPid, Event)

validate_fsm_type(FSMType)