pyobjc-framework-BrowserEngineKit 10.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. pyobjc-framework-BrowserEngineKit-10.2/Lib/BrowserEngineKit/__init__.py +34 -0
  2. pyobjc-framework-BrowserEngineKit-10.2/Lib/BrowserEngineKit/_metadata.py +237 -0
  3. pyobjc-framework-BrowserEngineKit-10.2/Lib/pyobjc_framework_BrowserEngineKit.egg-info/PKG-INFO +59 -0
  4. pyobjc-framework-BrowserEngineKit-10.2/Lib/pyobjc_framework_BrowserEngineKit.egg-info/SOURCES.txt +29 -0
  5. pyobjc-framework-BrowserEngineKit-10.2/Lib/pyobjc_framework_BrowserEngineKit.egg-info/dependency_links.txt +1 -0
  6. pyobjc-framework-BrowserEngineKit-10.2/Lib/pyobjc_framework_BrowserEngineKit.egg-info/not-zip-safe +1 -0
  7. pyobjc-framework-BrowserEngineKit-10.2/Lib/pyobjc_framework_BrowserEngineKit.egg-info/requires.txt +5 -0
  8. pyobjc-framework-BrowserEngineKit-10.2/Lib/pyobjc_framework_BrowserEngineKit.egg-info/top_level.txt +1 -0
  9. pyobjc-framework-BrowserEngineKit-10.2/License.txt +10 -0
  10. pyobjc-framework-BrowserEngineKit-10.2/MANIFEST.in +14 -0
  11. pyobjc-framework-BrowserEngineKit-10.2/Modules/_BrowserEngineKit.m +35 -0
  12. pyobjc-framework-BrowserEngineKit-10.2/Modules/_BrowserEngineKit_protocols.m +15 -0
  13. pyobjc-framework-BrowserEngineKit-10.2/Modules/pyobjc-api.h +214 -0
  14. pyobjc-framework-BrowserEngineKit-10.2/Modules/pyobjc-compat.h +245 -0
  15. pyobjc-framework-BrowserEngineKit-10.2/PKG-INFO +56 -0
  16. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/__init__.py +1 -0
  17. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/test_benetworkingprocess.py +20 -0
  18. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/test_beprocess.py +29 -0
  19. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/test_berenderingprocess.py +20 -0
  20. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/test_betextinputdelegate.py +17 -0
  21. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/test_betextinteractiondelegate.py +7 -0
  22. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/test_betextselectiontypes.py +31 -0
  23. pyobjc-framework-BrowserEngineKit-10.2/PyObjCTest/test_bewebcontentprocess.py +20 -0
  24. pyobjc-framework-BrowserEngineKit-10.2/metadata/BrowserEngineKit.fwinfo +147 -0
  25. pyobjc-framework-BrowserEngineKit-10.2/metadata/metadata.ini +2 -0
  26. pyobjc-framework-BrowserEngineKit-10.2/metadata/raw/arm64-14.4.fwinfo +1151 -0
  27. pyobjc-framework-BrowserEngineKit-10.2/metadata/raw/x86_64-14.4.fwinfo +1151 -0
  28. pyobjc-framework-BrowserEngineKit-10.2/pyobjc_setup.py +677 -0
  29. pyobjc-framework-BrowserEngineKit-10.2/pyproject.toml +3 -0
  30. pyobjc-framework-BrowserEngineKit-10.2/setup.cfg +4 -0
  31. pyobjc-framework-BrowserEngineKit-10.2/setup.py +49 -0
