From c00b32017b84f0856d848244182324df170efe70 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 11 Feb 2023 01:20:53 +0000 Subject: [PATCH] Dummied out lib timer --- README.md | 2 ++ Repl.vcxproj | 6 ++--- Toy.vcxproj | 2 +- repl/{lib_timer.c => lib_timer.cx} | 0 repl/{lib_timer.h => lib_timer.hx} | 0 repl/repl_main.c | 4 +-- repl/repl_tools.c | 4 +-- source/toy_common.h | 9 +++++-- test/scripts/lib/random-stuff.toy | 40 ------------------------------ test/test_libraries.c | 6 ++--- 10 files changed, 19 insertions(+), 54 deletions(-) rename repl/{lib_timer.c => lib_timer.cx} (100%) rename repl/{lib_timer.h => lib_timer.hx} (100%) diff --git a/README.md b/README.md index 7853d44..af84219 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Special thanks to http://craftinginterpreters.com/ for their fantastic book that For Windows(mingw32 & cygwin), Linux and MacOS, simply run `make` in the root directory. +For Windows(MSVC), project files are included. + Note: MacOS is not officially supported (no machines for testing), but we'll do our best! ## Tools diff --git a/Repl.vcxproj b/Repl.vcxproj index 6c2e7e4..30f15c3 100644 --- a/Repl.vcxproj +++ b/Repl.vcxproj @@ -71,7 +71,7 @@ false - $(SolutionDir)bin\$(Configuration) + $(SolutionDir)out\$(Configuration) @@ -105,7 +105,7 @@ Toy.lib;%(AdditionalDependencies) - $(SolutionDir)bin\$(Configuration) + $(SolutionDir)out\$(Configuration) C:\Users\kayne\Desktop\Toy\source;%(AdditionalIncludeDirectories) @@ -116,7 +116,6 @@ - @@ -125,7 +124,6 @@ - diff --git a/Toy.vcxproj b/Toy.vcxproj index 677256e..cc7a6f6 100644 --- a/Toy.vcxproj +++ b/Toy.vcxproj @@ -70,7 +70,7 @@ true - $(SolutionDir)bin\$(Configuration) + $(SolutionDir)out\$(Configuration) diff --git a/repl/lib_timer.c b/repl/lib_timer.cx similarity index 100% rename from repl/lib_timer.c rename to repl/lib_timer.cx diff --git a/repl/lib_timer.h b/repl/lib_timer.hx similarity index 100% rename from repl/lib_timer.h rename to repl/lib_timer.hx diff --git a/repl/repl_main.c b/repl/repl_main.c index e0dea6c..a308086 100644 --- a/repl/repl_main.c +++ b/repl/repl_main.c @@ -2,8 +2,8 @@ #include "lib_about.h" #include "lib_compound.h" #include "lib_standard.h" -#include "lib_timer.h" #include "lib_runner.h" +// #include "lib_timer.h" #include "toy_console_colors.h" @@ -32,8 +32,8 @@ void repl() { Toy_injectNativeHook(&interpreter, "about", Toy_hookAbout); Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound); Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard); - Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer); Toy_injectNativeHook(&interpreter, "runner", Toy_hookRunner); + // Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer); for(;;) { printf("> "); diff --git a/repl/repl_tools.c b/repl/repl_tools.c index 543ec18..f330047 100644 --- a/repl/repl_tools.c +++ b/repl/repl_tools.c @@ -2,8 +2,8 @@ #include "lib_about.h" #include "lib_compound.h" #include "lib_standard.h" -#include "lib_timer.h" #include "lib_runner.h" +// #include "lib_timer.h" #include "toy_console_colors.h" @@ -115,8 +115,8 @@ void Toy_runBinary(const unsigned char* tb, size_t size) { Toy_injectNativeHook(&interpreter, "about", Toy_hookAbout); Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound); Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard); - Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer); Toy_injectNativeHook(&interpreter, "runner", Toy_hookRunner); + // Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer); Toy_runInterpreter(&interpreter, tb, (int)size); Toy_freeInterpreter(&interpreter); diff --git a/source/toy_common.h b/source/toy_common.h index e93df0f..bd6d352 100644 --- a/source/toy_common.h +++ b/source/toy_common.h @@ -9,12 +9,12 @@ #define TOY_VERSION_PATCH 3 #define TOY_VERSION_BUILD __DATE__ " " __TIME__ -//platform-specific specifications +//platform/compiler-specific specifications #if defined(__linux__) #define TOY_API extern -#elif defined(_WIN32) || defined(_MSC_VER) +#elif defined(_MSC_VER) #ifndef TOY_EXPORT #define TOY_API __declspec(dllimport) @@ -22,7 +22,12 @@ #define TOY_API __declspec(dllexport) #endif +#elif defined(__MINGW32__) + +#define TOY_API extern + #else + #define TOY_API extern #endif diff --git a/test/scripts/lib/random-stuff.toy b/test/scripts/lib/random-stuff.toy index 0e64750..e69de29 100644 --- a/test/scripts/lib/random-stuff.toy +++ b/test/scripts/lib/random-stuff.toy @@ -1,40 +0,0 @@ -//test this logic for memory leaks -{ - import compound; - import timer; - - fn start(k, v) { - return startTimer(); - } - - fn check(k, v) { - var l = v.stopTimer(); - print l.timerToString(); - l.destroyTimer(); - return v; - } - - fn destroy(k, v) { - v.destroyTimer(); - } - - var arr = [1]; - - arr - .map(start) - .map(check) - .map(check) - .map(check) - .map(check) - .map(check) - .map(check) - .map(check) - .map(check) - .map(check) - .map(check) - .map(destroy) - ; -} - - -print "All good"; diff --git a/test/test_libraries.c b/test/test_libraries.c index 7dde861..8574ee5 100644 --- a/test/test_libraries.c +++ b/test/test_libraries.c @@ -17,7 +17,7 @@ #include "../repl/lib_compound.h" #include "../repl/lib_runner.h" #include "../repl/lib_standard.h" -#include "../repl/lib_timer.h" +// #include "../repl/lib_timer.h" //supress the print output static void noPrintFn(const char* output) { @@ -66,7 +66,7 @@ void runBinaryQuietly(const unsigned char* tb, size_t size) { Toy_injectNativeHook(&interpreter, "about", Toy_hookAbout); Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound); Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard); - Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer); + // Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer); Toy_injectNativeHook(&interpreter, "runner", Toy_hookRunner); Toy_runInterpreter(&interpreter, tb, size); @@ -99,7 +99,7 @@ int main() { {"compound.toy", "compound", Toy_hookCompound}, {"runner.toy", "runner", Toy_hookRunner}, {"standard.toy", "standard", Toy_hookStandard}, - {"timer.toy", "timer", Toy_hookTimer}, + // {"timer.toy", "timer", Toy_hookTimer}, {NULL, NULL, NULL} };