Renamed everything to fit the new naming scheme

This commit is contained in:
2023-01-26 21:12:44 +00:00
parent 3e18baeec0
commit f7f9e75ad9
21 changed files with 1883 additions and 580 deletions

View File

@@ -1,33 +1,33 @@
#pragma once
#include "core_common.h"
#include "box_common.h"
#include "literal_dictionary.h"
#include "interpreter.h"
#include "toy_literal_dictionary.h"
#include "toy_interpreter.h"
#define OPAQUE_TAG_ENGINE_NODE 1001
//forward declare
typedef struct _engineNode EngineNode;
typedef struct Box_private_engineNode Box_EngineNode;
// typedef void (*EngineNodeCallback)(void*);
//the node object, which forms a tree
typedef struct _engineNode {
typedef struct Box_private_engineNode {
//function for releasing memory NOTE: removed, because it's not needed with only 1 node type - I've left them commented out because I might need them soon
// EngineNodeCallback freeMemory;
//toy functions, stored in a dict for flexibility
LiteralDictionary* functions;
Toy_LiteralDictionary* functions;
//point to the parent
EngineNode* parent;
Box_EngineNode* parent;
//my opaque type tag
int tag;
int _unused0;
//use Toy's memory model
EngineNode** children;
Box_EngineNode** children;
int capacity;
int count; //includes tombstones
@@ -35,21 +35,21 @@ typedef struct _engineNode {
SDL_Texture* texture;
SDL_Rect rect;
//TODO: depth
} EngineNode;
} Box_EngineNode;
CORE_API void initEngineNode(EngineNode* node, Interpreter* interpreter, void* tb, size_t size); //run bytecode, then grab all top-level function literals
CORE_API void pushEngineNode(EngineNode* node, EngineNode* child); //push to the array (prune tombstones when expanding/copying)
CORE_API void freeEngineNode(EngineNode* node); //free and tombstone this node
BOX_API void Box_initEngineNode(Box_EngineNode* node, Toy_Interpreter* interpreter, void* tb, size_t size); //run bytecode, then grab all top-level function literals
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 and tombstone this node
CORE_API Literal callEngineNodeLiteral(EngineNode* node, Interpreter* interpreter, Literal key, LiteralArray* args);
CORE_API Literal callEngineNode(EngineNode* node, Interpreter* interpreter, char* fnName, LiteralArray* args); //call "fnName" on this node, and only this node, if it exists
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, char* fnName, Toy_LiteralArray* args); //call "fnName" on this node, and only this node, if it exists
CORE_API void callRecursiveEngineNodeLiteral(EngineNode* node, Interpreter* interpreter, Literal key, LiteralArray* args);
CORE_API void callRecursiveEngineNode(EngineNode* node, Interpreter* interpreter, char* fnName, LiteralArray* args); //call "fnName" on this node, and all children, if it exists
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, char* fnName, Toy_LiteralArray* args); //call "fnName" on this node, and all children, if it exists
CORE_API int loadTextureEngineNode(EngineNode* node, char* fname);
CORE_API void freeTextureEngineNode(EngineNode* node);
BOX_API int Box_loadTextureEngineNode(Box_EngineNode* node, char* fname);
BOX_API void Box_freeTextureEngineNode(Box_EngineNode* node);
CORE_API void setRectEngineNode(EngineNode* node, SDL_Rect rect);
BOX_API void Box_setRectEngineNode(Box_EngineNode* node, SDL_Rect rect);
//TODO: getRect
CORE_API void drawEngineNode(EngineNode* node, SDL_Rect dest);
BOX_API void Box_drawEngineNode(Box_EngineNode* node, SDL_Rect dest);