@litmusio/miravo-cli-linux-arm64 0.0.0-stage → 0.15.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +199 -0
- package/NOTICE +9 -0
- package/README.md +6 -2
- package/THIRD_PARTY_LICENSES.txt +15289 -0
- package/THIRD_PARTY_NOTICES.md +995 -0
- package/console-dist/assets/AnimatePresence-DWGUB15i.js +9 -0
- package/console-dist/assets/activity-DruTYzT1.js +1 -0
- package/console-dist/assets/api-V5Tf5xfh.js +57 -0
- package/console-dist/assets/arrow-up-right-DOENs04V.js +1 -0
- package/console-dist/assets/asset-detail-D_icTa2K.js +1 -0
- package/console-dist/assets/asset-detail-actions-DIYego9D.js +1 -0
- package/console-dist/assets/backup-power-Q84DVs_z.js +1 -0
- package/console-dist/assets/badge-CdRB4Nd_.js +1 -0
- package/console-dist/assets/boiler-s_q0j7rz.js +1 -0
- package/console-dist/assets/by-path-Cm2TEP7z.js +1 -0
- package/console-dist/assets/check-BTUv4z-H.js +1 -0
- package/console-dist/assets/chevron-down-CqA_2_CH.js +1 -0
- package/console-dist/assets/chevron-right-CVrgKBLR.js +1 -0
- package/console-dist/assets/chiller-r7DzAhJq.js +1 -0
- package/console-dist/assets/chunk-6KYCQHYJ-ga3Yekab.js +3 -0
- package/console-dist/assets/circle-x-BRkh0A1P.js +1 -0
- package/console-dist/assets/commercial-building-Cezt2R6W.js +1 -0
- package/console-dist/assets/compressor-ChZLMC94.js +1 -0
- package/console-dist/assets/console-panel-BnSjjW6l.js +1 -0
- package/console-dist/assets/dialog-BYkdndf9.js +1 -0
- package/console-dist/assets/district-heating-By_6QdGQ.js +1 -0
- package/console-dist/assets/dom-BxZbg3NX.js +1 -0
- package/console-dist/assets/download-CvjDP5mu.js +1 -0
- package/console-dist/assets/fira-code-cyrillic-ext-wght-normal-DhYMMuQd.woff2 +0 -0
- package/console-dist/assets/fira-code-cyrillic-wght-normal-Y3u8pIsh.woff2 +0 -0
- package/console-dist/assets/fira-code-greek-ext-wght-normal-wWus70Ix.woff2 +0 -0
- package/console-dist/assets/fira-code-greek-wght-normal-B2SviObF.woff2 +0 -0
- package/console-dist/assets/fira-code-latin-ext-wght-normal-Dvfvaomy.woff2 +0 -0
- package/console-dist/assets/fira-code-latin-wght-normal-CHoedHDv.woff2 +0 -0
- package/console-dist/assets/fira-code-symbols2-wght-normal-CE6EOz_n.woff2 +0 -0
- package/console-dist/assets/floor-page-DIUJBBhh.js +1 -0
- package/console-dist/assets/floor-page-E-0txA4z.css +1 -0
- package/console-dist/assets/format-YLUJ7AXt.js +1 -0
- package/console-dist/assets/genset-C6_EUoFo.js +1 -0
- package/console-dist/assets/index-BrlZMcSu.js +15 -0
- package/console-dist/assets/index-eZjXAdLh.css +2 -0
- package/console-dist/assets/loader-circle-w3T2fxvn.js +1 -0
- package/console-dist/assets/login-CpbaxAVs.js +136 -0
- package/console-dist/assets/not-found-CZjkulKD.js +1 -0
- package/console-dist/assets/pharma-cleanroom-CT2M_Mbh.js +1 -0
- package/console-dist/assets/preload-helper-7y9sWmk5.js +1 -0
- package/console-dist/assets/react-DRt7cCXI.js +1 -0
- package/console-dist/assets/rolldown-runtime-BWaJ3C7D.js +1 -0
- package/console-dist/assets/rtu-ByogcRPI.js +1 -0
- package/console-dist/assets/runtime-link-D88Db2wY.js +1 -0
- package/console-dist/assets/schibsted-grotesk-latin-ext-wght-normal-hsMS0n0O.woff2 +0 -0
- package/console-dist/assets/schibsted-grotesk-latin-wght-normal-Bb8VGrTG.woff2 +0 -0
- package/console-dist/assets/server-B0q1NVkV.js +1 -0
- package/console-dist/assets/shallow-mIK1Qu8X.js +1 -0
- package/console-dist/assets/smart-factory-gfMWfMWM.js +1 -0
- package/console-dist/assets/source-host-miravo-BW-SKMTe.js +1 -0
- package/console-dist/assets/stages-EYRT12Yp.js +1 -0
- package/console-dist/assets/status-DQYLUbXs.js +1 -0
- package/console-dist/assets/tank-Btg5piqB.js +1 -0
- package/console-dist/assets/tooltip-Dfmuq2yz.js +1 -0
- package/console-dist/assets/trash-2-BAh5-hxl.js +1 -0
- package/console-dist/assets/triangle-alert-3Ab-dBrN.js +1 -0
- package/console-dist/assets/use-engine-command-mutation-BmSUqrCp.js +1 -0
- package/console-dist/assets/use-transition-navigate-DIfW9U34.js +2 -0
- package/console-dist/assets/useQuery-yLeYL5Es.js +1 -0
- package/console-dist/assets/utils-D6wrZy-b.js +1 -0
- package/console-dist/assets/validation-DEb_QCoK.js +1 -0
- package/console-dist/assets/vendor-charts-Bquh2dWE.js +56 -0
- package/console-dist/assets/vendor-table-5YnGQUhO.js +4 -0
- package/console-dist/assets/vendor-ui-BGeFlRLR.js +1 -0
- package/console-dist/assets/water-treatment-DbSVGWoj.js +1 -0
- package/console-dist/icon.png +0 -0
- package/console-dist/index.html +53 -0
- package/console-dist/miravo-logo.webp +0 -0
- package/licenses/EPL-2.0.txt +80 -0
- package/licenses/GCC-exception-3.1.txt +33 -0
- package/licenses/GPL-2.0-only.txt +117 -0
- package/licenses/GPL-3.0-only.txt +232 -0
- package/licenses/LGPL-2.1-only.txt +176 -0
- package/licenses/MPL-2.0.txt +373 -0
- package/licenses/OFL-1.1.txt +93 -0
- package/licenses/overrides/@headlessui+vue@1.7.23.txt +24 -0
- package/licenses/overrides/@next+env@16.4.6.txt +24 -0
- package/licenses/overrides/@radix-ui+react-compose-refs@1.1.2.txt +24 -0
- package/licenses/overrides/@radix-ui+react-context@1.1.2.txt +24 -0
- package/licenses/overrides/@radix-ui+react-direction@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-id@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-callback-ref@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-escape-keydown@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-layout-effect@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-rect@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-size@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+rect@1.1.1.txt +24 -0
- package/licenses/overrides/@replit+codemirror-css-color-picker@6.3.0.txt +6 -0
- package/licenses/overrides/@scalar+openapi-types@0.8.0.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.10.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.7.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.9.txt +24 -0
- package/licenses/overrides/@scalar+postman-to-openapi@0.7.1.txt +24 -0
- package/licenses/overrides/@scalar+schemas@0.19.0.txt +24 -0
- package/licenses/overrides/@scalar+workspace-store@0.46.3.txt +24 -0
- package/licenses/overrides/@scalar+workspace-store@0.75.0.txt +24 -0
- package/licenses/overrides/assert-plus@1.0.0.txt +24 -0
- package/licenses/overrides/client-only@0.0.1.txt +24 -0
- package/licenses/overrides/embla-carousel-react@8.6.0.txt +24 -0
- package/licenses/overrides/embla-carousel-reactive-utils@8.6.0.txt +24 -0
- package/licenses/overrides/embla-carousel@8.6.0.txt +24 -0
- package/licenses/overrides/fastdom@1.0.12.txt +12 -0
- package/licenses/overrides/precond@0.2.3.txt +22 -0
- package/licenses/overrides/react-remove-scroll-bar@2.3.8.txt +24 -0
- package/licenses/overrides/strictdom@1.0.1.txt +12 -0
- package/licenses/overrides/victory-vendor@36.9.2.txt +33 -0
- package/licenses/runtime/Bun-1.4.3-LICENSE.md +85 -0
- package/licenses/runtime/ICU-78.1-LICENSE.txt +568 -0
- package/licenses/runtime/bun-components/boringssl.txt +238 -0
- package/licenses/runtime/bun-components/brotli.txt +19 -0
- package/licenses/runtime/bun-components/c-ares.txt +24 -0
- package/licenses/runtime/bun-components/highway.txt +371 -0
- package/licenses/runtime/bun-components/libarchive.txt +65 -0
- package/licenses/runtime/bun-components/libbase64.txt +28 -0
- package/licenses/runtime/bun-components/libdeflate.txt +22 -0
- package/licenses/runtime/bun-components/libjpeg-turbo.txt +147 -0
- package/licenses/runtime/bun-components/libspng.txt +25 -0
- package/licenses/runtime/bun-components/libuv.txt +19 -0
- package/licenses/runtime/bun-components/libwebp.txt +30 -0
- package/licenses/runtime/bun-components/llvm.txt +311 -0
- package/licenses/runtime/bun-components/lol-html.txt +27 -0
- package/licenses/runtime/bun-components/ls-hpack.txt +21 -0
- package/licenses/runtime/bun-components/ls-qpack.txt +21 -0
- package/licenses/runtime/bun-components/lsquic-chrome.txt +32 -0
- package/licenses/runtime/bun-components/lsquic.txt +21 -0
- package/licenses/runtime/bun-components/mimalloc.txt +21 -0
- package/licenses/runtime/bun-components/picohttpparser.txt +24 -0
- package/licenses/runtime/bun-components/simdutf-apache.txt +201 -0
- package/licenses/runtime/bun-components/simdutf-mit.txt +18 -0
- package/licenses/runtime/bun-components/tigerbeetle.txt +177 -0
- package/licenses/runtime/bun-components/tinycc.txt +504 -0
- package/licenses/runtime/bun-components/typescript-go.txt +55 -0
- package/licenses/runtime/bun-components/usockets.txt +201 -0
- package/licenses/runtime/bun-components/uucode.txt +30 -0
- package/licenses/runtime/bun-components/uwebsockets.txt +201 -0
- package/licenses/runtime/bun-components/xxhash.txt +31 -0
- package/licenses/runtime/bun-components/zlib-ng.txt +19 -0
- package/licenses/runtime/bun-components/zstd-copying.txt +339 -0
- package/licenses/runtime/bun-components/zstd.txt +30 -0
- package/licenses/runtime/musl-1.2.6-COPYRIGHT.txt +193 -0
- package/miravo +4 -0
- package/native/S7-NOTICES.txt +11 -0
- package/native/miravo-s7.node +0 -0
- package/native/s7-source/CMakeLists.txt +23 -0
- package/native/s7-source/NODE-SNAP7-LICENSE +24 -0
- package/native/s7-source/addon.cpp +124 -0
- package/native/s7-source/bridge.cpp +150 -0
- package/native/s7-source/node-api-headers/LICENSE +21 -0
- package/native/s7-source/node-api-headers/include/js_native_api.h +591 -0
- package/native/s7-source/node-api-headers/include/js_native_api_types.h +213 -0
- package/native/s7-source/node-api-headers/include/node_api.h +265 -0
- package/native/s7-source/node-api-headers/include/node_api_types.h +58 -0
- package/native/s7-source/node-api-windows.h +78 -0
- package/native/s7-source/snap7/HISTORY.txt +277 -0
- package/native/s7-source/snap7/gpl.txt +674 -0
- package/native/s7-source/snap7/lgpl-3.0.txt +165 -0
- package/native/s7-source/snap7/src/core/miravo_request_validation.h +72 -0
- package/native/s7-source/snap7/src/core/s7_client.cpp +503 -0
- package/native/s7-source/snap7/src/core/s7_client.h +104 -0
- package/native/s7-source/snap7/src/core/s7_firmware.h +1256 -0
- package/native/s7-source/snap7/src/core/s7_isotcp.cpp +541 -0
- package/native/s7-source/snap7/src/core/s7_isotcp.h +271 -0
- package/native/s7-source/snap7/src/core/s7_micro_client.cpp +3328 -0
- package/native/s7-source/snap7/src/core/s7_micro_client.h +364 -0
- package/native/s7-source/snap7/src/core/s7_partner.cpp +1178 -0
- package/native/s7-source/snap7/src/core/s7_partner.h +284 -0
- package/native/s7-source/snap7/src/core/s7_peer.cpp +121 -0
- package/native/s7-source/snap7/src/core/s7_peer.h +58 -0
- package/native/s7-source/snap7/src/core/s7_server.cpp +2161 -0
- package/native/s7-source/snap7/src/core/s7_server.h +261 -0
- package/native/s7-source/snap7/src/core/s7_text.cpp +788 -0
- package/native/s7-source/snap7/src/core/s7_text.h +49 -0
- package/native/s7-source/snap7/src/core/s7_types.h +1066 -0
- package/native/s7-source/snap7/src/lib/snap7.def +129 -0
- package/native/s7-source/snap7/src/lib/snap7_libmain.cpp +1196 -0
- package/native/s7-source/snap7/src/lib/snap7_libmain.h +201 -0
- package/native/s7-source/snap7/src/sys/snap_msgsock.cpp +958 -0
- package/native/s7-source/snap7/src/sys/snap_msgsock.h +339 -0
- package/native/s7-source/snap7/src/sys/snap_platform.h +152 -0
- package/native/s7-source/snap7/src/sys/snap_sysutils.cpp +73 -0
- package/native/s7-source/snap7/src/sys/snap_sysutils.h +39 -0
- package/native/s7-source/snap7/src/sys/snap_tcpsrvr.cpp +487 -0
- package/native/s7-source/snap7/src/sys/snap_tcpsrvr.h +247 -0
- package/native/s7-source/snap7/src/sys/snap_threads.cpp +162 -0
- package/native/s7-source/snap7/src/sys/snap_threads.h +45 -0
- package/native/s7-source/snap7/src/sys/sol_threads.h +208 -0
- package/native/s7-source/snap7/src/sys/unix_threads.h +228 -0
- package/native/s7-source/snap7/src/sys/win_threads.h +159 -0
- package/nodesets/.ignore +1 -0
- package/nodesets/1.02/FTNIR.NodeSet2.xml +819 -0
- package/nodesets/1.02/Opc.Ua.Adi.NodeSet2.xml +8301 -0
- package/nodesets/1.02/Opc.Ua.Di.NodeSet2.xml +1785 -0
- package/nodesets/Opc.ISA95.NodeSet2.xml +3589 -0
- package/nodesets/Opc.Ua.AMB.NodeSet2.xml +1395 -0
- package/nodesets/Opc.Ua.Adi.NodeSet2.xml +8301 -0
- package/nodesets/Opc.Ua.Adi.Types.xsd +104 -0
- package/nodesets/Opc.Ua.AutoID.NodeSet2.xml +6062 -0
- package/nodesets/Opc.Ua.CNC.NodeSet.xml +15875 -0
- package/nodesets/Opc.Ua.CommercialKitchenEquipment.NodeSet2.xml +12096 -0
- package/nodesets/Opc.Ua.Di.NodeSet2.xml +6042 -0
- package/nodesets/Opc.Ua.Di.Types.xsd +161 -0
- package/nodesets/Opc.Ua.Eumabois.Nodeset2.xml +2483 -0
- package/nodesets/Opc.Ua.Gds.NodeSet2.xml +8282 -0
- package/nodesets/Opc.Ua.Glass.NodeSet2.xml +5100 -0
- package/nodesets/Opc.Ua.IA.NodeSet2.xml +1782 -0
- package/nodesets/Opc.Ua.IOLink.NodeSet2.xml +4374 -0
- package/nodesets/Opc.Ua.IOLinkIODD.NodeSet2.xml +139 -0
- package/nodesets/Opc.Ua.IRDI.NodeSet2.xml +2243 -0
- package/nodesets/Opc.Ua.Ijt.Base.NodeSet2.xml +19459 -0
- package/nodesets/Opc.Ua.Ijt.Tightening.NodeSet2.xml +883 -0
- package/nodesets/Opc.Ua.LADS.NodeSet2.xml +7086 -0
- package/nodesets/Opc.Ua.MachineTool.NodeSet2.xml +7884 -0
- package/nodesets/Opc.Ua.MachineVision.NodeSet2.xml +17324 -0
- package/nodesets/Opc.Ua.Machinery.Jobs.Nodeset2.xml +1249 -0
- package/nodesets/Opc.Ua.Machinery.NodeSet2.xml +2099 -0
- package/nodesets/Opc.Ua.Machinery.ProcessValues.NodeSet2.xml +1858 -0
- package/nodesets/Opc.Ua.Machinery_Result.NodeSet2.xml +2640 -0
- package/nodesets/Opc.Ua.MetalForming.NodeSet2.xml +1577 -0
- package/nodesets/Opc.Ua.NodeSet2.xml +81975 -0
- package/nodesets/Opc.Ua.PADIM.NodeSet2.xml +14131 -0
- package/nodesets/Opc.Ua.PackML.NodeSet2.xml +3030 -0
- package/nodesets/Opc.Ua.Robotics.NodeSet2.xml +7409 -0
- package/nodesets/Opc.Ua.Scales.NodeSet2.xml +15817 -0
- package/nodesets/Opc.Ua.Types.bsd +3499 -0
- package/nodesets/Opc.Ua.Weihenstephan.NodeSet2.xml +821 -0
- package/nodesets/Opc.Ua.Woodworking.NodeSet2.xml +17831 -0
- package/nodesets/UANodeSet.xsd +497 -0
- package/nodesets/opc.ua.isa95-jobcontrol.nodeset2.xml +4594 -0
- package/package.json +37 -4
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/*=============================================================================|
|
|
2
|
+
| PROJECT SNAP7 1.3.0 |
|
|
3
|
+
|==============================================================================|
|
|
4
|
+
| Copyright (C) 2013, 2015 Davide Nardella |
|
|
5
|
+
| All rights reserved. |
|
|
6
|
+
|==============================================================================|
|
|
7
|
+
| SNAP7 is free software: you can redistribute it and/or modify |
|
|
8
|
+
| it under the terms of the Lesser GNU General Public License as published by |
|
|
9
|
+
| the Free Software Foundation, either version 3 of the License, or |
|
|
10
|
+
| (at your option) any later version. |
|
|
11
|
+
| |
|
|
12
|
+
| It means that you can distribute your commercial software linked with |
|
|
13
|
+
| SNAP7 without the requirement to distribute the source code of your |
|
|
14
|
+
| application and without the requirement that your application be itself |
|
|
15
|
+
| distributed under LGPL. |
|
|
16
|
+
| |
|
|
17
|
+
| SNAP7 is distributed in the hope that it will be useful, |
|
|
18
|
+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
19
|
+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
20
|
+
| Lesser GNU General Public License for more details. |
|
|
21
|
+
| |
|
|
22
|
+
| You should have received a copy of the GNU General Public License and a |
|
|
23
|
+
| copy of Lesser GNU General Public License along with Snap7. |
|
|
24
|
+
| If not, see http://www.gnu.org/licenses/ |
|
|
25
|
+
|==============================================================================|
|
|
26
|
+
| |
|
|
27
|
+
| Posix Threads support (Linux, FreeBSD) |
|
|
28
|
+
| |
|
|
29
|
+
|=============================================================================*/
|
|
30
|
+
#ifndef unix_threads_h
|
|
31
|
+
#define unix_threads_h
|
|
32
|
+
//---------------------------------------------------------------------------
|
|
33
|
+
#include "snap_platform.h"
|
|
34
|
+
#include "snap_sysutils.h"
|
|
35
|
+
#include <semaphore.h>
|
|
36
|
+
#include <pthread.h>
|
|
37
|
+
//---------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
class TSnapCriticalSection
|
|
40
|
+
{
|
|
41
|
+
private:
|
|
42
|
+
pthread_mutex_t mx;
|
|
43
|
+
// int result;
|
|
44
|
+
public:
|
|
45
|
+
|
|
46
|
+
TSnapCriticalSection()
|
|
47
|
+
{
|
|
48
|
+
/*
|
|
49
|
+
|
|
50
|
+
This would be the best code, but very often it causes a segmentation fault in many
|
|
51
|
+
unix systems (the problem seems to be pthread_mutexattr_destroy()).
|
|
52
|
+
So, to avoid problems in future kernel/libc release, we use the "safe" default.
|
|
53
|
+
|
|
54
|
+
pthread_mutexattr_t mxAttr;
|
|
55
|
+
pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE);
|
|
56
|
+
pthread_mutex_init(&mx, &mxAttr);
|
|
57
|
+
pthread_mutexattr_destroy(&mxAttr);
|
|
58
|
+
|
|
59
|
+
*/
|
|
60
|
+
pthread_mutex_init(&mx, 0);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
~TSnapCriticalSection()
|
|
64
|
+
{
|
|
65
|
+
pthread_mutex_destroy(&mx);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
void Enter()
|
|
69
|
+
{
|
|
70
|
+
pthread_mutex_lock(&mx);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
void Leave()
|
|
74
|
+
{
|
|
75
|
+
pthread_mutex_unlock(&mx);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
bool TryEnter()
|
|
79
|
+
{
|
|
80
|
+
return pthread_mutex_trylock(&mx) == 0;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
typedef TSnapCriticalSection *PSnapCriticalSection;
|
|
84
|
+
|
|
85
|
+
//---------------------------------------------------------------------------
|
|
86
|
+
const longword WAIT_OBJECT_0 = 0x00000000L;
|
|
87
|
+
const longword WAIT_ABANDONED = 0x00000080L;
|
|
88
|
+
const longword WAIT_TIMEOUT = 0x00000102L;
|
|
89
|
+
const longword WAIT_FAILED = 0xFFFFFFFFL;
|
|
90
|
+
|
|
91
|
+
class TSnapEvent
|
|
92
|
+
{
|
|
93
|
+
private:
|
|
94
|
+
pthread_cond_t CVariable;
|
|
95
|
+
pthread_mutex_t Mutex;
|
|
96
|
+
bool AutoReset;
|
|
97
|
+
bool State;
|
|
98
|
+
public:
|
|
99
|
+
|
|
100
|
+
TSnapEvent(bool ManualReset)
|
|
101
|
+
{
|
|
102
|
+
AutoReset = !ManualReset;
|
|
103
|
+
if (pthread_cond_init(&CVariable, 0) == 0)
|
|
104
|
+
pthread_mutex_init(&Mutex, 0);
|
|
105
|
+
State = false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
~TSnapEvent()
|
|
109
|
+
{
|
|
110
|
+
pthread_cond_destroy(&CVariable);
|
|
111
|
+
pthread_mutex_destroy(&Mutex);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
void Set()
|
|
115
|
+
{
|
|
116
|
+
pthread_mutex_lock(&Mutex);
|
|
117
|
+
State = true;
|
|
118
|
+
if (AutoReset)
|
|
119
|
+
pthread_cond_signal(&CVariable);
|
|
120
|
+
else
|
|
121
|
+
pthread_cond_broadcast(&CVariable);
|
|
122
|
+
pthread_mutex_unlock(&Mutex);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
void Reset()
|
|
126
|
+
{
|
|
127
|
+
pthread_mutex_lock(&Mutex);
|
|
128
|
+
State = false;
|
|
129
|
+
pthread_mutex_unlock(&Mutex);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
longword WaitForever()
|
|
133
|
+
{
|
|
134
|
+
pthread_mutex_lock(&Mutex);
|
|
135
|
+
while (!State) // <-- to avoid spurious wakeups
|
|
136
|
+
pthread_cond_wait(&CVariable, &Mutex);
|
|
137
|
+
if (AutoReset)
|
|
138
|
+
State = false;
|
|
139
|
+
pthread_mutex_unlock(&Mutex);
|
|
140
|
+
return WAIT_OBJECT_0;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
longword WaitFor(int64_t Timeout)
|
|
144
|
+
{
|
|
145
|
+
longword Result = WAIT_OBJECT_0;
|
|
146
|
+
if (Timeout == 0)
|
|
147
|
+
Timeout = 1; // 0 is not allowed
|
|
148
|
+
|
|
149
|
+
if (Timeout > 0)
|
|
150
|
+
{
|
|
151
|
+
pthread_mutex_lock(&Mutex);
|
|
152
|
+
if (!State)
|
|
153
|
+
{
|
|
154
|
+
timespec ts;
|
|
155
|
+
timeval tv;
|
|
156
|
+
gettimeofday(&tv, NULL);
|
|
157
|
+
uint64_t nsecs = ((uint64_t) tv.tv_sec) * 1000000000 +
|
|
158
|
+
Timeout * 1000000 +
|
|
159
|
+
((uint64_t) tv.tv_usec) * 1000;
|
|
160
|
+
ts.tv_sec = nsecs / 1000000000;
|
|
161
|
+
ts.tv_nsec = (nsecs - ((uint64_t) ts.tv_sec) * 1000000000);
|
|
162
|
+
do {
|
|
163
|
+
Result = pthread_cond_timedwait(&CVariable, &Mutex, &ts);
|
|
164
|
+
if (Result == ETIMEDOUT)
|
|
165
|
+
Result = WAIT_TIMEOUT;
|
|
166
|
+
} while (Result == 0 && !State);
|
|
167
|
+
}
|
|
168
|
+
else
|
|
169
|
+
if (AutoReset) // take the ownership
|
|
170
|
+
State = false;
|
|
171
|
+
pthread_mutex_unlock(&Mutex);
|
|
172
|
+
return Result;
|
|
173
|
+
}
|
|
174
|
+
else // Timeout<0
|
|
175
|
+
return WaitForever();
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
typedef TSnapEvent *PSnapEvent;
|
|
179
|
+
//---------------------------------------------------------------------------
|
|
180
|
+
class TSnapThread
|
|
181
|
+
{
|
|
182
|
+
private:
|
|
183
|
+
pthread_t th;
|
|
184
|
+
bool FCreateSuspended;
|
|
185
|
+
void ThreadCreate();
|
|
186
|
+
|
|
187
|
+
void ThreadJoin()
|
|
188
|
+
{
|
|
189
|
+
pthread_join(th, 0);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
void ThreadKill()
|
|
193
|
+
{
|
|
194
|
+
pthread_cancel(th);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
longword ThreadWait(uint64_t Timeout)
|
|
198
|
+
{
|
|
199
|
+
longword Elapsed = SysGetTick();
|
|
200
|
+
while (!Closed && !(DeltaTime(Elapsed) > Timeout))
|
|
201
|
+
SysSleep(100);
|
|
202
|
+
if (Closed)
|
|
203
|
+
return WAIT_OBJECT_0;
|
|
204
|
+
else
|
|
205
|
+
return WAIT_TIMEOUT;
|
|
206
|
+
};
|
|
207
|
+
protected:
|
|
208
|
+
bool Started;
|
|
209
|
+
public:
|
|
210
|
+
bool Terminated;
|
|
211
|
+
bool Closed;
|
|
212
|
+
bool FreeOnTerminate;
|
|
213
|
+
TSnapThread();
|
|
214
|
+
virtual ~TSnapThread();
|
|
215
|
+
|
|
216
|
+
virtual void Execute()
|
|
217
|
+
{
|
|
218
|
+
};
|
|
219
|
+
void Start();
|
|
220
|
+
void Terminate();
|
|
221
|
+
void Kill();
|
|
222
|
+
void Join();
|
|
223
|
+
longword WaitFor(uint64_t Timeout);
|
|
224
|
+
};
|
|
225
|
+
typedef TSnapThread *PSnapThread;
|
|
226
|
+
|
|
227
|
+
//---------------------------------------------------------------------------
|
|
228
|
+
#endif // unix_threads_h
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*=============================================================================|
|
|
2
|
+
| PROJECT SNAP7 1.3.0 |
|
|
3
|
+
|==============================================================================|
|
|
4
|
+
| Copyright (C) 2013, 2015 Davide Nardella |
|
|
5
|
+
| All rights reserved. |
|
|
6
|
+
|==============================================================================|
|
|
7
|
+
| SNAP7 is free software: you can redistribute it and/or modify |
|
|
8
|
+
| it under the terms of the Lesser GNU General Public License as published by |
|
|
9
|
+
| the Free Software Foundation, either version 3 of the License, or |
|
|
10
|
+
| (at your option) any later version. |
|
|
11
|
+
| |
|
|
12
|
+
| It means that you can distribute your commercial software linked with |
|
|
13
|
+
| SNAP7 without the requirement to distribute the source code of your |
|
|
14
|
+
| application and without the requirement that your application be itself |
|
|
15
|
+
| distributed under LGPL. |
|
|
16
|
+
| |
|
|
17
|
+
| SNAP7 is distributed in the hope that it will be useful, |
|
|
18
|
+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
19
|
+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
20
|
+
| Lesser GNU General Public License for more details. |
|
|
21
|
+
| |
|
|
22
|
+
| You should have received a copy of the GNU General Public License and a |
|
|
23
|
+
| copy of Lesser GNU General Public License along with Snap7. |
|
|
24
|
+
| If not, see http://www.gnu.org/licenses/ |
|
|
25
|
+
|==============================================================================|
|
|
26
|
+
| |
|
|
27
|
+
| Windows Threads support (Windows, ReactOS) |
|
|
28
|
+
| |
|
|
29
|
+
|=============================================================================*/
|
|
30
|
+
#ifndef win_threads_h
|
|
31
|
+
#define win_threads_h
|
|
32
|
+
//---------------------------------------------------------------------------
|
|
33
|
+
#include "snap_platform.h"
|
|
34
|
+
#include "snap_sysutils.h"
|
|
35
|
+
//---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
class TSnapCriticalSection
|
|
38
|
+
{
|
|
39
|
+
private:
|
|
40
|
+
CRITICAL_SECTION cs;
|
|
41
|
+
public:
|
|
42
|
+
|
|
43
|
+
TSnapCriticalSection()
|
|
44
|
+
{
|
|
45
|
+
InitializeCriticalSection(&cs);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
~TSnapCriticalSection()
|
|
49
|
+
{
|
|
50
|
+
DeleteCriticalSection(&cs);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
void Enter()
|
|
54
|
+
{
|
|
55
|
+
EnterCriticalSection(&cs);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
void Leave()
|
|
59
|
+
{
|
|
60
|
+
LeaveCriticalSection(&cs);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
bool TryEnter()
|
|
64
|
+
{
|
|
65
|
+
return (TryEnterCriticalSection(&cs) != 0);
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
typedef TSnapCriticalSection *PSnapCriticalSection;
|
|
69
|
+
//---------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
class TSnapEvent
|
|
72
|
+
{
|
|
73
|
+
private:
|
|
74
|
+
HANDLE Event;
|
|
75
|
+
public:
|
|
76
|
+
|
|
77
|
+
TSnapEvent(bool ManualReset)
|
|
78
|
+
{
|
|
79
|
+
Event = CreateEvent(0, ManualReset, false, 0);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
~TSnapEvent()
|
|
83
|
+
{
|
|
84
|
+
if (Event != 0)
|
|
85
|
+
CloseHandle(Event);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
void Set()
|
|
89
|
+
{
|
|
90
|
+
if (Event != 0)
|
|
91
|
+
SetEvent(Event);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
void Reset()
|
|
95
|
+
{
|
|
96
|
+
if (Event != 0)
|
|
97
|
+
ResetEvent(Event);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
longword WaitForever()
|
|
101
|
+
{
|
|
102
|
+
if (Event != 0)
|
|
103
|
+
return WaitForSingleObject(Event, INFINITE);
|
|
104
|
+
else
|
|
105
|
+
return WAIT_FAILED;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
longword WaitFor(int64_t Timeout) {
|
|
109
|
+
if (Event != 0)
|
|
110
|
+
return WaitForSingleObject(Event, DWORD(Timeout));
|
|
111
|
+
else
|
|
112
|
+
return WAIT_FAILED;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
typedef TSnapEvent *PSnapEvent;
|
|
116
|
+
//---------------------------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
class TSnapThread {
|
|
119
|
+
private:
|
|
120
|
+
HANDLE th;
|
|
121
|
+
bool FCreateSuspended;
|
|
122
|
+
void ThreadCreate();
|
|
123
|
+
|
|
124
|
+
void ThreadJoin()
|
|
125
|
+
{
|
|
126
|
+
WaitForSingleObject(th, INFINITE);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
void ThreadKill()
|
|
130
|
+
{
|
|
131
|
+
TerminateThread(th, 0);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
longword ThreadWait(uint64_t Timeout)
|
|
135
|
+
{
|
|
136
|
+
return WaitForSingleObject(th, DWORD(Timeout));
|
|
137
|
+
};
|
|
138
|
+
protected:
|
|
139
|
+
bool Started;
|
|
140
|
+
public:
|
|
141
|
+
bool Terminated;
|
|
142
|
+
bool Closed;
|
|
143
|
+
bool FreeOnTerminate;
|
|
144
|
+
TSnapThread();
|
|
145
|
+
virtual ~TSnapThread();
|
|
146
|
+
|
|
147
|
+
virtual void Execute()
|
|
148
|
+
{
|
|
149
|
+
};
|
|
150
|
+
void Start();
|
|
151
|
+
void Terminate();
|
|
152
|
+
void Kill();
|
|
153
|
+
void Join();
|
|
154
|
+
longword WaitFor(uint64_t Timeout);
|
|
155
|
+
};
|
|
156
|
+
typedef TSnapThread *PSnapThread;
|
|
157
|
+
|
|
158
|
+
//---------------------------------------------------------------------------
|
|
159
|
+
#endif // win_threads_h
|
package/nodesets/.ignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.xml
|