diff --git a/etk/Char.cpp b/etk/Char.cpp index cc864d6..eafd3b6 100644 --- a/etk/Char.cpp +++ b/etk/Char.cpp @@ -7,7 +7,6 @@ */ #include -#include etk::Char::Char(void) { diff --git a/etk/MessageFifo.h b/etk/MessageFifo.h index b7ec2a1..196d934 100644 --- a/etk/MessageFifo.h +++ b/etk/MessageFifo.h @@ -31,7 +31,7 @@ namespace etk // nothing to do ... }; - bool Wait(MY_TYPE &data) + bool Wait(MY_TYPE &_data) { m_mutex.Lock(); // Check if data is not previously here @@ -43,7 +43,7 @@ namespace etk // End Waiting message : if (0 #include -etk::BaseNoise::BaseNoise(ivec2 size, float min, float max) : - m_data(size.x()*size.y()), - m_size(size) +etk::BaseNoise::BaseNoise(ivec2 _size, float _min, float _max) : + m_data(_size.x()*_size.y()), + m_size(_size) { - m_data.ReSize(size.x()*size.y(), 0); + m_data.ReSize(_size.x()*_size.y(), 0); for(int32_t iii=0; iii m_data; ivec2 m_size; public: - BaseNoise(ivec2 size, float min, float max); + BaseNoise(ivec2 _size, float _min, float _max); ~BaseNoise(void); - float Get(int32_t x, int32_t y) const; + float Get(int32_t _x, int32_t _y) const; }; class Noise { @@ -40,13 +40,13 @@ namespace etk { etk::Vector m_data; ivec2 m_size; noise_te m_type; - float smoothNoise(float x, float y, const etk::BaseNoise& noise); - float turbulence(float x, float y, float size, const etk::BaseNoise& noise); - float turbulenceNoSmooth(float x, float y, float size, const etk::BaseNoise& noise); + float smoothNoise(float _x, float _y, const etk::BaseNoise& _noise); + float turbulence(float _x, float _y, float _size, const etk::BaseNoise& _noise); + float turbulenceNoSmooth(float _x, float _y, float _size, const etk::BaseNoise& _noise); public: - Noise(noise_te type, ivec2 size, int32_t depth); + Noise(noise_te _type, ivec2 _size, int32_t _depth); ~Noise(void); - float Get(int32_t x, int32_t y) const; + float Get(int32_t _x, int32_t _y) const; }; }; diff --git a/etk/RegExp.h b/etk/RegExp.h index 283b1f5..4abe1c2 100644 --- a/etk/RegExp.h +++ b/etk/RegExp.h @@ -11,7 +11,6 @@ #include #include -#include #include #include diff --git a/etk/UString.cpp b/etk/UString.cpp index 1ef14c5..492f031 100644 --- a/etk/UString.cpp +++ b/etk/UString.cpp @@ -7,7 +7,6 @@ */ #include -#include #include #include diff --git a/etk/Vector.h b/etk/Vector.h index 9139d38..241aece 100644 --- a/etk/Vector.h +++ b/etk/Vector.h @@ -11,7 +11,6 @@ #include #include -#include #undef __class__ #define __class__ "etk::Vector" diff --git a/etk/os/Memory.cpp b/etk/os/Memory.cpp deleted file mode 100644 index 82b36ad..0000000 --- a/etk/os/Memory.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#include -#include - -// General -#if ETK_MEMORY_CHECKER > 0 - -void etk::MemFree( void * pointerData, const char * variableName, const char * functionName, int32_t line, const char * fileName ) -{ - TK_CRITICAL(" MEM FREE is not written ==> TODO..."); - if (NULL != pointerData) { - free(pointerData); - } -} - -void * etk::MemMalloc( size_t num, size_t size, uint8_t init, const char * variableName, const char * functionName, int32_t line, const char * fileName ) -{ - TK_CRITICAL(" MEM ALLOCATOR is not written ==> TODO..."); - return calloc(num, size); -} - -void etk::MemShowLogs( void ) -{ - TK_CRITICAL(" MEM DISPLAY is not written ==> TODO..."); -} - -#endif - diff --git a/etk/os/Memory.h b/etk/os/Memory.h deleted file mode 100644 index 6206aaa..0000000 --- a/etk/os/Memory.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __ETK_TOOLS_MEMORY_H__ -#define __ETK_TOOLS_MEMORY_H__ - -#ifndef ETK_MEMORY_CHECKER -#define ETK_MEMORY_CHECKER 0 -#endif - -// General -#if ETK_MEMORY_CHECKER > 0 -namespace etk { - void MemFree( void * pointerData, const char * variableName, const char * functionName, int32_t line, const char * fileName ); - void * MemMalloc( size_t num, size_t size, uint8_t init, const char * variableName, const char * functionName, int32_t line, const char * fileName ); - void MemShowLogs( void ); -}; -# define ETK_MALLOC(pointerData, nbElements, dataType) do { \ - pointerData = (dataType *)etk::MemMalloc( (nbElements), sizeof(dataType), 0, #pointerData, __func__, __LINE__, __FILE__); \ - }while(0) -# define ETK_MALLOC_CAST(pointerData, nbElements, dataType, cast) do { \ - pointerData = (cast)etk::MemMalloc( (nbElements), sizeof(dataType), 0, #pointerData, __func__, __LINE__, __FILE__); \ - }while(0) -# define ETK_CALLOC(pointerData, nbElements, dataType) do { \ - pointerData = (dataType *)etk::MemMalloc( (nbElements), sizeof(dataType), 1, #pointerData, __func__, __LINE__, __FILE__); \ - }while(0) -# define ETK_CALLOC_CAST(pointerData, nbElements, dataType, cast) do { \ - pointerData = (cast)etk::MemMalloc( (nbElements), sizeof(dataType), 1, #pointerData, __func__, __LINE__, __FILE__); \ - }while(0) -# define ETK_FREE(pointerData) do { \ - etk::MemFree( (pointerData) , #pointerData, __func__, __LINE__, __FILE__); \ - (pointerData) = NULL; \ - }while(0) -# define ETK_MEM_SHOW_LOG() do { \ - etk::MemShowLogs(); \ - }while(0) -#else - -# define ETK_MALLOC(pointerData, nbElements, dataType) do { \ - (pointerData) = (dataType *)malloc( (nbElements) * sizeof(dataType) ); \ - }while(0) - -# define ETK_MALLOC_CAST(pointerData, nbElements, dataType, cast) do { \ - (pointerData) = (cast)malloc( (nbElements) * sizeof(dataType) ); \ - }while(0) - -# define ETK_CALLOC(pointerData, nbElements, dataType) do { \ - (pointerData) = (dataType *)calloc( (nbElements), sizeof(dataType) ); \ - }while(0) - -# define ETK_CALLOC_CAST(pointerData, nbElements, dataType, cast) do { \ - (pointerData) = (cast)calloc( (nbElements), sizeof(dataType) ); \ - }while(0) - -# define ETK_REALLOC(pointerData, nbElements, dataType) do { \ - (pointerData) = (dataType *)realloc( (pointerData), (nbElements)* sizeof(dataType) ); \ - }while(0) - -# define ETK_REALLOC_CAST(pointerData, nbElements, dataType, cast) do { \ - (pointerData) = (cast)realloc( (pointerData), (nbElements) * sizeof(dataType) ); \ - }while(0) - -# define ETK_FREE(pointerData) do { \ - free( pointerData ); \ - (pointerData) = NULL; \ - }while(0) - -# define ETK_MEM_SHOW_LOG() do { \ - TK_DEBUG("No Memory check availlable"); \ - }while(0) -#endif - - -#endif - diff --git a/etk/os/Semaphore.Generic.cpp b/etk/os/Semaphore.Generic.cpp index 0b4357f..10bbfe7 100644 --- a/etk/os/Semaphore.Generic.cpp +++ b/etk/os/Semaphore.Generic.cpp @@ -11,7 +11,7 @@ #include #include -etk::Semaphore::Semaphore(uint32_t nbBasicElement, uint32_t nbMessageMax) +etk::Semaphore::Semaphore(uint32_t _nbBasicElement, uint32_t _nbMessageMax) { // create interface mutex : int ret = pthread_mutex_init(&m_mutex, NULL); @@ -23,8 +23,8 @@ etk::Semaphore::Semaphore(uint32_t nbBasicElement, uint32_t nbMessageMax) ret = pthread_mutex_destroy(&m_mutex); TK_ASSERT(ret == 0, "Error destroying Mutex ..."); } - m_maximum = nbMessageMax; - m_data = nbBasicElement; + m_maximum = _nbMessageMax; + m_data = _nbBasicElement; } @@ -72,7 +72,7 @@ void etk::Semaphore::Wait(void) } -bool etk::Semaphore::Wait(uint32_t timeOutInUs) +bool etk::Semaphore::Wait(uint32_t _timeOutInUs) { pthread_mutex_lock(&m_mutex); if(m_data == 0) { @@ -80,7 +80,7 @@ bool etk::Semaphore::Wait(uint32_t timeOutInUs) struct timespec ts; gettimeofday(&tp,NULL); uint64_t totalTimeUS = tp.tv_sec * 1000000 + tp.tv_usec; - totalTimeUS += timeOutInUs; + totalTimeUS += _timeOutInUs; ts.tv_sec = totalTimeUS / 1000000; ts.tv_nsec = (totalTimeUS%1000000) * 1000; int ret = pthread_cond_timedwait(&m_condition, &m_mutex, &ts); diff --git a/etk/os/Semaphore.Windows.cpp b/etk/os/Semaphore.Windows.cpp index 0c13529..4b36a23 100644 --- a/etk/os/Semaphore.Windows.cpp +++ b/etk/os/Semaphore.Windows.cpp @@ -9,10 +9,10 @@ #include #include -etk::Semaphore::Semaphore(uint32_t nbBasicElement, uint32_t nbMessageMax) +etk::Semaphore::Semaphore(uint32_t _nbBasicElement, uint32_t _nbMessageMax) { // create interface mutex : - m_semaphore = CreateSemaphore(NULL, nbBasicElement, nbMessageMax, NULL); + m_semaphore = CreateSemaphore(NULL, _nbBasicElement, _nbMessageMax, NULL); TK_ASSERT(m_semaphore != 0, "Error creating SEMAPHORE ..."); } @@ -41,9 +41,9 @@ void etk::Semaphore::Wait(void) } -bool etk::Semaphore::Wait(uint32_t timeOutInUs) +bool etk::Semaphore::Wait(uint32_t _timeOutInUs) { - DWORD result = WaitForSingleObject(m_semaphore, timeOutInUs); + DWORD result = WaitForSingleObject(m_semaphore, _timeOutInUs); if (result == WAIT_FAILED) { TK_ERROR("Failed to wait for semaphore "); return false; diff --git a/etk/os/Semaphore.cpp b/etk/os/Semaphore.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/etk/os/Semaphore.h b/etk/os/Semaphore.h index b5511a1..da28cf1 100644 --- a/etk/os/Semaphore.h +++ b/etk/os/Semaphore.h @@ -31,13 +31,13 @@ namespace etk uint32_t m_maximum; #endif public: - Semaphore(uint32_t nbBasicElement=0, uint32_t nbMessageMax=1); + Semaphore(uint32_t _nbBasicElement=0, uint32_t _nbMessageMax=1); ~Semaphore(void); uint32_t GetCount(void); void Post(void); void Wait(void); // wait with a timeout in us; return true if get the semaphore - bool Wait(uint32_t timeOutInUs); + bool Wait(uint32_t _timeOutInUs); }; }; diff --git a/etk/tool.cpp b/etk/tool.cpp index 59e54b1..5557a8d 100644 --- a/etk/tool.cpp +++ b/etk/tool.cpp @@ -14,42 +14,42 @@ #include #include -float etk::tool::frand(float a, float b) +float etk::tool::frand(float _a, float _b) { - return ( rand()/(float)RAND_MAX ) * (b-a) + a; + return ( rand()/(float)RAND_MAX ) * (_b-_a) + _a; } -int32_t etk::tool::irand(int32_t a, int32_t b) +int32_t etk::tool::irand(int32_t _a, int32_t _b) { - return (int32_t)(( rand()/(float)RAND_MAX ) * ((float)b-(float)a) + (float)a); + return (int32_t)(( rand()/(float)RAND_MAX ) * ((float)_b-(float)_a) + (float)_a); } -void etk::tool::SortList(etk::Vector &m_listDirectory) +void etk::tool::SortList(etk::Vector &_list) { - etk::Vector tmpList = m_listDirectory; - m_listDirectory.Clear(); + etk::Vector tmpList = _list; + _list.Clear(); for(int32_t iii=0; iii *m_listDirectory[jjj]) { + if (*tmpList[iii] > *_list[jjj]) { findPos = jjj+1; } } //EWOL_DEBUG("position="<= 'A') { in1 = in1 - 'A' + 'a'; @@ -62,53 +62,53 @@ bool etk::tool::strnCmpNoCase(const char * input1, const char * input2, int32_t } } iii++; - input1++; - input2++; + _input1++; + _input2++; } return true; } -etk::UString etk::tool::SimplifyPath(etk::UString input) +etk::UString etk::tool::SimplifyPath(etk::UString _input) { - int32_t findStartPos = input.FindForward('/') + 1; - int32_t findPos = input.FindForward('/', findStartPos); + int32_t findStartPos = _input.FindForward('/') + 1; + int32_t findPos = _input.FindForward('/', findStartPos); //TK_DEBUG("Siplify : \"" << input << "\""); int32_t preventBadCode = 0; while (findPos!=-1) { //TK_DEBUG(" string=\"" << input << "\""); //TK_DEBUG(" '/' @" << findPos); - if (input.Size()5000) { TK_CRITICAL("ERROR when getting the small path ... this is loop prevention..."); @@ -119,16 +119,16 @@ etk::UString etk::tool::SimplifyPath(etk::UString input) // for the target that supported the Realpath system : char buf[MAX_FILE_NAME]; memset(buf, 0, MAX_FILE_NAME); - char * ok = realpath(input.c_str(), buf); + char * ok = realpath(_input.c_str(), buf); if (!ok) { TK_ERROR("Error to get the real path"); - input = "/"; + _input = "/"; } else { - input = buf; + _input = buf; } #endif //TK_DEBUG(" ==> \"" << input << "\""); - return input; + return _input; } diff --git a/etk/tool.h b/etk/tool.h index 42de4c1..c847e1a 100644 --- a/etk/tool.h +++ b/etk/tool.h @@ -14,12 +14,12 @@ namespace etk { namespace tool { - float frand(float a, float b); - int32_t irand(int32_t a, int32_t b); + float frand(float _a, float _b); + int32_t irand(int32_t _a, int32_t _b); - void SortList(etk::Vector &m_listDirectory); - bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen); - etk::UString SimplifyPath(etk::UString input); + void SortList(etk::Vector& _list); + bool strnCmpNoCase(const char* _input1, const char* _input2, int32_t _maxLen); + etk::UString SimplifyPath(etk::UString _input); }; }; diff --git a/lutin_etk.py b/lutin_etk.py index 566c9db..aeb92a4 100644 --- a/lutin_etk.py +++ b/lutin_etk.py @@ -25,7 +25,6 @@ def Create(target): 'etk/math/Vector3D.cpp', 'etk/os/FSNode.cpp', 'etk/os/FSNodeRight.cpp', - 'etk/os/Memory.cpp', 'etk/archive/Archive.cpp', 'etk/archive/Zip.cpp'])