Expose GroundScope struct

This commit is contained in:
2026-02-02 13:07:02 +11:00
parent e3702f46f3
commit d011d2beb4

View File

@@ -1,5 +1,6 @@
#ifndef LIBGROUND_H #ifndef LIBGROUND_H
#define LIBGROUND_H #define LIBGROUND_H
#define MAX_ID_LEN 64
/* /*
* groundvm.h * groundvm.h
@@ -165,6 +166,24 @@ typedef struct GroundObject {
GroundObjectField* fields; GroundObjectField* fields;
} GroundObject; } GroundObject;
typedef struct GroundLabel {
char id[MAX_ID_LEN];
int lineNum;
UT_hash_handle hh;
} GroundLabel;
typedef struct GroundVariable {
char id[MAX_ID_LEN];
GroundValue value;
UT_hash_handle hh;
} GroundVariable;
typedef struct GroundScope {
GroundLabel** labels;
GroundVariable** variables;
bool isMainScope;
} GroundScope;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@@ -180,6 +199,8 @@ void groundAddValueToInstruction(GroundInstruction* inst, GroundValue value);
void groundAddReferenceToInstruction(GroundInstruction* inst, GroundArg value); void groundAddReferenceToInstruction(GroundInstruction* inst, GroundArg value);
GroundArg groundCreateReference(GroundArgType type, char* ref); GroundArg groundCreateReference(GroundArgType type, char* ref);
void groundAddValueToScope(GroundScope* gs, const char* name, GroundValue value);
GroundValue groundCreateValue(GroundValueType type, ...); GroundValue groundCreateValue(GroundValueType type, ...);
GroundProgram groundParseFile(const char* code); GroundProgram groundParseFile(const char* code);