From daefaf979b5463867d51627406747b28fdc42635 Mon Sep 17 00:00:00 2001 From: mihacooper Date: Sun, 22 Jan 2017 19:30:40 +0300 Subject: [PATCH] rename project to Effil --- CMakeLists.txt | 10 +++++----- README.md | 2 +- lua-tests/smoke_test.lua | 12 ++++++------ src/lua-module.cpp | 10 +++++----- src/shared-table.cpp | 10 +++++----- src/shared-table.h | 4 ++-- src/spin-mutex.h | 4 ++-- src/stored-object.cpp | 4 ++-- src/stored-object.h | 8 ++++---- src/threading.cpp | 8 ++++---- src/threading.h | 4 ++-- tests/shared-table.cpp | 2 +- 12 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 125ba63..f5907b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8) -project(woofer) +project(effil) find_package(Lua REQUIRED) @@ -18,13 +18,13 @@ if(APPLE) set(CMAKE_MACOSX_RPATH 1) endif() -add_library(woofer SHARED ${SOURCES}) -target_link_libraries(woofer -lpthread ${LUA_LIBRARY}) +add_library(effil SHARED ${SOURCES}) +target_link_libraries(effil -lpthread ${LUA_LIBRARY}) set(GENERAL "-std=c++14 -pthread") set(ENABLE_WARNINGS "-Wall -Wextra -pedantic -Werror") set(BUILD_FLAVOR "-O3 -UNDEBUG") -set_target_properties(woofer PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENERAL} ${BUILD_FLAVOR}") +set_target_properties(effil PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENERAL} ${BUILD_FLAVOR}") #---------- # TESTS --- @@ -35,7 +35,7 @@ set(GTEST_DIR tests/gtest/googletest) include_directories(${GTEST_DIR}/include ${GTEST_DIR}) add_executable(tests ${TEST_SOURCES} ${GTEST_DIR}/src/gtest-all.cc) -target_link_libraries(tests woofer) +target_link_libraries(tests effil) set_target_properties(tests PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENERAL} ${BUILD_FLAVOR}") diff --git a/README.md b/README.md index e9976e2..958aed0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Woofer +# Effil Threading library for Lua. Written in C++ with great help of [sol2](https://github.com/ThePhD/sol2). [![Build Status](https://travis-ci.org/loud-hound/woofer.svg?branch=master)](https://travis-ci.org/loud-hound/woofer) diff --git a/lua-tests/smoke_test.lua b/lua-tests/smoke_test.lua index 82b41a2..961c44d 100644 --- a/lua-tests/smoke_test.lua +++ b/lua-tests/smoke_test.lua @@ -1,15 +1,15 @@ TestSmoke = {} function TestSmoke:testGeneralWorkability() - local woofer = require('libwoofer') - local share = woofer.share() + local effil = require('libeffil') + local share = effil.share() share["number"] = 100500 share["string"] = "string value" share["bool"] = true log "Start thread" - local thread = woofer.thread( + local thread = effil.thread( function(share) share["child.number"] = share["number"] share["child.string"] = share["string"] @@ -30,12 +30,12 @@ function TestSmoke:testGeneralWorkability() end function TestSmoke:testDetach() - local woofer = require('libwoofer') - local share = woofer.share() + local effil = require('libeffil') + local share = effil.share() share["finished"] = false log "Start thread" - local thread = woofer.thread( + local thread = effil.thread( function(share) local startTime = os.time() while ( (os.time() - startTime) <= 3) do --[[ Like we are working 3sec ... ]] end diff --git a/src/lua-module.cpp b/src/lua-module.cpp index 710d46b..e492698 100644 --- a/src/lua-module.cpp +++ b/src/lua-module.cpp @@ -6,19 +6,19 @@ namespace { static sol::object createThread(sol::this_state lua, sol::function func, const sol::variadic_args &args) noexcept { - return sol::make_object(lua, std::make_unique(func, args)); + return sol::make_object(lua, std::make_unique(func, args)); } static sol::object createShare(sol::this_state lua) noexcept { - return sol::make_object(lua, std::make_unique()); + return sol::make_object(lua, std::make_unique()); } } // namespace -extern "C" int luaopen_libwoofer(lua_State *L) { +extern "C" int luaopen_libeffil(lua_State *L) { sol::state_view lua(L); - threading::LuaThread::getUserType(lua); - share_data::SharedTable::getUserType(lua); + effil::LuaThread::getUserType(lua); + effil::SharedTable::getUserType(lua); sol::table public_api = lua.create_table_with( "thread", createThread, "share", createShare diff --git a/src/shared-table.cpp b/src/shared-table.cpp index fcea503..a73efe6 100644 --- a/src/shared-table.cpp +++ b/src/shared-table.cpp @@ -3,13 +3,13 @@ #include #include -namespace share_data { +namespace effil { sol::object SharedTable::getUserType(sol::state_view &lua) noexcept { - static sol::usertype type( + static sol::usertype type( sol::call_construction(), sol::default_constructor, - sol::meta_function::new_index, &share_data::SharedTable::luaSet, - sol::meta_function::index, &share_data::SharedTable::luaGet, + sol::meta_function::new_index, &SharedTable::luaSet, + sol::meta_function::index, &SharedTable::luaGet, sol::meta_function::length, &SharedTable::size ); sol::stack::push(lua, type); @@ -75,4 +75,4 @@ TablePool& defaultPool() noexcept { return pool; } -} // share_data +} // effil diff --git a/src/shared-table.h b/src/shared-table.h index d131f1b..2f759b4 100644 --- a/src/shared-table.h +++ b/src/shared-table.h @@ -9,7 +9,7 @@ #include #include -namespace share_data { +namespace effil { class SharedTable { public: @@ -50,4 +50,4 @@ private: TablePool& defaultPool() noexcept; -} // share_data +} // effil diff --git a/src/spin-mutex.h b/src/spin-mutex.h index be04e79..0f5d2a4 100644 --- a/src/spin-mutex.h +++ b/src/spin-mutex.h @@ -3,7 +3,7 @@ #include #include -namespace share_data { +namespace effil { class SpinMutex { public: @@ -21,4 +21,4 @@ private: std::atomic_flag lock_ = ATOMIC_FLAG_INIT; }; -} // share_data +} // effil diff --git a/src/stored-object.cpp b/src/stored-object.cpp index 80a0812..2e33bac 100644 --- a/src/stored-object.cpp +++ b/src/stored-object.cpp @@ -9,7 +9,7 @@ #include -namespace share_data { +namespace effil { namespace { @@ -211,4 +211,4 @@ bool StoredObject::operator<(const StoredObject& o) const noexcept { return data_.get() < o.data_.get(); } -} // share_data +} // effil diff --git a/src/stored-object.h b/src/stored-object.h index 50bdcc2..9a70bc2 100644 --- a/src/stored-object.h +++ b/src/stored-object.h @@ -5,7 +5,7 @@ #include #include -namespace share_data { +namespace effil { class BaseHolder { public: @@ -63,14 +63,14 @@ private: StoredObject& operator=(const StoredObject&) = delete; }; -} // share_data +} // effil namespace std { // For storing as key in std::unordered_map template<> -struct hash { - std::size_t operator()(const share_data::StoredObject &object) const noexcept { +struct hash { + std::size_t operator()(const effil::StoredObject &object) const noexcept { return object.hash(); } }; diff --git a/src/threading.cpp b/src/threading.cpp index 1ae4250..b53e807 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -1,6 +1,6 @@ #include "threading.h" -namespace threading { +namespace effil { LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept { // 1. Dump function to string @@ -15,7 +15,7 @@ LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& ar sol::lib::package, sol::lib::io, sol::lib::os ); getUserType(*p_state_); - share_data::SharedTable::getUserType(*p_state_); + effil::SharedTable::getUserType(*p_state_); // 3. Save parameters storeArgs(args); @@ -28,7 +28,7 @@ LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& ar void LuaThread::storeArgs(const sol::variadic_args &args) noexcept { p_arguments_ = std::make_shared>(); for(auto iter = args.begin(); iter != args.end(); iter++) { - share_data::StoredObject store(iter->get()); + effil::StoredObject store(iter->get()); p_arguments_->push_back(store.unpack(sol::this_state{p_state_->lua_state()})); } } @@ -78,4 +78,4 @@ sol::object LuaThread::getUserType(sol::state_view &lua) noexcept return sol::stack::pop(lua); } -} // threading +} // effil diff --git a/src/threading.h b/src/threading.h index c4431fc..6e5087a 100644 --- a/src/threading.h +++ b/src/threading.h @@ -8,7 +8,7 @@ #include #include -namespace threading { +namespace effil { class LuaThread { public: @@ -30,4 +30,4 @@ private: std::shared_ptr> p_arguments_; }; -} // threading +} // effil diff --git a/tests/shared-table.cpp b/tests/shared-table.cpp index 89966a7..5607863 100644 --- a/tests/shared-table.cpp +++ b/tests/shared-table.cpp @@ -4,7 +4,7 @@ #include -using namespace share_data; +using namespace effil; namespace {