/* * Copyright (c) 2026, Mirocom Laboratories * Provided under the BSD-3 clause * * Abstract: * This header defines the quip state machine * Author: * Ian M. Moffett */ #ifndef COMMON_STATE_H #define COMMON_STATE_H 1 #include #include #include "common/knobs.h" #include "common/ptrbox.h" /* * Represents the build state machine * * @in_fd: Input file descriptor of build file * @line_num: Current line number * @lex_buf: Used to reduce system call frequency * @lex_buf_cap: Lexer buffer capacity * @lex_buf_i: Lexer buffer index * @lex_putback: Lexer putback buffer * @ptrbox: Global pointer box */ struct quip_state { int in_fd; size_t line_num; char lex_buf[LEX_FILEBUF_LEN]; size_t lex_buf_cap; size_t lex_buf_i; char lex_putback; struct ptrbox ptrbox; }; /* * Initialize the quip state machine * * @build_file: Path to build file * @state: State instance to initialize * * Returns zero on success */ int quip_state_init(const char *build_file, struct quip_state *state); /* * Destroy a quip state */ void quip_state_destroy(struct quip_state *state); #endif /* !COMMON_STATE_H */