mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Replacing Toy_Literal function bytecode with Toy_RefFunction, addressing #77
This seems to have worked way too easily.
This commit is contained in:
23
source/toy_reffunction.h
Normal file
23
source/toy_reffunction.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "toy_common.h"
|
||||
|
||||
//memory allocation hook
|
||||
typedef void* (*Toy_RefFunctionAllocatorFn)(void* pointer, size_t oldSize, size_t newSize);
|
||||
TOY_API void Toy_setRefFunctionAllocatorFn(Toy_RefFunctionAllocatorFn);
|
||||
|
||||
//the RefFunction structure
|
||||
typedef struct Toy_RefFunction {
|
||||
size_t length;
|
||||
int refCount;
|
||||
unsigned char data[];
|
||||
} Toy_RefFunction;
|
||||
|
||||
//API
|
||||
TOY_API Toy_RefFunction* Toy_createRefFunction(const void* data, size_t length);
|
||||
TOY_API void Toy_deleteRefFunction(Toy_RefFunction* refFunction);
|
||||
TOY_API int Toy_countRefFunction(Toy_RefFunction* refFunction);
|
||||
TOY_API size_t Toy_lengthRefFunction(Toy_RefFunction* refFunction);
|
||||
TOY_API Toy_RefFunction* Toy_copyRefFunction(Toy_RefFunction* refFunction);
|
||||
TOY_API Toy_RefFunction* Toy_deepCopyRefFunction(Toy_RefFunction* refFunction);
|
||||
|
||||
Reference in New Issue
Block a user