@@ -0,0 +1,34 @@
1
+ """
2
+ Python mapping for the BrowserEngineKit framework.
3
+
4
+ This module does not contain docstrings for the wrapped code, check Apple's
5
+ documentation for details on how to use these functions and classes.
6
+ """
7
+
8
+
9
+ def _setup():
10
+ import sys
11
+
12
+ import Foundation
13
+ import objc
14
+ from . import _BrowserEngineKit, _metadata
15
+
16
+ dir_func, getattr_func = objc.createFrameworkDirAndGetattr(
17
+ name="BrowserEngineKit",
18
+ frameworkIdentifier="com.apple.BrowserEngineKit",
19
+ frameworkPath=objc.pathForFramework(
20
+ "/System/Library/Frameworks/BrowserEngineKit.framework"
21
+ ),
22
+ globals_dict=globals(),
23
+ inline_list=None,
24
+ parents=(_BrowserEngineKit, Foundation),
25
+ metadict=_metadata.__dict__,
26
+ )
27
+
28
+ globals()["__dir__"] = dir_func
29
+ globals()["__getattr__"] = getattr_func
30
+
31
+ del sys.modules["BrowserEngineKit._metadata"]
32
+
33
+
34
+ globals().pop("_setup")()
@@ -0,0 +1,237 @@
1
+ # This file is generated by objective.metadata
2
+ #
3
+ # Last update: Thu Feb 15 21:09:58 2024
4
+ #
5
+ # flake8: noqa
6
+
7
+ import objc, sys
8
+ from typing import NewType
9
+
10
+ if sys.maxsize > 2**32:
11
+
12
+ def sel32or64(a, b):
13
+ return b
14
+
15
+ else:
16
+
17
+ def sel32or64(a, b):
18
+ return a
19
+
20
+
21
+ if objc.arch == "arm64":
22
+
23
+ def selAorI(a, b):
24
+ return a
25
+
26
+ else:
27
+
28
+ def selAorI(a, b):
29
+ return b
30
+
31
+
32
+ misc = {}
33
+ constants = """$$"""
34
+ enums = """$BEGestureTypeDoubleTap@3$BEGestureTypeDoubleTapAndHold@2$BEGestureTypeForceTouch@15$BEGestureTypeIMPhraseBoundaryDrag@14$BEGestureTypeLoupe@0$BEGestureTypeOneFingerDoubleTap@8$BEGestureTypeOneFingerTap@1$BEGestureTypeOneFingerTripleTap@9$BEGestureTypeTwoFingerRangedSelectGesture@11$BEGestureTypeTwoFingerSingleTap@10$BEPhraseBoundaryChanged@4$BESelectionFlagsNone@0$BESelectionFlipped@2$BESelectionTouchPhaseEnded@2$BESelectionTouchPhaseEndedMovingBackward@4$BESelectionTouchPhaseEndedMovingForward@3$BESelectionTouchPhaseEndedNotMoving@5$BESelectionTouchPhaseMoved@1$BESelectionTouchPhaseStarted@0$BEWordIsNearTap@1$"""
35
+ misc.update(
36
+ {
37
+ "BESelectionFlags": NewType("BESelectionFlags", int),
38
+ "BESelectionTouchPhase": NewType("BESelectionTouchPhase", int),
39
+ "BEGestureType": NewType("BEGestureType", int),
40
+ }
41
+ )
42
+ misc.update({})
43
+ misc.update({})
44
+ r = objc.registerMetaDataForSelector
45
+ objc._updatingMetadata(True)
46
+ try:
47
+ r(
48
+ b"BELayerHierarchy",
49
+ b"layerHierarchyWithError:",
50
+ {"arguments": {2: {"type_modifier": b"o"}}},
51
+ )
52
+ r(
53
+ b"BELayerHierarchyHostingTransactionCoordinator",
54
+ b"coordinatorWithError:",
55
+ {"arguments": {2: {"type_modifier": b"o"}}},
56
+ )
57
+ r(
58
+ b"BEMediaEnvironment",
59
+ b"activateWithError:",
60
+ {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}},
61
+ )
62
+ r(
63
+ b"BEMediaEnvironment",
64
+ b"makeCaptureSessionWithError:",
65
+ {"arguments": {2: {"type_modifier": b"o"}}},
66
+ )
67
+ r(
68
+ b"BEMediaEnvironment",
69
+ b"suspendWithError:",
70
+ {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}},
71
+ )
72
+ r(
73
+ b"BENetworkingProcess",
74
+ b"grantCapability:error:",
75
+ {"arguments": {3: {"type_modifier": b"o"}}},
76
+ )
77
+ r(
78
+ b"BENetworkingProcess",
79
+ b"makeLibXPCConnectionError:",
80
+ {"arguments": {2: {"type_modifier": b"o"}}},
81
+ )
82
+ r(
83
+ b"BENetworkingProcess",
84
+ b"networkProcessWithInterruptionHandler:completion:",
85
+ {
86
+ "arguments": {
87
+ 2: {
88
+ "callable": {
89
+ "retval": {"type": b"v"},
90
+ "arguments": {0: {"type": b"^v"}},
91
+ }
92
+ },
93
+ 3: {
94
+ "callable": {
95
+ "retval": {"type": b"v"},
96
+ "arguments": {
97
+ 0: {"type": b"^v"},
98
+ 1: {"type": b"@"},
99
+ 2: {"type": b"@"},
100
+ },
101
+ }
102
+ },
103
+ }
104
+ },
105
+ )
106
+ r(
107
+ b"BEProcessCapability",
108
+ b"requestWithError:",
109
+ {"arguments": {2: {"type_modifier": b"o"}}},
110
+ )
111
+ r(
112
+ b"BERenderingProcess",
113
+ b"grantCapability:error:",
114
+ {"arguments": {3: {"type_modifier": b"o"}}},
115
+ )
116
+ r(
117
+ b"BERenderingProcess",
118
+ b"makeLibXPCConnectionError:",
119
+ {"arguments": {2: {"type_modifier": b"o"}}},
120
+ )
121
+ r(
122
+ b"BERenderingProcess",
123
+ b"renderingProcessWithInterruptionHandler:completion:",
124
+ {
125
+ "arguments": {
126
+ 2: {
127
+ "callable": {
128
+ "retval": {"type": b"v"},
129
+ "arguments": {0: {"type": b"^v"}},
130
+ }
131
+ },
132
+ 3: {
133
+ "callable": {
134
+ "retval": {"type": b"v"},
135
+ "arguments": {
136
+ 0: {"type": b"^v"},
137
+ 1: {"type": b"@"},
138
+ 2: {"type": b"@"},
139
+ },
140
+ }
141
+ },
142
+ }
143
+ },
144
+ )
145
+ r(
146
+ b"BEWebContentProcess",
147
+ b"grantCapability:error:",
148
+ {"arguments": {3: {"type_modifier": b"o"}}},
149
+ )
150
+ r(
151
+ b"BEWebContentProcess",
152
+ b"makeLibXPCConnectionError:",
153
+ {"arguments": {2: {"type_modifier": b"o"}}},
154
+ )
155
+ r(
156
+ b"BEWebContentProcess",
157
+ b"webContentProcessWithInterruptionHandler:completion:",
158
+ {
159
+ "arguments": {
160
+ 2: {
161
+ "callable": {
162
+ "retval": {"type": b"v"},
163
+ "arguments": {0: {"type": b"^v"}},
164
+ }
165
+ },
166
+ 3: {
167
+ "callable": {
168
+ "retval": {"type": b"v"},
169
+ "arguments": {
170
+ 0: {"type": b"^v"},
171
+ 1: {"type": b"@"},
172
+ 2: {"type": b"@"},
173
+ },
174
+ }
175
+ },
176
+ }
177
+ },
178
+ )
179
+ r(b"NSObject", b"invalidate", {"required": True, "retval": {"type": b"Z"}})
180
+ r(
181
+ b"NSObject",
182
+ b"invalidateTextEntryContextForTextInput:",
183
+ {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}},
184
+ )
185
+ r(b"NSObject", b"isValid", {"required": True, "retval": {"type": b"Z"}})
186
+ r(
187
+ b"NSObject",
188
+ b"selectionDidChangeForTextInput:",
189
+ {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}},
190
+ )
191
+ r(
192
+ b"NSObject",
193
+ b"selectionWillChangeForTextInput:",
194
+ {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}},
195
+ )
196
+ r(
197
+ b"NSObject",
198
+ b"shouldDeferEventHandlingToSystemForTextInput:context:",
199
+ {
200
+ "required": True,
201
+ "retval": {"type": b"Z"},
202
+ "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}},
203
+ },
204
+ )
205
+ r(
206
+ b"NSObject",
207
+ b"systemDidChangeSelectionForInteraction:",
208
+ {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}},
209
+ )
210
+ r(
211
+ b"NSObject",
212
+ b"systemWillChangeSelectionForInteraction:",
213
+ {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}},
214
+ )
215
+ r(
216
+ b"NSObject",
217
+ b"textInput:deferReplaceTextActionToSystem:",
218
+ {
219
+ "required": True,
220
+ "retval": {"type": b"v"},
221
+ "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}},
222
+ },
223
+ )
224
+ r(
225
+ b"NSObject",
226
+ b"textInput:setCandidateSuggestions:",
227
+ {
228
+ "required": True,
229
+ "retval": {"type": b"v"},
230
+ "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}},
231
+ },
232
+ )
233
+ finally:
234
+ objc._updatingMetadata(False)
235
+ expressions = {}
236
+
237
+ # END OF FILE
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyobjc-framework-BrowserEngineKit
3
+ Version: 10.2
4
+ Summary: Wrappers for the framework BrowserEngineKit on macOS
5
+ Home-page: https://github.com/ronaldoussoren/pyobjc
6
+ Author: Ronald Oussoren
7
+ Author-email: pyobjc-dev@lists.sourceforge.net
8
+ License: MIT License
9
+ Keywords: PyObjC,BrowserEngineKit
10
+ Platform: MacOS X (>=10.7)
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Environment :: MacOS X :: Cocoa
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Natural Language :: English
17
+ Classifier: Operating System :: MacOS :: MacOS X
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: Implementation :: CPython
28
+ Classifier: Programming Language :: Objective C
29
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
+ Classifier: Topic :: Software Development :: User Interfaces
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/x-rst; charset=UTF-8
33
+ Requires-Dist: pyobjc-core>=10.2
34
+ Requires-Dist: pyobjc-framework-CoreMedia>=10.2
35
+ Requires-Dist: pyobjc-framework-CoreAudio>=10.2
36
+ Requires-Dist: pyobjc-framework-Cocoa>=10.2
37
+ Requires-Dist: pyobjc-framework-Quartz>=10.2
38
+ Project-URL: Documentation, https://pyobjc.readthedocs.io/en/latest/
39
+ Project-URL: Issue tracker, https://github.com/ronaldoussoren/pyobjc/issues
40
+ Project-URL: Repository, https://github.com/ronaldoussoren/pyobjc
41
+
42
+
43
+ Wrappers for the "BrowserEngineKit" framework on macOS.
44
+
45
+ These wrappers don't include documentation, please check Apple's documentation
46
+ for information on how to use this framework and PyObjC's documentation
47
+ for general tips and tricks regarding the translation between Python
48
+ and (Objective-)C frameworks
49
+
50
+
51
+ Project links
52
+ -------------
53
+
54
+ * `Documentation <https://pyobjc.readthedocs.io/en/latest/>`_
55
+
56
+ * `Issue Tracker <https://github.com/ronaldoussoren/pyobjc/issues>`_
57
+
58
+ * `Repository <https://github.com/ronaldoussoren/pyobjc/>`_
59
+
@@ -0,0 +1,29 @@
1
+ License.txt
2
+ MANIFEST.in
3
+ pyobjc_setup.py
4
+ pyproject.toml
5
+ setup.py
6
+ Lib/BrowserEngineKit/__init__.py
7
+ Lib/BrowserEngineKit/_metadata.py
8
+ Lib/pyobjc_framework_BrowserEngineKit.egg-info/PKG-INFO
9
+ Lib/pyobjc_framework_BrowserEngineKit.egg-info/SOURCES.txt
10
+ Lib/pyobjc_framework_BrowserEngineKit.egg-info/dependency_links.txt
11
+ Lib/pyobjc_framework_BrowserEngineKit.egg-info/not-zip-safe
12
+ Lib/pyobjc_framework_BrowserEngineKit.egg-info/requires.txt
13
+ Lib/pyobjc_framework_BrowserEngineKit.egg-info/top_level.txt
14
+ Modules/_BrowserEngineKit.m
15
+ Modules/_BrowserEngineKit_protocols.m
16
+ Modules/pyobjc-api.h
17
+ Modules/pyobjc-compat.h
18
+ PyObjCTest/__init__.py
19
+ PyObjCTest/test_benetworkingprocess.py
20
+ PyObjCTest/test_beprocess.py
21
+ PyObjCTest/test_berenderingprocess.py
22
+ PyObjCTest/test_betextinputdelegate.py
23
+ PyObjCTest/test_betextinteractiondelegate.py
24
+ PyObjCTest/test_betextselectiontypes.py
25
+ PyObjCTest/test_bewebcontentprocess.py
26
+ metadata/BrowserEngineKit.fwinfo
27
+ metadata/metadata.ini
28
+ metadata/raw/arm64-14.4.fwinfo
29
+ metadata/raw/x86_64-14.4.fwinfo
@@ -0,0 +1,5 @@
1
+ pyobjc-core>=10.2
2
+ pyobjc-framework-CoreMedia>=10.2
3
+ pyobjc-framework-CoreAudio>=10.2
4
+ pyobjc-framework-Cocoa>=10.2
5
+ pyobjc-framework-Quartz>=10.2
@@ -0,0 +1,10 @@
1
+ (This is the MIT license, note that libffi-src is a separate product with its own license)
2
+
3
+ Copyright 2002, 2003 - Bill Bumgarner, Ronald Oussoren, Steve Majewski, Lele Gaifax, et.al.
4
+ Copyright 2003-2024 - Ronald Oussoren
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ include *.txt MANIFEST.in *.py
2
+ graft Doc
3
+ graft Examples
4
+ graft Lib
5
+ graft Modules
6
+ graft source-deps
7
+ graft PyObjCTest
8
+ graft metadata
9
+ global-exclude .DS_Store
10
+ global-exclude *.pyc
11
+ global-exclude *.pyo
12
+ global-exclude *.so
13
+ prune Lib/*/*.dSYM
14
+ prune PyObjCTest/*.dSYM
@@ -0,0 +1,35 @@
1
+ #define Py_LIMITED_API 0x03060000
2
+ #define PY_SSIZE_T_CLEAN
3
+ #include "Python.h"
4
+ #include "pyobjc-api.h"
5
+
6
+ #import <BrowserEngineKit/BrowserEngineKit.h>
7
+
8
+ /* We include the source code here instead of
9
+ * using the linker due to limitations in pyobjc-api.h
10
+ */
11
+ #include "_BrowserEngineKit_protocols.m"
12
+
13
+ static PyMethodDef mod_methods[] = {
14
+ {0, 0, 0, 0} /* sentinel */
15
+ };
16
+
17
+ /* Python glue */
18
+ static struct PyModuleDef mod_module = {
19
+ PyModuleDef_HEAD_INIT, "_BrowserEngineKit", NULL, 0, mod_methods, NULL, NULL, NULL, NULL};
20
+
21
+ PyObject* PyInit__BrowserEngineKit(void);
22
+
23
+ PyObject* __attribute__((__visibility__("default"))) PyInit__BrowserEngineKit(void)
24
+ {
25
+ PyObject* m;
26
+ m = PyModule_Create(&mod_module);
27
+ if (!m) {
28
+ return NULL;
29
+ }
30
+
31
+ if (PyObjC_ImportAPI(m) == -1)
32
+ return NULL;
33
+
34
+ return m;
35
+ }
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This file is generated by objective.metadata
3
+ *
4
+ * Last update: Thu Feb 15 21:33:39 2024
5
+ */
6
+
7
+ static void __attribute__((__used__)) use_protocols(void)
8
+ {
9
+ PyObject* p __attribute__((__unused__));
10
+ #if PyObjC_BUILD_RELEASE >= 1404
11
+ p = PyObjC_IdToPython(@protocol(BEProcessCapabilityGrant)); Py_XDECREF(p);
12
+ p = PyObjC_IdToPython(@protocol(BETextInputDelegate)); Py_XDECREF(p);
13
+ p = PyObjC_IdToPython(@protocol(BETextInteractionDelegate)); Py_XDECREF(p);
14
+ #endif /* PyObjC_BUILD_RELEASE >= 1404 */
15
+ }
@@ -0,0 +1,214 @@
1
+ #ifndef PyObjC_API_H
2
+ #define PyObjC_API_H
3
+
4
+ /*
5
+ * Use this in helper modules for the objc package, and in wrappers
6
+ * for functions that deal with objective-C objects/classes
7
+ *
8
+ * This header defines some utility wrappers for importing and using
9
+ * the core bridge.
10
+ *
11
+ * This is the *only* header file that should be used to access
12
+ * functionality in the core bridge.
13
+ *
14
+ * WARNING: this file is not part of the public interface of PyObjC and
15
+ * might change or be removed without warning or regard for backward
16
+ * compatibility.
17
+ */
18
+
19
+ #include <objc/objc.h>
20
+
21
+ #import <Foundation/Foundation.h>
22
+
23
+ #include "pyobjc-compat.h"
24
+
25
+ #ifdef Py_LIMITED_API
26
+ /*
27
+ * Make sure PyObjC framework wrappers can build using the limited API
28
+ */
29
+ typedef void Py_buffer;
30
+ #endif
31
+
32
+ #include <objc/objc-runtime.h>
33
+
34
+ NS_ASSUME_NONNULL_BEGIN
35
+
36
+ /* Current API version, increase whenever:
37
+ * - Semantics of current functions change
38
+ * - Functions are removed
39
+ *
40
+ * Do not increase when adding a new function, the struct_len field
41
+ * can be used for detecting if a function has been added.
42
+ */
43
+ #ifndef PYOBJC_API_VERSION
44
+ #define PYOBJC_API_VERSION 25
45
+ #endif
46
+
47
+ #define PYOBJC_API_NAME "__C_API__"
48
+
49
+ #ifndef PyObjC_EXPECTED_STRUCT_SIZE
50
+ #define PyObjC_EXPECTED_STRUCT_SIZE (sizeof(struct pyobjc_api))
51
+ #endif
52
+
53
+ /*
54
+ * Only add items to the end of this list!
55
+ */
56
+ typedef int(RegisterMethodMappingFunctionType)(
57
+ Class, SEL,
58
+ PyObject* _Nullable (*_Nonnull)(PyObject* _Nonnull, PyObject* _Nonnull,
59
+ PyObject* _Nonnull const* _Nonnull, size_t),
60
+ IMP _Nullable (*_Nonnull)(PyObject* _Nonnull, PyObject* _Nonnull));
61
+
62
+ struct pyobjc_api {
63
+ int api_version; /* API version */
64
+ size_t struct_len; /* Length of this struct */
65
+ RegisterMethodMappingFunctionType* register_method_mapping;
66
+ id _Nullable (*_Nonnull obj_get_object)(PyObject* _Nonnull);
67
+ Class _Nullable (*_Nonnull cls_get_class)(PyObject* _Nonnull);
68
+ int (*_Nonnull depythonify_python_object)(PyObject* _Nonnull, id _Nullable* _Nonnull);
69
+ PyObject* _Nullable (*_Nonnull id_to_python)(id _Nullable);
70
+ void (*_Nonnull err_objc_to_python)(NSObject* _Nonnull);
71
+ int (*_Nonnull py_to_objc)(const char* _Nonnull, PyObject* _Nonnull, void* _Nonnull);
72
+ PyObject* _Nullable (*_Nonnull objc_to_py)(const char* _Nonnull,
73
+ const void* _Nonnull);
74
+ Py_ssize_t (*_Nonnull sizeof_type)(const char* _Nonnull);
75
+ Class _Nullable (*_Nonnull sel_get_class)(PyObject* _Nonnull sel);
76
+ SEL _Nullable (*_Nonnull sel_get_sel)(PyObject* _Nonnull sel);
77
+ int (*_Nonnull register_pointer_wrapper)(
78
+ const char* _Nonnull, const char* _Nonnull,
79
+ PyObject* _Nullable (*_Nonnull pythonify)(void* _Nonnull),
80
+ int (*_Nonnull depythonify)(PyObject* _Nonnull, void* _Nonnull));
81
+ IMP _Nullable (*_Nonnull unsupported_method_imp)(PyObject* _Nonnull,
82
+ PyObject* _Nonnull);
83
+ PyObject* _Nullable (*_Nonnull unsupported_method_caller)(
84
+ PyObject* _Nonnull, PyObject* _Nonnull, PyObject* _Nonnull const* _Nonnull,
85
+ size_t);
86
+ void (*_Nonnull err_python_to_objc_gil)(PyGILState_STATE* _Nonnull state);
87
+ int (*_Nonnull simplify_sig)(const char* signature, char* buf, size_t buflen);
88
+ void (*_Nonnull free_c_array)(int, Py_buffer*);
89
+ int (*_Nonnull py_to_c_array)(BOOL, BOOL, const char* _Nonnull, PyObject* _Nonnull,
90
+ void* _Nullable* _Nonnull, Py_ssize_t* _Nullable,
91
+ PyObject* _Nonnull* _Nonnull, Py_buffer* _Nonnull);
92
+ PyObject* _Nullable (*_Nonnull c_array_to_py)(const char* _Nonnull,
93
+ const void* _Nonnull, Py_ssize_t);
94
+ PyTypeObject* _Nonnull imp_type;
95
+ IMP _Nullable (*_Nonnull imp_get_imp)(PyObject* _Nonnull);
96
+ SEL _Nullable (*_Nonnull imp_get_sel)(PyObject* _Nonnull);
97
+ PyObject* _Nullable (*_Nonnull newtransient)(id _Nullable objc_object,
98
+ int* _Nonnull cookie);
99
+ void (*_Nonnull releasetransient)(PyObject* _Nonnull proxy, int cookie);
100
+ PyObject* _Nonnull* _Nonnull pyobjc_null;
101
+ int (*_Nonnull dep_c_array_count)(const char* _Nonnull type, Py_ssize_t count,
102
+ BOOL strict, PyObject* _Nonnull value,
103
+ void* _Nonnull datum, BOOL, BOOL);
104
+ PyObject* _Nullable (*_Nonnull varlistnew)(const char* _Nonnull tp,
105
+ void* _Nonnull array);
106
+ int (*_Nonnull pyobjcobject_convert)(PyObject* _Nonnull, void* _Nonnull);
107
+ int (*_Nonnull register_id_alias)(const char* _Nonnull, const char* _Nonnull);
108
+ int (*_Nonnull memview_check)(PyObject* _Nonnull);
109
+ PyObject* _Nullable (*_Nonnull memview_new)(void);
110
+ Py_buffer* _Nullable (*_Nonnull memview_getbuffer)(PyObject* _Nonnull);
111
+ int (*_Nonnull checkargcount)(PyObject* _Nonnull callable, size_t min_args,
112
+ size_t max_args, size_t nargsf);
113
+ int (*_Nonnull checknokwnames)(PyObject* _Nonnull callable,
114
+ PyObject* _Nullable kwnames);
115
+
116
+ PyObject* _Nullable (*_Nonnull createopaquepointertype)(const char*, const char*, const char*);
117
+ };
118
+
119
+ #ifndef PYOBJC_BUILD
120
+
121
+ #ifndef PYOBJC_METHOD_STUB_IMPL
122
+ static struct pyobjc_api* PyObjC_API;
123
+ #endif /* PYOBJC_METHOD_STUB_IMPL */
124
+
125
+ #define PyObjCIMP_Check(obj) PyObject_TypeCheck(obj, PyObjC_API->imp_type)
126
+ #define PyObjCObject_GetObject (PyObjC_API->obj_get_object)
127
+ #define PyObjCClass_GetClass (PyObjC_API->cls_get_class)
128
+ #define PyObjCSelector_GetClass (PyObjC_API->sel_get_class)
129
+ #define PyObjCSelector_GetSelector (PyObjC_API->sel_get_sel)
130
+ #define depythonify_python_object (PyObjC_API->depythonify_python_object)
131
+ #define PyObjC_IdToPython (PyObjC_API->id_to_python)
132
+ #define PyObjCErr_FromObjC (PyObjC_API->err_objc_to_python)
133
+ #define PyObjCErr_ToObjCWithGILState (PyObjC_API->err_python_to_objc_gil)
134
+ #define PyObjC_PythonToObjC (PyObjC_API->py_to_objc)
135
+ #define PyObjC_ObjCToPython (PyObjC_API->objc_to_py)
136
+ #define PyObjC_RegisterMethodMapping (PyObjC_API->register_method_mapping)
137
+ #define PyObjCPointerWrapper_Register (PyObjC_API->register_pointer_wrapper)
138
+ #define PyObjCUnsupportedMethod_IMP (PyObjC_API->unsupported_method_imp)
139
+ #define PyObjCUnsupportedMethod_Caller (PyObjC_API->unsupported_method_caller)
140
+ #define PyObjCRT_SizeOfType (PyObjC_API->sizeof_type)
141
+ #define PyObjC_FreeCArray (PyObjC_API->free_c_array)
142
+ #define PyObjC_PythonToCArray (PyObjC_API->py_to_c_array)
143
+ #define PyObjC_CArrayToPython (PyObjC_API->c_array_to_py)
144
+ #define PyObjCIMP_GetIMP (PyObjC_API->imp_get_imp)
145
+ #define PyObjCIMP_GetSelector (PyObjC_API->imp_get_sel)
146
+ #define PyObjCObject_NewTransient (PyObjC_API->newtransient)
147
+ #define PyObjCObject_ReleaseTransient (PyObjC_API->releasetransient)
148
+ #define PyObjC_NULL (*(PyObjC_API->pyobjc_null))
149
+ #define PyObjC_DepythonifyCArray (PyObjC_API->dep_c_array_count)
150
+ #define PyObjCVarList_New (PyObjC_API->varlistnew)
151
+ #define PyObjCObject_Convert (PyObjC_API->pyobjcobject_convert)
152
+ #define PyObjCPointerWrapper_RegisterID (PyObjC_API->register_id_alias)
153
+ #define PyObjCMemView_Check (PyObjC_API->memview_check)
154
+ #define PyObjCMemView_New (PyObjC_API->memview_new)
155
+ #define PyObjCMemView_GetBuffer (PyObjC_API->memview_getbuffer)
156
+ #define PyObjC_CheckArgCount (PyObjC_API->checkargcount)
157
+ #define PyObjC_CheckNoKwnames (PyObjC_API->checknokwnames)
158
+ #define PyObjCCreateOpaquePointerType (PyObjC_API->createopaquepointertype)
159
+
160
+ typedef void (*PyObjC_Function_Pointer)(void);
161
+ typedef struct PyObjC_function_map {
162
+ const char* name;
163
+ PyObjC_Function_Pointer function;
164
+ } PyObjC_function_map;
165
+
166
+ #ifndef PYOBJC_METHOD_STUB_IMPL
167
+
168
+ static inline PyObject*
169
+ PyObjC_CreateInlineTab(PyObjC_function_map* map)
170
+ {
171
+ return PyCapsule_New(map, "objc.__inline__", NULL);
172
+ }
173
+
174
+ static inline int
175
+ PyObjC_ImportAPI(PyObject* calling_module)
176
+ {
177
+ PyObjC_API = (struct pyobjc_api*)PyCapsule_Import("objc." PYOBJC_API_NAME, 0);
178
+ if (PyObjC_API == NULL) {
179
+ return -1;
180
+ }
181
+ if (PyObjC_API->api_version != PYOBJC_API_VERSION) {
182
+ PyErr_Format(PyExc_RuntimeError,
183
+ "Wrong version of PyObjC C API (got %d, expected %d)",
184
+ (int)PyObjC_API->api_version, (int)PYOBJC_API_VERSION);
185
+ return -1;
186
+ }
187
+
188
+ if (PyObjC_API->struct_len < PyObjC_EXPECTED_STRUCT_SIZE) {
189
+ PyErr_Format(PyExc_RuntimeError,
190
+ "Wrong struct-size of PyObjC C API (got %d, expected %d)",
191
+ (int)PyObjC_API->struct_len, (int)sizeof(struct pyobjc_api));
192
+ return -1;
193
+ }
194
+
195
+ /* Current pyobjc implementation doesn't allow deregistering
196
+ * information, avoid unloading of users of the C-API.
197
+ * (Yes this is ugle, patches to fix this situation are apriciated)
198
+ */
199
+ Py_INCREF(calling_module);
200
+
201
+ return 0;
202
+ }
203
+ #endif /* PYOBJC_METHOD_STUB_IMPL */
204
+
205
+ #else /* PyObjC_BUILD */
206
+
207
+ extern struct pyobjc_api objc_api;
208
+ extern int PyObjCAPI_Register(PyObject* module);
209
+
210
+ #endif /* !PYOBJC_BUILD */
211
+
212
+ NS_ASSUME_NONNULL_END
213
+
214
+ #endif /* PyObjC_API_H */