compiled for esp32

This commit is contained in:
2022-01-15 14:54:36 +03:00
parent c9e329d27d
commit 86130d7105
8 changed files with 60 additions and 46 deletions

View File

@@ -1,6 +1,5 @@
{
"name": "PIP",
"version": "2.33.0",
"keywords": "pip",
"description": "Platform-Independent Primitives",
"repository":
@@ -15,8 +14,11 @@
{
"srcFilter": [
"+<libs/main/core/*.cpp>",
"+<libs/main/containers/*.cpp>"
"+<libs/main/containers/*.cpp>",
"+<libs/main/math/*.cpp>",
"+<libs/main/thread/*.cpp>"
],
"extraScript": "platformio_pre.py"
"extraScript": "platformio_pre.py",
"flags": "-DPIP_FREERTOS"
}
}

View File

@@ -32,7 +32,9 @@ class PIMutexLocker;
class PIObject;
class PIString;
class PIByteArray;
#ifndef MICRO_PIP
class PIInit;
#endif
class PIChar;
class PICout;

View File

@@ -19,15 +19,15 @@
#include "piincludes_p.h"
#include "piinit.h"
#ifndef MICRO_PIP
#include "pitime.h"
#include "pisignals.h"
#include "piobject.h"
#include "pisysteminfo.h"
#include "piresourcesstorage.h"
#include "pidir.h"
#ifndef MICRO_PIP
# include "piprocess.h"
#endif
#include "piprocess.h"
#ifdef ESP_PLATFORM
# include "esp_system.h"
#endif
@@ -49,9 +49,7 @@ void __PISetTimerResolution() {
}
#else
# include <pwd.h>
# ifndef MICRO_PIP
# include <sys/utsname.h>
# endif
# include <sys/utsname.h>
# include <pthread.h>
# ifdef BLACKBERRY
# include <signal.h>
@@ -84,7 +82,6 @@ ULONG prev_res;
bool delete_locs;
PRIVATE_DEFINITION_END(PIInit)
#ifndef MICRO_PIP
void __sighandler__(PISignals::Signal s) {
//piCout << Hex << int(s);
if (s == PISignals::StopTTYInput || s == PISignals::StopTTYOutput)
@@ -92,7 +89,6 @@ void __sighandler__(PISignals::Signal s) {
if (s == PISignals::UserDefined1)
dumpApplicationToFile(PIDir::home().path() + PIDir::separator + PIStringAscii("_PIP_DUMP_") + PIString::fromNumber(PIProcess::currentPID()));
}
#endif
#ifdef ANDROID
@@ -106,12 +102,11 @@ PIInit::PIInit() {
file_charset = 0;
PISystemInfo * sinfo = PISystemInfo::instance();
sinfo->execDateTime = PIDateTime::current();
#ifndef MICRO_PIP
setFileCharset("UTF-8");
# ifndef ANDROID
#ifndef ANDROID
PISignals::setSlot(__sighandler__);
PISignals::grabSignals(PISignals::UserDefined1);
# ifndef WINDOWS
# ifndef WINDOWS
PISignals::grabSignals(PISignals::StopTTYInput | PISignals::StopTTYOutput);
sigset_t ss;
sigemptyset(&ss);
@@ -128,7 +123,7 @@ PIInit::PIInit() {
break;
}
}
# else //WINDOWS
# else //WINDOWS
// OS version
DWORD dwVersion = GetVersion();
DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
@@ -154,33 +149,33 @@ PIInit::PIInit() {
setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtSetTimerResolution");
__PISetTimerResolution();
}
# endif //WINDOWS
# ifdef HAS_LOCALE
# endif //WINDOWS
# ifdef HAS_LOCALE
//cout << "has locale" << endl;
if (currentLocale_t != 0) {
freelocale(currentLocale_t);
currentLocale_t = 0;
}
currentLocale_t = newlocale(LC_ALL, setlocale(LC_ALL, ""), 0);
# else //HAS_LOCALE
# else //HAS_LOCALE
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");
# endif //HAS_LOCALE
# else //ANDROID
# endif //HAS_LOCALE
#else //ANDROID
struct sigaction actions;
memset(&actions, 0, sizeof(actions));
sigemptyset(&actions.sa_mask);
actions.sa_flags = 0;
actions.sa_handler = android_thread_exit_handler;
sigaction(SIGTERM, &actions, 0);
# endif //ANDROID
#endif //ANDROID
PRIVATE->delete_locs = false;
__syslocname__ = __sysoemname__ = 0;
__utf8name__ = const_cast<char*>("UTF-8");
# ifdef PIP_ICU
#ifdef PIP_ICU
UErrorCode e((UErrorCode)0);
u_init(&e);
# ifdef WINDOWS
# ifdef WINDOWS
PRIVATE->delete_locs = true;
CPINFOEX cpinfo;
int l = 0;
@@ -192,30 +187,30 @@ PIInit::PIInit() {
memset(__sysoemname__, 0, 256);
memcpy(__sysoemname__, "ibm-", 4);
memcpy(&(__sysoemname__[4]), cpinfo.CodePageName, l);
# else
# else
/*PIString en(getenv("LANG"));
if (!en.isEmpty())
en = en.mid(en.find(".") + 1);
PIByteArray enba = en.toByteArray();
memcpy(__syslocname__, enba.data(), enba.size_s());*/
# endif
# endif
//piCout << __syslocname__;
//piCout << __sysoemname__;
# else //PIP_ICU
# ifdef WINDOWS
#else //PIP_ICU
# ifdef WINDOWS
__syslocname__ = (char *)CP_ACP;
__sysoemname__ = (char *)CP_OEMCP;
__utf8name__ = (char *)CP_UTF8;
# endif
# endif //PIP_ICU
# ifdef MAC_OS
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock);
# endif
#endif //PIP_ICU
#ifdef MAC_OS
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock);
#endif
char cbuff[1024];
memset(cbuff, 0, 1024);
if (gethostname(cbuff, 1023) == 0)
sinfo->hostname = cbuff;
# ifdef WINDOWS
#ifdef WINDOWS
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
sinfo->processorsCount = sysinfo.dwNumberOfProcessors;
@@ -236,7 +231,7 @@ PIInit::PIInit() {
ulong unlen = 1023;
if (GetUserName(cbuff, &unlen) != 0)
sinfo->user = cbuff;
# else //WINDOWS
#else //WINDOWS
sinfo->processorsCount = piMaxi(1, int(sysconf(_SC_NPROCESSORS_ONLN)));
passwd * ps = getpwuid(getuid());
if (ps)
@@ -252,8 +247,7 @@ PIInit::PIInit() {
sinfo->OS_version = uns.release;
sinfo->architecture = uns.machine;
}
# endif //WINDOWS
#endif // MICRO_PIP
#endif //WINDOWS
#ifdef ESP_PLATFORM
esp_chip_info_t chip_info;
@@ -266,21 +260,21 @@ PIInit::PIInit() {
sinfo->OS_name =
#ifdef WINDOWS
PIStringAscii("Windows");
# elif defined(QNX)
#elif defined(QNX)
PIStringAscii("QNX");
# elif defined(MAC_OS)
#elif defined(MAC_OS)
PIStringAscii("MacOS");
# elif defined(ANDROID)
#elif defined(ANDROID)
PIStringAscii("Android");
# elif defined(FREE_BSD)
#elif defined(FREE_BSD)
PIStringAscii("FreeBSD");
# elif defined(FREERTOS)
#elif defined(FREERTOS)
PIStringAscii("FreeRTOS");
# elif defined(MICRO_PIP)
#elif defined(MICRO_PIP)
PIStringAscii("MicroPIP");
# else
#else
uns.sysname;
# endif
#endif
}
@@ -418,3 +412,6 @@ __PIInit_Initializer__::~__PIInit_Initializer__() {
__instance__ = 0;
}
}
#endif // MICRO_PIP

