Dummied out lib timer

This commit is contained in:
2023-02-11 01:20:53 +00:00
parent 457014d577
commit c00b32017b
10 changed files with 19 additions and 54 deletions

View File

@@ -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(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! Note: MacOS is not officially supported (no machines for testing), but we'll do our best!
## Tools ## Tools

View File

@@ -71,7 +71,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<OutDir>$(SolutionDir)bin\$(Configuration)</OutDir> <OutDir>$(SolutionDir)out\$(Configuration)</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -105,7 +105,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link> <Link>
<AdditionalDependencies>Toy.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>Toy.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)bin\$(Configuration)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)out\$(Configuration)</AdditionalLibraryDirectories>
</Link> </Link>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>C:\Users\kayne\Desktop\Toy\source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>C:\Users\kayne\Desktop\Toy\source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -116,7 +116,6 @@
<ClCompile Include="repl\lib_compound.c" /> <ClCompile Include="repl\lib_compound.c" />
<ClCompile Include="repl\lib_runner.c" /> <ClCompile Include="repl\lib_runner.c" />
<ClCompile Include="repl\lib_standard.c" /> <ClCompile Include="repl\lib_standard.c" />
<ClCompile Include="repl\lib_timer.c" />
<ClCompile Include="repl\repl_main.c" /> <ClCompile Include="repl\repl_main.c" />
<ClCompile Include="repl\repl_tools.c" /> <ClCompile Include="repl\repl_tools.c" />
</ItemGroup> </ItemGroup>
@@ -125,7 +124,6 @@
<ClInclude Include="repl\lib_compound.h" /> <ClInclude Include="repl\lib_compound.h" />
<ClInclude Include="repl\lib_runner.h" /> <ClInclude Include="repl\lib_runner.h" />
<ClInclude Include="repl\lib_standard.h" /> <ClInclude Include="repl\lib_standard.h" />
<ClInclude Include="repl\lib_timer.h" />
<ClInclude Include="repl\repl_tools.h" /> <ClInclude Include="repl\repl_tools.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@@ -70,7 +70,7 @@
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)bin\$(Configuration)</OutDir> <OutDir>$(SolutionDir)out\$(Configuration)</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>

View File

@@ -2,8 +2,8 @@
#include "lib_about.h" #include "lib_about.h"
#include "lib_compound.h" #include "lib_compound.h"
#include "lib_standard.h" #include "lib_standard.h"
#include "lib_timer.h"
#include "lib_runner.h" #include "lib_runner.h"
// #include "lib_timer.h"
#include "toy_console_colors.h" #include "toy_console_colors.h"
@@ -32,8 +32,8 @@ void repl() {
Toy_injectNativeHook(&interpreter, "about", Toy_hookAbout); Toy_injectNativeHook(&interpreter, "about", Toy_hookAbout);
Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound); Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound);
Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard); Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard);
Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer);
Toy_injectNativeHook(&interpreter, "runner", Toy_hookRunner); Toy_injectNativeHook(&interpreter, "runner", Toy_hookRunner);
// Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer);
for(;;) { for(;;) {
printf("> "); printf("> ");

View File

@@ -2,8 +2,8 @@
#include "lib_about.h" #include "lib_about.h"
#include "lib_compound.h" #include "lib_compound.h"
#include "lib_standard.h" #include "lib_standard.h"
#include "lib_timer.h"
#include "lib_runner.h" #include "lib_runner.h"
// #include "lib_timer.h"
#include "toy_console_colors.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, "about", Toy_hookAbout);
Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound); Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound);
Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard); Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard);
Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer);
Toy_injectNativeHook(&interpreter, "runner", Toy_hookRunner); Toy_injectNativeHook(&interpreter, "runner", Toy_hookRunner);
// Toy_injectNativeHook(&interpreter, "timer", Toy_hookTimer);
Toy_runInterpreter(&interpreter, tb, (int)size); Toy_runInterpreter(&interpreter, tb, (int)size);
Toy_freeInterpreter(&interpreter); Toy_freeInterpreter(&interpreter);

View File

@@ -9,12 +9,12 @@
#define TOY_VERSION_PATCH 3 #define TOY_VERSION_PATCH 3
#define TOY_VERSION_BUILD __DATE__ " " __TIME__ #define TOY_VERSION_BUILD __DATE__ " " __TIME__
//platform-specific specifications //platform/compiler-specific specifications
#if defined(__linux__) #if defined(__linux__)
#define TOY_API extern #define TOY_API extern
#elif defined(_WIN32) || defined(_MSC_VER) #elif defined(_MSC_VER)
#ifndef TOY_EXPORT #ifndef TOY_EXPORT
#define TOY_API __declspec(dllimport) #define TOY_API __declspec(dllimport)
@@ -22,7 +22,12 @@
#define TOY_API __declspec(dllexport) #define TOY_API __declspec(dllexport)
#endif #endif
#elif defined(__MINGW32__)
#define TOY_API extern
#else #else
#define TOY_API extern #define TOY_API extern
#endif #endif

View File

@@ -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";

View File

@@ -17,7 +17,7 @@
#include "../repl/lib_compound.h" #include "../repl/lib_compound.h"
#include "../repl/lib_runner.h" #include "../repl/lib_runner.h"
#include "../repl/lib_standard.h" #include "../repl/lib_standard.h"
#include "../repl/lib_timer.h" // #include "../repl/lib_timer.h"
//supress the print output //supress the print output
static void noPrintFn(const char* 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, "about", Toy_hookAbout);
Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound); Toy_injectNativeHook(&interpreter, "compound", Toy_hookCompound);
Toy_injectNativeHook(&interpreter, "standard", Toy_hookStandard); 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_injectNativeHook(&interpreter, "runner", Toy_hookRunner);
Toy_runInterpreter(&interpreter, tb, size); Toy_runInterpreter(&interpreter, tb, size);
@@ -99,7 +99,7 @@ int main() {
{"compound.toy", "compound", Toy_hookCompound}, {"compound.toy", "compound", Toy_hookCompound},
{"runner.toy", "runner", Toy_hookRunner}, {"runner.toy", "runner", Toy_hookRunner},
{"standard.toy", "standard", Toy_hookStandard}, {"standard.toy", "standard", Toy_hookStandard},
{"timer.toy", "timer", Toy_hookTimer}, // {"timer.toy", "timer", Toy_hookTimer},
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };