Added MSVC debugging tool, discovered globals feature

This commit is contained in:
2023-03-03 17:20:56 +11:00
parent f9d0a27408
commit 08ce7b5536
4 changed files with 41 additions and 25 deletions

View File

@@ -24,12 +24,15 @@
#include <SDL_image.h>
#include <windows.h>
#include <crtdbg.h>
#ifndef BOX_EXPORT
#define BOX_API __declspec(dllimport)
#else
#define BOX_API __declspec(dllexport)
#endif
//TODO: figure out the sleep issue
#define sleep Sleep
#else

View File

@@ -70,7 +70,7 @@ void Box_initEngine() {
const unsigned char* tb = Toy_compileString((const char*)source, &size);
free((void*)source);
//TODO: inner-interpreter
//A quirk of the setup is that anything defined in `init.toy` becomes a global object
Toy_runInterpreter(&engine.interpreter, tb, size);
}
@@ -147,7 +147,7 @@ static void execLoadRootNode() {
Box_callEngineNode(engine.rootNode, &inner, "onLoad", NULL);
//manual cleanup
inner.scope = Toy_popScope(inner.scope);
Toy_popScope(inner.scope);
Toy_freeLiteralArray(&inner.stack);
Toy_freeLiteralArray(&inner.literalCache);