Pawn engine WIP

This commit is contained in:
Aaron Cook 2026-06-20 23:03:35 -05:00
commit c778c1aa82
2 changed files with 59 additions and 0 deletions

0
src/pawn_engine.c Normal file
View file

59
src/pawn_engine.h Normal file
View file

@ -0,0 +1,59 @@
#ifndef _PAWN_ENGINE_H_
#define _PAWN_ENGINE_H_
#include <stddef.h>
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_ */