Adding support for windows and fixing some errors
This commit is contained in:
parent
7660d58f26
commit
420bb37039
84 changed files with 168 additions and 255 deletions
|
|
@ -2,5 +2,7 @@
|
||||||
|
|
||||||
#include "Common.hpp"
|
#include "Common.hpp"
|
||||||
|
|
||||||
|
#ifndef ENV_OS_WINDOWS
|
||||||
inline void* operator new(std::size_t aSize, void* aWhere) noexcept { return aWhere; }
|
inline void* operator new(std::size_t aSize, void* aWhere) noexcept { return aWhere; }
|
||||||
inline void* operator new[](std::size_t aSize, void* aWhere) noexcept { return aWhere; }
|
inline void* operator new[](std::size_t aSize, void* aWhere) noexcept { return aWhere; }
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const ualni size = 1000;
|
const ualni size = 500;
|
||||||
|
|
||||||
template <typename Alloc>
|
template <typename Alloc>
|
||||||
void testAlloc() {
|
void testAlloc() {
|
||||||
|
|
@ -214,7 +214,7 @@ void testAlloc() {
|
||||||
|
|
||||||
TEST_DEF_STATIC(GlobalHeap) { testAlloc<HeapAllocGlobal>(); }
|
TEST_DEF_STATIC(GlobalHeap) { testAlloc<HeapAllocGlobal>(); }
|
||||||
|
|
||||||
TEST_DEF_STATIC(Heap) { testAlloc<HeapAlloc>(); }
|
TEST_DEF_STATIC(Heap) { testAlloc<tp::HeapAlloc>(); }
|
||||||
|
|
||||||
TEST_DEF_STATIC(Chunk) {
|
TEST_DEF_STATIC(Chunk) {
|
||||||
testAlloc<ChunkAlloc<TestStruct, size>>();
|
testAlloc<ChunkAlloc<TestStruct, size>>();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "CmdLineInterpreter.hpp"
|
#include "CmdLineInterpreter.hpp"
|
||||||
|
|
||||||
#define MAX_LINE_LENGTH 1024
|
#define MAX_LINE_LENGTH 1024
|
||||||
|
|
@ -116,4 +114,4 @@ CmdLineInterpreter::~CmdLineInterpreter() {
|
||||||
for (auto cmd : mCommands) {
|
for (auto cmd : mCommands) {
|
||||||
delete cmd->val.args;
|
delete cmd->val.args;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "CommandLine.hpp"
|
#include "CommandLine.hpp"
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
@ -463,4 +461,4 @@ void CommandLine::help() const {
|
||||||
for (auto arg : mArgsOrder) {
|
for (auto arg : mArgsOrder) {
|
||||||
logArg(*arg.data());
|
logArg(*arg.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "Map.hpp"
|
#include "Map.hpp"
|
||||||
#include "Tokenizer.hpp"
|
#include "Tokenizer.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace tp {
|
namespace tp {
|
||||||
|
|
||||||
extern ModuleManifest gModuleCommandLine;
|
extern ModuleManifest gModuleCommandLine;
|
||||||
|
|
@ -127,4 +128,4 @@ namespace tp {
|
||||||
static void initDefault(Arg& arg);
|
static void initDefault(Arg& arg);
|
||||||
void parseArg(Arg& arg, const char* src);
|
void parseArg(Arg& arg, const char* src);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "CmdLineInterpreter.hpp"
|
#include "CmdLineInterpreter.hpp"
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "LocalConnection.hpp"
|
#include "LocalConnection.hpp"
|
||||||
|
|
||||||
#include "bindings/Disk.hpp"
|
#include "bindings/Disk.hpp"
|
||||||
|
|
@ -84,4 +82,4 @@ LocalConnection::SizeBytes LocalConnection::size() {
|
||||||
DEBUG_ASSERT(mStatus.isOpened());
|
DEBUG_ASSERT(mStatus.isOpened());
|
||||||
if (!mStatus.isOpened() || !mHandle) return 0;
|
if (!mStatus.isOpened() || !mHandle) return 0;
|
||||||
return mHandle->size();
|
return mHandle->size();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "LocalConnection.hpp"
|
#include "LocalConnection.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
|
|
@ -30,4 +28,4 @@ TEST_DEF_STATIC(Simple) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(LocalConnection) { testSimple(); }
|
TEST_DEF(LocalConnection) { testSimple(); }
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Buffer2D.hpp"
|
#include "Buffer2D.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
||||||
|
#include "HeapAllocator.hpp"
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
const ualni size = 1000;
|
const ualni size = 1000;
|
||||||
|
|
||||||
TEST_DEF_STATIC(Simple1) {
|
TEST_DEF_STATIC(Simple1) {
|
||||||
Buffer2D<int, HeapAlloc> buff;
|
Buffer2D<int, tp::HeapAlloc> buff;
|
||||||
buff.reserve({ 4, 4 });
|
buff.reserve({ 4, 4 });
|
||||||
buff.set({ 2, 2 }, 5);
|
buff.set({ 2, 2 }, 5);
|
||||||
TEST(buff.get({ 2, 2 }) == 5);
|
TEST(buff.get({ 2, 2 }) == 5);
|
||||||
|
|
@ -22,4 +22,4 @@ TEST_DEF_STATIC(Simple2) {
|
||||||
TEST_DEF(Buffer2d) {
|
TEST_DEF(Buffer2d) {
|
||||||
testSimple1();
|
testSimple1();
|
||||||
testSimple2();
|
testSimple2();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Buffer.hpp"
|
#include "Buffer.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
@ -9,7 +7,7 @@ using namespace tp;
|
||||||
const ualni size = 1000;
|
const ualni size = 1000;
|
||||||
|
|
||||||
TEST_DEF_STATIC(Simple1) {
|
TEST_DEF_STATIC(Simple1) {
|
||||||
Buffer<TestClass, HeapAlloc> buff;
|
Buffer<TestClass, tp::HeapAlloc> buff;
|
||||||
TEST(buff.size() == 0);
|
TEST(buff.size() == 0);
|
||||||
for (auto i : Range(size * 10)) {
|
for (auto i : Range(size * 10)) {
|
||||||
buff.append(TestClass(i));
|
buff.append(TestClass(i));
|
||||||
|
|
@ -21,7 +19,7 @@ TEST_DEF_STATIC(Simple1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(Simple2) {
|
TEST_DEF_STATIC(Simple2) {
|
||||||
Buffer<TestClass, HeapAlloc> buff(size);
|
Buffer<TestClass, tp::HeapAlloc> buff(size);
|
||||||
TEST(buff.size() == size);
|
TEST(buff.size() == size);
|
||||||
for (auto i : Range(size * 10))
|
for (auto i : Range(size * 10))
|
||||||
buff.append(TestClass(i));
|
buff.append(TestClass(i));
|
||||||
|
|
@ -34,4 +32,4 @@ TEST_DEF_STATIC(Simple2) {
|
||||||
TEST_DEF(Buffer) {
|
TEST_DEF(Buffer) {
|
||||||
testSimple1();
|
testSimple1();
|
||||||
testSimple2();
|
testSimple2();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Archiver.hpp"
|
#include "Archiver.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
@ -7,7 +5,7 @@
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
TEST_DEF_STATIC(SimpleReference) {
|
TEST_DEF_STATIC(SimpleReference) {
|
||||||
tp::List<TestClass, HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
|
tp::List<TestClass, tp::HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
|
||||||
|
|
||||||
list.pushBack(TestClass(5));
|
list.pushBack(TestClass(5));
|
||||||
list.pushFront(TestClass(0));
|
list.pushFront(TestClass(0));
|
||||||
|
|
@ -24,7 +22,7 @@ TEST_DEF_STATIC(SimpleReference) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(SimplePointer) {
|
TEST_DEF_STATIC(SimplePointer) {
|
||||||
tp::List<TestClass*, HeapAlloc> list = { new TestClass(1), new TestClass(2), new TestClass(3), new TestClass(4) };
|
tp::List<TestClass*, tp::HeapAlloc> list = { new TestClass(1), new TestClass(2), new TestClass(3), new TestClass(4) };
|
||||||
|
|
||||||
list.pushBack(new TestClass(5));
|
list.pushBack(new TestClass(5));
|
||||||
list.pushFront(new TestClass(0));
|
list.pushFront(new TestClass(0));
|
||||||
|
|
@ -45,8 +43,8 @@ TEST_DEF_STATIC(SimplePointer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(Copy) {
|
TEST_DEF_STATIC(Copy) {
|
||||||
tp::List<TestClass, HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
|
tp::List<TestClass, tp::HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
|
||||||
tp::List<TestClass, HeapAlloc> list2 = list;
|
tp::List<TestClass, tp::HeapAlloc> list2 = list;
|
||||||
|
|
||||||
TEST_EQUAL(list, list2);
|
TEST_EQUAL(list, list2);
|
||||||
|
|
||||||
|
|
@ -55,7 +53,7 @@ TEST_DEF_STATIC(Copy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(Serialization) {
|
TEST_DEF_STATIC(Serialization) {
|
||||||
tp::List<TestClass, HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
|
tp::List<TestClass, tp::HeapAlloc> list = { TestClass(1), TestClass(2), TestClass(3), TestClass(4) };
|
||||||
|
|
||||||
ArchiverExample<1024, false> write;
|
ArchiverExample<1024, false> write;
|
||||||
ArchiverExample<1024, true> read;
|
ArchiverExample<1024, true> read;
|
||||||
|
|
@ -82,4 +80,4 @@ TEST_DEF(List) {
|
||||||
testSimplePointer();
|
testSimplePointer();
|
||||||
testSimpleReference();
|
testSimpleReference();
|
||||||
testSerialization();
|
testSerialization();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Archiver.hpp"
|
#include "Archiver.hpp"
|
||||||
#include "Map.hpp"
|
#include "Map.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
@ -8,7 +6,7 @@
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
TEST_DEF_STATIC(SimpleReference) {
|
TEST_DEF_STATIC(SimpleReference) {
|
||||||
tp::Map<tp::ualni, TestClass, HeapAlloc> map;
|
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map;
|
||||||
|
|
||||||
for (auto i : Range(1000, 100000)) {
|
for (auto i : Range(1000, 100000)) {
|
||||||
map.put(i, TestClass(i));
|
map.put(i, TestClass(i));
|
||||||
|
|
@ -42,7 +40,7 @@ TEST_DEF_STATIC(SimpleReference) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(SimplePointer) {
|
TEST_DEF_STATIC(SimplePointer) {
|
||||||
tp::Map<tp::ualni, TestClass*, HeapAlloc> map;
|
tp::Map<tp::ualni, TestClass*, tp::HeapAlloc> map;
|
||||||
|
|
||||||
for (auto i : Range(1000)) {
|
for (auto i : Range(1000)) {
|
||||||
map.put(i, new TestClass(i));
|
map.put(i, new TestClass(i));
|
||||||
|
|
@ -80,13 +78,13 @@ TEST_DEF_STATIC(SimplePointer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(Copy) {
|
TEST_DEF_STATIC(Copy) {
|
||||||
tp::Map<tp::ualni, TestClass, HeapAlloc> map;
|
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map;
|
||||||
|
|
||||||
for (auto i : Range(10)) {
|
for (auto i : Range(10)) {
|
||||||
map.put(i, TestClass(i));
|
map.put(i, TestClass(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
tp::Map<tp::ualni, TestClass, HeapAlloc> map2 = map;
|
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map2 = map;
|
||||||
|
|
||||||
TEST_EQUAL(map, map2);
|
TEST_EQUAL(map, map2);
|
||||||
|
|
||||||
|
|
@ -95,7 +93,7 @@ TEST_DEF_STATIC(Copy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(SaveLoad) {
|
TEST_DEF_STATIC(SaveLoad) {
|
||||||
tp::Map<tp::ualni, TestClass, HeapAlloc> map;
|
tp::Map<tp::ualni, TestClass, tp::HeapAlloc> map;
|
||||||
|
|
||||||
for (auto i : Range(10)) {
|
for (auto i : Range(10)) {
|
||||||
map.put(i, TestClass(i));
|
map.put(i, TestClass(i));
|
||||||
|
|
@ -128,4 +126,4 @@ TEST_DEF(Map) {
|
||||||
testSimplePointer();
|
testSimplePointer();
|
||||||
testSimpleReference();
|
testSimpleReference();
|
||||||
testSaveLoad();
|
testSaveLoad();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
#include "Tree.hpp"
|
#include "Tree.hpp"
|
||||||
|
|
@ -7,7 +5,7 @@
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
TEST_DEF_STATIC(Simple) {
|
TEST_DEF_STATIC(Simple) {
|
||||||
AvlTree<AvlNumericKey<alni>, TestClass, HeapAlloc> tree;
|
AvlTree<AvlNumericKey<alni>, TestClass, tp::HeapAlloc> tree;
|
||||||
|
|
||||||
TEST(tree.size() == 0);
|
TEST(tree.size() == 0);
|
||||||
TEST(tree.head() == nullptr);
|
TEST(tree.head() == nullptr);
|
||||||
|
|
@ -24,7 +22,7 @@ TEST_DEF_STATIC(Simple) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_STATIC(Persistance) {
|
TEST_DEF_STATIC(Persistance) {
|
||||||
AvlTree<AvlNumericKey<alni>, TestClass, HeapAlloc> tree;
|
AvlTree<AvlNumericKey<alni>, TestClass, tp::HeapAlloc> tree;
|
||||||
|
|
||||||
const auto size = 1000;
|
const auto size = 1000;
|
||||||
|
|
||||||
|
|
@ -126,4 +124,4 @@ TEST_DEF_STATIC(Persistance) {
|
||||||
TEST_DEF(Avl) {
|
TEST_DEF(Avl) {
|
||||||
testSimple();
|
testSimple();
|
||||||
testPersistance();
|
testPersistance();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
Externals/CMakeLists.txt
vendored
15
Externals/CMakeLists.txt
vendored
|
|
@ -1,3 +1,18 @@
|
||||||
|
# find_package(ALSA REQUIRED)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
set(CMAKE_PREFIX_PATH "../../ModulesWindowsLibraries/glew-2.1.0")
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
set(GLEW_LIB ${GLEW_STATIC_LIBRARY_RELEASE} opengl32.lib PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(PORTAUDIO_INCLUDE_DIR "../../ModulesWindowsLibraries/portaudio/include" PARENT_SCOPE)
|
||||||
|
set(PORTAUDIO_LIB "../../ModulesWindowsLibraries/portaudio_build/Debug/portaudio" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
set(GLEW_LIB ${GLEW_LIBRARIES} GL PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(PORTAUDIO_LIB portaudio PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
|
||||||
#add_subdirectory(glew/build/cmake/)
|
#add_subdirectory(glew/build/cmake/)
|
||||||
#target_compile_definitions(glew_s PUBLIC GLEW_NO_GLU)
|
#target_compile_definitions(glew_s PUBLIC GLEW_NO_GLU)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
project(Graphics)
|
project(Graphics)
|
||||||
|
|
||||||
find_package(GLEW REQUIRED)
|
|
||||||
|
|
||||||
### ---------------------- Externals --------------------- ###
|
### ---------------------- Externals --------------------- ###
|
||||||
set(BINDINGS_INCLUDE ../Externals/glfw/include ../Externals/glew/include)
|
set(BINDINGS_INCLUDE ../Externals/glfw/include ${GLEW_INCLUDE_DIR})
|
||||||
set(BINDINGS_LIBS glfw Imgui Nanovg ${GLEW_LIBRARIES} GL)
|
set(BINDINGS_LIBS glfw Imgui Nanovg ${GLEW_LIB})
|
||||||
|
|
||||||
|
|
||||||
### ---------------------- Static Library --------------------- ###
|
### ---------------------- Static Library --------------------- ###
|
||||||
file(GLOB SOURCES "./private/*.cpp" "./private/*/*.cpp")
|
file(GLOB SOURCES "./private/*.cpp" "./private/*/*.cpp")
|
||||||
|
|
|
||||||
|
|
@ -194,4 +194,4 @@ halnf Window::Events::getScrollY() const {
|
||||||
|
|
||||||
bool Window::Events::isEvent() const {
|
bool Window::Events::isEvent() const {
|
||||||
return mContext->inputManager.isEvents();
|
return mContext->inputManager.isEvents();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ namespace tp {
|
||||||
TAB = 258,
|
TAB = 258,
|
||||||
BACKSPACE = 259,
|
BACKSPACE = 259,
|
||||||
INSERT = 260,
|
INSERT = 260,
|
||||||
DELETE = 261,
|
DELETE_KEY = 261,
|
||||||
RIGHT = 262,
|
RIGHT = 262,
|
||||||
LEFT = 263,
|
LEFT = 263,
|
||||||
DOWN = 264,
|
DOWN = 264,
|
||||||
|
|
@ -156,7 +156,7 @@ namespace tp {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KeyEvent {
|
struct KeyEvent {
|
||||||
Keycode code;
|
Keycode code;
|
||||||
enum class EventState {
|
enum class EventState {
|
||||||
RELEASED = 0,
|
RELEASED = 0,
|
||||||
PRESSED = 1,
|
PRESSED = 1,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
project(LibraryViewer)
|
project(LibraryViewer)
|
||||||
|
|
||||||
find_package(ALSA REQUIRED)
|
|
||||||
find_package(GLEW REQUIRED)
|
|
||||||
|
|
||||||
### ---------------------- Externals --------------------- ###
|
### ---------------------- Externals --------------------- ###
|
||||||
set(BINDINGS_INCLUDE ../Externals/glfw/include ../Externals/glew/include)
|
set(BINDINGS_INCLUDE ../Externals/glfw/include ${GLEW_INCLUDE_DIR} ${PORTAUDIO_INCLUDE_DIR})
|
||||||
set(BINDINGS_LIBS glfw Imgui Nanovg ${GLEW_LIBRARIES} GL portaudio)
|
set(BINDINGS_LIBS glfw Imgui Nanovg ${GLEW_LIB} ${ALSA_LIBRARY} ${PORTAUDIO_LIB})
|
||||||
|
|
||||||
### ---------------------- Static Library --------------------- ###
|
### ---------------------- Static Library --------------------- ###
|
||||||
file(GLOB SOURCES "./private/*.cpp" "./private/*/*.cpp")
|
file(GLOB SOURCES "./private/*.cpp" "./private/*/*.cpp")
|
||||||
|
|
@ -22,4 +19,5 @@ file(COPY "applications/Font.ttf" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAM
|
||||||
|
|
||||||
### -------------------------- Applications -------------------------- ###
|
### -------------------------- Applications -------------------------- ###
|
||||||
add_executable(libView ./applications/Entry.cpp)
|
add_executable(libView ./applications/Entry.cpp)
|
||||||
target_link_libraries(libView ${PROJECT_NAME} ${ALSA_LIBRARY})
|
target_link_libraries(libView ${PROJECT_NAME})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
#include "Buffer.hpp"
|
#include "Buffer.hpp"
|
||||||
#include "Multithreading.hpp"
|
#include "Multithreading.hpp"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
#include "Streamer.hpp"
|
#include "Streamer.hpp"
|
||||||
|
|
||||||
|
#ifndef ENV_OS_WINDOWS
|
||||||
typedef u_int8_t uint8_t;
|
typedef u_int8_t uint8_t;
|
||||||
typedef u_int16_t uint16_t;
|
typedef u_int16_t uint16_t;
|
||||||
typedef u_int32_t uint32_t;
|
typedef u_int32_t uint32_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DR_FLAC_IMPLEMENTATION
|
#define DR_FLAC_IMPLEMENTATION
|
||||||
#include "dr_flac.h"
|
#include "dr_flac.h"
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ file(GLOB SOURCES "./private/*.cpp")
|
||||||
file(GLOB HEADERS "./public/*.hpp")
|
file(GLOB HEADERS "./public/*.hpp")
|
||||||
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS})
|
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS})
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC ./public/)
|
target_include_directories(${PROJECT_NAME} PUBLIC ./public/)
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)
|
target_link_libraries(${PROJECT_NAME} PUBLIC Allocators)
|
||||||
|
|
||||||
### -------------------------- Tests -------------------------- ###
|
### -------------------------- Tests -------------------------- ###
|
||||||
enable_testing()
|
enable_testing()
|
||||||
file(GLOB TEST_SOURCES "./tests/*.cpp")
|
file(GLOB TEST_SOURCES "./tests/*.cpp")
|
||||||
add_executable(${PROJECT_NAME}Tests ${TEST_SOURCES})
|
add_executable(${PROJECT_NAME}Tests ${TEST_SOURCES})
|
||||||
target_link_libraries(${PROJECT_NAME}Tests ${PROJECT_NAME} Utils)
|
target_link_libraries(${PROJECT_NAME}Tests ${PROJECT_NAME} Utils)
|
||||||
add_test(NAME ${PROJECT_NAME}Tests COMMAND ${PROJECT_NAME}Tests)
|
add_test(NAME ${PROJECT_NAME}Tests COMMAND ${PROJECT_NAME}Tests)
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@
|
||||||
/// whoaoao wtf
|
/// whoaoao wtf
|
||||||
|
|
||||||
#include "MathCommon.hpp"
|
#include "MathCommon.hpp"
|
||||||
|
#include "Allocators.hpp"
|
||||||
|
|
||||||
#include "ContainersCommon.hpp"
|
static tp::ModuleManifest* sModuleDependencies[] = { &tp::gModuleAllocators, nullptr };
|
||||||
|
|
||||||
static tp::ModuleManifest* sModuleDependencies[] = { &tp::gModuleContainers, nullptr };
|
|
||||||
|
|
||||||
tp::ModuleManifest tp::gModuleMath = ModuleManifest("Math", nullptr, nullptr, sModuleDependencies);
|
tp::ModuleManifest tp::gModuleMath = ModuleManifest("Math", nullptr, nullptr, sModuleDependencies);
|
||||||
|
|
||||||
|
|
@ -42,4 +41,4 @@ tp::alnf std_rad(const tp::alnf val) { return val * (PI / 180.f); }
|
||||||
tp::alnf std_deg(const tp::alnf val) { return val * (180.f / PI); }
|
tp::alnf std_deg(const tp::alnf val) { return val * (180.f / PI); }
|
||||||
tp::alnf std_atan2(const tp::alnf X, const tp::alnf Y) { return atan2((tp::halnf) X, (tp::halnf) Y); }
|
tp::alnf std_atan2(const tp::alnf X, const tp::alnf Y) { return atan2((tp::halnf) X, (tp::halnf) Y); }
|
||||||
tp::alnf std_atan(const tp::alnf val) { return atan((tp::halnf) val); }
|
tp::alnf std_atan(const tp::alnf val) { return atan((tp::halnf) val); }
|
||||||
tp::alnf std_log2(const tp::alnf val) { return log2((tp::halnf) val); }
|
tp::alnf std_log2(const tp::alnf val) { return log2((tp::halnf) val); }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
#include "Topology.hpp"
|
#include "Topology.hpp"
|
||||||
|
|
||||||
void* operator new(std::size_t, void* in) { return in; }
|
#include "NewPlacement.hpp"
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using namespace tp;
|
||||||
|
|
||||||
TEST_DEF(ComplexNumber) {
|
TEST_DEF(ComplexNumber) {
|
||||||
TEST((ComplexCart{ 3, 4 }.mod() == 5));
|
TEST((ComplexCart{ 3, 4 }.mod() == 5));
|
||||||
TEST((ComplexCart{ 1, 1 }.arg() == 0.7853981633974483));
|
TEST((abs(ComplexCart{ 1, 1 }.arg() - 0.7853981633974483) < 0.001));
|
||||||
TEST((ComplexCart{ 3, 4 }.norm2() == 25));
|
TEST((ComplexCart{ 3, 4 }.norm2() == 25));
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
|
|
||||||
#include "strings.h"
|
#include "Strings.hpp"
|
||||||
|
|
||||||
namespace obj {
|
namespace obj {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "Window.hpp"
|
#include "Window.hpp"
|
||||||
|
|
||||||
#include "GUI.h"
|
#include "GUI.h"
|
||||||
|
|
@ -45,4 +44,4 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include "compiler/constants.h"
|
#include "compiler/constants.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "primitives/methodobject.h"
|
#include "primitives/methodobject.h"
|
||||||
#include "primitives/primitives.h"
|
#include "primitives/primitives.h"
|
||||||
|
|
||||||
|
|
@ -142,4 +141,4 @@ void ConstObjectsPool::save(tp::Buffer<ConstData>& out) {
|
||||||
mBoolTrue.mConstIdx = data_idx;
|
mBoolTrue.mConstIdx = data_idx;
|
||||||
}
|
}
|
||||||
mDelete = false;
|
mDelete = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include "compiler/expression.h"
|
#include "compiler/expression.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
using namespace BCgen;
|
using namespace BCgen;
|
||||||
|
|
@ -64,30 +63,30 @@ ExpressionFunc::ExpressionFunc(tp::String id) :
|
||||||
Expression(Type::FUNC),
|
Expression(Type::FUNC),
|
||||||
mFuncId(id) {}
|
mFuncId(id) {}
|
||||||
ExpressionConst::ExpressionConst(tp::String val) :
|
ExpressionConst::ExpressionConst(tp::String val) :
|
||||||
Expression(Type::CONST),
|
Expression(Type::CONST_EXPR),
|
||||||
mConstType(STR),
|
mConstType(STR),
|
||||||
str(val) {}
|
str(val) {}
|
||||||
ExpressionConst::ExpressionConst(const char* val) :
|
ExpressionConst::ExpressionConst(const char* val) :
|
||||||
Expression(Type::CONST),
|
Expression(Type::CONST_EXPR),
|
||||||
mConstType(STR),
|
mConstType(STR),
|
||||||
str(val) {}
|
str(val) {}
|
||||||
ExpressionConst::ExpressionConst(tp::int4 val) :
|
ExpressionConst::ExpressionConst(tp::int4 val) :
|
||||||
Expression(Type::CONST),
|
Expression(Type::CONST_EXPR),
|
||||||
mConstType(INT),
|
mConstType(INT),
|
||||||
integer(val) {}
|
integer(val) {}
|
||||||
ExpressionConst::ExpressionConst(tp::flt4 val) :
|
ExpressionConst::ExpressionConst(tp::flt4 val) :
|
||||||
Expression(Type::CONST),
|
Expression(Type::CONST_EXPR),
|
||||||
mConstType(FLT),
|
mConstType(FLT),
|
||||||
floating(val) {}
|
floating(val) {}
|
||||||
ExpressionConst::ExpressionConst(tp::alni val) :
|
ExpressionConst::ExpressionConst(tp::alni val) :
|
||||||
Expression(Type::CONST),
|
Expression(Type::CONST_EXPR),
|
||||||
mConstType(INT),
|
mConstType(INT),
|
||||||
integer(val) {}
|
integer(val) {}
|
||||||
ExpressionConst::ExpressionConst(tp::alnf val) :
|
ExpressionConst::ExpressionConst(tp::alnf val) :
|
||||||
Expression(Type::CONST),
|
Expression(Type::CONST_EXPR),
|
||||||
mConstType(FLT),
|
mConstType(FLT),
|
||||||
floating(val) {}
|
floating(val) {}
|
||||||
ExpressionConst::ExpressionConst(bool val) :
|
ExpressionConst::ExpressionConst(bool val) :
|
||||||
Expression(Type::CONST),
|
Expression(Type::CONST_EXPR),
|
||||||
mConstType(BOOL),
|
mConstType(BOOL),
|
||||||
boolean(val) {}
|
boolean(val) {}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
|
|
||||||
#include "primitives/methodobject.h"
|
#include "primitives/methodobject.h"
|
||||||
|
|
@ -305,7 +303,7 @@ void FunctionDefinition::EvalExpr(Expression* expr) {
|
||||||
inst(Instruction(OpCode::LOAD_LOCAL, mConstants.get(local->mLocalId)));
|
inst(Instruction(OpCode::LOAD_LOCAL, mConstants.get(local->mLocalId)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Expression::Type::CONST:
|
case Expression::Type::CONST_EXPR:
|
||||||
{
|
{
|
||||||
auto constobj = (ExpressionConst*) expr;
|
auto constobj = (ExpressionConst*) expr;
|
||||||
switch (constobj->mConstType) {
|
switch (constobj->mConstType) {
|
||||||
|
|
@ -384,7 +382,7 @@ tp::alni instSize(const Instruction& inst) {
|
||||||
out += inst.mParamBytes;
|
out += inst.mParamBytes;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
case Instruction::ArgType::CONST:
|
case Instruction::ArgType::CONST_ARG:
|
||||||
{
|
{
|
||||||
out += 2;
|
out += 2;
|
||||||
if (inst.mConstData2) {
|
if (inst.mConstData2) {
|
||||||
|
|
@ -516,7 +514,7 @@ void FunctionDefinition::generateByteCode(ByteCode& out) {
|
||||||
writeParam(out, idx, (tp::int1*) &inst.mParam, inst.mParamBytes);
|
writeParam(out, idx, (tp::int1*) &inst.mParam, inst.mParamBytes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Instruction::ArgType::CONST:
|
case Instruction::ArgType::CONST_ARG:
|
||||||
{
|
{
|
||||||
writeConst(out, idx, (tp::uint2) inst.mConstData->mConstIdx);
|
writeConst(out, idx, (tp::uint2) inst.mConstData->mConstIdx);
|
||||||
if (inst.mConstData2) {
|
if (inst.mConstData2) {
|
||||||
|
|
@ -594,4 +592,4 @@ bool obj::BCgen::Compile(obj::MethodObject* method) {
|
||||||
delete res.scope;
|
delete res.scope;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
#include "compiler/instruction.h"
|
#include "compiler/instruction.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
@ -21,14 +20,14 @@ Instruction::Instruction(ConstObject* constData) :
|
||||||
Instruction::Instruction(OpCode op, ConstObject* constData) :
|
Instruction::Instruction(OpCode op, ConstObject* constData) :
|
||||||
mOp(op),
|
mOp(op),
|
||||||
mConstData(constData),
|
mConstData(constData),
|
||||||
mArgType(ArgType::CONST),
|
mArgType(ArgType::CONST_ARG),
|
||||||
mInstType(InstType::EXEC) {}
|
mInstType(InstType::EXEC) {}
|
||||||
|
|
||||||
Instruction::Instruction(OpCode op, ConstObject* constData, ConstObject* constData2) :
|
Instruction::Instruction(OpCode op, ConstObject* constData, ConstObject* constData2) :
|
||||||
mOp(op),
|
mOp(op),
|
||||||
mConstData(constData),
|
mConstData(constData),
|
||||||
mConstData2(constData2),
|
mConstData2(constData2),
|
||||||
mArgType(ArgType::CONST),
|
mArgType(ArgType::CONST_ARG),
|
||||||
mInstType(InstType::EXEC) {}
|
mInstType(InstType::EXEC) {}
|
||||||
|
|
||||||
Instruction::Instruction(OpCode op, tp::alni param, tp::alni nBytes) :
|
Instruction::Instruction(OpCode op, tp::alni param, tp::alni nBytes) :
|
||||||
|
|
@ -41,4 +40,4 @@ Instruction::Instruction(OpCode op, tp::alni param, tp::alni nBytes) :
|
||||||
Instruction::Instruction(Instruction* inst, InstType jump_type) :
|
Instruction::Instruction(Instruction* inst, InstType jump_type) :
|
||||||
mInstTarget(inst) {
|
mInstTarget(inst) {
|
||||||
mInstType = jump_type;
|
mInstType = jump_type;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include "compiler/statement.h"
|
#include "compiler/statement.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
using namespace BCgen;
|
using namespace BCgen;
|
||||||
|
|
@ -76,7 +75,7 @@ StatementClassDef::StatementClassDef(tp::String class_id, StatementScope* scope)
|
||||||
StatementFuncDef* obj::BCgen::StmDefFunc(tp::String id, tp::InitialierList<tp::String> args, tp::InitialierList<Statement*> stms) { return new StatementFuncDef(id, args, stms); }
|
StatementFuncDef* obj::BCgen::StmDefFunc(tp::String id, tp::InitialierList<tp::String> args, tp::InitialierList<Statement*> stms) { return new StatementFuncDef(id, args, stms); }
|
||||||
|
|
||||||
StatementLocalDef* obj::BCgen::StmDefLocal(tp::String id, Expression* value) {
|
StatementLocalDef* obj::BCgen::StmDefLocal(tp::String id, Expression* value) {
|
||||||
if (value->mType == Expression::Type::CONST) {
|
if (value->mType == Expression::Type::CONST_EXPR) {
|
||||||
return new StatementLocalDef(id, (ExpressionConst*) value);
|
return new StatementLocalDef(id, (ExpressionConst*) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,4 +98,4 @@ StatementWhile* obj::BCgen::StmWhile(Expression* condition, StatementScope* scop
|
||||||
|
|
||||||
StatementIgnore* obj::BCgen::StmIgnore(Expression* expr) { return new StatementIgnore(expr); }
|
StatementIgnore* obj::BCgen::StmIgnore(Expression* expr) { return new StatementIgnore(expr); }
|
||||||
|
|
||||||
StatementClassDef* obj::BCgen::StmClassDef(tp::String id, StatementScope* scope) { return new StatementClassDef(id, scope); }
|
StatementClassDef* obj::BCgen::StmClassDef(tp::String id, StatementScope* scope) { return new StatementClassDef(id, scope); }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Tokenizer.hpp"
|
#include "Tokenizer.hpp"
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
|
|
@ -88,4 +86,4 @@ static tp::ModuleManifest* sModuleDependencies[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
tp::ModuleManifest obj::gModuleObjects = tp::ModuleManifest("Objects", init, deinit, sModuleDependencies);
|
tp::ModuleManifest obj::gModuleObjects = tp::ModuleManifest("Objects", init, deinit, sModuleDependencies);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
||||||
#include "primitives/classobject.h"
|
#include "primitives/classobject.h"
|
||||||
|
|
@ -224,4 +222,4 @@ namespace obj {
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
||||||
#include "primitives/nullobject.h"
|
#include "primitives/nullobject.h"
|
||||||
|
|
@ -432,4 +431,4 @@ namespace obj {
|
||||||
sl_callbacks[sl_callbacks_load_idx] = in;
|
sl_callbacks[sl_callbacks_load_idx] = in;
|
||||||
sl_callbacks_load_idx++;
|
sl_callbacks_load_idx++;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
#include "HeapAllocatorGlobal.hpp"
|
#include "HeapAllocatorGlobal.hpp"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "core/scriptsection.h"
|
#include "core/scriptsection.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "core/typegroups.h"
|
#include "core/typegroups.h"
|
||||||
|
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
@ -80,4 +78,4 @@ obj::TypeGroups::~TypeGroups() {
|
||||||
}
|
}
|
||||||
childs.~Map();
|
childs.~Map();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "core/typemethods.h"
|
#include "core/typemethods.h"
|
||||||
|
|
||||||
#include "primitives/floatobject.h"
|
#include "primitives/floatobject.h"
|
||||||
|
|
@ -131,4 +129,4 @@ void TypeMethod::init() {
|
||||||
while (args[mNargs].descr) {
|
while (args[mNargs].descr) {
|
||||||
mNargs++;
|
mNargs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "interpreter/callstack.h"
|
#include "interpreter/callstack.h"
|
||||||
|
|
||||||
#include "interpreter/bytecode.h"
|
#include "interpreter/bytecode.h"
|
||||||
|
|
@ -33,4 +31,4 @@ void CallStack::leave() {
|
||||||
|
|
||||||
ByteCode* CallStack::getBytecode() { return &mStack.last().mMethod->mScript->mBytecode; }
|
ByteCode* CallStack::getBytecode() { return &mStack.last().mMethod->mScript->mBytecode; }
|
||||||
|
|
||||||
tp::halni CallStack::len() const { return mStack.size(); }
|
tp::halni CallStack::len() const { return mStack.size(); }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "interpreter/interpreter.h"
|
#include "interpreter/interpreter.h"
|
||||||
|
|
||||||
#include "primitives/primitives.h"
|
#include "primitives/primitives.h"
|
||||||
|
|
@ -606,4 +604,4 @@ void Interpreter::execAll(obj::MethodObject* method, obj::ClassObject* self, obj
|
||||||
while (!finished()) {
|
while (!finished()) {
|
||||||
stepBytecodeIn();
|
stepBytecodeIn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "interpreter/operandsstack.h"
|
#include "interpreter/operandsstack.h"
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "interpreter/scopestack.h"
|
#include "interpreter/scopestack.h"
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "primitives/boolobject.h"
|
#include "primitives/boolobject.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
@ -53,4 +52,4 @@ struct obj::ObjectType obj::BoolObject::TypeData = {
|
||||||
.save_size = (object_save_size) save_size,
|
.save_size = (object_save_size) save_size,
|
||||||
.save = (object_save) save,
|
.save = (object_save) save,
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "primitives/classobject.h"
|
#include "primitives/classobject.h"
|
||||||
#include "primitives/dictobject.h"
|
#include "primitives/dictobject.h"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
#include "primitives/colorobject.h"
|
#include "primitives/colorobject.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
@ -63,4 +62,4 @@ struct obj::ObjectType obj::ColorObject::TypeData = {
|
||||||
.save_size = (object_save_size) save_size,
|
.save_size = (object_save_size) save_size,
|
||||||
.save = (object_save) save,
|
.save = (object_save) save,
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "primitives/dictobject.h"
|
#include "primitives/dictobject.h"
|
||||||
#include "primitives/stringobject.h"
|
#include "primitives/stringobject.h"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "primitives/enumobject.h"
|
#include "primitives/enumobject.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
|
@ -174,4 +171,4 @@ struct obj::ObjectType obj::EnumObject::TypeData = {
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
.comparison = (object_compare) EnumObject::compare,
|
.comparison = (object_compare) EnumObject::compare,
|
||||||
.allocated_size = (object_allocated_size) allocated_size,
|
.allocated_size = (object_allocated_size) allocated_size,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "primitives/floatobject.h"
|
#include "primitives/floatobject.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
@ -69,4 +66,4 @@ struct obj::ObjectType obj::FloatObject::TypeData = {
|
||||||
.save_size = (object_save_size) save_size,
|
.save_size = (object_save_size) save_size,
|
||||||
.save = (object_save) save,
|
.save = (object_save) save,
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "primitives/interpreterobject.h"
|
#include "primitives/interpreterobject.h"
|
||||||
#include "primitives/linkobject.h"
|
#include "primitives/linkobject.h"
|
||||||
#include "primitives/methodobject.h"
|
#include "primitives/methodobject.h"
|
||||||
|
|
@ -75,4 +73,4 @@ struct obj::ObjectType InterpreterObject::TypeData = {
|
||||||
.size = sizeof(InterpreterObject),
|
.size = sizeof(InterpreterObject),
|
||||||
.name = "interpreter",
|
.name = "interpreter",
|
||||||
.load = (object_load) InterpreterObject::load,
|
.load = (object_load) InterpreterObject::load,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "primitives/intobject.h"
|
#include "primitives/intobject.h"
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
|
|
@ -71,4 +67,4 @@ struct obj::ObjectType obj::IntObject::TypeData = {
|
||||||
.save_size = (object_save_size) save_size,
|
.save_size = (object_save_size) save_size,
|
||||||
.save = (object_save) save,
|
.save = (object_save) save,
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "primitives/linkobject.h"
|
#include "primitives/linkobject.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
@ -106,4 +103,4 @@ struct obj::ObjectType LinkObject::TypeData = { .base = NULL,
|
||||||
.type_methods = { .methods = {
|
.type_methods = { .methods = {
|
||||||
&tm_set,
|
&tm_set,
|
||||||
&tm_get,
|
&tm_get,
|
||||||
} } };
|
} } };
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "primitives/intobject.h"
|
#include "primitives/intobject.h"
|
||||||
#include "primitives/listobject.h"
|
#include "primitives/listobject.h"
|
||||||
|
|
||||||
|
|
@ -130,4 +126,4 @@ struct obj::ObjectType obj::ListObject::TypeData = { .base = NULL,
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
.childs_retrival = (object_debug_all_childs_retrival) childs_retrival,
|
.childs_retrival = (object_debug_all_childs_retrival) childs_retrival,
|
||||||
.allocated_size = (object_allocated_size) allocated_size,
|
.allocated_size = (object_allocated_size) allocated_size,
|
||||||
.allocated_size_recursive = (object_allocated_size_recursive) allocated_size_recursive };
|
.allocated_size_recursive = (object_allocated_size_recursive) allocated_size_recursive };
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
#include "core/scriptsection.h"
|
#include "core/scriptsection.h"
|
||||||
|
|
@ -62,4 +59,4 @@ MethodObject* MethodObject::create(tp::String script) {
|
||||||
out->mScript->mReadable->val = script;
|
out->mScript->mReadable->val = script;
|
||||||
out->compile();
|
out->compile();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "primitives/nullobject.h"
|
#include "primitives/nullobject.h"
|
||||||
|
|
||||||
|
|
@ -47,4 +44,4 @@ struct ObjectType NullObject::TypeData = {
|
||||||
.size = sizeof(NullObject),
|
.size = sizeof(NullObject),
|
||||||
.name = "null",
|
.name = "null",
|
||||||
.convesions = &NullObjectTypeConversions,
|
.convesions = &NullObjectTypeConversions,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "primitives/stringobject.h"
|
#include "primitives/stringobject.h"
|
||||||
|
|
||||||
|
|
@ -75,4 +72,4 @@ struct obj::ObjectType StringObject::TypeData = {
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
.comparison = (object_compare) compare_strings,
|
.comparison = (object_compare) compare_strings,
|
||||||
.allocated_size = (object_allocated_size) allocated_size,
|
.allocated_size = (object_allocated_size) allocated_size,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "primitives/typeobject.h"
|
#include "primitives/typeobject.h"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "primitives/nullobject.h"
|
#include "primitives/nullobject.h"
|
||||||
|
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
|
|
@ -69,4 +66,4 @@ struct obj::ObjectType TypeObject::TypeData = {
|
||||||
.load = (object_load) load,
|
.load = (object_load) load,
|
||||||
.comparison = (object_compare) comparator,
|
.comparison = (object_compare) comparator,
|
||||||
.allocated_size = (object_allocated_size) allocated_size,
|
.allocated_size = (object_allocated_size) allocated_size,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
namespace obj {
|
namespace obj {
|
||||||
namespace BCgen {
|
namespace BCgen {
|
||||||
|
|
||||||
struct ConstObject {
|
class ConstObject {
|
||||||
|
public:
|
||||||
obj::Object* mObj = NULL;
|
obj::Object* mObj = NULL;
|
||||||
tp::alni mConstIdx = 0;
|
tp::alni mConstIdx = 0;
|
||||||
|
|
||||||
|
|
@ -16,7 +17,8 @@ namespace obj {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ConstObjectsPool {
|
class ConstObjectsPool {
|
||||||
|
public:
|
||||||
tp::Map<tp::String, ConstObject*> mMethods;
|
tp::Map<tp::String, ConstObject*> mMethods;
|
||||||
tp::Map<tp::String, ConstObject*> mStrings;
|
tp::Map<tp::String, ConstObject*> mStrings;
|
||||||
tp::Map<tp::alni, ConstObject*> mIntegers;
|
tp::Map<tp::alni, ConstObject*> mIntegers;
|
||||||
|
|
@ -36,6 +38,7 @@ namespace obj {
|
||||||
ConstObject* registerObject(obj::Object* obj);
|
ConstObject* registerObject(obj::Object* obj);
|
||||||
void save(tp::Buffer<ConstData>& out);
|
void save(tp::Buffer<ConstData>& out);
|
||||||
|
|
||||||
|
ConstObjectsPool() = default;
|
||||||
~ConstObjectsPool();
|
~ConstObjectsPool();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace obj {
|
||||||
NONE,
|
NONE,
|
||||||
NEW,
|
NEW,
|
||||||
LOCAL,
|
LOCAL,
|
||||||
CONST,
|
CONST_EXPR,
|
||||||
CHILD,
|
CHILD,
|
||||||
CALL,
|
CALL,
|
||||||
ARIPHM,
|
ARIPHM,
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,17 @@
|
||||||
namespace obj {
|
namespace obj {
|
||||||
namespace BCgen {
|
namespace BCgen {
|
||||||
|
|
||||||
struct ConstObject;
|
class ConstObject;
|
||||||
|
|
||||||
struct Instruction {
|
class Instruction {
|
||||||
|
public:
|
||||||
|
|
||||||
OpCode mOp = OpCode::NONE;
|
OpCode mOp = OpCode::NONE;
|
||||||
|
|
||||||
enum class ArgType : tp::ualni {
|
enum class ArgType : tp::ualni {
|
||||||
NO_ARG,
|
NO_ARG,
|
||||||
PARAM,
|
PARAM,
|
||||||
CONST,
|
CONST_ARG,
|
||||||
} mArgType = ArgType::NO_ARG;
|
} mArgType = ArgType::NO_ARG;
|
||||||
|
|
||||||
enum class InstType : tp::ualni {
|
enum class InstType : tp::ualni {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "compiler/statement.h"
|
#include "compiler/statement.h"
|
||||||
#include "compiler/expression.h"
|
#include "compiler/expression.h"
|
||||||
|
|
||||||
|
|
@ -192,4 +192,4 @@ namespace obj {
|
||||||
|
|
||||||
BCgen::StatementScope* parseScope(bool aPushToScopeStack);
|
BCgen::StatementScope* parseScope(bool aPushToScopeStack);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
#include "primitives/primitives.h"
|
#include "primitives/primitives.h"
|
||||||
|
|
@ -32,4 +31,4 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
@ -30,4 +28,4 @@ TEST_DEF_STATIC(BasicAPI) {
|
||||||
NDO->destroy(savedInt);
|
NDO->destroy(savedInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(Core) { testBasicAPI(); }
|
TEST_DEF(Core) { testBasicAPI(); }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
|
|
@ -84,4 +82,4 @@ TEST_DEF_STATIC(Simple) {
|
||||||
TEST_DEF(Interpreter) {
|
TEST_DEF(Interpreter) {
|
||||||
testSimple();
|
testSimple();
|
||||||
// testComplex();
|
// testComplex();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
@ -30,4 +28,4 @@ TEST_DEF_STATIC(Dict) {
|
||||||
NDO->destroy(dictLoaded);
|
NDO->destroy(dictLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(Primitives) { testDict(); }
|
TEST_DEF(Primitives) { testDict(); }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "CommandLine.hpp"
|
#include "CommandLine.hpp"
|
||||||
#include "Parser.hpp"
|
#include "Parser.hpp"
|
||||||
|
|
||||||
|
|
@ -81,4 +79,4 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
testModule.deinitialize();
|
testModule.deinitialize();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include "CLR.hpp"
|
#include "CLR.hpp"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
|
|
@ -17,4 +16,4 @@ void CLR::setTerminal(const String& name, TerminalStream::TerminalID id) {}
|
||||||
|
|
||||||
void CLR::build() {}
|
void CLR::build() {}
|
||||||
|
|
||||||
void CLR::parse(TerminalStream* source, List<ASTNode>& out, ASTNode** root) { *root = nullptr; }
|
void CLR::parse(TerminalStream* source, List<ASTNode>& out, ASTNode** root) { *root = nullptr; }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
#include "CfGrammar.hpp"
|
#include "CfGrammar.hpp"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Timing.hpp"
|
#include "Timing.hpp"
|
||||||
|
|
||||||
|
|
@ -159,4 +158,4 @@ bool CfGrammar::compile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "CfGrammar.hpp"
|
#include "CfGrammar.hpp"
|
||||||
#include "Tokenizer.hpp"
|
#include "Tokenizer.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
#include "Parser.hpp"
|
#include "Parser.hpp"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Tokenizer.hpp"
|
#include "Tokenizer.hpp"
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "Parser.hpp"
|
#include "Parser.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
|
|
@ -7,4 +6,4 @@ using namespace tp;
|
||||||
|
|
||||||
TEST_DEF(CLR) {
|
TEST_DEF(CLR) {
|
||||||
// TEST(false);
|
// TEST(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "Parser.hpp"
|
#include "Parser.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
|
|
@ -46,4 +45,4 @@ List : [ LIST ];
|
||||||
printf("Example sentences formed from grammar: \n");
|
printf("Example sentences formed from grammar: \n");
|
||||||
for (auto sentence : sentences)
|
for (auto sentence : sentences)
|
||||||
tp::CfGrammar::printSentence(sentence.data());
|
tp::CfGrammar::printSentence(sentence.data());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
#include "Parser.hpp"
|
#include "Parser.hpp"
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
|
|
||||||
|
|
@ -21,4 +20,4 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
testModule.deinitialize();
|
testModule.deinitialize();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
#include "stb_image_write.h"
|
#include "stb_image_write.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
void writeImage(const RayTracer::RenderBuffer& output, const char* name) {
|
void writeImage(const RayTracer::RenderBuffer& output, const char* name) {
|
||||||
|
|
@ -37,22 +41,19 @@ void writeImage(const RayTracer::RenderBuffer& output, const char* name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* printStatus(void* arg) {
|
void printStatus(const halnf* percentage) {
|
||||||
auto percentage = (const halnf*) arg;
|
|
||||||
auto old = *percentage;
|
auto old = *percentage;
|
||||||
while (*percentage < 0.99f) {
|
while (*percentage < 0.99f) {
|
||||||
sleep(500);
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
if (old != *percentage && (*percentage - old) > 0.01) {
|
if (old != *percentage && (*percentage - old) > 0.01) {
|
||||||
printf("Progress - %f\n", (*percentage) * 100);
|
std::cout << "Progress - " << (*percentage) * 100 << std::endl;
|
||||||
old = *percentage;
|
old = *percentage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_exit(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderCommand(const String& scenePath) {
|
void renderCommand(const String& scenePath) {
|
||||||
Scene scene;
|
Scene scene;
|
||||||
|
|
||||||
RayTracer::RenderSettings settings;
|
RayTracer::RenderSettings settings;
|
||||||
|
|
||||||
loadScene(scene, scenePath, settings);
|
loadScene(scene, scenePath, settings);
|
||||||
|
|
@ -60,16 +61,9 @@ void renderCommand(const String& scenePath) {
|
||||||
RayTracer::OutputBuffers output;
|
RayTracer::OutputBuffers output;
|
||||||
RayTracer rayt;
|
RayTracer rayt;
|
||||||
|
|
||||||
pthread_t my_thread;
|
std::thread statusThread(printStatus, &rayt.mProgress.percentage);
|
||||||
int ret;
|
|
||||||
|
|
||||||
printf("\nStarting Render:\n\n");
|
std::cout << "\nStarting Render:\n\n";
|
||||||
|
|
||||||
ret = pthread_create(&my_thread, NULL, &printStatus, &rayt.mProgress.percentage);
|
|
||||||
if (ret != 0) {
|
|
||||||
printf("Error: pthread_create() failed\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto start = get_time();
|
auto start = get_time();
|
||||||
|
|
||||||
|
|
@ -77,9 +71,9 @@ void renderCommand(const String& scenePath) {
|
||||||
|
|
||||||
auto end = get_time();
|
auto end = get_time();
|
||||||
|
|
||||||
pthread_join(my_thread, NULL);
|
statusThread.join();
|
||||||
|
|
||||||
printf("\nRender finished with average render time per sample - %i (ms)\n", end - start);
|
std::cout << "\nRender finished with average render time per sample - " << (end - start) << " (ms)\n";
|
||||||
|
|
||||||
writeImage(output.normals, "normals.png");
|
writeImage(output.normals, "normals.png");
|
||||||
writeImage(output.color, "color.png");
|
writeImage(output.color, "color.png");
|
||||||
|
|
@ -97,4 +91,4 @@ int main(int argc, const char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
#include "MathCommon.hpp"
|
#include "MathCommon.hpp"
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "CommandLine.hpp"
|
#include "CommandLine.hpp"
|
||||||
#include "Module.hpp"
|
#include "Module.hpp"
|
||||||
|
|
@ -48,10 +47,10 @@ ModuleManifest* sDependencies[] = { &gModuleMath, &gModuleCommandLine, &gModuleC
|
||||||
|
|
||||||
ModuleManifest tp::gModuleRayTracer = ModuleManifest("RayTracer", nullptr, nullptr, sDependencies);
|
ModuleManifest tp::gModuleRayTracer = ModuleManifest("RayTracer", nullptr, nullptr, sDependencies);
|
||||||
|
|
||||||
void RayTracer::castRay(const Ray& ray, RayCastData& out, alnf far) {
|
void RayTracer::castRay(const Ray& ray, RayCastData& out, alnf farVal) {
|
||||||
out.hit = false;
|
out.hit = false;
|
||||||
|
|
||||||
far *= far;
|
farVal *= farVal;
|
||||||
|
|
||||||
for (auto obj : mScene->mObjects) {
|
for (auto obj : mScene->mObjects) {
|
||||||
for (auto trig : obj->mCache.TrigCaches) {
|
for (auto trig : obj->mCache.TrigCaches) {
|
||||||
|
|
@ -60,13 +59,13 @@ void RayTracer::castRay(const Ray& ray, RayCastData& out, alnf far) {
|
||||||
|
|
||||||
auto dist = (trig->getHitPos() - ray.pos).length2();
|
auto dist = (trig->getHitPos() - ray.pos).length2();
|
||||||
|
|
||||||
if (far > dist && dist > EPSILON) {
|
if (farVal > dist && dist > EPSILON) {
|
||||||
out.trig = &trig.data();
|
out.trig = &trig.data();
|
||||||
out.hitPos = trig->getHitPos();
|
out.hitPos = trig->getHitPos();
|
||||||
out.obj = &obj.data();
|
out.obj = &obj.data();
|
||||||
out.hit = true;
|
out.hit = true;
|
||||||
|
|
||||||
far = dist;
|
farVal = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Logging.hpp"
|
#include "Logging.hpp"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
@ -51,4 +49,4 @@ namespace tp {
|
||||||
delete gLogger;
|
delete gLogger;
|
||||||
gLogger = nullptr;
|
gLogger = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "Strings.hpp"
|
#include "Strings.hpp"
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
||||||
|
|
@ -46,4 +44,4 @@ TEST_DEF_STATIC(Simple) {
|
||||||
TEST_DEF(Strings) {
|
TEST_DEF(Strings) {
|
||||||
testSimple();
|
testSimple();
|
||||||
testAddition();
|
testAddition();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#include "NewPlacement.hpp"
|
|
||||||
|
|
||||||
#include "StringLogic.hpp"
|
#include "StringLogic.hpp"
|
||||||
#include "Tests.hpp"
|
#include "Tests.hpp"
|
||||||
|
|
||||||
|
|
@ -242,4 +240,4 @@ TEST_DEF(StringLogic) {
|
||||||
testremoveLogic();
|
testremoveLogic();
|
||||||
|
|
||||||
testConversions();
|
testConversions();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
#include "Map.hpp"
|
#include "Map.hpp"
|
||||||
|
|
||||||
|
#ifdef ENV_OS_WINDOWS
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace tp {
|
namespace tp {
|
||||||
|
|
||||||
extern ModuleManifest gModuleTokenizer;
|
extern ModuleManifest gModuleTokenizer;
|
||||||
|
|
@ -100,7 +105,7 @@ namespace tp {
|
||||||
|
|
||||||
Range<tAlphabetType> getAlphabetRange() const {
|
Range<tAlphabetType> getAlphabetRange() const {
|
||||||
tAlphabetType start = 0, end = 0;
|
tAlphabetType start = 0, end = 0;
|
||||||
Range<tAlphabetType> all_range = { std::numeric_limits<tAlphabetType>::min(), std::numeric_limits<tAlphabetType>::max() };
|
Range<tAlphabetType> all_range(std::numeric_limits<tAlphabetType>::min(), std::numeric_limits<tAlphabetType>::max());
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
for (auto vertex : mVertices) {
|
for (auto vertex : mVertices) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
#include "NewPlacement.hpp"
|
// #include "NewPlacement.hpp"
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "Testing.hpp"
|
||||||
#include "Tokenizer.hpp"
|
#include "Tokenizer.hpp"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#define LOG(val) // std::cout << #val << " "
|
#define LOG(val) std::cout << #val << " "
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ void initializeCallStackCapture() { gCSCapture = new (malloc(sizeof(CallStackCap
|
||||||
void deinitializeCallStackCapture() {
|
void deinitializeCallStackCapture() {
|
||||||
gCSCapture->~CallStackCapture();
|
gCSCapture->~CallStackCapture();
|
||||||
free(gCSCapture);
|
free(gCSCapture);
|
||||||
|
gCSCapture = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ualni CallStackCapture::CallStack::getDepth() const {
|
ualni CallStackCapture::CallStack::getDepth() const {
|
||||||
|
|
@ -70,6 +71,8 @@ CallStackCapture::CallStackCapture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const CallStackCapture::CallStack* CallStackCapture::getSnapshot() {
|
const CallStackCapture::CallStack* CallStackCapture::getSnapshot() {
|
||||||
|
MODULE_SANITY_CHECK(gModuleUtils)
|
||||||
|
|
||||||
if (mBuffLoad > mBuffLen) {
|
if (mBuffLoad > mBuffLen) {
|
||||||
static CallStack cs;
|
static CallStack cs;
|
||||||
cs.frames[0] = 0;
|
cs.frames[0] = 0;
|
||||||
|
|
@ -229,4 +232,10 @@ void CallStackCapture::platformWriteDebugSymbols(FramePointer frame, DebugSymbol
|
||||||
std::strcpy(out->file, "unresolved");
|
std::strcpy(out->file, "unresolved");
|
||||||
std::strcpy(out->function, "unresolved");
|
std::strcpy(out->function, "unresolved");
|
||||||
}
|
}
|
||||||
|
void CallStackCapture::printSnapshot(const CallStack* snapshot) {
|
||||||
|
printf("CallStack: \n");
|
||||||
|
printf("Call stack debugging is not supported on this platform");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
void CallStackCapture::logAll() { printf("Call stack debugging is not supported on this platform"); }
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -37,7 +37,7 @@ void Testing::reportState() {
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
mRootTest.report();
|
mRootTest.report();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Testing::hasFailed() {
|
bool Testing::hasFailed() {
|
||||||
mRootTest.updateState();
|
mRootTest.updateState();
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <mutex>
|
||||||
|
|
||||||
namespace tp {
|
namespace tp {
|
||||||
class Mutex {
|
class Mutex {
|
||||||
pthread_mutex_t mMutex{};
|
std::mutex mMutex;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mutex() = default;
|
Mutex() = default;
|
||||||
|
|
||||||
void lock() { pthread_mutex_lock(&mMutex); }
|
void lock() { mMutex.lock(); }
|
||||||
|
|
||||||
void unlock() { pthread_mutex_unlock(&mMutex); }
|
void unlock() { mMutex.unlock(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue