Misc stuff, probably crashes
This commit is contained in:
@@ -20,6 +20,12 @@ typedef struct GroundInstruction GroundInstruction;
|
||||
typedef struct GroundProgram GroundProgram;
|
||||
typedef struct GroundState GroundState;
|
||||
|
||||
typedef struct GroundBytecodeValue GroundBytecodeValue;
|
||||
typedef struct GroundBytecodeList GroundBytecodeList;
|
||||
typedef struct GroundBytecodeFunction GroundBytecodeFunction;
|
||||
typedef struct GroundBytecodeStruct GroundBytecodeStruct;
|
||||
typedef struct GroundBytecodeObject GroundBytecodeObject;
|
||||
typedef struct GroundBytecodeError GroundBytecodeError;
|
||||
typedef struct GroundBytecodeProgram GroundBytecodeProgram;
|
||||
typedef struct GroundBytecodeInstruction GroundBytecodeInstruction;
|
||||
typedef struct GroundBytecodeHeap GroundBytecodeHeap;
|
||||
@@ -261,6 +267,49 @@ struct GroundIdentifier {
|
||||
GroundSize referenceCount;
|
||||
};
|
||||
|
||||
struct GroundBytecodeList {
|
||||
GroundSize capacity;
|
||||
GroundSize count;
|
||||
GroundBytecodeValue* at;
|
||||
};
|
||||
struct GroundBytecodeFunction {
|
||||
struct {
|
||||
GroundSize capacity;
|
||||
GroundSize count;
|
||||
GroundFunctionArg* at;
|
||||
} args;
|
||||
|
||||
bool isNativeFunction;
|
||||
|
||||
union {
|
||||
void* native;
|
||||
GroundBytecodeProgram* ground;
|
||||
} program;
|
||||
|
||||
GroundBytecodeHeap* closure;
|
||||
|
||||
GroundSize _requiredSize;
|
||||
};
|
||||
struct GroundBytecodeStruct {};
|
||||
struct GroundBytecodeObject {};
|
||||
|
||||
struct GroundBytecodeValue {
|
||||
union {
|
||||
GroundInt Int;
|
||||
GroundDouble Double;
|
||||
GroundChar Char;
|
||||
GroundBool Bool;
|
||||
GroundString String;
|
||||
|
||||
GroundBytecodeList List;
|
||||
GroundBytecodeFunction Function;
|
||||
GroundBytecodeStruct Struct;
|
||||
GroundBytecodeObject Object;
|
||||
} as;
|
||||
|
||||
GroundType type;
|
||||
};
|
||||
|
||||
struct GroundBytecodeProgram {
|
||||
GroundBytecodeInstruction* at;
|
||||
GroundSize capacity;
|
||||
@@ -277,7 +326,7 @@ struct GroundBytecodeInstruction {
|
||||
};
|
||||
|
||||
struct GroundBytecodeHeap {
|
||||
GroundValue* heap;
|
||||
GroundBytecodeValue* heap;
|
||||
GroundSize capacity;
|
||||
GroundSize len;
|
||||
};
|
||||
@@ -340,7 +389,8 @@ struct _Ground {
|
||||
|
||||
GroundIdentifier* (*Identifier) (const char* id);
|
||||
|
||||
GroundBytecode (*Bytecode) (GroundProgram* program, GroundState* state);
|
||||
GroundBytecode (*Bytecode) (GroundProgram* program, GroundState* state);
|
||||
GroundBytecodeValue (*BytecodeValue) (GroundValue value);
|
||||
|
||||
} New;
|
||||
|
||||
@@ -359,6 +409,8 @@ struct _Ground {
|
||||
void (*State) (GroundState* state);
|
||||
|
||||
void (*Identifier) (GroundIdentifier* identifier);
|
||||
|
||||
void (*BytecodeValue) (GroundBytecodeValue* value);
|
||||
} Free;
|
||||
|
||||
// Creates a copy of the memory held by the specified struct
|
||||
@@ -388,8 +440,9 @@ struct _Ground {
|
||||
} Instruction;
|
||||
|
||||
struct {
|
||||
void (*append) (GroundProgram* program, GroundInstruction instruction);
|
||||
void (*execute) (GroundProgram* program, GroundState* state);
|
||||
void (*append) (GroundProgram* program, GroundInstruction instruction);
|
||||
void (*execute) (GroundProgram* program, GroundState* state);
|
||||
GroundProgram (*preprocess) (GroundProgram* program, GroundState* state);
|
||||
} Program;
|
||||
|
||||
struct {
|
||||
@@ -447,6 +500,8 @@ struct _Ground {
|
||||
char* (*Program)(GroundProgram* program);
|
||||
char* (*String)(GroundString* string);
|
||||
char* (*Value)(GroundValue* value);
|
||||
|
||||
char* (*BytecodeValue)(GroundBytecodeValue* value);
|
||||
} Stringify;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user