define PIP_MICRO

detect AVR_GCC
add library.json
This commit is contained in:
Andrey
2022-01-14 14:37:51 +03:00
parent 1d9a39f792
commit 0504fa187e
6 changed files with 55 additions and 14 deletions

3
include_pip.py Normal file
View File

@@ -0,0 +1,3 @@
Import("env")
env.Append(CCFLAGS=["-Ilib/pip/libs/main/core", "-Ilib/pip/libs/main/containers", "-Ilib/pip/libs/main/introspection"])

29
library.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "PIP",
"version": "2.33.0",
"keywords": "pip",
"description": "Platform-Independent Primitives",
"repository":
{
"type": "git",
"url": "https://git.shs.tools/SHS/pip.git"
},
"frameworks": "*",
"platforms": "*",
"dependencies": {"mike-matera/ArduinoSTL": "^1.3.2"},
"build":
{
"srcDir": "libs/main",
"srcFilter": [
"+<core/*.cpp>",
"+<core/*.h>",
"+<containers/*.cpp>",
"+<containers/*.h>"
],
"flags": [
"-std=c++11",
"-DPIP_MICRO"
],
"extraScript": "include_pip.py"
}
}

View File

@@ -28,10 +28,12 @@
#include "picout.h" #include "picout.h"
#include "piintrospection_containers.h" #include "piintrospection_containers.h"
#ifdef MAC_OS #ifndef PIP_MICRO
# include <stdlib.h> # ifdef MAC_OS
#else # include <stdlib.h>
# include <malloc.h> # else
# include <malloc.h>
# endif
#endif #endif
#include <initializer_list> #include <initializer_list>
#include <type_traits> #include <type_traits>

View File

@@ -31,8 +31,6 @@
#include "pip_export.h" #include "pip_export.h"
#include "pip_defs.h" #include "pip_defs.h"
#include "string.h" #include "string.h"
#include <limits>
//! Meta-information section for any entity. //! Meta-information section for any entity.
//! Parsing by \a pip_cmg and can be accessed by \a PICodeInfo. //! Parsing by \a pip_cmg and can be accessed by \a PICodeInfo.
//! Contains sequence of key=value pairs, e.g. //! Contains sequence of key=value pairs, e.g.
@@ -119,9 +117,14 @@
#endif //DOXYGEN #endif //DOXYGEN
#ifdef CC_AVR_GCC
# include <ArduinoSTL.h>
#endif
#include <functional> #include <functional>
#include <cstddef> #include <cstddef>
#include <cassert>
#include <limits>
#ifdef WINDOWS #ifdef WINDOWS
# ifdef CC_VC # ifdef CC_VC
# define SHUT_RDWR 2 # define SHUT_RDWR 2
@@ -162,7 +165,6 @@
#ifdef NDEBUG #ifdef NDEBUG
# undef NDEBUG # undef NDEBUG
#endif #endif
#include <cassert>
#ifndef assert #ifndef assert
# define assert(x) # define assert(x)
# define assertm(exp, msg) # define assertm(exp, msg)
@@ -364,7 +366,7 @@ inline bool piCompareBinary(const void * f, const void * s, size_t size) {
*/ */
template<typename T> template<typename T>
inline bool piCompare(const T & a, const T & b, const T & epsilon = std::numeric_limits<T>::epsilon()) { inline bool piCompare(const T & a, const T & b, const T & epsilon = std::numeric_limits<T>::epsilon()) {
return std::abs(a - b) <= epsilon; return piAbs(a - b) <= epsilon;
} }
/*! @brief Templated function return round of float falue /*! @brief Templated function return round of float falue
@@ -499,13 +501,13 @@ template<typename T> inline void piLetobe(T * v) {piLetobe(v, sizeof(T));}
template<typename T> inline T piLetobe(const T & v) {T tv(v); piLetobe(&tv, sizeof(T)); return tv;} template<typename T> inline T piLetobe(const T & v) {T tv(v); piLetobe(&tv, sizeof(T)); return tv;}
// specialization // specialization
template<> inline ushort piLetobe(const ushort & v) {return (v << 8) | (v >> 8);} template<> inline uint16_t piLetobe(const uint16_t & v) {return (v << 8) | (v >> 8);}
template<> inline uint piLetobe(const uint & v) {return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000);} template<> inline uint32_t piLetobe(const uint32_t & v) {return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000);}
template<> inline float piLetobe(const float & v) { template<> inline float piLetobe(const float & v) {
union _pletobe_f { union _pletobe_f {
_pletobe_f(const float &f_) {f = f_;} _pletobe_f(const float &f_) {f = f_;}
float f; float f;
uint v; uint32_t v;
}; };
_pletobe_f a(v); _pletobe_f a(v);
a.v = (a.v >> 24) | ((a.v >> 8) & 0xFF00) | ((a.v << 8) & 0xFF0000) | ((a.v << 24) & 0xFF000000); a.v = (a.v >> 24) | ((a.v >> 8) & 0xFF00) | ((a.v << 8) & 0xFF0000) | ((a.v << 24) & 0xFF000000);

View File

@@ -26,8 +26,9 @@
#ifdef PIP_STD_IOSTREAM #ifdef PIP_STD_IOSTREAM
# include <iostream> # include <iostream>
#endif #endif
#include <atomic> #ifndef PIP_MICRO
# include <atomic>
#endif
class PIMutex; class PIMutex;
class PIMutexLocker; class PIMutexLocker;

View File

@@ -84,6 +84,10 @@
# define CC_OTHER # define CC_OTHER
#endif #endif
#ifdef __AVR__
# define CC_AVR_GCC
#endif
#ifdef WINDOWS #ifdef WINDOWS
# ifdef CC_GCC # ifdef CC_GCC
# define typeof __typeof # define typeof __typeof