Use reference counting for identifiers

This commit is contained in:
2026-06-17 10:11:15 +10:00
parent 6d35acbe60
commit b4e481ed9c
16 changed files with 112 additions and 156 deletions

View File

@@ -11,12 +11,12 @@ GroundValue _GroundNewValueStruct(GroundStruct in);
GroundValue _GroundNewValueObject(GroundObject in);
GroundArg _GroundNewArgValue(GroundValue value);
GroundArg _GroundNewArgValueRef(const char* ref);
GroundArg _GroundNewArgDirectRef(const char* ref);
GroundArg _GroundNewArgLineRef(const char* ref);
GroundArg _GroundNewArgLabelRef(const char* ref);
GroundArg _GroundNewArgFunctionRef(const char* ref);
GroundArg _GroundNewArgTypeRef(const char* ref);
GroundArg _GroundNewArgValueRef(GroundIdentifier* ref);
GroundArg _GroundNewArgDirectRef(GroundIdentifier* ref);
GroundArg _GroundNewArgLineRef(GroundIdentifier* ref);
GroundArg _GroundNewArgLabelRef(GroundIdentifier* ref);
GroundArg _GroundNewArgFunctionRef(GroundIdentifier* ref);
GroundArg _GroundNewArgTypeRef(GroundIdentifier* ref);
GroundList _GroundNewList();
GroundString _GroundNewString(const char* in);
@@ -30,6 +30,7 @@ GroundInstruction _GroundNewInstruction(enum GroundInstructionType type);
GroundProgram _GroundNewProgram();
GroundType _GroundNewType(enum GroundTypeType type, ...);
GroundIdentifier* _GroundNewIdentifier(const char* id);
void _GroundFreeValue(GroundValue* in);
void _GroundFreeList(GroundList* in);
@@ -43,6 +44,8 @@ void _GroundFreeInstruction(GroundInstruction* in);
void _GroundFreeProgram(GroundProgram* in);
void _GroundFreeState(GroundState* in);
void _GroundFreeIdentifier(GroundIdentifier* identifier);
GroundValue _GroundCopyValue(GroundValue* in);
GroundList _GroundCopyList(GroundList* in);
@@ -56,6 +59,8 @@ GroundInstruction _GroundCopyInstruction(GroundInstruction* in);
GroundProgram _GroundCopyProgram(GroundProgram* in);
GroundState _GroundCopyState(GroundState* in);
GroundIdentifier* _GroundCopyIdentifier(GroundIdentifier* identifier);
void _GroundListAppend(GroundList* list, GroundValue value);
@@ -129,6 +134,8 @@ struct _Ground Ground = {
.Instruction = _GroundNewInstruction,
.Program = _GroundNewProgram,
.Type = _GroundNewType,
.Identifier = _GroundNewIdentifier,
},
.Free = {
@@ -143,6 +150,8 @@ struct _Ground Ground = {
.Instruction = _GroundFreeInstruction,
.Program = _GroundFreeProgram,
.State = _GroundFreeState,
.Identifier = _GroundFreeIdentifier,
},
.Copy = {
@@ -158,6 +167,7 @@ struct _Ground Ground = {
.Program = _GroundCopyProgram,
.State = _GroundCopyState,
.Identifier = _GroundCopyIdentifier,
},
.List = {