mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Dummied out lib timer
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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" />
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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("> ");
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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";
|
|
||||||
|
|||||||
@@ -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}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user