Files
Cescal/include/cescal/state.h
T

54 lines
1.0 KiB
C
Raw Normal View History

2026-05-23 01:34:59 -04:00
/*
* 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"
2026-05-23 02:57:50 -04:00
#include "cescal/tokbuf.h"
2026-05-23 06:03:23 -04:00
#include "cescal/ptrbox.h"
2026-05-23 21:50:43 -04:00
#include "cescal/symbol.h"
2026-05-23 01:34:59 -04:00
/*
* Compiler state machine
*
2026-05-23 02:57:50 -04:00
* @in_fd: Input file descriptor
* @rb: Read buffer
* @tokbuf: Token buffer
2026-05-23 06:03:23 -04:00
* @ptrbox: Global pointer box
2026-05-23 10:53:41 +00:00
* @lex_putback: Lexer putback buffer
2026-05-23 11:09:12 +00:00
* @pass: Current pass
2026-05-23 21:50:43 -04:00
* @symtab: Symbol table
2026-05-23 01:34:59 -04:00
*/
struct cescal_state {
int in_fd;
struct readbuf rb;
2026-05-23 02:57:50 -04:00
struct tokbuf tokbuf;
2026-05-23 06:03:23 -04:00
struct ptrbox ptrbox;
2026-05-23 10:53:41 +00:00
char lex_putback;
2026-05-23 11:09:12 +00:00
uint8_t pass;
2026-05-23 21:50:43 -04:00
struct symbol_table symtab;
2026-05-23 01:34:59 -04:00
};
/*
* 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 */