groundFindVariable function

This commit is contained in:
2026-04-11 13:09:32 +10:00
parent 18ac18bc6d
commit e5776b16dd
2 changed files with 8 additions and 1 deletions

View File

@@ -20,7 +20,7 @@ typedef enum GroundInstType {
} GroundInstType; } GroundInstType;
typedef enum GroundValueType { typedef enum GroundValueType {
INT, DOUBLE, STRING, CHAR, BOOL, LIST, FUNCTION, STRUCTVAL, CUSTOM, ERROR, NONE INT, DOUBLE, STRING, CHAR, BOOL, LIST, FUNCTION, STRUCTVAL, CUSTOM, ERROR, NONE, ANY
} GroundValueType; } GroundValueType;
typedef enum GroundArgType { typedef enum GroundArgType {
@@ -209,6 +209,7 @@ GroundStruct groundCreateStruct();
void groundAddFieldToStruct(GroundStruct* gstruct, char* name, GroundValue field); void groundAddFieldToStruct(GroundStruct* gstruct, char* name, GroundValue field);
GroundObjectField* groundFindField(GroundObject head, const char *id); GroundObjectField* groundFindField(GroundObject head, const char *id);
GroundVariable* groundFindVariable(GroundScope* gs, const char *id);
// Run function returned by Ground code // Run function returned by Ground code
// Use argc to set count of args, accepts that amount of GroundValue's after // Use argc to set count of args, accepts that amount of GroundValue's after

View File

@@ -221,3 +221,9 @@ GroundObjectField* groundFindField(GroundObject head, const char *id) {
HASH_FIND_STR(head.fields, id, s); HASH_FIND_STR(head.fields, id, s);
return s; return s;
} }
GroundVariable* groundFindVariable(GroundScope* gs, const char *id) {
GroundVariable* var;
HASH_FIND_STR(*gs->variables, id, var);
return var;
}