From c778c1aa829818f377fd8ef85ecae8fd74d8b7dd Mon Sep 17 00:00:00 2001 From: Aaron Cook Date: Sat, 20 Jun 2026 23:03:35 -0500 Subject: [PATCH] Pawn engine WIP --- src/pawn_engine.c | 0 src/pawn_engine.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/pawn_engine.c create mode 100644 src/pawn_engine.h diff --git a/src/pawn_engine.c b/src/pawn_engine.c new file mode 100644 index 0000000..e69de29 diff --git a/src/pawn_engine.h b/src/pawn_engine.h new file mode 100644 index 0000000..8a48cdb --- /dev/null +++ b/src/pawn_engine.h @@ -0,0 +1,59 @@ +#ifndef _PAWN_ENGINE_H_ +#define _PAWN_ENGINE_H_ + +#include + +typedef struct str_struct { + /** Actual value of the string */ + char *val; + /** Current length of the string in bytes */ + size_t len; + /** Capacity of the string buffer */ + size_t cap; +} str_t; + +typedef struct file_position_struct { + /** Line number in the file (1-indexed) */ + size_t line; + /** Column number in the file (1-indexed) */ + size_t column; +} file_position_t; + +typedef struct file_range_struct { + /** Start of the range, inclusive */ + file_position_t start; + /** End of the range, inclusive */ + file_position_t end; +} file_range_t; + +typedef struct file_diagnostic_struct { + /** Message for the diagnostic */ + str_t message; + /** Range of text the diagnostic applies to */ + file_range_t range; +} file_diagnostic_t; + +typedef struct pawn_diagnostics_struct { + /** Errors present in a Pawn script */ + file_diagnostic_t *errors; + /** Number of errors */ + size_t errors_len; + /** Warnings present in a Pawn script */ + file_diagnostic_t *warnings; + /** Number of warnings */ + size_t warnings_len; +} pawn_diagnostics_t; + +typedef struct pawn_engine_settings_struct { + /** Path to the pawncc executable */ + const char *pawncc; + /** Extra options to run pawncc with, not including the pawncc or script paths */ + const char **argv; + /** Number of extra options */ + int argc; +} pawn_engine_settings_t; + +pawn_diagnostics_t *pawn_engine_compile(const char *path, pawn_engine_settings_t *settings); + +#endif /* _PAWN_ENGINE_H_ */ +