596e63e468
Signed-off-by: Chloe M. <chloe@mirocom.org>
51 lines
990 B
C
51 lines
990 B
C
/*
|
|
* Copyright (c) 2026, Chloe M.
|
|
* Provided under the BSD-3 clause
|
|
*/
|
|
|
|
#ifndef CESCAL_STATE_H
|
|
#define CESCAL_STATE_H 1
|
|
|
|
#include <stdint.h>
|
|
#include "cescal/readbuf.h"
|
|
#include "cescal/tokbuf.h"
|
|
#include "cescal/ptrbox.h"
|
|
|
|
/*
|
|
* Compiler state machine
|
|
*
|
|
* @in_fd: Input file descriptor
|
|
* @rb: Read buffer
|
|
* @tokbuf: Token buffer
|
|
* @ptrbox: Global pointer box
|
|
* @lex_putback: Lexer putback buffer
|
|
* @pass: Current pass
|
|
*/
|
|
struct cescal_state {
|
|
int in_fd;
|
|
struct readbuf rb;
|
|
struct tokbuf tokbuf;
|
|
struct ptrbox ptrbox;
|
|
char lex_putback;
|
|
uint8_t pass;
|
|
};
|
|
|
|
/*
|
|
* Initialize the compiler state machine
|
|
*
|
|
* @state: Compiler state machine
|
|
* @pathname: Path of input source file
|
|
*
|
|
* Returns zero on success
|
|
*/
|
|
int state_init(struct cescal_state *state, const char *pathname);
|
|
|
|
/*
|
|
* Close the compiler state machine
|
|
*
|
|
* @state: Compiler state machine to close
|
|
*/
|
|
void state_close(struct cescal_state *state);
|
|
|
|
#endif /* !CESCAL_STATE_H */
|