#include "../include/ground.h" GroundValue _GroundNewValueInt(GroundInt in); GroundValue _GroundNewValueDouble(GroundDouble in); GroundValue _GroundNewValueChar(GroundChar in); GroundValue _GroundNewValueBool(GroundBool in); GroundValue _GroundNewValueList(GroundList in); GroundValue _GroundNewValueString(GroundString in); GroundValue _GroundNewValueFunction(GroundFunction in); GroundValue _GroundNewValueStruct(GroundStruct in); GroundValue _GroundNewValueObject(GroundObject in); GroundArg _GroundNewArgValue(GroundValue value); 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); GroundFunction _GroundNewFunction(GroundState* state); GroundFunction _GroundNewNativeFunction(void* function, GroundSize argc, ...); GroundStruct _GroundNewStruct(); GroundObject _GroundNewObject(GroundStruct* in); GroundError _GroundNewError(GroundValue* in); GroundInstruction _GroundNewInstruction(enum GroundInstructionType type); GroundProgram _GroundNewProgram(); GroundType _GroundNewType(enum GroundTypeType type, ...); GroundIdentifier* _GroundNewIdentifier(const char* id); GroundBytecode _GroundNewBytecode (GroundProgram* program, GroundState* state); GroundBytecodeValue _GroundNewBytecodeValue(GroundValue value); void _GroundFreeValue(GroundValue* in); void _GroundFreeList(GroundList* in); void _GroundFreeString(GroundString* in); void _GroundFreeFunction(GroundFunction* in); void _GroundFreeStruct(GroundStruct* in); void _GroundFreeObject(GroundObject* in); void _GroundFreeArg(GroundArg* in); void _GroundFreeInstruction(GroundInstruction* in); void _GroundFreeProgram(GroundProgram* in); void _GroundFreeState(GroundState* in); void _GroundFreeIdentifier(GroundIdentifier* identifier); void _GroundFreeBytecodeValue(GroundBytecodeValue* in); GroundValue _GroundCopyValue(GroundValue* in); GroundList _GroundCopyList(GroundList* in); GroundString _GroundCopyString(GroundString* in); GroundFunction _GroundCopyFunction(GroundFunction* in); GroundStruct _GroundCopyStruct(GroundStruct* in); GroundObject _GroundCopyObject(GroundObject* in); GroundArg _GroundCopyArg(GroundArg* in); GroundInstruction _GroundCopyInstruction(GroundInstruction* in); GroundProgram _GroundCopyProgram(GroundProgram* in); GroundState _GroundCopyState(GroundState* in); GroundIdentifier* _GroundCopyIdentifier(GroundIdentifier* identifier); GroundBytecodeValue _GroundCopyBytecodeValue(GroundBytecodeValue* value); void _GroundListAppend(GroundList* list, GroundValue value); void _GroundInstructionAppend(GroundInstruction* instruction, GroundArg arg); int64_t _GroundInstructionExecute(GroundInstruction* instruction, GroundValue* heap); void _GroundProgramAppend(GroundProgram* program, GroundInstruction instruction); void _GroundProgramExecute(GroundProgram* program, GroundState* state); GroundProgram _GroundProgramPreprocess(GroundProgram* program, GroundState* state); void _GroundFunctionAppendInstruction(GroundFunction* function, GroundInstruction instruction); void _GroundFunctionAppendArg(GroundFunction* function, const char* argName); void _GroundStructAddField(GroundStruct* gs, const char* id, GroundValue value); GroundValue* _GroundStateFindVariable(GroundState* state, const char* id); GroundSize* _GroundStateFindLabel(GroundState* state, const char* id); GroundCatch* _GroundStateFindCatch(GroundState* state, const char* id); void _GroundInternalRun(GroundProgram* program, GroundState* state); void _GroundLogError(const char* message); void _GroundLogWarning(const char* message); void _GroundLogPrintErrors(); GroundBytecodeValue _GroundBytecodeProgramExecute(GroundBytecodeProgram* program, GroundBytecodeHeap* heap); void _GroundBytecodeProgramOptimise(GroundBytecodeProgram* program); struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeInstruction* instruction, GroundBytecodeHeap* heap); void _GroundBytecodeSave(GroundBytecode* bytecode, const char* path); GroundBytecode _GroundBytecodeLoad(const char* path); void _GroundBytecodeHeapSet(GroundBytecodeHeap* heap, GroundSize idx, GroundValue value); GroundValue* _GroundBytecodeHeapGet(GroundBytecodeHeap* heap, GroundSize idx); char* _GroundStringifyArg(GroundArg* arg); char* _GroundStringifyHeap(GroundBytecodeHeap* heap); char* _GroundStringifyInstruction(GroundInstruction* instruction); char* _GroundStringifyProgram(GroundProgram* program); char* _GroundStringifyString(GroundString* string); char* _GroundStringifyValue(GroundValue* value); char* _GroundStringifyBytecodeValue(GroundBytecodeValue* value); struct _Ground Ground = { .Flags = { .error = false }, .New = { .Value = { .Int = _GroundNewValueInt, .Double = _GroundNewValueDouble, .Char = _GroundNewValueChar, .Bool = _GroundNewValueBool, .List = _GroundNewValueList, .String = _GroundNewValueString, .Function = _GroundNewValueFunction, .Struct = _GroundNewValueStruct, .Object = _GroundNewValueObject, }, .Arg = { .Value = _GroundNewArgValue, .ValueRef = _GroundNewArgValueRef, .DirectRef = _GroundNewArgDirectRef, .LineRef = _GroundNewArgLineRef, .LabelRef = _GroundNewArgLabelRef, .FunctionRef = _GroundNewArgFunctionRef, .TypeRef = _GroundNewArgTypeRef, }, .List = _GroundNewList, .String = _GroundNewString, .Function = _GroundNewFunction, .Struct = _GroundNewStruct, .Object = _GroundNewObject, .Error = _GroundNewError, .NativeFunction = _GroundNewNativeFunction, .Instruction = _GroundNewInstruction, .Program = _GroundNewProgram, .Type = _GroundNewType, .Identifier = _GroundNewIdentifier, .Bytecode = _GroundNewBytecode, .BytecodeValue = _GroundNewBytecodeValue, }, .Free = { .Value = _GroundFreeValue, .List = _GroundFreeList, .String = _GroundFreeString, .Function = _GroundFreeFunction, .Struct = _GroundFreeStruct, .Object = _GroundFreeObject, .Arg = _GroundFreeArg, .Instruction = _GroundFreeInstruction, .Program = _GroundFreeProgram, .State = _GroundFreeState, .Identifier = _GroundFreeIdentifier, .BytecodeValue = _GroundFreeBytecodeValue, }, .Copy = { .Value = _GroundCopyValue, .List = _GroundCopyList, .String = _GroundCopyString, .Function = _GroundCopyFunction, .Struct = _GroundCopyStruct, .Object = _GroundCopyObject, .Arg = _GroundCopyArg, .Instruction = _GroundCopyInstruction, .Program = _GroundCopyProgram, .State = _GroundCopyState, .Identifier = _GroundCopyIdentifier, .BytecodeValue = _GroundCopyBytecodeValue, }, .List = { .append = _GroundListAppend, }, .Instruction = { .append = _GroundInstructionAppend, .execute = _GroundInstructionExecute, }, .Program = { .append = _GroundProgramAppend, .execute = _GroundProgramExecute, .preprocess = _GroundProgramPreprocess, }, .Function = { .appendInstruction = _GroundFunctionAppendInstruction, .appendArg = _GroundFunctionAppendArg, }, .Struct = { .addField = _GroundStructAddField, }, .State = { .findCatch = _GroundStateFindCatch, .findLabel = _GroundStateFindLabel, .findVariable = _GroundStateFindVariable, }, .Internal = { .run = _GroundInternalRun }, .Log = { .Error = _GroundLogError, .Warning = _GroundLogWarning, .printErrors = _GroundLogPrintErrors, .errors = NULL, .warnings = NULL, }, .Bytecode = { .save = _GroundBytecodeSave, .load = _GroundBytecodeLoad, .Program = { .execute = _GroundBytecodeProgramExecute, .optimise = _GroundBytecodeProgramOptimise, }, .Instruction = { .execute = _GroundBytecodeInstructionExecute, }, .Heap = { .set = _GroundBytecodeHeapSet, .get = _GroundBytecodeHeapGet, }, }, .Stringify = { .Arg = _GroundStringifyArg, .Heap = _GroundStringifyHeap, .Instruction = _GroundStringifyInstruction, .Program = _GroundStringifyProgram, .String = _GroundStringifyString, .Value = _GroundStringifyValue, .BytecodeValue = _GroundStringifyBytecodeValue, }, };