WIP: Compiles but still very broken

This commit is contained in:
2026-04-05 17:04:30 +10:00
parent 914ee6fcfa
commit 57fe9bb00d
11 changed files with 194 additions and 268 deletions

View File

@@ -1,18 +1,17 @@
#pragma once
#include "toy_common.h"
#include "toy_module.h"
#include "toy_bucket.h"
typedef enum Toy_FunctionType {
TOY_FUNCTION_MODULE,
TOY_FUNCTION_CUSTOM,
TOY_FUNCTION_NATIVE,
} Toy_FunctionType;
typedef struct Toy_FunctionModule {
typedef struct Toy_FunctionBytecode {
Toy_FunctionType type;
Toy_Module module;
} Toy_FunctionModule;
unsigned char* code;
} Toy_FunctionBytecode;
typedef struct Toy_FunctionNative {
Toy_FunctionType type;
@@ -21,8 +20,8 @@ typedef struct Toy_FunctionNative {
typedef union Toy_Function_t {
Toy_FunctionType type;
Toy_FunctionModule module;
Toy_FunctionBytecode bytecode;
Toy_FunctionNative native;
} Toy_Function;
TOY_API Toy_Function* Toy_createModuleFunction(Toy_Bucket** bucketHandle, Toy_Module module);
TOY_API Toy_Function* Toy_createFunctionFromBytecode(Toy_Bucket** bucketHandle, unsigned char* bytecode);