Moved more polyfill code into the engine proper

This commit is contained in:
2023-02-28 04:22:37 +11:00
parent 479e38d492
commit d3a3896efe
10 changed files with 139 additions and 67 deletions

View File

@@ -29,6 +29,7 @@ typedef struct Box_private_engineNode {
Box_EngineNode** children;
int capacity;
int count; //includes tombstones
int childCount;
//rendering-specific features
SDL_Texture* texture;
@@ -41,6 +42,9 @@ BOX_API void Box_initEngineNode(Box_EngineNode* node, Toy_Interpreter* interpret
BOX_API void Box_pushEngineNode(Box_EngineNode* node, Box_EngineNode* child); //push to the array (prune tombstones when expanding/copying)
BOX_API void Box_freeEngineNode(Box_EngineNode* node); //free this node and all children
BOX_API Box_EngineNode* Box_getChildEngineNode(Box_EngineNode* node, int index);
BOX_API void Box_freeChildEngineNode(Box_EngineNode* node, int index);
BOX_API Toy_Literal Box_callEngineNodeLiteral(Box_EngineNode* node, Toy_Interpreter* interpreter, Toy_Literal key, Toy_LiteralArray* args);
BOX_API Toy_Literal Box_callEngineNode(Box_EngineNode* node, Toy_Interpreter* interpreter, const char* fnName, Toy_LiteralArray* args); //call "fnName" on this node, and only this node, if it exists
@@ -48,6 +52,8 @@ BOX_API Toy_Literal Box_callEngineNode(Box_EngineNode* node, Toy_Interpreter* in
BOX_API void Box_callRecursiveEngineNodeLiteral(Box_EngineNode* node, Toy_Interpreter* interpreter, Toy_Literal key, Toy_LiteralArray* args);
BOX_API void Box_callRecursiveEngineNode(Box_EngineNode* node, Toy_Interpreter* interpreter, const char* fnName, Toy_LiteralArray* args); //call "fnName" on this node, and all children, if it exists
BOX_API int Box_getChildCountEngineNode(Box_EngineNode* node);
BOX_API int Box_loadTextureEngineNode(Box_EngineNode* node, const char* fname);
BOX_API void Box_freeTextureEngineNode(Box_EngineNode* node);