Search

PythonReactSEOPDF
GitHub Skill

patternsstate-machine

State Machine Pattern pattern for C development

mgreenly☆ 1 Repository stars0 Repository forks

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

View source ↗Guides

Skill instructions

State Machine Pattern

Model system behavior as discrete states with defined transitions. Current state determines which actions are valid and what state comes next.

ikigai Application

Input parser: Tracks escape sequence state (normal, escape, CSI, etc.) to interpret terminal input bytes.

Streaming response: States like idle → requesting → streaming → complete → idle.

Implementation: Enum for states, switch or function pointer table for transitions:

typedef enum { STATE_IDLE, STATE_STREAMING, STATE_ERROR } stream_state_t;

REPL states: Input mode, scrolling mode, command mode.

Benefit: Complex input handling becomes manageable. Each state handles its valid inputs.

Examples

Read the usage examples in the source repository.

View source ↗

Source history

Indexed on
2026-01-20
Index updated
2026-01-26
Branch
main

Index and sync dates describe this directory. View the source repository for code history.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!