1 Commits

Author SHA1 Message Date
34bc322b9b version 5.5.3
force using '.' instead of ',' in PIString::fromNumber()
2025-10-22 15:24:10 +03:00
19 changed files with 490 additions and 546 deletions

View File

@@ -6,7 +6,7 @@ endif()
project(PIP)
set(PIP_MAJOR 5)
set(PIP_MINOR 5)
set(PIP_REVISION 2)
set(PIP_REVISION 3)
set(PIP_SUFFIX )
set(PIP_COMPANY SHS)
set(PIP_DOMAIN org.SHS)
@@ -221,17 +221,10 @@ if (TESTS)
add_subdirectory(tests)
endif()
if(PIP_MICRO)
add_definitions(-DMICRO_PIP)
set(ICU OFF)
set(LOCAL ON)
endif()
if(PIP_FREERTOS)
add_definitions(-DPIP_FREERTOS)
endif()
if(DEFINED PICO_BOARD)
add_definitions(-DPICO_SDK)
message(STATUS "Building PIP for Pi Pico SDK ${PICO_SDK_VERSION_STRING}")
set(ICU OFF)
set(LOCAL ON)
endif()
# Check Bessel functions
@@ -336,7 +329,7 @@ if ((NOT DEFINED SHSTKPROJECT) AND (DEFINED ANDROID_PLATFORM))
#message("${ANDROID_NDK}/sysroot/usr/include")
endif()
if(NOT PIP_MICRO)
if(NOT PIP_FREERTOS)
if(WIN32)
if(${C_COMPILER} STREQUAL "cl.exe")
else()
@@ -357,7 +350,7 @@ if(NOT PIP_MICRO)
endif()
endif()
set(PIP_LIBS)
if(PIP_MICRO)
if(PIP_FREERTOS)
set(PIP_LIBS ${LIBS_MAIN})
else()
foreach(LIB_ ${LIBS_MAIN})
@@ -371,11 +364,11 @@ if(WIN32)
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
if(DEFINED ENV{QNX_HOST} OR PIP_MICRO)
if(DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32")
endif()
endif()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
set(PCRE2_BUILD_PCRE2_8 OFF)
set(PCRE2_BUILD_PCRE2_16 ON )
@@ -413,7 +406,7 @@ endif()
if (NOT CROSSTOOLS)
if (NOT PIP_MICRO)
if (NOT PIP_FREERTOS)
if (PIP_BUILD_CONSOLE)
pip_module(console "" "PIP console support" "" "" "")
@@ -631,7 +624,7 @@ string(REPLACE ";" "," PIP_EXPORTS_STR "${PIP_EXPORTS}")
target_compile_definitions(pip PRIVATE "PICODE_DEFINES=\"${PIP_EXPORTS_STR}\"")
if(NOT PIP_MICRO)
if(NOT PIP_FREERTOS)
# Auxiliary
if (NOT CROSSTOOLS)
@@ -708,7 +701,7 @@ if(NOT LOCAL)
install(TARGETS ${PIP_MODULES} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif()
else()
if(NOT PIP_MICRO)
if(NOT PIP_FREERTOS)
if(WIN32)
install(TARGETS ${PIP_MODULES} RUNTIME DESTINATION bin)
install(TARGETS ${PIP_MODULES} ARCHIVE DESTINATION lib)
@@ -736,7 +729,7 @@ endif()
#
# Build Documentation
#
if ((NOT PIP_MICRO) AND (NOT CROSSTOOLS))
if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS))
include(PIPDocumentation)
find_package(Doxygen)
if(DOXYGEN_FOUND)
@@ -805,7 +798,7 @@ message(" Type : ${CMAKE_BUILD_TYPE}")
if (NOT LOCAL)
message(" Install: \"${CMAKE_INSTALL_PREFIX}\"")
else()
if(NOT PIP_MICRO)
if(NOT PIP_FREERTOS)
message(" Install: local \"bin\", \"lib\" and \"include\"")
endif()
endif()
@@ -838,7 +831,7 @@ message(" Utilites:")
foreach(_util ${PIP_UTILS_LIST})
message(" * ${_util}")
endforeach()
if(NOT PIP_MICRO)
if(NOT PIP_FREERTOS)
message("")
message(" Using libraries:")
foreach(LIB_ ${LIBS_STATUS})

View File

