[DEV] update of external of elog and ethread

This commit is contained in:
Edouard DUPIN 2016-03-08 21:29:34 +01:00
parent 9e7d41f266
commit 2abb546c5e
22 changed files with 62 additions and 71 deletions

View File

@ -13,7 +13,7 @@
#include <etk/tool.h>
#include <etk/os/FSNode.h>
#include <etk/thread/tools.h>
#include <ethread/tools.h>
#include <mutex>
#include <ewol/ewol.h>

View File

@ -9,6 +9,6 @@
#include <ewol/debug.h>
int32_t ewol::getLogId() {
static int32_t g_val = etk::log::registerInstance("ewol");
static int32_t g_val = elog::registerInstance("ewol");
return g_val;
}

View File

@ -7,12 +7,12 @@
*/
#pragma once
#include <etk/log.h>
#include <elog/log.h>
namespace ewol {
int32_t getLogId();
};
#define EWOL_BASE(info,data) TK_LOG_BASE(ewol::getLogId(),info,data)
#define EWOL_BASE(info,data) ELOG_BASE(ewol::getLogId(),info,data)
#define EWOL_PRINT(data) EWOL_BASE(-1, data)
#define EWOL_CRITICAL(data) EWOL_BASE(1, data)

View File

@ -23,7 +23,7 @@ ewol::resource::ColorFile::ColorFile() :
}
void ewol::resource::ColorFile::init(const std::string& _filename) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
gale::Resource::init(_filename);
EWOL_DEBUG("CF : load \"" << _filename << "\"");
reload();
@ -37,7 +37,7 @@ ewol::resource::ColorFile::~ColorFile() {
void ewol::resource::ColorFile::reload() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// remove all previous set of value :
for (int32_t iii = 0; iii < m_list.size() ; ++iii) {
m_list[iii] = m_errorColor;
@ -72,7 +72,7 @@ void ewol::resource::ColorFile::reload() {
int32_t ewol::resource::ColorFile::request(const std::string& _paramName) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// check if the parameters existed :
if (m_list.exist(_paramName) == false) {
m_list.add(_paramName, m_errorColor);

View File

@ -25,7 +25,7 @@ ewol::resource::ConfigFile::ConfigFile() :
}
void ewol::resource::ConfigFile::init(const std::string& _filename) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
gale::Resource::init(_filename);
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
reload();
@ -37,7 +37,7 @@ ewol::resource::ConfigFile::~ConfigFile() {
}
void ewol::resource::ConfigFile::reload() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// reset all parameters
for (int32_t iii=0; iii<m_list.size(); iii++){
if (nullptr != m_list[iii]) {
@ -55,7 +55,7 @@ void ewol::resource::ConfigFile::reload() {
int32_t ewol::resource::ConfigFile::request(const std::string& _paramName) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// check if the parameters existed :
if (m_list.exist(_paramName) == false) {
m_list.add(_paramName, nullptr);
@ -68,7 +68,7 @@ int32_t ewol::resource::ConfigFile::request(const std::string& _paramName) {
double ewol::resource::ConfigFile::getNumber(int32_t _id) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if ( _id < 0
|| m_list[_id] == nullptr) {
return 0.0;
@ -81,7 +81,7 @@ double ewol::resource::ConfigFile::getNumber(int32_t _id) {
}
const std::string& ewol::resource::ConfigFile::getString(int32_t _id) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
static const std::string& errorString("");
if ( _id < 0
|| m_list[_id] == nullptr) {
@ -95,7 +95,7 @@ const std::string& ewol::resource::ConfigFile::getString(int32_t _id) {
}
bool ewol::resource::ConfigFile::getBoolean(int32_t _id) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if ( _id < 0
|| m_list[_id] == nullptr) {
return false;

View File

@ -36,7 +36,7 @@ ewol::resource::DistanceFieldFont::DistanceFieldFont() :
}
void ewol::resource::DistanceFieldFont::init(const std::string& _fontName) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
ewol::resource::Texture::init(_fontName);
std::string localName = _fontName;
std::vector<std::string> folderList;
@ -135,13 +135,13 @@ ewol::resource::DistanceFieldFont::~DistanceFieldFont() {
float ewol::resource::DistanceFieldFont::getDisplayRatio(float _size) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
return _size / (float)SIZE_GENERATION;
}
void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
int32_t size = _input.getSize().x() * _input.getSize().y();
std::vector<short> xdist(size);
std::vector<short> ydist(size);
@ -221,7 +221,7 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
}
bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
bool hasChange = false;
if (m_font == nullptr) {
return false;
@ -303,7 +303,7 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
}
int32_t ewol::resource::DistanceFieldFont::getIndex(char32_t _charcode) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (_charcode < 0x20) {
return 0;
} else if (_charcode < 0x80) {
@ -330,7 +330,7 @@ int32_t ewol::resource::DistanceFieldFont::getIndex(char32_t _charcode) {
}
ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const char32_t& _charcode) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
//EWOL_DEBUG("Get glyph property for mode: " << _displayMode << " == > wrapping index : " << m_modeWraping[_displayMode]);
int32_t index = getIndex(_charcode);
if( index < 0
@ -350,7 +350,7 @@ ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const ch
}
void ewol::resource::DistanceFieldFont::exportOnFile() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
EWOL_DEBUG("EXPORT: DistanceFieldFont : file : '" << m_fileName << ".json'");
ejson::Document doc;
std::shared_ptr<ejson::Array> tmpList = ejson::Array::create();
@ -385,7 +385,7 @@ void ewol::resource::DistanceFieldFont::exportOnFile() {
}
bool ewol::resource::DistanceFieldFont::importFromFile() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
EWOL_DEBUG("IMPORT: DistanceFieldFont : file : '" << m_fileName << ".json'");
// test file existance:
etk::FSNode fileJSON(m_fileName + ".json");

View File

@ -60,7 +60,7 @@ ewol::resource::FontFreeType::FontFreeType() {
}
void ewol::resource::FontFreeType::init(const std::string& _fontName) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
ewol::resource::FontBase::init(_fontName);
etk::FSNode myfile(_fontName);
if (false == myfile.exist()) {
@ -101,7 +101,7 @@ void ewol::resource::FontFreeType::init(const std::string& _fontName) {
}
ewol::resource::FontFreeType::~FontFreeType() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// clean the tmp memory
if (nullptr != m_FileBuffer) {
delete[] m_FileBuffer;
@ -112,7 +112,7 @@ ewol::resource::FontFreeType::~FontFreeType() {
}
vec2 ewol::resource::FontFreeType::getSize(int32_t _fontSize, const std::string& _unicodeString) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if(false == m_init) {
return vec2(0,0);
}
@ -122,16 +122,16 @@ vec2 ewol::resource::FontFreeType::getSize(int32_t _fontSize, const std::string&
}
int32_t ewol::resource::FontFreeType::getHeight(int32_t _fontSize) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
return _fontSize*1.43f; // this is a really "magic" number ...
}
float ewol::resource::FontFreeType::getSizeWithHeight(float _fontHeight) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
return _fontHeight*0.6993f; // this is a really "magic" number ...
}
bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if(false == m_init) {
return false;
}
@ -176,7 +176,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
ivec2 _glyphPosition,
ewol::GlyphProperty& _property,
int8_t _posInImage) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if(false == m_init) {
return false;
}
@ -238,7 +238,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::ImageMono& _imageOut,
int32_t _fontSize,
ewol::GlyphProperty& _property,
int32_t _borderSize) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if(false == m_init) {
return false;
}
@ -282,7 +282,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::ImageMono& _imageOut,
void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, std::vector<ewol::GlyphProperty>& listGlyph) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if(m_init == false) {
return;
}
@ -316,7 +316,7 @@ void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, std::vector
void ewol::resource::FontFreeType::display() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if(m_init == false) {
return;
}

View File

@ -26,12 +26,12 @@ ewol::resource::TextureFile::TextureFile() {
}
void ewol::resource::TextureFile::init() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
ewol::resource::Texture::init();
}
void ewol::resource::TextureFile::init(std::string _genName, const std::string& _tmpfileName, const ivec2& _size) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
ewol::resource::Texture::init(_genName);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpfileName=" << _tmpfileName << " size=" << _size);
if (egami::load(m_data, _tmpfileName, _size) == false) {

View File

@ -24,12 +24,12 @@ ewol::resource::ImageDF::ImageDF() {
void ewol::resource::ImageDF::init() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
ewol::resource::Texture::init();
}
void ewol::resource::ImageDF::init(std::string _genName, const std::string& _tmpfileName, const ivec2& _size) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
ewol::resource::Texture::init(_genName);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpfileName=" << _tmpfileName << " size=" << _size);
if (false == egami::load(m_data, _tmpfileName, _size)) {
@ -54,7 +54,7 @@ void ewol::resource::ImageDF::init(std::string _genName, const std::string& _tmp
void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
int32_t size = _input.getSize().x() * _input.getSize().y();
std::vector<short> xdist(size);
std::vector<short> ydist(size);

View File

@ -55,7 +55,7 @@ ewol::resource::Texture::~Texture() {
//#include <egami/wrapperBMP.h>
bool ewol::resource::Texture::updateContext() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex, std11::defer_lock);
std::unique_lock<std::recursive_mutex> lock(m_mutex, std::defer_lock);
if (lock.try_lock() == false) {
//Lock error ==> try later ...
return false;
@ -94,7 +94,7 @@ bool ewol::resource::Texture::updateContext() {
}
void ewol::resource::Texture::removeContext() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (true == m_loaded) {
// Request remove texture ...
EWOL_INFO("TEXTURE: Rm [" << getId() << "] texId=" << m_texId);
@ -104,19 +104,19 @@ void ewol::resource::Texture::removeContext() {
}
void ewol::resource::Texture::removeContextToLate() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_loaded = false;
m_texId=0;
}
void ewol::resource::Texture::flush() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// request to the manager to be call at the next update ...
getManager().update(std::dynamic_pointer_cast<gale::Resource>(shared_from_this()));
}
void ewol::resource::Texture::setImageSize(ivec2 _newSize) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
_newSize.setValue( nextP2(_newSize.x()), nextP2(_newSize.y()) );
m_data.resize(_newSize);
}

View File

@ -47,7 +47,7 @@ ewol::resource::TexturedFont::TexturedFont() {
}
void ewol::resource::TexturedFont::init(const std::string& _fontName) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
ewol::resource::Texture::init(_fontName);
EWOL_DEBUG("Load font : '" << _fontName << "'" );
@ -237,7 +237,7 @@ ewol::resource::TexturedFont::~TexturedFont() {
}
bool ewol::resource::TexturedFont::addGlyph(const char32_t& _val) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
bool hasChange = false;
// for each font :
for (int32_t iii=0; iii<4 ; iii++) {
@ -306,7 +306,7 @@ bool ewol::resource::TexturedFont::addGlyph(const char32_t& _val) {
}
int32_t ewol::resource::TexturedFont::getIndex(char32_t _charcode, const enum ewol::font::mode _displayMode) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (_charcode < 0x20) {
return 0;
} else if (_charcode < 0x80) {
@ -333,7 +333,7 @@ int32_t ewol::resource::TexturedFont::getIndex(char32_t _charcode, const enum ew
}
ewol::GlyphProperty* ewol::resource::TexturedFont::getGlyphPointer(const char32_t& _charcode, const enum ewol::font::mode _displayMode) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
//EWOL_DEBUG("Get glyph property for mode: " << _displayMode << " == > wrapping index : " << m_modeWraping[_displayMode]);
int32_t index = getIndex(_charcode, _displayMode);
if( index < 0

View File

@ -80,7 +80,7 @@ void ewol::widget::Manager::focusKeep(const ewol::WidgetShared& _newWidget) {
return;
}
EWOL_VERBOSE("focusKeep=" << _newWidget->getId() );
//etk::log::displayBacktrace();
//elog::displayBacktrace();
auto focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (_newWidget == focusWidgetCurrent) {
// nothing to do ...

View File

@ -10,6 +10,6 @@
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("example");
static int32_t g_val = elog::registerInstance("example");
return g_val;
}

View File

@ -7,12 +7,12 @@
*/
#pragma once
#include <etk/log.h>
#include <elog/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)

View File

@ -10,6 +10,6 @@
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("example");
static int32_t g_val = elog::registerInstance("example");
return g_val;
}

View File

@ -7,12 +7,12 @@
*/
#pragma once
#include <etk/log.h>
#include <elog/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)

View File

@ -10,6 +10,6 @@
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("example");
static int32_t g_val = elog::registerInstance("example");
return g_val;
}

View File

@ -7,12 +7,12 @@
*/
#pragma once
#include <etk/log.h>
#include <elog/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)

View File

@ -13,7 +13,7 @@
#include <etk/Hash.h>
#include <etk/os/FSNode.h>
#include <etk/archive/Archive.h>
#include <etk/log.h>
#include <elog/log.h>
#include <etk/Color.h>
#include <etk/stdTools.h>
#include <string>
@ -29,8 +29,8 @@ int main(int argc, const char *argv[]) {
// init Google test :
::testing::InitGoogleTest(&argc, const_cast<char **>(argv));
// the only one init for etk:
//etk::log::setLevel(etk::log::logLevelVerbose);
etk::log::setLevel(etk::log::logLevelInfo);
//elog::setLevel(elog::logLevelVerbose);
elog::setLevel(elog::logLevelInfo);
etk::setArgZero(argv[0]);
etk::initDefaultFolder("ewol-test");
return RUN_ALL_TESTS();

View File

@ -184,15 +184,6 @@ void appl::MainWindows::onCallbackWidgetChange(int32_t _increment) {
*/
break;
}
m_subWidget = ewol::widget::Spin::create("name", std::string("plop"));
// wrong: m_subWidget = ewol::widget::SpinBase::create("name", std::string("plop"), 1521);
m_subWidget = ewol::widget::Spin::create("name", std::string("plop"),
"spin-mode", ewol::widget::spinPosition_RightRight);
return;
// create the widget with a xml generator (readable for test ...):
m_subWidget = ewol::widget::composerGenerateString(tmpConstruct);
if (m_subWidget != nullptr) {

View File

@ -10,6 +10,6 @@
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("test_ewol");
static int32_t g_val = elog::registerInstance("test_ewol");
return g_val;
}

View File

@ -7,7 +7,7 @@
*/
#pragma once
#include <etk/log.h>
#include <elog/log.h>
namespace appl {
int32_t getLogId();
@ -15,11 +15,11 @@ namespace appl {
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
#define APPL_BASE(info,data) \
do { \
if (info <= etk::log::getLevel(appl::getLogId())) { \
if (info <= elog::getLevel(appl::getLogId())) { \
std::stringbuf sb; \
std::ostream tmpStream(&sb); \
tmpStream << data; \
etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
elog::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
} \
} while(0)