xref: /PHP-8.2/ext/ffi/ffi.stub.php (revision 148ac364)
1<?php
2
3/** @generate-class-entries */
4
5namespace {
6
7	/** @not-serializable */
8    final class FFI
9    {
10        /**
11         * @var int
12         * @cvalue __BIGGEST_ALIGNMENT__
13         * @link ffi-ffi.constants.biggest-alignment
14         */
15        public const __BIGGEST_ALIGNMENT__ = UNKNOWN;
16
17        public static function cdef(string $code = "", ?string $lib = null): FFI {}
18
19        public static function load(string $filename): ?FFI {}
20
21        public static function scope(string $name): FFI {}
22
23        public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): ?FFI\CData {}
24
25        /** @prefer-ref $ptr */
26        public static function free(FFI\CData $ptr): void {}
27
28        /**
29         * @param FFI\CData|int|float|bool|null $ptr
30         * @prefer-ref $ptr
31         */
32        public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
33
34        public static function type(string $type): ?FFI\CType {}
35
36        /** @prefer-ref $ptr */
37        public static function typeof(FFI\CData $ptr): FFI\CType {}
38
39        public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
40
41        /** @prefer-ref $ptr */
42        public static function addr(FFI\CData $ptr): FFI\CData {}
43
44        /** @prefer-ref $ptr */
45        public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
46
47        /** @prefer-ref $ptr */
48        public static function alignof(FFI\CData|FFI\CType $ptr): int {}
49
50        /**
51         * @param FFI\CData|string $from
52         * @prefer-ref $to
53         * @prefer-ref $from
54         */
55        public static function memcpy(FFI\CData $to, $from, int $size): void {}
56
57        /**
58         * @prefer-ref $ptr1
59         * @param string|FFI\CData $ptr1
60         * @prefer-ref $ptr2
61         * @param string|FFI\CData $ptr2
62         */
63        public static function memcmp($ptr1, $ptr2, int $size): int {}
64
65        /** @prefer-ref $ptr */
66        public static function memset(FFI\CData $ptr, int $value, int $size): void {}
67
68        /** @prefer-ref $ptr */
69        public static function string(FFI\CData $ptr, ?int $size = null): string {}
70
71        /** @prefer-ref $ptr */
72        public static function isNull(FFI\CData $ptr): bool {}
73    }
74
75}
76
77namespace FFI {
78
79	/** @not-serializable */
80    final class CData {
81    }
82
83	/** @not-serializable */
84    final class CType {
85        /**
86         * @var int
87         * @cvalue ZEND_FFI_TYPE_VOID
88         */
89        public const TYPE_VOID = UNKNOWN;
90        /**
91         * @var int
92         * @cvalue ZEND_FFI_TYPE_FLOAT
93         */
94        public const TYPE_FLOAT = UNKNOWN;
95        /**
96         * @var int
97         * @cvalue ZEND_FFI_TYPE_DOUBLE
98         */
99        public const TYPE_DOUBLE = UNKNOWN;
100#ifdef HAVE_LONG_DOUBLE
101        /**
102         * @var int
103         * @cvalue ZEND_FFI_TYPE_LONGDOUBLE
104         */
105        public const TYPE_LONGDOUBLE = UNKNOWN;
106#endif
107        /**
108         * @var int
109         * @cvalue ZEND_FFI_TYPE_UINT8
110         */
111        public const TYPE_UINT8 = UNKNOWN;
112        /**
113         * @var int
114         * @cvalue ZEND_FFI_TYPE_SINT8
115         */
116        public const TYPE_SINT8 = UNKNOWN;
117        /**
118         * @var int
119         * @cvalue ZEND_FFI_TYPE_UINT16
120         */
121        public const TYPE_UINT16 = UNKNOWN;
122        /**
123         * @var int
124         * @cvalue ZEND_FFI_TYPE_SINT16
125         */
126        public const TYPE_SINT16 = UNKNOWN;
127        /**
128         * @var int
129         * @cvalue ZEND_FFI_TYPE_UINT32
130         */
131        public const TYPE_UINT32 = UNKNOWN;
132        /**
133         * @var int
134         * @cvalue ZEND_FFI_TYPE_SINT32
135         */
136        public const TYPE_SINT32 = UNKNOWN;
137        /**
138         * @var int
139         * @cvalue ZEND_FFI_TYPE_UINT64
140         */
141        public const TYPE_UINT64 = UNKNOWN;
142        /**
143         * @var int
144         * @cvalue ZEND_FFI_TYPE_SINT64
145         */
146        public const TYPE_SINT64 = UNKNOWN;
147        /**
148         * @var int
149         * @cvalue ZEND_FFI_TYPE_ENUM
150         */
151        public const TYPE_ENUM = UNKNOWN;
152        /**
153         * @var int
154         * @cvalue ZEND_FFI_TYPE_BOOL
155         */
156        public const TYPE_BOOL = UNKNOWN;
157        /**
158         * @var int
159         * @cvalue ZEND_FFI_TYPE_CHAR
160         */
161        public const TYPE_CHAR = UNKNOWN;
162        /**
163         * @var int
164         * @cvalue ZEND_FFI_TYPE_POINTER
165         */
166        public const TYPE_POINTER = UNKNOWN;
167        /**
168         * @var int
169         * @cvalue ZEND_FFI_TYPE_FUNC
170         */
171        public const TYPE_FUNC = UNKNOWN;
172        /**
173         * @var int
174         * @cvalue ZEND_FFI_TYPE_ARRAY
175         */
176        public const TYPE_ARRAY = UNKNOWN;
177        /**
178         * @var int
179         * @cvalue ZEND_FFI_TYPE_STRUCT
180         */
181        public const TYPE_STRUCT = UNKNOWN;
182
183        /**
184         * @var int
185         * @cvalue ZEND_FFI_ATTR_CONST
186         */
187        public const ATTR_CONST = UNKNOWN;
188        /**
189         * @var int
190         * @cvalue ZEND_FFI_ATTR_INCOMPLETE_TAG
191         */
192        public const ATTR_INCOMPLETE_TAG = UNKNOWN;
193        /**
194         * @var int
195         * @cvalue ZEND_FFI_ATTR_VARIADIC
196         */
197        public const ATTR_VARIADIC = UNKNOWN;
198        /**
199         * @var int
200         * @cvalue ZEND_FFI_ATTR_INCOMPLETE_ARRAY
201         */
202        public const ATTR_INCOMPLETE_ARRAY = UNKNOWN;
203        /**
204         * @var int
205         * @cvalue ZEND_FFI_ATTR_VLA
206         */
207        public const ATTR_VLA = UNKNOWN;
208        /**
209         * @var int
210         * @cvalue ZEND_FFI_ATTR_UNION
211         */
212        public const ATTR_UNION = UNKNOWN;
213        /**
214         * @var int
215         * @cvalue ZEND_FFI_ATTR_PACKED
216         */
217        public const ATTR_PACKED = UNKNOWN;
218        /**
219         * @var int
220         * @cvalue ZEND_FFI_ATTR_MS_STRUCT
221         */
222        public const ATTR_MS_STRUCT = UNKNOWN;
223        /**
224         * @var int
225         * @cvalue ZEND_FFI_ATTR_GCC_STRUCT
226         */
227        public const ATTR_GCC_STRUCT = UNKNOWN;
228
229        /**
230         * @var int
231         * @cvalue ZEND_FFI_ABI_DEFAULT
232         */
233        public const ABI_DEFAULT = UNKNOWN;
234        /**
235         * @var int
236         * @cvalue ZEND_FFI_ABI_CDECL
237         */
238        public const ABI_CDECL = UNKNOWN;
239        /**
240         * @var int
241         * @cvalue ZEND_FFI_ABI_FASTCALL
242         */
243        public const ABI_FASTCALL = UNKNOWN;
244        /**
245         * @var int
246         * @cvalue ZEND_FFI_ABI_THISCALL
247         */
248        public const ABI_THISCALL = UNKNOWN;
249        /**
250         * @var int
251         * @cvalue ZEND_FFI_ABI_STDCALL
252         */
253        public const ABI_STDCALL = UNKNOWN;
254        /**
255         * @var int
256         * @cvalue ZEND_FFI_ABI_PASCAL
257         */
258        public const ABI_PASCAL = UNKNOWN;
259        /**
260         * @var int
261         * @cvalue ZEND_FFI_ABI_REGISTER
262         */
263        public const ABI_REGISTER = UNKNOWN;
264        /**
265         * @var int
266         * @cvalue ZEND_FFI_ABI_MS
267         */
268        public const ABI_MS = UNKNOWN;
269        /**
270         * @var int
271         * @cvalue ZEND_FFI_ABI_SYSV
272         */
273        public const ABI_SYSV = UNKNOWN;
274        /**
275         * @var int
276         * @cvalue ZEND_FFI_ABI_VECTORCALL
277         */
278        public const ABI_VECTORCALL = UNKNOWN;
279
280        public function getName(): string {}
281
282        public function getKind(): int {}
283        public function getSize(): int {}
284        public function getAlignment(): int {}
285        public function getAttributes(): int {}
286
287        public function getEnumKind(): int {}
288
289        public function getArrayElementType(): CType {}
290        public function getArrayLength(): int {}
291
292        public function getPointerType(): CType {}
293
294        public function getStructFieldNames(): array {}
295        public function getStructFieldOffset(string $name): int {}
296        public function getStructFieldType(string $name): CType {}
297
298        public function getFuncABI(): int {}
299        public function getFuncReturnType(): CType {}
300        public function getFuncParameterCount(): int {}
301        public function getFuncParameterType(int $index): CType {}
302    }
303
304    class Exception extends \Error {
305    }
306
307    final class ParserException extends Exception {
308    }
309
310}
311