@@ -71,7 +71,7 @@ if (NOT BUILDING_PIP)
find_library(PTHREAD_LIBRARY pthread)
find_library(UTIL_LIBRARY util)
set(_PIP_ADD_LIBS_ ${PTHREAD_LIBRARY} ${UTIL_LIBRARY})
if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT PIP_MICRO))
if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT PIP_FREERTOS))
find_library(RT_LIBRARY rt)
list(APPEND _PIP_ADD_LIBS_ ${RT_LIBRARY})
endif()

View File

@@ -17,7 +17,6 @@ list(APPEND COMPONENT_ADD_INCLUDEDIRS "../libs/main/thread")
set(COMPONENT_PRIV_REQUIRES pthread lwip freertos vfs spi_flash libsodium)
register_component()
set(PIP_FREERTOS ON)
set(PIP_MICRO ON)
set(LIB OFF)
set(INCLUDE_DIRS ${IDF_INCLUDE_DIRECTORIES})
list(APPEND INCLUDE_DIRS $ENV{IDF_PATH}/components/newlib/platform_include)

View File

@@ -178,9 +178,6 @@ PISystemTime uint64toST(uint64_t v) {
void PISystemMonitor::run() {
cur_tm.clear();
tbid.clear();
ProcessStats tstat;
tstat.ID = pID_;
#ifndef PIP_NO_THREADS
__PIThreadCollection * pitc = __PIThreadCollection::instance();
pitc->lock();
PIVector<PIThread *> tv = pitc->threads();
@@ -188,10 +185,12 @@ void PISystemMonitor::run() {
if (t->isPIObject()) tbid[t->tid()] = t->name();
pitc->unlock();
// piCout << tbid.keys().toType<uint>();
# ifdef FREERTOS
ProcessStats tstat;
tstat.ID = pID_;
#ifdef MICRO_PIP
for (auto * t: tv)
if (t->isPIObject()) gatherThread(t->tid());
# else // FREERTOS
#else
# ifndef WINDOWS
double delay_ms = delay_.toMilliseconds();
tbid[pID_] = "main";
@@ -211,7 +210,7 @@ void PISystemMonitor::run() {
tstat.cpu_load_user = 100.f * (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms;
cycle = 0;
// piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms;
# else // MAC_OS
# else
PRIVATE->file.seekToBegin();
PIString str = PIString::fromAscii(PRIVATE->file.readAll());
int si = str.find('(') + 1, fi = 0, cc = 1;
@@ -265,8 +264,8 @@ void PISystemMonitor::run() {
if (i.flags[PIFile::FileInfo::Dot] || i.flags[PIFile::FileInfo::DotDot]) continue;
gatherThread(i.name().toInt());
}
# endif // MAC_OS
# else // WINDOWS
# endif
# else
if (GetProcessMemoryInfo(PRIVATE->hProc, &PRIVATE->mem_cnt, sizeof(PRIVATE->mem_cnt)) != 0) {
tstat.physical_memsize = PRIVATE->mem_cnt.WorkingSetSize;
}
@@ -316,9 +315,8 @@ void PISystemMonitor::run() {
tstat.cpu_load_user = 0.f;
}
PRIVATE->tm.reset();
# endif // WINDOWS
# endif // FREERTOS
#endif // PIP_NO_THREADS
# endif
#endif
tstat.cpu_load_system = piClampf(tstat.cpu_load_system, 0.f, 100.f);
tstat.cpu_load_user = piClampf(tstat.cpu_load_user, 0.f, 100.f);

View File

@@ -18,8 +18,6 @@
*/
#include "pikbdlistener.h"
#ifndef MICRO_PIP
#include "piincludes_p.h"
#include "piliterals.h"
#include "piwaitevent_p.h"
@@ -589,5 +587,3 @@ void PIKbdListener::setActive(bool yes) {
#endif
}
}
#endif // MICRO_PIP

View File

@@ -26,10 +26,6 @@
#ifndef PIKBDLISTENER_H
#define PIKBDLISTENER_H
#include "pibase.h"
#ifndef MICRO_PIP
#include "pithread.h"
#include "pitime.h"
@@ -309,5 +305,4 @@ REGISTER_PIVARIANTSIMPLE(PIKbdListener::KeyEvent)
REGISTER_PIVARIANTSIMPLE(PIKbdListener::MouseEvent)
REGISTER_PIVARIANTSIMPLE(PIKbdListener::WheelEvent)
#endif // MICRO_PIP
#endif // PIKBDLISTENER_H

View File

@@ -18,7 +18,6 @@
*/
#include "piwaitevent_p.h"
#ifndef MICRO_PIP
#ifdef WINDOWS
// # ifdef _WIN32_WINNT
// # undef _WIN32_WINNT
@@ -152,5 +151,3 @@ void * PIWaitEvent::getEvent() const {
return nullptr;
#endif
}
#endif // MICRO_PIP

View File

@@ -20,8 +20,6 @@
#ifndef PIWAITEVENT_P_H
#define PIWAITEVENT_P_H
#ifndef MICRO_PIP
#include "pibase.h"
// clang-format off
#ifdef WINDOWS
@@ -67,5 +65,4 @@ private:
};
#endif // MICRO_PIP
#endif // PIWAITEVENT_P_H

View File

@@ -19,8 +19,6 @@
#include "piintrospection_server_p.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#include "pichunkstream.h"
#include "piinit.h"
#include "piobject.h"
@@ -172,5 +170,3 @@ void PIIntrospection::unpackObjects(PIByteArray & ba, PIVector<PIIntrospection::
objects.clear();
ba >> objects;
}
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)

View File

@@ -27,7 +27,6 @@
#include "piintrospection_threads_p.h"
#include "pisystemmonitor.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
class PIP_EXPORT PIIntrospection {
public:
@@ -169,5 +168,4 @@ BINARY_STREAM_READ(PIIntrospection::ObjectInfo) {
return s;
}
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#endif // PIINTROSPECTION_SERVER_P_H

View File

@@ -19,7 +19,6 @@
#include "piintrospection_threads_p.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
PIIntrospectionThreads::ThreadInfo::ThreadInfo() {
id = delay = 0;
@@ -79,5 +78,3 @@ void PIIntrospectionThreads::threadRunDone(PIThread * t, ullong us) {
ThreadInfo & ti(threads[t]);
ti.run_us = (ti.run_us * 0.8) + (us * 0.2); /// WARNING
}
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)

View File

@@ -20,10 +20,6 @@
#ifndef PIINTROSPECTION_THREADS_P_H
#define PIINTROSPECTION_THREADS_P_H
#include "pibase.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#include "pimap.h"
#include "pithread.h"
@@ -72,5 +68,4 @@ BINARY_STREAM_READ(PIIntrospectionThreads::ThreadInfo) {
return s;
}
#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#endif // PIINTROSPECTION_THREADS_P_H

View File

@@ -20,7 +20,7 @@
#include "pipropertystorage.h"
#include "piwaitevent_p.h"
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(PIP_NO_SOCKET)
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(MICRO_PIP)
# define PIP_CAN
#endif
#ifdef PIP_CAN
@@ -39,29 +39,25 @@
REGISTER_DEVICE(PICAN)
#ifdef PIP_CAN
PRIVATE_DEFINITION_START(PICAN)
PIWaitEvent event;
PRIVATE_DEFINITION_END(PICAN)
#endif
PICAN::PICAN(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(path, mode) {
setThreadedReadBufferSize(256);
setPath(path);
#ifdef PIP_CAN
can_id = 0;
sock = 0;
PRIVATE->event.create();
#endif
}
PICAN::~PICAN() {
stopAndWait();
close();
#ifdef PIP_CAN
PRIVATE->event.destroy();
#endif
}
@@ -168,9 +164,7 @@ int PICAN::readedCANID() const {
void PICAN::interrupt() {
#ifdef PIP_CAN
PRIVATE->event.interrupt();
#endif
}

View File

@@ -18,8 +18,6 @@
*/
#include "piethernet.h"
#ifndef PIP_NO_SOCKET
#include "piconfig.h"
#include "piconstchars.h"
#include "piincludes_p.h"
@@ -27,7 +25,7 @@
#include "pipropertystorage.h"
#include "pisysteminfo.h"
#include "pitranslator.h"
// clang-format off
#ifdef QNX
# include <arpa/inet.h>
# include <fcntl.h>
@@ -51,21 +49,21 @@
#else
# ifdef WINDOWS
# include <io.h>
# include <winsock2.h>
# include <iphlpapi.h>
# include <psapi.h>
# include <winsock2.h>
# include <ws2tcpip.h>
# define ip_mreqn ip_mreq
# define imr_address imr_interface
# else
# include <arpa/inet.h>
# include <fcntl.h>
# include <net/if.h>
# include <netdb.h>
# include <sys/ioctl.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <sys/ioctl.h>
# include <arpa/inet.h>
# include <sys/socket.h>
# include <netdb.h>
# include <net/if.h>
# if !defined(ANDROID) && !defined(LWIP)
# include <ifaddrs.h>
# endif
@@ -74,6 +72,7 @@
# endif
# endif
#endif
// clang-format on
#include "piwaitevent_p.h"
#include <errno.h>
@@ -197,7 +196,7 @@ void PIEthernet::construct() {
setMulticastTTL(1);
server_thread_.setData(this);
server_thread_.setName("_S.tcpserver"_a);
# ifdef LWIP
#ifdef MICRO_PIP
setThreadedReadBufferSize(512);
#else
setThreadedReadBufferSize(64_KiB);
@@ -1171,7 +1170,7 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
}
if (pAdapterInfo) HeapFree(GetProcessHeap(), 0, pAdapterInfo);
#else
# ifdef LWIP
# ifdef MICRO_PIP
# else
# ifdef ANDROID
struct ifconf ifc;
@@ -1283,7 +1282,7 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
PINetworkAddress PIEthernet::interfaceAddress(const PIString & interface_) {
# if defined(WINDOWS) || defined(LWIP)
#if defined(WINDOWS) || defined(MICRO_PIP)
piCout << "[PIEthernet] Not implemented, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
return PINetworkAddress();
#else
@@ -1487,5 +1486,3 @@ bool PIEthernet::ethIsWriteable(int sock) {
return ret == 0;
#endif
}
#endif // PIP_NO_SOCKET

View File

@@ -26,12 +26,9 @@
#ifndef PIETHERNET_H
#define PIETHERNET_H
#include "piiodevice.h"
#include "pinetworkaddress.h"
#ifndef PIP_NO_SOCKET
#ifdef ANDROID
struct
#else
@@ -539,5 +536,4 @@ inline bool operator!=(const PIEthernet::Interface & v0, const PIEthernet::Inter
return (v0.name != v1.name || v0.address != v1.address || v0.netmask != v1.netmask);
}
#endif // PIP_NO_SOCKET
#endif // PIETHERNET_H

View File

@@ -45,7 +45,7 @@
# include <utime.h>
#endif
#define S_IFHDN 0x40
#if defined(QNX) || defined(ANDROID) || defined(MICRO_PIP)
#if defined(QNX) || defined(ANDROID) || defined(FREERTOS)
# define _fopen_call_ fopen
# define _fseek_call_ fseek
# define _ftell_call_ ftell

View File

@@ -19,8 +19,6 @@
#include "piserial.h"
#ifndef MICRO_PIP
#include "piconfig.h"
#include "pidir.h"
#include "piincludes_p.h"
@@ -31,6 +29,9 @@
#include <errno.h>
#if defined(MICRO_PIP)
# define PISERIAL_NO_PINS
#endif
#if defined(PISERIAL_NO_PINS) || defined(WINDOWS)
# define TIOCM_LE 1
# define TIOCM_DTR 4
@@ -1317,5 +1318,3 @@ void PISerial::threadedReadBufferSizeChanged() {
// piCoutObj << "a" << ss.xmit_fifo_size;
#endif
}
#endif // MICRO_PIP

View File

@@ -51,14 +51,8 @@
#ifdef PIP_FREERTOS
# define FREERTOS
#endif
#ifdef MICRO_PIP
# ifndef FREERTOS
# define PIP_NO_THREADS
# endif
# ifndef LWIP
# define PIP_NO_SOCKET
# endif
# define PISERIAL_NO_PINS
#if defined(FREERTOS) || defined(PLATFORMIO)
# define MICRO_PIP
#endif
#ifndef WINDOWS
# ifndef QNX

View File

@@ -206,7 +206,10 @@ PIString PIString::dtos(const double num, char format, int precision) {
if (wr > 4) wr = 4;
f[2 + wr] = format;
f[3 + wr] = 0;
pisprintf(f, num);
char ch[256];
piZeroMemory(ch, 256);
snprintf(ch, 256, f, num);
return PIStringAscii(ch).replaceAll(',', '.');
}
#undef pisprintf