diff --git a/CHANGES.md b/CHANGES.md index 37696fc..a5bce0d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,17 @@ # Changes +## 0.2.1 (2023-01-01) + +- FEATURE: Added support for fixed-length arrays of function pointers (for callback functions). Similar to individual function pointers in *zugbruecke*, the pointers can not be overwritten by DLL functions. +- FIX: By value simple type members of structs passed as pointer / by reference were not synchronized correctly. This includes scalar integers and floats, individual `c_char` and `c_wchar` objects as well as `c_char` and `c_wchar` arrays, i.e. strings. +- FIX: The type parser's cache could, under certain circumstances, confuse fixed-length struct array types with their scalar base types. +- FIX: Indicate Python 3.11 support in `pyproject.toml`. +- DOCS: Updated benchmarks. +- DOCS: Added notes on known CentOS issues. +- DOCS: Added information on known symbolic link issues with certain versions of Wine, recently staging >=7.18, see #94. +- DOCS: Many small fixes. +- DEV: Added test for light-weight pointers, `ctypes.byref`. Those were previously supported but remained untested. + ## 0.2.0 (2022-12-29) **CAUTION**: A number changes at least partially **BREAK BACKWARDS COMPATIBILITY** for certain use and edge cases. @@ -13,15 +25,15 @@ If entire struct objects are synced via `memsync` directives, the struct types n This **RELEASE FIXES A CRITICAL BUG** where *zugbruecke* was falsely translating 64 bit integer types from the Unix side to 32 bit integer types on the Wine side. - FEATURE: Improved performance. With logging disabled, function calls carry 10% less overhead on average. -- FEATURE: In `memsync` directives, `ctypes` types do not need to be specified by their name as strings anymore - plain `ctypes` fundamental types and structure types can be used instead. Strings remain valid specifications for compatibility though. +- FEATURE: In `memsync` directives, `ctypes` types do not need to be specified by their name as strings anymore - plain `ctypes` fundamental types and structure types can be used instead. Strings remain valid specifications (only) for fundamental `ctypes` types for compatibility though. - FEATURE: `memsync` directives allow for more descriptive parameter names while the old single-character names remain valid for compatibility. - FEATURE: Added support for CPython 3.11, see #86 and #87. - FEATURE: Logging now relies on Python's `logging` module's log levels, i.e. `NOTSET`, `DEBUG`, `INFO`, `WARNING`, `ERROR` and `CRITICAL`. This change serves to work towards #84. - FEATURE: Log output has been divided into log levels, see #9. -- FIX: Argtypes and restype would translate `c_int64`, `c_uint64`, `c_long` and `c_ulong` from the Unix side to their 32-bit equivalents, `c_int32` and `c_uint32`, on the Wine side. This was due to `c_long` and `c_ulong` being 8 bytes long on Unix-like systems while they are 4 bytes long on Window. +- FIX: Argtypes and restype would translate `c_int64`, `c_uint64`, `c_long` and `c_ulong` from the Unix side to their 32-bit equivalents, `c_int32` and `c_uint32`, on the Wine side. This was due to `c_long` and `c_ulong` being 8 bytes long on Unix-like systems while they are 4 bytes long on Window, see #95. - FIX: Fixed-length `c_char` and `c_wchar` buffers passed by value within structures were not handled correctly, see #93. - FIX: The new `argtypes` and `restype` parser does not suffer from #61 anymore where earlier different structure types from different name spaces but with identical names would cause problems. -- FIX: CI revealed that an issue similar to #50 returned as packages on Wine side can sometimes not be imported if they are symlinked. The new `copy_modules` configuration parameter can be used to indicate that a copy instead of symlinks is required. This problem is caused by [Wine bug #54228](https://bugs.winehq.org/show_bug.cgi?id=54228) in Wine Staging >= 7.18. +- FIX: CI revealed that an issue similar to #50 returned as packages on Wine side can sometimes not be imported if they are symlinked. The new `copy_modules` configuration parameter can be used to indicate that a copy instead of symlinks is required. This problem is caused by [Wine bug #54228](https://bugs.winehq.org/show_bug.cgi?id=54228) in Wine Staging >= 7.18, see #94. - FIX: If `zugbruecke` (and `wenv`) were installed into user site-packages, the installation would break, see #88. - FIX: If writing of logs to disk (`log_write`) was set to `True` during run-time, `zugbruecke` would crash, see #77. - FIX: Syncing entire structs via `memsync` was broken, see #92. diff --git a/benchmark/__init__.py b/benchmark/__init__.py index e69de29..902d911 100644 --- a/benchmark/__init__.py +++ b/benchmark/__init__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +""" + +ZUGBRUECKE +Calling routines in Windows DLLs from Python scripts running on unixlike systems +https://github.com/pleiszenburg/zugbruecke + + benchmark/__init__.py: Benchmark package init file + + Required to run on platform / side: [UNIX] + + Copyright (C) 2017-2023 Sebastian M. Ernst + + +The contents of this file are subject to the GNU Lesser General Public License +Version 2.1 ("LGPL" or "License"). You may not use this file except in +compliance with the License. You may obtain a copy of the License at +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt +https://github.com/pleiszenburg/zugbruecke/blob/master/LICENSE + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the +specific language governing rights and limitations under the License. + + +""" + + diff --git a/benchmark/data.raw b/benchmark/data.raw index 1bef578..f59fe79 100644 --- a/benchmark/data.raw +++ b/benchmark/data.raw @@ -1,33 +1,33 @@ -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 67600, "runs": 13920, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 67400, "runs": 13945, "server": null, "client": "3.7.9"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 11400, "runs": 76035, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 11500, "runs": 76314, "server": null, "client": "3.7.9"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 738094, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 724923, "server": null, "client": "3.7.9"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 60700, "runs": 15354, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 61400, "runs": 15197, "server": null, "client": "3.8.10"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 10200, "runs": 84871, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 10100, "runs": 85793, "server": null, "client": "3.8.10"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 738024, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 734172, "server": null, "client": "3.8.10"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 59600, "runs": 15640, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 59400, "runs": 15722, "server": null, "client": "3.9.13"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 9400, "runs": 89185, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 9400, "runs": 91625, "server": null, "client": "3.9.13"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 739152, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 733425, "server": null, "client": "3.9.13"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 61900, "runs": 14989, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 62200, "runs": 15028, "server": null, "client": "3.10.9"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 9900, "runs": 86901, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 9900, "runs": 87076, "server": null, "client": "3.10.9"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 722644, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 720775, "server": null, "client": "3.10.9"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 58700, "runs": 15962, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 58500, "runs": 16044, "server": null, "client": "3.11.1"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 9300, "runs": 91690, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 9300, "runs": 93300, "server": null, "client": "3.11.1"}] -[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 740511, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 600, "runs": 803078, "server": null, "client": "3.11.1"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 50000, "runs": 18640, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 50100, "runs": 18674, "server": null, "client": "3.7.9"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 8900, "runs": 99248, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 8700, "runs": 100647, "server": null, "client": "3.7.9"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 600, "runs": 942288, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 600, "runs": 954372, "server": null, "client": "3.7.9"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 44500, "runs": 20743, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 44300, "runs": 21073, "server": null, "client": "3.8.10"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7500, "runs": 115525, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7400, "runs": 117227, "server": null, "client": "3.8.10"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 1047170, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1043092, "server": null, "client": "3.8.10"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 45000, "runs": 20238, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 44800, "runs": 20898, "server": null, "client": "3.9.13"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7200, "runs": 120078, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7000, "runs": 122826, "server": null, "client": "3.9.13"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 1017719, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1016067, "server": null, "client": "3.9.13"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 46300, "runs": 20181, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 46400, "runs": 20223, "server": null, "client": "3.10.9"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7500, "runs": 116438, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7400, "runs": 119270, "server": null, "client": "3.10.9"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 1076759, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1063255, "server": null, "client": "3.10.9"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 42300, "runs": 22155, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 41900, "runs": 22335, "server": null, "client": "3.11.1"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7300, "runs": 118484, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7200, "runs": 120088, "server": null, "client": "3.11.1"}] -[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 964802, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1052559, "server": null, "client": "3.11.1"}] -[{"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2498416, "runs": 371, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2317756, "runs": 399, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2311076, "runs": 405, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2293365, "runs": 414, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2268035, "runs": 422, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2191875, "runs": 418, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2101124, "runs": 451, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2052883, "runs": 450, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2042834, "runs": 460, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 1991903, "runs": 473, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2564858, "runs": 369, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2441696, "runs": 389, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2382886, "runs": 395, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2429506, "runs": 392, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2343346, "runs": 405, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2215125, "runs": 421, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2430546, "runs": 384, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2377706, "runs": 349, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2350396, "runs": 404, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2075134, "runs": 461, "server": "3.11.1", "client": "3.10.6"}] -[{"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 210252, "runs": 4316, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 203261, "runs": 4530, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 201532, "runs": 4600, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 203161, "runs": 4581, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 200492, "runs": 4667, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 194711, "runs": 4789, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 186072, "runs": 4089, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 184581, "runs": 5052, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 182991, "runs": 5035, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 185371, "runs": 4069, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 210191, "runs": 4463, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 203931, "runs": 4567, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 204011, "runs": 4591, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 203812, "runs": 4596, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 197522, "runs": 4687, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 193962, "runs": 4924, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 186241, "runs": 4794, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 182951, "runs": 4618, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 184271, "runs": 4662, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 184602, "runs": 4496, "server": "3.11.1", "client": "3.10.6"}] -[{"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 152061, "runs": 6143, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 148731, "runs": 6276, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 145751, "runs": 6267, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 146831, "runs": 6307, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 146981, "runs": 5862, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 136891, "runs": 6557, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 133001, "runs": 6296, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 130831, "runs": 7072, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 134530, "runs": 6067, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 131741, "runs": 6703, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 152431, "runs": 6122, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 146231, "runs": 5387, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 143451, "runs": 6175, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 143001, "runs": 6599, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 138381, "runs": 6663, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 135761, "runs": 7077, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 131831, "runs": 7126, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 126161, "runs": 7273, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 130221, "runs": 7095, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 126891, "runs": 7392, "server": "3.11.1", "client": "3.10.6"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 67300, "runs": 13943, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 66800, "runs": 14128, "server": null, "client": "3.7.9"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 11600, "runs": 76056, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 11600, "runs": 75559, "server": null, "client": "3.7.9"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 747528, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 750524, "server": null, "client": "3.7.9"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 59900, "runs": 15745, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 60500, "runs": 15705, "server": null, "client": "3.8.10"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 10100, "runs": 87240, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 10000, "runs": 87012, "server": null, "client": "3.8.10"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 751947, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 746447, "server": null, "client": "3.8.10"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 59600, "runs": 15671, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 59800, "runs": 15728, "server": null, "client": "3.9.13"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 9400, "runs": 92267, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 9400, "runs": 92530, "server": null, "client": "3.9.13"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 747497, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 755718, "server": null, "client": "3.9.13"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 62600, "runs": 14994, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 62500, "runs": 15080, "server": null, "client": "3.10.9"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 9800, "runs": 88976, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 9700, "runs": 89378, "server": null, "client": "3.10.9"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 698145, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 703944, "server": null, "client": "3.10.9"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 58500, "runs": 16145, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 58600, "runs": 16109, "server": null, "client": "3.11.1"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 9400, "runs": 92638, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 9300, "runs": 93391, "server": null, "client": "3.11.1"}] +[{"platform": "wine", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 700, "runs": 754346, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 700, "runs": 796721, "server": null, "client": "3.11.1"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 49900, "runs": 18655, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 51400, "runs": 18140, "server": null, "client": "3.7.9"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 8600, "runs": 101884, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 8400, "runs": 104052, "server": null, "client": "3.7.9"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 600, "runs": 932614, "server": null, "client": "3.7.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 600, "runs": 930656, "server": null, "client": "3.7.9"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 45200, "runs": 20739, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 44700, "runs": 21030, "server": null, "client": "3.8.10"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7200, "runs": 120332, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7100, "runs": 121516, "server": null, "client": "3.8.10"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 1035822, "server": null, "client": "3.8.10"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1032207, "server": null, "client": "3.8.10"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 45900, "runs": 20321, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 45600, "runs": 20646, "server": null, "client": "3.9.13"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7200, "runs": 122331, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7100, "runs": 122237, "server": null, "client": "3.9.13"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 1040865, "server": null, "client": "3.9.13"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1046962, "server": null, "client": "3.9.13"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 47000, "runs": 20035, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 46500, "runs": 20398, "server": null, "client": "3.10.9"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7300, "runs": 120503, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7300, "runs": 120587, "server": null, "client": "3.10.9"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 1075504, "server": null, "client": "3.10.9"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1059252, "server": null, "client": "3.10.9"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 42700, "runs": 21746, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 42700, "runs": 22079, "server": null, "client": "3.11.1"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 7200, "runs": 120445, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 7200, "runs": 120558, "server": null, "client": "3.11.1"}] +[{"platform": "wine", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 500, "runs": 954184, "server": null, "client": "3.11.1"}, {"platform": "wine", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 500, "runs": 1056899, "server": null, "client": "3.11.1"}] +[{"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 201012, "runs": 4705, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 192382, "runs": 4763, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 195101, "runs": 4838, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 194792, "runs": 4854, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "memsync", "runtime": 190821, "runs": 4863, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 185431, "runs": 4828, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 180131, "runs": 4949, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 174411, "runs": 5032, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 183332, "runs": 4897, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "memsync", "runtime": 179691, "runs": 5168, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 205681, "runs": 4528, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 199662, "runs": 4699, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 203741, "runs": 4613, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 200141, "runs": 4655, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "memsync", "runtime": 193132, "runs": 4723, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 186651, "runs": 4746, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 179702, "runs": 5163, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 180261, "runs": 4555, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 180281, "runs": 5020, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "memsync", "runtime": 176651, "runs": 5071, "server": "3.11.1", "client": "3.10.6"}] +[{"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 151841, "runs": 6123, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 143101, "runs": 6412, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 146831, "runs": 6112, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 146231, "runs": 6396, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "minimal", "runtime": 142521, "runs": 6529, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 132111, "runs": 6958, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 128380, "runs": 7151, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 130391, "runs": 6134, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 139121, "runs": 6069, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "minimal", "runtime": 131801, "runs": 6586, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 143461, "runs": 6535, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 139211, "runs": 6658, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 147312, "runs": 6000, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 146081, "runs": 6454, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "minimal", "runtime": 142481, "runs": 6043, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 133661, "runs": 6418, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 132521, "runs": 6230, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 135031, "runs": 6833, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 131451, "runs": 6906, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "minimal", "runtime": 133771, "runs": 6990, "server": "3.11.1", "client": "3.10.6"}] +[{"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2573507, "runs": 369, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2406456, "runs": 390, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2434566, "runs": 376, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2361866, "runs": 393, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "cdll", "name": "maximal", "runtime": 2490106, "runs": 362, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2301915, "runs": 399, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2166914, "runs": 431, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2187484, "runs": 431, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2177895, "runs": 376, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "cdll", "name": "maximal", "runtime": 2113584, "runs": 448, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2578108, "runs": 370, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2402486, "runs": 396, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2415735, "runs": 379, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2439176, "runs": 393, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win32", "convention": "windll", "name": "maximal", "runtime": 2347905, "runs": 379, "server": "3.11.1", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2313505, "runs": 342, "server": "3.7.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2181114, "runs": 428, "server": "3.8.10", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2188535, "runs": 419, "server": "3.9.13", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2173694, "runs": 396, "server": "3.10.9", "client": "3.10.6"}, {"platform": "unix", "arch": "win64", "convention": "windll", "name": "maximal", "runtime": 2123373, "runs": 445, "server": "3.11.1", "client": "3.10.6"}] diff --git a/benchmark/maximal.py b/benchmark/maximal.py index 9156e32..d43d6af 100644 --- a/benchmark/maximal.py +++ b/benchmark/maximal.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/benchmark/memsync.py b/benchmark/memsync.py index 61737af..d63b244 100644 --- a/benchmark/memsync.py +++ b/benchmark/memsync.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/benchmark/minimal.py b/benchmark/minimal.py index f83b613..57125f9 100644 --- a/benchmark/minimal.py +++ b/benchmark/minimal.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/docs/Makefile b/docs/Makefile index 8fc18dc..3f74782 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,7 +6,7 @@ # # Required to run on platform / side: [UNIX] # -# Copyright (C) 2017-2022 Sebastian M. Ernst +# Copyright (C) 2017-2023 Sebastian M. Ernst # # # The contents of this file are subject to the GNU Lesser General Public License diff --git a/docs/__init__.py b/docs/__init__.py index ecaf1c1..5e4bd17 100644 --- a/docs/__init__.py +++ b/docs/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/docs/source/__init__.py b/docs/source/__init__.py index 39f1f31..5b28fba 100644 --- a/docs/source/__init__.py +++ b/docs/source/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/docs/source/benchmark_maximal.rst b/docs/source/benchmark_maximal.rst index 46d6351..fce276e 100644 --- a/docs/source/benchmark_maximal.rst +++ b/docs/source/benchmark_maximal.rst @@ -2,26 +2,26 @@ :header: "version", "arch", "convention", "ctypes [µs]", "zugbruecke [µs]", "overhead [µs]" :delim: 0x0003B - "3.7.9"; "win32"; "cdll"; 67.6; 2,498.4; 2,430.8 - "3.7.9"; "win32"; "windll"; 67.4; 2,564.9; 2,497.5 - "3.7.9"; "win64"; "cdll"; 50.0; 2,191.9; 2,141.9 - "3.7.9"; "win64"; "windll"; 50.1; 2,215.1; 2,165.0 - "3.8.10"; "win32"; "cdll"; 60.7; 2,317.8; 2,257.1 - "3.8.10"; "win32"; "windll"; 61.4; 2,441.7; 2,380.3 - "3.8.10"; "win64"; "cdll"; 44.5; 2,101.1; 2,056.6 - "3.8.10"; "win64"; "windll"; 44.3; 2,430.5; 2,386.2 - "3.9.13"; "win32"; "cdll"; 59.6; 2,311.1; 2,251.5 - "3.9.13"; "win32"; "windll"; 59.4; 2,382.9; 2,323.5 - "3.9.13"; "win64"; "cdll"; 45.0; 2,052.9; 2,007.9 - "3.9.13"; "win64"; "windll"; 44.8; 2,377.7; 2,332.9 - "3.10.9"; "win32"; "cdll"; 61.9; 2,293.4; 2,231.5 - "3.10.9"; "win32"; "windll"; 62.2; 2,429.5; 2,367.3 - "3.10.9"; "win64"; "cdll"; 46.3; 2,042.8; 1,996.5 - "3.10.9"; "win64"; "windll"; 46.4; 2,350.4; 2,304.0 - "3.11.1"; "win32"; "cdll"; 58.7; 2,268.0; 2,209.3 - "3.11.1"; "win32"; "windll"; 58.5; 2,343.3; 2,284.8 - "3.11.1"; "win64"; "cdll"; 42.3; 1,991.9; 1,949.6 - "3.11.1"; "win64"; "windll"; 41.9; 2,075.1; 2,033.2 + "3.7.9"; "win32"; "cdll"; 67.3; 2,573.5; 2,506.2 + "3.7.9"; "win32"; "windll"; 66.8; 2,578.1; 2,511.3 + "3.7.9"; "win64"; "cdll"; 49.9; 2,301.9; 2,252.0 + "3.7.9"; "win64"; "windll"; 51.4; 2,313.5; 2,262.1 + "3.8.10"; "win32"; "cdll"; 59.9; 2,406.5; 2,346.6 + "3.8.10"; "win32"; "windll"; 60.5; 2,402.5; 2,342.0 + "3.8.10"; "win64"; "cdll"; 45.2; 2,166.9; 2,121.7 + "3.8.10"; "win64"; "windll"; 44.7; 2,181.1; 2,136.4 + "3.9.13"; "win32"; "cdll"; 59.6; 2,434.6; 2,375.0 + "3.9.13"; "win32"; "windll"; 59.8; 2,415.7; 2,355.9 + "3.9.13"; "win64"; "cdll"; 45.9; 2,187.5; 2,141.6 + "3.9.13"; "win64"; "windll"; 45.6; 2,188.5; 2,142.9 + "3.10.9"; "win32"; "cdll"; 62.6; 2,361.9; 2,299.3 + "3.10.9"; "win32"; "windll"; 62.5; 2,439.2; 2,376.7 + "3.10.9"; "win64"; "cdll"; 47.0; 2,177.9; 2,130.9 + "3.10.9"; "win64"; "windll"; 46.5; 2,173.7; 2,127.2 + "3.11.1"; "win32"; "cdll"; 58.5; 2,490.1; 2,431.6 + "3.11.1"; "win32"; "windll"; 58.6; 2,347.9; 2,289.3 + "3.11.1"; "win64"; "cdll"; 42.7; 2,113.6; 2,070.9 + "3.11.1"; "win64"; "windll"; 42.7; 2,123.4; 2,080.7 The "maximal" benchmark runs through everything that *zugbuecke* has to offer. diff --git a/docs/source/benchmark_memsync.rst b/docs/source/benchmark_memsync.rst index 6cae9e5..d483cff 100644 --- a/docs/source/benchmark_memsync.rst +++ b/docs/source/benchmark_memsync.rst @@ -2,26 +2,26 @@ :header: "version", "arch", "convention", "ctypes [µs]", "zugbruecke [µs]", "overhead [µs]" :delim: 0x0003B - "3.7.9"; "win32"; "cdll"; 11.4; 210.3; 198.9 - "3.7.9"; "win32"; "windll"; 11.5; 210.2; 198.7 - "3.7.9"; "win64"; "cdll"; 8.9; 194.7; 185.8 - "3.7.9"; "win64"; "windll"; 8.7; 194.0; 185.3 - "3.8.10"; "win32"; "cdll"; 10.2; 203.3; 193.1 - "3.8.10"; "win32"; "windll"; 10.1; 203.9; 193.8 - "3.8.10"; "win64"; "cdll"; 7.5; 186.1; 178.6 - "3.8.10"; "win64"; "windll"; 7.4; 186.2; 178.8 - "3.9.13"; "win32"; "cdll"; 9.4; 201.5; 192.1 - "3.9.13"; "win32"; "windll"; 9.4; 204.0; 194.6 - "3.9.13"; "win64"; "cdll"; 7.2; 184.6; 177.4 - "3.9.13"; "win64"; "windll"; 7.0; 183.0; 176.0 - "3.10.9"; "win32"; "cdll"; 9.9; 203.2; 193.3 - "3.10.9"; "win32"; "windll"; 9.9; 203.8; 193.9 - "3.10.9"; "win64"; "cdll"; 7.5; 183.0; 175.5 - "3.10.9"; "win64"; "windll"; 7.4; 184.3; 176.9 - "3.11.1"; "win32"; "cdll"; 9.3; 200.5; 191.2 - "3.11.1"; "win32"; "windll"; 9.3; 197.5; 188.2 - "3.11.1"; "win64"; "cdll"; 7.3; 185.4; 178.1 - "3.11.1"; "win64"; "windll"; 7.2; 184.6; 177.4 + "3.7.9"; "win32"; "cdll"; 11.6; 201.0; 189.4 + "3.7.9"; "win32"; "windll"; 11.6; 205.7; 194.1 + "3.7.9"; "win64"; "cdll"; 8.6; 185.4; 176.8 + "3.7.9"; "win64"; "windll"; 8.4; 186.7; 178.3 + "3.8.10"; "win32"; "cdll"; 10.1; 192.4; 182.3 + "3.8.10"; "win32"; "windll"; 10.0; 199.7; 189.7 + "3.8.10"; "win64"; "cdll"; 7.2; 180.1; 172.9 + "3.8.10"; "win64"; "windll"; 7.1; 179.7; 172.6 + "3.9.13"; "win32"; "cdll"; 9.4; 195.1; 185.7 + "3.9.13"; "win32"; "windll"; 9.4; 203.7; 194.3 + "3.9.13"; "win64"; "cdll"; 7.2; 174.4; 167.2 + "3.9.13"; "win64"; "windll"; 7.1; 180.3; 173.2 + "3.10.9"; "win32"; "cdll"; 9.8; 194.8; 185.0 + "3.10.9"; "win32"; "windll"; 9.7; 200.1; 190.4 + "3.10.9"; "win64"; "cdll"; 7.3; 183.3; 176.0 + "3.10.9"; "win64"; "windll"; 7.3; 180.3; 173.0 + "3.11.1"; "win32"; "cdll"; 9.4; 190.8; 181.4 + "3.11.1"; "win32"; "windll"; 9.3; 193.1; 183.8 + "3.11.1"; "win64"; "cdll"; 7.2; 179.7; 172.5 + "3.11.1"; "win64"; "windll"; 7.2; 176.7; 169.5 The "memsync" benchmark is a basic test of bidirectional memory synchronization diff --git a/docs/source/benchmark_minimal.rst b/docs/source/benchmark_minimal.rst index dc41ae5..4005f86 100644 --- a/docs/source/benchmark_minimal.rst +++ b/docs/source/benchmark_minimal.rst @@ -2,26 +2,26 @@ :header: "version", "arch", "convention", "ctypes [µs]", "zugbruecke [µs]", "overhead [µs]" :delim: 0x0003B - "3.7.9"; "win32"; "cdll"; 0.7; 152.1; 151.4 - "3.7.9"; "win32"; "windll"; 0.7; 152.4; 151.7 - "3.7.9"; "win64"; "cdll"; 0.6; 136.9; 136.3 - "3.7.9"; "win64"; "windll"; 0.6; 135.8; 135.2 - "3.8.10"; "win32"; "cdll"; 0.7; 148.7; 148.0 - "3.8.10"; "win32"; "windll"; 0.7; 146.2; 145.5 - "3.8.10"; "win64"; "cdll"; 0.5; 133.0; 132.5 - "3.8.10"; "win64"; "windll"; 0.5; 131.8; 131.3 - "3.9.13"; "win32"; "cdll"; 0.7; 145.8; 145.1 - "3.9.13"; "win32"; "windll"; 0.7; 143.5; 142.8 - "3.9.13"; "win64"; "cdll"; 0.5; 130.8; 130.3 - "3.9.13"; "win64"; "windll"; 0.5; 126.2; 125.7 - "3.10.9"; "win32"; "cdll"; 0.7; 146.8; 146.1 - "3.10.9"; "win32"; "windll"; 0.7; 143.0; 142.3 - "3.10.9"; "win64"; "cdll"; 0.5; 134.5; 134.0 - "3.10.9"; "win64"; "windll"; 0.5; 130.2; 129.7 - "3.11.1"; "win32"; "cdll"; 0.7; 147.0; 146.3 - "3.11.1"; "win32"; "windll"; 0.6; 138.4; 137.8 - "3.11.1"; "win64"; "cdll"; 0.5; 131.7; 131.2 - "3.11.1"; "win64"; "windll"; 0.5; 126.9; 126.4 + "3.7.9"; "win32"; "cdll"; 0.7; 151.8; 151.1 + "3.7.9"; "win32"; "windll"; 0.7; 143.5; 142.8 + "3.7.9"; "win64"; "cdll"; 0.6; 132.1; 131.5 + "3.7.9"; "win64"; "windll"; 0.6; 133.7; 133.1 + "3.8.10"; "win32"; "cdll"; 0.7; 143.1; 142.4 + "3.8.10"; "win32"; "windll"; 0.7; 139.2; 138.5 + "3.8.10"; "win64"; "cdll"; 0.5; 128.4; 127.9 + "3.8.10"; "win64"; "windll"; 0.5; 132.5; 132.0 + "3.9.13"; "win32"; "cdll"; 0.7; 146.8; 146.1 + "3.9.13"; "win32"; "windll"; 0.7; 147.3; 146.6 + "3.9.13"; "win64"; "cdll"; 0.5; 130.4; 129.9 + "3.9.13"; "win64"; "windll"; 0.5; 135.0; 134.5 + "3.10.9"; "win32"; "cdll"; 0.7; 146.2; 145.5 + "3.10.9"; "win32"; "windll"; 0.7; 146.1; 145.4 + "3.10.9"; "win64"; "cdll"; 0.5; 139.1; 138.6 + "3.10.9"; "win64"; "windll"; 0.5; 131.5; 131.0 + "3.11.1"; "win32"; "cdll"; 0.7; 142.5; 141.8 + "3.11.1"; "win32"; "windll"; 0.7; 142.5; 141.8 + "3.11.1"; "win64"; "cdll"; 0.5; 131.8; 131.3 + "3.11.1"; "win64"; "windll"; 0.5; 133.8; 133.3 The "minimal" benchmark is a simple function call with diff --git a/docs/source/benchmarks_all.rst b/docs/source/benchmarks_all.rst index fe21e1b..257e833 100644 --- a/docs/source/benchmarks_all.rst +++ b/docs/source/benchmarks_all.rst @@ -1,3 +1,3 @@ -.. include:: benchmark_maximal.rst .. include:: benchmark_memsync.rst .. include:: benchmark_minimal.rst +.. include:: benchmark_maximal.rst diff --git a/docs/source/bugs.rst b/docs/source/bugs.rst index 267a446..e11caea 100644 --- a/docs/source/bugs.rst +++ b/docs/source/bugs.rst @@ -45,10 +45,10 @@ A custom session can be manipulated in a similar way: from zugbruecke import CtypesSession from logging import DEBUG - ctypes = CtypesSession(log_level = DEBUG) + ctypes = CtypesSession(log_level = DEBUG, log_write = True) # proceed as usual - with a lot more verbosity -Alternatively, you can drop a configuration file named ``.zugbruecke.json`` into your current working directory or *zugbruecke*'s configuration directory (likely ``~/.zugbruecke``) and add configuration parameters to it, for example: +Alternatively, you can drop a configuration file named ``.zugbruecke.json`` e.g. into your current working directory or your user account folder, ``/home/username``, and add configuration parameters to it, for example: .. code:: json @@ -69,3 +69,31 @@ As a last resort, you can activate additional debugging features intended for de As an alternative approach, you can also check what happens if you run your code directly in a *Windows Python* interpreter with *ctypes*. Consult the :ref:`chapter on the Wine Python environment ` for details. It is easy to get *ctypes* syntax wrong, so this is a good approach for getting it right. If in doubt, please also test your code with *ctypes* on an actual *Windows* system - it might be a bug in this module or *Wine* as well. + +Known issues: Failing to import modules +--------------------------------------- + +You may encounter issues where *zugbruecke* shows exceptions during initialization, complaining that it could not import ``wenv``, submodules from ``wenv`` or even itself. *zugbruecke* relies on symbolic links to make itself available to a Windows Python interpreter within its dedicated ``site-packages`` folder. This approach has the benefit that if *zugbruecke* and/or its dependency *wenv* are beging updated on the Unix side, the update becomes immediately available to the Wine Python environment with no further user interaction required. Unfortunately, Wine keeps having various issues with handling symbolic links, for instance from stable versions 4.0 to 4.16 and more recently from staging version 7.18 onwards, see `issue 94`_. Those issues break the import mechanisms of Windows builds of CPython. The workaround is to tell *zugbruecke* to copy the required modules into the Wine Python environment via the ``copy_modules`` configuration parameter instead of using symbolic links, see :ref:`section on configuration parameters `. Be aware that this may cause issues when updating *zugbruecke* and/or *wenv* later on. It is recommended to re-create the Wine Python environments in question whenever any of the two packages are updated. + +.. _issue 94: https://github.com/pleiszenburg/zugbruecke/issues/94 + +.. _centos: + +Known issues: Running on CentOS +------------------------------- + +.. warning:: + + CentOS packages both CPython and Wine in rather unusual ways, effectively making it a minefield for *zugbruecke*. Avoid CentOS if possible. + +*zugbruecke* expects the command for Wine 32 bit to be ``wine`` and the command for Wine 64 bit to be ``wine64``. This is not the case for CentOS' Wine packages where ``wine`` points to Wine 64 bit. However, alternative packages for CentOS restore the expected behaviour. For a discussion see `issue 70`_. + +.. _issue 70: https://github.com/pleiszenburg/zugbruecke/issues/70 + +CentOS uses a customized CPython interpreter which behaves differently compared to a regular CPython interpreter. Notably, in regular builds of CPython, the authentication mechanism used by ``multiprocessing`` for connecting to other processes uses the MD5 hash algorithm by default, which is generally considered insecure. In CentOS, this mechanism was patched to use SHA256 for improved security. As a consequence, CentOS' CPython can not connect to an official Windows build of CPython, causing *zugbruecke* to fail to launch. A discussion and workarounds can be found in `issue 73`_. + +.. _issue 73: https://github.com/pleiszenburg/zugbruecke/issues/73 + +*zugbruecke* is prone to random crashes during startup on older versions of CentOS. An ongoing discussion and a partial workaround can be found in `issue 78`_. + +.. _issue 78: https://github.com/pleiszenburg/zugbruecke/issues/78 diff --git a/docs/source/conf.py b/docs/source/conf.py index 876fb92..3c4a440 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License @@ -72,7 +72,7 @@ # General information about the project. project = "zugbruecke" author = "Sebastian M. Ernst" -copyright = f"2017-2022 {author:s}" +copyright = f"2017-2023 {author:s}" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/source/index.rst b/docs/source/index.rst index 9c09243..cb06ce1 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -81,7 +81,7 @@ User's guide `Interested in contributing?`_ -.. _Interested in contributing?: https://github.com/pleiszenburg/zugbruecke/blob/develop/CONTRIBUTING.rst +.. _Interested in contributing?: https://github.com/pleiszenburg/zugbruecke/blob/develop/CONTRIBUTING.md Indices and tables ------------------ diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 333969b..5a5c419 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -17,11 +17,11 @@ Getting *Wine* For using *zugbruecke*, you need to install **Wine** first. Depending on your platform, there are different ways of doing that. * `Installation instructions for various Linux distributions`_ -* `Installation instructions for Mac OS X`_ +* `Installation instructions for MacOS`_ * `Installation instructions for FreeBSD`_ .. _Installation instructions for various Linux distributions: https://www.winehq.org/download -.. _Installation instructions for Mac OS X: https://wiki.winehq.org/MacOS +.. _Installation instructions for MacOS: https://wiki.winehq.org/MacOS .. _Installation instructions for FreeBSD: https://wiki.winehq.org/FreeBSD .. note:: @@ -34,7 +34,7 @@ For using *zugbruecke*, you need to install **Wine** first. Depending on your pl .. warning:: - Support for Mac OS X and FreeBSD is provided on a best-effort basis. *zugbruecke* currently does not receive regular testing on those platforms. + Support for MacOS and FreeBSD is provided on a best-effort basis. *zugbruecke* currently does not receive regular testing on those platforms. Getting *zugbruecke* -------------------- @@ -59,6 +59,10 @@ After installing the package with ``pip``, you may choose to manually :ref:`init If you are encountering any problems, see :ref:`section on bugs and known issues `. +.. warning:: + + CentOS is known to be problematic. It packages both CPython and Wine in rather unusual and partially incompatible ways. See section on :ref:`CentOS `. + Installing *zugbruecke* in Development Mode ------------------------------------------- diff --git a/docs/source/version.py b/docs/source/version.py index 33862a6..f98d408 100644 --- a/docs/source/version.py +++ b/docs/source/version.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/makefile b/makefile index 09a6321..b4bfc73 100644 --- a/makefile +++ b/makefile @@ -6,7 +6,7 @@ # # Required to run on platform / side: [UNIX] # -# Copyright (C) 2017-2022 Sebastian M. Ernst +# Copyright (C) 2017-2023 Sebastian M. Ernst # # # The contents of this file are subject to the GNU Lesser General Public License diff --git a/pyproject.toml b/pyproject.toml index 6caefae..a2f6260 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering", diff --git a/src/zugbruecke/__init__.py b/src/zugbruecke/__init__.py index f413efc..c482158 100644 --- a/src/zugbruecke/__init__.py +++ b/src/zugbruecke/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License @@ -30,7 +30,7 @@ # CONST # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -__version__ = "0.2.0" +__version__ = "0.2.1" # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # EXPORT: zugbruecke core diff --git a/src/zugbruecke/_server_.py b/src/zugbruecke/_server_.py index a2b1349..0fc0ab5 100755 --- a/src/zugbruecke/_server_.py +++ b/src/zugbruecke/_server_.py @@ -11,7 +11,7 @@ Required to run on platform / side: [WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/__init__.py b/src/zugbruecke/core/__init__.py index 2b142ec..55e0263 100644 --- a/src/zugbruecke/core/__init__.py +++ b/src/zugbruecke/core/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/abc.py b/src/zugbruecke/core/abc.py index 776d6e7..0a9827f 100644 --- a/src/zugbruecke/core/abc.py +++ b/src/zugbruecke/core/abc.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/cache.py b/src/zugbruecke/core/cache.py index e4f443e..af28142 100644 --- a/src/zugbruecke/core/cache.py +++ b/src/zugbruecke/core/cache.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/callback_client.py b/src/zugbruecke/core/callback_client.py index e8f82d1..d0bf60f 100644 --- a/src/zugbruecke/core/callback_client.py +++ b/src/zugbruecke/core/callback_client.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/callback_server.py b/src/zugbruecke/core/callback_server.py index 83133f7..c525d86 100644 --- a/src/zugbruecke/core/callback_server.py +++ b/src/zugbruecke/core/callback_server.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/config.py b/src/zugbruecke/core/config.py index d963782..eca8c50 100644 --- a/src/zugbruecke/core/config.py +++ b/src/zugbruecke/core/config.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/const.py b/src/zugbruecke/core/const.py index f7fa132..7ff058a 100644 --- a/src/zugbruecke/core/const.py +++ b/src/zugbruecke/core/const.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/data.py b/src/zugbruecke/core/data.py index 2fa1b25..02b1920 100644 --- a/src/zugbruecke/core/data.py +++ b/src/zugbruecke/core/data.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License @@ -32,7 +32,7 @@ # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import ctypes -from typing import Any, Callable, List, Optional, Tuple +from typing import Any, Callable, List, Optional, Tuple, Union from .abc import CacheABC, DataABC, LogABC, RpcClientABC, RpcServerABC from .cache import Cache @@ -291,6 +291,10 @@ def _pack_array(self, array: Any, arraytype: Definition, start: int = 0) -> Any: array = [ self._pack_struct(struct, arraytype) for struct in array ] + elif arraytype.GROUP == FUNC_GROUP: + array = [ + self._pack_func(func, arraytype) for func in array + ] # Handle unknown flags else: @@ -351,21 +355,28 @@ def _pack_struct(self, struct: Any, structtype: Definition) -> List[Tuple[str, A for name, definition in structtype.fields ] - def _sync_arg(self, old_arg: Any, new_arg: Any, argtype: Definition): + def _sync_arg( + self, + old_arg: Any, + new_arg: Any, + argtype: Definition, + instruct: bool = False, + ) -> Optional[Any]: """ Args: - old_arg: Raw argument - new_arg: Raw argument - argtype: zugbruecke argtype definition Returns: - Nothing + Can return data for writing it into a struct """ # The non-trivial case first, arrays if not argtype.is_scalar: - # Sync items in array - self._sync_array(old_arg, new_arg, argtype) - # Leave + # Sync items in array and return (if there is something to return) + value = self._sync_array(old_arg, new_arg, argtype, instruct = instruct) + if instruct: + return value return # Do not do this for void pointers, likely handled by memsync @@ -382,8 +393,11 @@ def _sync_arg(self, old_arg: Any, new_arg: Any, argtype: Definition): if argtype.GROUP == SIMPLE_GROUP: if hasattr(old_arg, "value"): old_arg.value = new_arg.value - else: - pass # only relevant within structs or for actual pointers to scalars + return + if argtype.is_pointer: + return + if instruct: + return new_arg # only relevant in structs, struct sync should pick it up return if argtype.GROUP == STRUCT_GROUP: @@ -395,7 +409,14 @@ def _sync_arg(self, old_arg: Any, new_arg: Any, argtype: Definition): raise DataGroupError("unexpected datatype group") - def _sync_array(self, old_array: Any, new_array: Any, arraytype: Definition, start: int = 0): + def _sync_array( + self, + old_array: Any, + new_array: Any, + arraytype: Definition, + start: int = 0, + instruct: bool = False, + ) -> Optional[Union[str, bytes]]: """ Recursive function, syncing one dimension per call @@ -405,7 +426,7 @@ def _sync_array(self, old_array: Any, new_array: Any, arraytype: Definition, sta - arraytype: zugbruecke argtype definition - start: dimension to start with when syncing Returns: - Nothing + Can return bytes/str for writing into a struct """ for idx, flag in enumerate(arraytype.flags[start:], start = start): @@ -430,17 +451,17 @@ def _sync_array(self, old_array: Any, new_array: Any, arraytype: Definition, sta if arraytype.GROUP == SIMPLE_GROUP: # HACK can not overwrite immutable bytes & strings, skipping sync operation. # Relevant for fixed-length char & wchar arrays by value in structs. - if not isinstance(old_array, bytes) and not isinstance(old_array, str): + if not isinstance(old_array, (bytes, str)): old_array[:] = new_array[:] + elif isinstance(old_array, (bytes, str)) and not arraytype.is_pointer and instruct: + return new_array # HACK return new string so it can be written into a struct field elif arraytype.GROUP == STRUCT_GROUP: for old_struct, new_struct in zip(old_array[:], new_array[:]): self._sync_struct( old_struct, new_struct, arraytype ) elif arraytype.GROUP == FUNC_GROUP: - raise NotImplementedError( - "functions in arrays are not supported" - ) + return # TODO function pointers may have been overwritten - ignore this case for now else: raise DataGroupError("unexpected datatype group") @@ -460,11 +481,15 @@ def _sync_struct(self, old_struct: Any, new_struct: Any, structtype: Definition) # Step through arguments for name, definition in structtype.fields: - self._sync_arg( + value = self._sync_arg( getattr(old_struct, name), getattr(new_struct, name), definition, + instruct = True, ) + if value is None or definition.GROUP != SIMPLE_GROUP: + continue + setattr(old_struct, name, getattr(new_struct, name)) # HACK simple data types by value def _unpack_item(self, item: Any, itemtype: Definition) -> Any: """ @@ -573,7 +598,11 @@ def _unpack_array(self, array: Any, arraytype: Definition, start: int = 0) -> Tu *(self._unpack_struct(dim, arraytype) for dim in array) ) elif arraytype.GROUP == FUNC_GROUP: - raise NotImplementedError("functions in arrays are not supported") + subtype = arraytype.base_type * flag + if not all(dim is None for dim in array): # Only unpack on server. Server returns None(s) to client - ignore. + array = subtype( + *(self._unpack_func(dim, arraytype) for dim in array) + ) else: raise DataGroupError("unexpected datatype group") diff --git a/src/zugbruecke/core/definitions/__init__.py b/src/zugbruecke/core/definitions/__init__.py index 1ca4910..c4e5763 100644 --- a/src/zugbruecke/core/definitions/__init__.py +++ b/src/zugbruecke/core/definitions/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/definitions/base.py b/src/zugbruecke/core/definitions/base.py index e3af4b9..b96be5f 100644 --- a/src/zugbruecke/core/definitions/base.py +++ b/src/zugbruecke/core/definitions/base.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/definitions/custom.py b/src/zugbruecke/core/definitions/custom.py index 0b7da1d..2f2badd 100644 --- a/src/zugbruecke/core/definitions/custom.py +++ b/src/zugbruecke/core/definitions/custom.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/definitions/func.py b/src/zugbruecke/core/definitions/func.py index ce6c32a..7521f71 100644 --- a/src/zugbruecke/core/definitions/func.py +++ b/src/zugbruecke/core/definitions/func.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/definitions/memsync.py b/src/zugbruecke/core/definitions/memsync.py index b2bd0f7..d070c19 100644 --- a/src/zugbruecke/core/definitions/memsync.py +++ b/src/zugbruecke/core/definitions/memsync.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/definitions/simple.py b/src/zugbruecke/core/definitions/simple.py index 69bdec9..5d7ec42 100644 --- a/src/zugbruecke/core/definitions/simple.py +++ b/src/zugbruecke/core/definitions/simple.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/definitions/struct.py b/src/zugbruecke/core/definitions/struct.py index 570794d..b45ac5c 100644 --- a/src/zugbruecke/core/definitions/struct.py +++ b/src/zugbruecke/core/definitions/struct.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License @@ -34,7 +34,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union from ..abc import CacheABC, DefinitionABC -from ..const import STRUCT_GROUP +from ..const import FLAG_POINTER, STRUCT_GROUP from ..typeguard import typechecked from . import base @@ -177,11 +177,12 @@ def _from_data_type( cache = cache, )) for field in base_type._fields_ ] + arrayflags = tuple(flag for flag in flags if flag != FLAG_POINTER) structtype = cls( flags = flags, field_name = field_name, - type_name = f'structtype_{hash(tuple((name, definition.data_type) for name, definition in fields)):x}', + type_name = f'structtype_{hash(tuple((name, definition.data_type) for name, definition in fields) + arrayflags):x}', data_type = data_type, base_type = base_type, fields = fields, diff --git a/src/zugbruecke/core/dll_client.py b/src/zugbruecke/core/dll_client.py index 93cc1d0..2a90d5d 100644 --- a/src/zugbruecke/core/dll_client.py +++ b/src/zugbruecke/core/dll_client.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/dll_server.py b/src/zugbruecke/core/dll_server.py index d371987..c1f3250 100644 --- a/src/zugbruecke/core/dll_server.py +++ b/src/zugbruecke/core/dll_server.py @@ -10,7 +10,7 @@ Required to run on platform / side: [WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/errors.py b/src/zugbruecke/core/errors.py index 8832091..6d75ab2 100644 --- a/src/zugbruecke/core/errors.py +++ b/src/zugbruecke/core/errors.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/interpreter.py b/src/zugbruecke/core/interpreter.py index 1541b2d..7c1c81c 100644 --- a/src/zugbruecke/core/interpreter.py +++ b/src/zugbruecke/core/interpreter.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/lib.py b/src/zugbruecke/core/lib.py index 2d16bd5..49c4ffa 100644 --- a/src/zugbruecke/core/lib.py +++ b/src/zugbruecke/core/lib.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/log.py b/src/zugbruecke/core/log.py index 7f4a9e4..c641f1f 100644 --- a/src/zugbruecke/core/log.py +++ b/src/zugbruecke/core/log.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/memory.py b/src/zugbruecke/core/memory.py index a215d7c..238c7ae 100644 --- a/src/zugbruecke/core/memory.py +++ b/src/zugbruecke/core/memory.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/mempkg.py b/src/zugbruecke/core/mempkg.py index 5235e77..12e75a5 100644 --- a/src/zugbruecke/core/mempkg.py +++ b/src/zugbruecke/core/mempkg.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/path.py b/src/zugbruecke/core/path.py index 2868044..720024a 100644 --- a/src/zugbruecke/core/path.py +++ b/src/zugbruecke/core/path.py @@ -10,7 +10,7 @@ Required to run on platform / side: [WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/routine_client.py b/src/zugbruecke/core/routine_client.py index c881898..349a75b 100644 --- a/src/zugbruecke/core/routine_client.py +++ b/src/zugbruecke/core/routine_client.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/routine_server.py b/src/zugbruecke/core/routine_server.py index f14a606..7683061 100644 --- a/src/zugbruecke/core/routine_server.py +++ b/src/zugbruecke/core/routine_server.py @@ -10,7 +10,7 @@ Required to run on platform / side: [WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/rpc.py b/src/zugbruecke/core/rpc.py index a126766..bb9d759 100644 --- a/src/zugbruecke/core/rpc.py +++ b/src/zugbruecke/core/rpc.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/session.py b/src/zugbruecke/core/session.py index 66a386d..102b5b7 100644 --- a/src/zugbruecke/core/session.py +++ b/src/zugbruecke/core/session.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/session_client.py b/src/zugbruecke/core/session_client.py index 83d90e3..1e2d289 100644 --- a/src/zugbruecke/core/session_client.py +++ b/src/zugbruecke/core/session_client.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/session_server.py b/src/zugbruecke/core/session_server.py index 69d0aba..eb27f1e 100644 --- a/src/zugbruecke/core/session_server.py +++ b/src/zugbruecke/core/session_server.py @@ -10,7 +10,7 @@ Required to run on platform / side: [WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/typeguard.py b/src/zugbruecke/core/typeguard.py index e97d366..0d853f7 100644 --- a/src/zugbruecke/core/typeguard.py +++ b/src/zugbruecke/core/typeguard.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/core/wenv.py b/src/zugbruecke/core/wenv.py index 5143fca..f76e593 100644 --- a/src/zugbruecke/core/wenv.py +++ b/src/zugbruecke/core/wenv.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/ctypes/__init__.py b/src/zugbruecke/ctypes/__init__.py index bdb5c21..5935f8d 100644 --- a/src/zugbruecke/ctypes/__init__.py +++ b/src/zugbruecke/ctypes/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/ctypes/util.py b/src/zugbruecke/ctypes/util.py index 32b113a..0e0dacc 100644 --- a/src/zugbruecke/ctypes/util.py +++ b/src/zugbruecke/ctypes/util.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/src/zugbruecke/ctypes/wintypes.py b/src/zugbruecke/ctypes/wintypes.py index e1daaa9..1a8f196 100644 --- a/src/zugbruecke/ctypes/wintypes.py +++ b/src/zugbruecke/ctypes/wintypes.py @@ -18,7 +18,7 @@ https://github.com/python/cpython/blob/3.6/LICENSE Modifications from original: - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/__init__.py b/tests/__init__.py index 3767315..ce91e66 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index 61ea128..2630558 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/benchmark.py b/tests/lib/benchmark.py index 4e13f15..cb5587f 100644 --- a/tests/lib/benchmark.py +++ b/tests/lib/benchmark.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/build.py b/tests/lib/build.py index 3f9c2f0..887ff60 100644 --- a/tests/lib/build.py +++ b/tests/lib/build.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/cmd.py b/tests/lib/cmd.py index 1c6c8f4..32ebb79 100644 --- a/tests/lib/cmd.py +++ b/tests/lib/cmd.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/const.py b/tests/lib/const.py index 05c5124..c9c779c 100644 --- a/tests/lib/const.py +++ b/tests/lib/const.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/ctypes.py b/tests/lib/ctypes.py index 130f15c..f36f13b 100644 --- a/tests/lib/ctypes.py +++ b/tests/lib/ctypes.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/install.py b/tests/lib/install.py index 0e27564..a861066 100644 --- a/tests/lib/install.py +++ b/tests/lib/install.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/names.py b/tests/lib/names.py index 8af2e28..0465bec 100644 --- a/tests/lib/names.py +++ b/tests/lib/names.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/param.py b/tests/lib/param.py index 30b0064..526a093 100644 --- a/tests/lib/param.py +++ b/tests/lib/param.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/parser.py b/tests/lib/parser.py index 4a78185..5573850 100644 --- a/tests/lib/parser.py +++ b/tests/lib/parser.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/pythonversion.py b/tests/lib/pythonversion.py index f010fb3..8691c2c 100644 --- a/tests/lib/pythonversion.py +++ b/tests/lib/pythonversion.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/lib/run.py b/tests/lib/run.py index 4b26195..b2e4759 100644 --- a/tests/lib/run.py +++ b/tests/lib/run.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_callback_memsync.py b/tests/test_callback_memsync.py index d0a744f..4fd1ed1 100644 --- a/tests/test_callback_memsync.py +++ b/tests/test_callback_memsync.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_callback_optional.py b/tests/test_callback_optional.py index 42f0190..95f4c22 100644 --- a/tests/test_callback_optional.py +++ b/tests/test_callback_optional.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_callback_simple.py b/tests/test_callback_simple.py index b59322f..a04a562 100644 --- a/tests/test_callback_simple.py +++ b/tests/test_callback_simple.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_callback_simple_struct.py b/tests/test_callback_simple_struct.py index fb8d6be..efd9510 100644 --- a/tests/test_callback_simple_struct.py +++ b/tests/test_callback_simple_struct.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_customtype.py b/tests/test_customtype.py index 4bda777..08ea2eb 100644 --- a/tests/test_customtype.py +++ b/tests/test_customtype.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_error_argtypes.py b/tests/test_error_argtypes.py index d06f677..bdcf8b9 100644 --- a/tests/test_error_argtypes.py +++ b/tests/test_error_argtypes.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_error_memsync.py b/tests/test_error_memsync.py index 3c443e8..ffcd03b 100644 --- a/tests/test_error_memsync.py +++ b/tests/test_error_memsync.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_error_missing_dll.py b/tests/test_error_missing_dll.py index 62b38f4..53083bc 100644 --- a/tests/test_error_missing_dll.py +++ b/tests/test_error_missing_dll.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_error_missing_routine.py b/tests/test_error_missing_routine.py index 19fc974..9e4c087 100644 --- a/tests/test_error_missing_routine.py +++ b/tests/test_error_missing_routine.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_error_restype.py b/tests/test_error_restype.py index 89487aa..ffeb57f 100644 --- a/tests/test_error_restype.py +++ b/tests/test_error_restype.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_fixedlength_arrays.py b/tests/test_fixedlength_arrays.py index adaacfb..c35e5a6 100644 --- a/tests/test_fixedlength_arrays.py +++ b/tests/test_fixedlength_arrays.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_fixedlength_callback.py b/tests/test_fixedlength_callback.py new file mode 100644 index 0000000..5f82214 --- /dev/null +++ b/tests/test_fixedlength_callback.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- + +""" + +ZUGBRUECKE +Calling routines in Windows DLLs from Python scripts running on unixlike systems +https://github.com/pleiszenburg/zugbruecke + + tests/test_fixedlength_callback.py: Tests fixed length arrays of function pointers + + Required to run on platform / side: [UNIX, WINE] + + Copyright (C) 2017-2023 Sebastian M. Ernst + + +The contents of this file are subject to the GNU Lesser General Public License +Version 2.1 ("LGPL" or "License"). You may not use this file except in +compliance with the License. You may obtain a copy of the License at +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt +https://github.com/pleiszenburg/zugbruecke/blob/master/LICENSE + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the +specific language governing rights and limitations under the License. + + +""" + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# C +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +HEADER = """ +typedef double {{ SUFFIX }} (*mathop)(double a, double b); + +{{ PREFIX }} double {{ SUFFIX }} apply_op( + mathop ops[2], + double a, + double b, + int opcode + ); +""" + +SOURCE = """ +{{ PREFIX }} double {{ SUFFIX }} apply_op( + mathop ops[2], + double a, + double b, + int opcode + ) +{ + if (opcode >= 0 && opcode <= 1) { + return ops[opcode](a, b); + } + return 0.0; +} +""" + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# IMPORT +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +from .lib.ctypes import get_context + +import pytest + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# TEST(s) +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_fixedlength_callback(arch, conv, ctypes, dll_handle): + """ + Tests fixed length arrays of callback functions + """ + + if conv == "cdll": + FuncType = ctypes.CFUNCTYPE + elif conv == "windll": + FuncType = ctypes.WINFUNCTYPE + else: + raise ValueError("unknown calling convention", conv) + + MathOp = FuncType(ctypes.c_double, ctypes.c_double, ctypes.c_double) + + apply_op_dll = dll_handle.apply_op + apply_op_dll.argtypes = ( + MathOp * 2, + ctypes.c_double, + ctypes.c_double, + ctypes.c_int, + ) + apply_op_dll.restype = ctypes.c_double + + @MathOp + def add_op(a, b): + """ + Callback function, called by DLL function + """ + + return a + b + + @MathOp + def sub_op(a, b): + """ + Callback function, called by DLL function + """ + + return a - b + + def apply_op(a: float, b: float, opcode: int) -> float: + """ + User-facing wrapper around DLL function + """ + + ops = (MathOp * 2)() + ops[0] = add_op + ops[1] = sub_op + + return apply_op_dll(ops, a, b, opcode) + + assert pytest.approx(10.0) == apply_op(7.0, 3.0, 0) + assert pytest.approx(4.0) == apply_op(7.0, 3.0, 1) + assert pytest.approx(0.0) == apply_op(7.0, 3.0, 2) diff --git a/tests/test_fixedlength_string.py b/tests/test_fixedlength_string.py index d0ecb40..a4037e4 100644 --- a/tests/test_fixedlength_string.py +++ b/tests/test_fixedlength_string.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_fixedlength_struct.py b/tests/test_fixedlength_struct.py new file mode 100644 index 0000000..9303df3 --- /dev/null +++ b/tests/test_fixedlength_struct.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- + +""" + +ZUGBRUECKE +Calling routines in Windows DLLs from Python scripts running on unixlike systems +https://github.com/pleiszenburg/zugbruecke + + tests/test_fixedlength_struct.py: Tests fixed length arrays of structs + + Required to run on platform / side: [UNIX, WINE] + + Copyright (C) 2017-2023 Sebastian M. Ernst + + +The contents of this file are subject to the GNU Lesser General Public License +Version 2.1 ("LGPL" or "License"). You may not use this file except in +compliance with the License. You may obtain a copy of the License at +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt +https://github.com/pleiszenburg/zugbruecke/blob/master/LICENSE + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the +specific language governing rights and limitations under the License. + + +""" + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# C +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +HEADER = """ +typedef struct manynumbers { + float a, b, c, d, e, f; +} manynumbers; + +{{ PREFIX }} void {{ SUFFIX }} sum_members( + manynumbers numbers[10], + manynumbers *sum + ); +""" + +SOURCE = """ +{{ PREFIX }} void {{ SUFFIX }} sum_members( + manynumbers numbers[10], + manynumbers *sum + ) +{ + sum->a = 0.0; + sum->b = 0.0; + sum->c = 0.0; + sum->d = 0.0; + sum->e = 0.0; + sum->f = 0.0; + for (int i = 0; i < 10; i++) + { + sum->a += numbers[i].a; + sum->b += numbers[i].b; + sum->c += numbers[i].c; + sum->d += numbers[i].d; + sum->e += numbers[i].e; + sum->f += numbers[i].f; + } +} +""" + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# IMPORT +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +from .lib.ctypes import get_context + +import pytest + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# TEST(s) +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_fixedlength_struct(arch, conv, ctypes, dll_handle): + """ + Tests fixed length arrays of structs + """ + + class ManyNumbers(ctypes.Structure): + _fields_ = [ + ('a', ctypes.c_float), + ('b', ctypes.c_float), + ('c', ctypes.c_float), + ('d', ctypes.c_float), + ('e', ctypes.c_float), + ('f', ctypes.c_float), + ] + + sum_members_dll = dll_handle.sum_members + sum_members_dll.argtypes = ( + ManyNumbers * 10, + ctypes.POINTER(ManyNumbers), + ) + + numbers = (ManyNumbers * 10)() + for idx in range(10): + numbers[idx].a = 1 + idx * 10 + numbers[idx].b = 2 + idx * 10 + numbers[idx].c = 3 + idx * 10 + numbers[idx].d = 4 + idx * 10 + numbers[idx].e = 5 + idx * 10 + numbers[idx].f = 6 + idx * 10 + sum_ = ManyNumbers() + + sum_members_dll(numbers, ctypes.pointer(sum_)) + + assert all(( + sum_.a == 460, + sum_.b == 470, + sum_.c == 480, + sum_.d == 490, + sum_.e == 500, + sum_.f == 510, + )) diff --git a/tests/test_float_types.py b/tests/test_float_types.py index 0603703..00a90d1 100644 --- a/tests/test_float_types.py +++ b/tests/test_float_types.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_int_minimal.py b/tests/test_int_minimal.py index 191cb11..8fbbe3f 100644 --- a/tests/test_int_minimal.py +++ b/tests/test_int_minimal.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_int_types.py b/tests/test_int_types.py index ac50074..8d9d9ac 100644 --- a/tests/test_int_types.py +++ b/tests/test_int_types.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_memsync_computed_length.py b/tests/test_memsync_computed_length.py index bf16d43..ac2a6ba 100644 --- a/tests/test_memsync_computed_length.py +++ b/tests/test_memsync_computed_length.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_memsync_in_struct.py b/tests/test_memsync_in_struct.py index 1e26b16..8d125d3 100644 --- a/tests/test_memsync_in_struct.py +++ b/tests/test_memsync_in_struct.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_memsync_minimal.py b/tests/test_memsync_minimal.py index 9602d29..1d8a84f 100644 --- a/tests/test_memsync_minimal.py +++ b/tests/test_memsync_minimal.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_memsync_struct_array.py b/tests/test_memsync_struct_array.py index 4a1e078..3f350f4 100644 --- a/tests/test_memsync_struct_array.py +++ b/tests/test_memsync_struct_array.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_no_arguments.py b/tests/test_no_arguments.py index 83f4aa5..f62d404 100644 --- a/tests/test_no_arguments.py +++ b/tests/test_no_arguments.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_paths.py b/tests/test_paths.py index 9d11ebd..71590ed 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_pointers_and_array_in_struct_malloc_by_dll.py b/tests/test_pointers_and_array_in_struct_malloc_by_dll.py index b6ad741..4f77450 100644 --- a/tests/test_pointers_and_array_in_struct_malloc_by_dll.py +++ b/tests/test_pointers_and_array_in_struct_malloc_by_dll.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_pointers_and_array_malloc_by_dll.py b/tests/test_pointers_and_array_malloc_by_dll.py index 1f0c3a2..17beb00 100644 --- a/tests/test_pointers_and_array_malloc_by_dll.py +++ b/tests/test_pointers_and_array_malloc_by_dll.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_pointers_and_struct.py b/tests/test_pointers_and_struct.py index 796e8c8..6ceec0a 100644 --- a/tests/test_pointers_and_struct.py +++ b/tests/test_pointers_and_struct.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_pointers_and_struct_malloc_by_dll.py b/tests/test_pointers_and_struct_malloc_by_dll.py index a73aa97..9c77ae3 100644 --- a/tests/test_pointers_and_struct_malloc_by_dll.py +++ b/tests/test_pointers_and_struct_malloc_by_dll.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_pointers_byref.py b/tests/test_pointers_byref.py new file mode 100644 index 0000000..d2a7695 --- /dev/null +++ b/tests/test_pointers_byref.py @@ -0,0 +1,152 @@ +# -*- coding: utf-8 -*- + +""" + +ZUGBRUECKE +Calling routines in Windows DLLs from Python scripts running on unixlike systems +https://github.com/pleiszenburg/zugbruecke + + tests/test_pointers_byref.py: Testing "light-weight pointers" + + Required to run on platform / side: [UNIX, WINE] + + Copyright (C) 2017-2023 Sebastian M. Ernst + + +The contents of this file are subject to the GNU Lesser General Public License +Version 2.1 ("LGPL" or "License"). You may not use this file except in +compliance with the License. You may obtain a copy of the License at +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt +https://github.com/pleiszenburg/zugbruecke/blob/master/LICENSE + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the +specific language governing rights and limitations under the License. + + +""" + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# C +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +HEADER = """ +typedef struct subparam { + int a; + int b; + int diff; +} subparam; + +typedef struct mulparam { + float a; + float b; + float prod; +} mulparam; + +{{ PREFIX }} void {{ SUFFIX }} add_int( + int a, + int b, + int *sum + ); + +{{ PREFIX }} void {{ SUFFIX }} sub_int( + subparam *values + ); + +{{ PREFIX }} void {{ SUFFIX }} mul_float( + mulparam *values + ); +""" + +SOURCE = """ +{{ PREFIX }} void {{ SUFFIX }} add_int( + int a, + int b, + int *sum + ) +{ + *sum = a + b; +} + +{{ PREFIX }} void {{ SUFFIX }} sub_int( + subparam *values + ) +{ + values->diff = values->a - values->b; +} + +{{ PREFIX }} void {{ SUFFIX }} mul_float( + mulparam *values + ) +{ + values->prod = values->a * values->b; +} +""" + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# IMPORT +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +from .lib.ctypes import get_context + +import pytest + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# TEST(s) +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_pointers_byref_simple(arch, conv, ctypes, dll_handle): + """ + Tests byref with simple data type + """ + + add_int = dll_handle.add_int + add_int.argtypes = (ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_int)) + + sum_ = ctypes.c_int() + add_int(3, 4, ctypes.byref(sum_)) + assert sum_.value == 7 + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_pointers_byref_struct_int(arch, conv, ctypes, dll_handle): + """ + Tests byref with struct data type containing int + """ + + class SubParam(ctypes.Structure): + _fields_ = [ + ("a", ctypes.c_int), + ("b", ctypes.c_int), + ("diff", ctypes.c_int), + ] + + sub_int = dll_handle.sub_int + sub_int.argtypes = (ctypes.POINTER(SubParam),) + + param = SubParam(17, 15, 0) + sub_int(ctypes.byref(param)) + assert param.diff == 2 + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_pointers_byref_struct_float(arch, conv, ctypes, dll_handle): + """ + Tests byref with struct data type containing float + """ + + class MulParam(ctypes.Structure): + _fields_ = [ + ("a", ctypes.c_float), + ("b", ctypes.c_float), + ("prod", ctypes.c_float), + ] + + mul_float = dll_handle.mul_float + mul_float.argtypes = (ctypes.POINTER(MulParam),) + + param = MulParam(5.0, 6.0, 0.0) + mul_float(ctypes.byref(param)) + assert pytest.approx(30.0) == param.prod diff --git a/tests/test_string_byval_in_struct_pointer.py b/tests/test_string_byval_in_struct_pointer.py new file mode 100644 index 0000000..4932b60 --- /dev/null +++ b/tests/test_string_byval_in_struct_pointer.py @@ -0,0 +1,244 @@ +# -*- coding: utf-8 -*- + +""" + +ZUGBRUECKE +Calling routines in Windows DLLs from Python scripts running on unixlike systems +https://github.com/pleiszenburg/zugbruecke + + tests/test_string_byval_in_struct_pointer.py: Testing by value strings in structs by reference + + Required to run on platform / side: [UNIX, WINE] + + Copyright (C) 2017-2023 Sebastian M. Ernst + + +The contents of this file are subject to the GNU Lesser General Public License +Version 2.1 ("LGPL" or "License"). You may not use this file except in +compliance with the License. You may obtain a copy of the License at +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt +https://github.com/pleiszenburg/zugbruecke/blob/master/LICENSE + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the +specific language governing rights and limitations under the License. + + +""" + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# C +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +HEADER = """ +{% for TYPE in TYPES %} + + typedef struct threewords_{{ TYPE }} { + {{ TYPE }} a[5]; + {{ TYPE }} b[5]; + {{ TYPE }} c[11]; + } threewords_{{ TYPE }}; + + typedef struct onechar_{{ TYPE }} { + {{ TYPE }} x; + } onechar_{{ TYPE }}; + + {{ PREFIX }} void {{ SUFFIX }} concatenate_byval_fixedlength_in_struct_{{ TYPE }}( + threewords_{{ TYPE }} *somewords + ); + + {{ PREFIX }} void {{ SUFFIX }} charbingo_byval_in_struct_{{ TYPE }}( + onechar_{{ TYPE }} *thechar, + int y + ); + +{% endfor %} +""" + +SOURCE = """ +{% for TYPE in TYPES %} + + {{ PREFIX }} void {{ SUFFIX }} concatenate_byval_fixedlength_in_struct_{{ TYPE }}( + threewords_{{ TYPE }} *somewords + ) + { + for (int i = 0; i < 11; i++) { + somewords->c[i] = ' '; + } + for (int i = 0; i < 5; i++) { + if (somewords->a[i] != '\\0') { + somewords->c[i] = somewords->a[i]; + } + } + for (int i = 0; i < 5; i++) { + if (somewords->b[i] != '\\0') { + somewords->c[i + 6] = somewords->b[i]; + } + } + } + + {{ PREFIX }} void {{ SUFFIX }} charbingo_byval_in_struct_{{ TYPE }}( + onechar_{{ TYPE }} *thechar, + int y + ) + { + thechar->x = ' '; + if (y == 1) { + thechar->x = 'f'; + } else if (y == 2) { + thechar->x = 'g'; + } + } + +{% endfor %} +""" + +EXTRA = { + "TYPES": ["char", "wchar_t"], +} + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# IMPORT +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +from .lib.ctypes import get_context + +import pytest + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# TEST(s) +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_fixedlength_string_in_struct_char(arch, conv, ctypes, dll_handle): + """ + Test char arrays, fixed length, passed by value within struct + """ + + class ThreeWords(ctypes.Structure): + _fields_ = [ + ('a', ctypes.c_char * 5), + ('b', ctypes.c_char * 5), + ('c', ctypes.c_char * 11), + ] + + concatenate_byval_fixedlength_in_struct_dll = dll_handle.concatenate_byval_fixedlength_in_struct_char + concatenate_byval_fixedlength_in_struct_dll.argtypes = ( + ctypes.POINTER(ThreeWords), + ) + + def concatenate_byval_fixedlength_in_struct(a: str, b: str) -> str: + """ + User-facing wrapper around DLL function + """ + + assert len(a) <= 5 and len(b) <= 5 + + somewords = ctypes.pointer(ThreeWords(a.encode('utf-8'), b.encode('utf-8'), b'')) + + concatenate_byval_fixedlength_in_struct_dll(somewords) + + return somewords.contents.c.decode('utf-8') + + assert 'Hello world' == concatenate_byval_fixedlength_in_struct('Hello', 'world') + assert 'Hell worl ' == concatenate_byval_fixedlength_in_struct('Hell', 'worl') + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_fixedlength_string_in_struct_wchar(arch, conv, ctypes, dll_handle): + """ + Test char arrays, fixed length, passed by value within struct, UNICODE + """ + + class ThreeWords(ctypes.Structure): + _fields_ = [ + ('a', ctypes.c_wchar * 5), + ('b', ctypes.c_wchar * 5), + ('c', ctypes.c_wchar * 11), + ] + + concatenate_byval_fixedlength_in_struct_dll = dll_handle.concatenate_byval_fixedlength_in_struct_wchar_t + concatenate_byval_fixedlength_in_struct_dll.argtypes = ( + ctypes.POINTER(ThreeWords), + ) + + def concatenate_byval_fixedlength_in_struct(a: str, b: str) -> str: + """ + User-facing wrapper around DLL function + """ + + assert len(a) <= 5 and len(b) <= 5 + + somewords = ctypes.pointer(ThreeWords(a, b, '')) + + concatenate_byval_fixedlength_in_struct_dll(somewords) + + return somewords.contents.c + + assert 'Hello world' == concatenate_byval_fixedlength_in_struct('Hello', 'world') + assert 'Hell worl ' == concatenate_byval_fixedlength_in_struct('Hell', 'worl') + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_single_char_in_struct_char(arch, conv, ctypes, dll_handle): + """ + Test single char passed by value within struct + """ + + class OneChar(ctypes.Structure): + _fields_ = [ + ('x', ctypes.c_char), + ] + + charbingo_byval_in_struct_char_dll = dll_handle.charbingo_byval_in_struct_char + charbingo_byval_in_struct_char_dll.argtypes = ( + ctypes.POINTER(OneChar), ctypes.c_int, + ) + + def charbingo_byval_in_struct_char(y: int) -> str: + """ + User-facing wrapper around DLL function + """ + + onechar = ctypes.pointer(OneChar()) + + charbingo_byval_in_struct_char_dll(onechar, y) + + return onechar.contents.x.decode('utf-8') + + assert 'f' == charbingo_byval_in_struct_char(1) + assert 'g' == charbingo_byval_in_struct_char(2) + assert ' ' == charbingo_byval_in_struct_char(3) + + +@pytest.mark.parametrize("arch,conv,ctypes,dll_handle", get_context(__file__)) +def test_single_char_in_struct_wchar(arch, conv, ctypes, dll_handle): + """ + Test single char passed by value within struct, UNICODE + """ + + class OneChar(ctypes.Structure): + _fields_ = [ + ('x', ctypes.c_wchar), + ] + + charbingo_byval_in_struct_char_dll = dll_handle.charbingo_byval_in_struct_wchar_t + charbingo_byval_in_struct_char_dll.argtypes = ( + ctypes.POINTER(OneChar), ctypes.c_int, + ) + + def charbingo_byval_in_struct_char(y: int) -> str: + """ + User-facing wrapper around DLL function + """ + + onechar = ctypes.pointer(OneChar()) + + charbingo_byval_in_struct_char_dll(onechar, y) + + return onechar.contents.x + + assert 'f' == charbingo_byval_in_struct_char(1) + assert 'g' == charbingo_byval_in_struct_char(2) + assert ' ' == charbingo_byval_in_struct_char(3) diff --git a/tests/test_string_computed_length.py b/tests/test_string_computed_length.py index 9a8fb49..5babdb5 100644 --- a/tests/test_string_computed_length.py +++ b/tests/test_string_computed_length.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_string_nullterminated.py b/tests/test_string_nullterminated.py index 87cda30..f4f5ab7 100644 --- a/tests/test_string_nullterminated.py +++ b/tests/test_string_nullterminated.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_string_strsxp.py b/tests/test_string_strsxp.py index 7aee397..2e09c9d 100644 --- a/tests/test_string_strsxp.py +++ b/tests/test_string_strsxp.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_struct_pointer.py b/tests/test_struct_pointer.py index 3f0f3bc..d1b1603 100644 --- a/tests/test_struct_pointer.py +++ b/tests/test_struct_pointer.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License diff --git a/tests/test_util.py b/tests/test_util.py index 5eaddb4..66f9172 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -10,7 +10,7 @@ Required to run on platform / side: [UNIX, WINE] - Copyright (C) 2017-2022 Sebastian M. Ernst + Copyright (C) 2017-2023 Sebastian M. Ernst The contents of this file are subject to the GNU Lesser General Public License