View File

@@ -23,6 +23,10 @@
#ifndef PIINIT_H
#define PIINIT_H
#include "pibase.h"
#ifndef MICRO_PIP
#include "piincludes.h"
@@ -70,4 +74,5 @@ private:
};
#endif // MICRO_PIP
#endif // PIINIT_H

View File

@@ -19,6 +19,7 @@
#include "pifft.h"
#ifndef MICRO_PIP
PIFFT_double::PIFFT_double() {
}
@@ -1883,3 +1884,5 @@ void PIFFT_float::ftbase_ffttwcalc(PIVector<float> * a, int aoffset, int n1, int
}
}
}
#endif // MICRO_PIP

View File

@@ -23,9 +23,12 @@
#ifndef PIFFT_H
#define PIFFT_H
#include "pip_fftw_export.h"
#include "pimathcomplex.h"
#ifndef MICRO_PIP
#include "pip_fftw_export.h"
class PIP_EXPORT PIFFT_double
{
public:
@@ -194,4 +197,6 @@ typedef PIFFTW<ldouble> PIFFTWld;
#endif
#endif // MICRO_PIP
#endif // PIFFT_H

View File

@@ -46,7 +46,7 @@ PIConditionVariable::PIConditionVariable() {
pthread_condattr_t condattr;
pthread_condattr_init(&condattr);
# ifndef MAC_OS
# if !defined(MAC_OS) && !defined(FREERTOS)
pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
# endif
memset(&(PRIVATE->nativeHandle), 0, sizeof(PRIVATE->nativeHandle));

View File

@@ -2,7 +2,7 @@ import os
import glob
import shutil
import re
# The list of items
files = glob.glob('libs/main/*/*.h', recursive=True)
files += glob.glob('libs/main/*.h', recursive=True)