Began writing Toy_VM, read more

Toy_VM and Toy_Stack are both considered WIP, and neither has any tests
yet.
This commit is contained in:
2024-09-26 17:17:18 +10:00
parent 7d92101c1f
commit 0504f4af8b
6 changed files with 437 additions and 8 deletions

18
source/toy_stack.h Normal file
View File

@@ -0,0 +1,18 @@
#pragma once
#include "toy_common.h"
#include "toy_value.h"
typedef struct Toy_Stack {
Toy_Value* ptr;
int capacity;
int count;
} Toy_Stack;
TOY_API void Toy_initStack(Toy_Stack* stack); //null memory
TOY_API void Toy_preallocateStack(Toy_Stack* stack); //non-null memory, ready to go
TOY_API void Toy_freeStack(Toy_Stack* stack);
TOY_API void Toy_pushStack(Toy_Stack* stack, Toy_Value value);
TOY_API Toy_Value Toy_peekStack(Toy_Stack* stack);
TOY_API Toy_Value Toy_popStack(Toy_Stack* stack);