Home
last modified time | relevance | path

Searched refs:FFI (Results 1 – 25 of 119) sorted by relevance

12345

/PHP-8.4/ext/ffi/tests/
H A D034.phpt2 FFI 034: FFI::typeof(), FFI::sizeof(), FFI::alignof()
9 $ffi = FFI::cdef();
14 var_dump(FFI::sizeof($p1), FFI::sizeof($p2), FFI::sizeof($p3));
15 var_dump(FFI::alignof($p1), FFI::alignof($p2), FFI::alignof($p3));
16 var_dump(FFI::sizeof(FFI::typeof($p1)), FFI::sizeof(FFI::typeof($p2)), FFI::sizeof(FFI::typeof($p3)…
17 var_dump(FFI::alignof(FFI::typeof($p1)), FFI::alignof(FFI::typeof($p2)), FFI::alignof(FFI::typeof($…
H A D041.phpt2 FFI 041: Type memory management
11 return FFI::cdef()->new(FFI::cdef()->type($str));
13 $type = FFI::cdef()->type($str);
14 return FFI::cdef()->new($type);
24 return FFI::typeof(FFI::cdef()->new($str));
27 return FFI::typeof($data);
37 return FFI::cdef()->cast(FFI::cdef()->type($str), FFI::cdef()->new($str));
40 return FFI::cdef()->cast($type, FFI::cdef()->new($str));
50 return FFI::arrayType(FFI::cdef()->type($str), [2]);
62 object(FFI\CData:int32_t)#%d (1) {
[all …]
H A D040.phpt2 FFI 040: Support for scalar types
15 $ffi = FFI::cdef();
20 var_dump(FFI::typeof($x));
22 $p = FFI::addr($x);
26 var_dump(FFI::sizeof($x));
27 var_dump(FFI::alignof($x));
28 FFI::memset($x, ord("a"), 4);
29 var_dump(FFI::string($x, 4));
36 var_dump(FFI::typeof($y[0]));
38 $p = FFI::addr($y[0]);
[all …]
H A D033.phpt2 FFI 033: FFI::new(), FFI::free(), FFI::type(), FFI::typeof(), FFI::arrayType()
9 $ffi = FFI::cdef();
15 $t1 = FFI::typeof($p1);
28 $t3 = FFI::arrayType($t2, [2, 2]);
32 object(FFI\CData:uint8_t[2])#%d (2) {
38 object(FFI\CData:uint16_t[2])#%d (2) {
44 object(FFI\CType:uint8_t[2])#%d (0) {
46 object(FFI\CData:uint8_t[2])#%d (2) {
52 object(FFI\CType:uint16_t[2])#%d (0) {
54 object(FFI\CData:uint16_t[2])#%d (2) {
[all …]
H A D045.phpt2 FFI 045: FFI::isNull()
9 var_dump(FFI::isNull(FFI::cdef()->new("int*")));
10 $i = FFI::cdef()->new("int");
11 var_dump(FFI::isNull(FFI::addr($i)));
13 var_dump(FFI::isNull(null));
18 var_dump(FFI::isNull(FFI::cdef()->new("int[0]")));
26 TypeError: FFI::isNull(): Argument #1 ($ptr) must be of type FFI\CData, null given
27 FFI\Exception: Cannot instantiate FFI\CData of zero size
H A D009.phpt2 FFI 009: memcpy(), memcmp(), memset() and sizeof()
9 $ffi = FFI::cdef();
15 var_dump(FFI::memcmp($b, $a, FFI::sizeof($a)));
16 FFI::memcpy($b, $a, FFI::sizeof($a));
18 var_dump(FFI::memcmp($b, $a, FFI::sizeof($a)));
19 FFI::memset($a, -1, FFI::sizeof($a));
24 object(FFI\CData:int32_t[4])#%d (4) {
35 object(FFI\CData:int32_t[3])#%d (3) {
H A Ddeprecations.phpt2 Test calling the deprecated signature of FFI::new(), FFI::type(), FFI::cast()
10 $p1 = FFI::new("uint8_t[2]");
16 FFI::new("uint8_t[2]");
24 $t1 = FFI::type("uint16_t[2]");
30 FFI::type("uint16_t[2]");
36 $p = FFI::cast("uint8_t[2]", $p1);
41 FFI::cast("uint8_t[2]", $p1);
49 Calling FFI::new() statically is deprecated
50 object(FFI\CData:uint8_t[2])#1 (2) {
58 Calling FFI::type() statically is deprecated
[all …]
H A Dgh7867.phpt2 GH-7867 (FFI::cast() from pointer to array is broken)
9 $value = FFI::cdef()->new('char[26]');
12 $slice = FFI::cdef()->new('char[4]');
15 FFI::memcpy($slice, $value, 4);
20 FFI::memcpy($slice, $value + 4, 4);
26 object(FFI\CData:char*)#%d (1) {
30 object(FFI\CData:char[4])#%d (4) {
40 object(FFI\CData:char[4])#%d (4) {
52 object(FFI\CData:char*)#%d (1) {
56 object(FFI\CData:char[4])#%d (4) {
[all …]
H A Dnested_addr.phpt2 FFI Cannot nest FFI::addr() calls
9 $ffi = \FFI::cdef(<<<'CPP'
16 $structPtrPtr = \FFI::addr(\FFI::addr($struct));
19 Fatal error: Uncaught FFI\Exception: FFI::addr() cannot create a reference to a temporary pointer i…
21 #0 %s(%d): FFI::addr(Object(FFI\CData:struct <anonymous>*))
H A D027.phpt2 FFI 027: Incomplete and variable length arrays
9 $ffi = FFI::cdef();
18 FFI::cdef("static int (*foo)[*];");
24 FFI::cdef("typedef int foo[*];");
30 FFI::cdef("static void foo(int[*][*]);");
36 var_dump(FFI::sizeof($ffi->new("int[0]")));
41 var_dump(FFI::sizeof($ffi->new("int[]")));
57 $f = FFI::cdef("typedef int(*foo)[];");
63 $f = FFI::cdef("typedef int foo[][2];");
69 $f = FFI::cdef("typedef int foo[];");
[all …]
H A Dgh12905.phpt2 GH-12905 (FFI::new interacts badly with observers)
9 $libc = FFI::cdef("int printf(const char *format, ...);", "libc.so.6");
22 $ffi = FFI::cdef("", "libc.so.6");
28 <!-- init FFI::cdef() -->
29 <FFI::cdef>
30 </FFI::cdef>
31 <!-- init FFI::new() -->
32 <FFI::new>
33 </FFI::new>
H A D044.phpt2 FFI 044: mode attribute
9 $ffi = FFI::cdef("
21 var_dump(FFI::sizeof($ffi->new("a")));
22 var_dump(FFI::sizeof($ffi->new("ua")));
23 var_dump(FFI::sizeof($ffi->new("b")));
24 var_dump(FFI::sizeof($ffi->new("ub")));
25 var_dump(FFI::sizeof($ffi->new("c")));
26 var_dump(FFI::sizeof($ffi->new("uc")));
27 var_dump(FFI::sizeof($ffi->new("d")));
29 var_dump(FFI::sizeof($ffi->new("e")));
[all …]
H A D021.phpt2 FFI 021: packed enums
10 if (FFI::sizeof(FFI::new($type)) !== $size) {
57 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
59 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
61 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
63 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
65 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
67 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
69 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
71 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
[all …]
H A D035.phpt2 FFI 035: FFI::cdef()->new() not-owned
9 $p = FFI::cdef()->new("uint16_t[2]", false);
12 FFI::free($p);
20 object(FFI\CData:uint16_t[2])#%d (2) {
26 object(FFI\CData:uint16_t[2])#%d (0) {
28 FFI\Exception: Use after free()
H A D010.phpt2 FFI 010: string()
9 $a = FFI::cdef()->new("int[3]");
10 FFI::memset($a, ord("a"), FFI::sizeof($a));
11 var_dump(FFI::string($a, FFI::sizeof($a)));
H A D023.phpt2 FFI 023: GCC struct extensions
9 $ffi = FFI::cdef();
12 var_dump(FFI::sizeof($ffi->new("struct {}")));
16 var_dump(FFI::sizeof($ffi->new("struct {int a}")));
17 var_dump(FFI::sizeof($ffi->new("struct {int a; int b}")));
21 FFI\Exception: Cannot instantiate FFI\CData of zero size
H A D017.phpt2 FFI 017: Structure constraints & tags cleanup
10 var_dump(FFI::new("struct X {void x();}"));
15 var_dump(FFI::new("struct X {struct X x;}"));
20 var_dump(FFI::new("struct X {struct X *ptr;}"));
27 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
28 FFI\ParserException: function type is not allowed at line 1
30 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
31 FFI\ParserException: Struct/union can't contain an instance of itself at line 1
33 Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
34 object(FFI\CData:struct X)#%d (1) {
H A D013.phpt2 FFI 013: Declaration priorities and constrains
9 $ffi = FFI::cdef();
28 FFI::cdef("static int foo(int)[5];");
34 FFI::cdef("static int foo[5](int);");
40 FFI::cdef("static int foo(int)(int);");
46 FFI::cdef("typedef int foo[2][];");
52 FFI::cdef("typedef int foo[][2];");
62 FFI\ParserException: void type is not allowed at line 1
63 FFI\ParserException: void type is not allowed at line 1
64 FFI\ParserException: Function returning array is not allowed at line 1
[all …]
H A Dbug80847.phpt27 $ffi = FFI::cdef($header);
30 $ffi = FFI::cdef($header, 'php_zend_test.dll');
31 } catch (FFI\Exception $ex) {
32 $ffi = FFI::cdef($header, ffi_get_php_dll_name());
43 object(FFI\CData:struct bug80847_02)#%d (1) {
45 object(FFI\CData:struct bug80847_01)#%d (2) {
52 object(FFI\CData:struct bug80847_02)#%d (1) {
54 object(FFI\CData:struct bug80847_01)#%d (2) {
61 object(FFI\CData:struct bug80847_02)#%d (1) {
63 object(FFI\CData:struct bug80847_01)#%d (2) {
H A D006.phpt2 FFI 006: Pointer assignment
9 $ffi = FFI::cdef();
15 FFI::free($v[1]);
19 object(FFI\CData:int32_t*[2])#%d (2) {
23 object(FFI\CData:int32_t*)#%d (1) {
28 object(FFI\CData:int32_t*[2])#%d (2) {
H A D004.phpt2 FFI 004: Enum declarations
9 $ffi = FFI::cdef(<<<EOF
55 object(FFI\CData:enum _a)#%d (1) {
59 object(FFI\CData:enum _b)#%d (1) {
63 object(FFI\CData:enum _c)#%d (1) {
67 object(FFI\CData:enum _d)#%d (1) {
71 object(FFI\CData:int32_t[1])#%d (1) {
75 object(FFI\CData:int32_t[1])#%d (1) {
79 object(FFI\CData:int32_t[2])#%d (2) {
85 FFI\ParserException: Incomplete enum "_e" at line 1
[all …]
H A D047.phpt2 FFI 047: FFI::CData->cdata meaning
9 $x = FFI::cdef()->new("int");
13 $x = FFI::cdef()->new("int*");
21 $x = FFI::cdef()->new("struct {int cdata;}");
30 object(FFI\CData:int32_t)#%d (1) {
35 object(FFI\CData:struct <anonymous>)#%d (1) {
H A D028.phpt2 FFI 028: Incomplete arrays inside structure
10 FFI::cdef("struct _x {int a; int b[0];};");
16 FFI::cdef("struct _x {int a; int b[];};");
22 FFI::cdef("struct _x {int a[0]; int b;};");
28 FFI::cdef("struct _x {int a[]; int b;};");
34 FFI::cdef("struct _x { struct {int a; int b[];}; int c;};");
40 FFI::cdef("union _x {int a; int b[];};");
50 FFI\ParserException: Flexible array member not at end of struct at line 1
51 FFI\ParserException: Flexible array member not at end of struct at line 1
52 FFI\ParserException: Flexible array member in union at line 1
/PHP-8.4/ext/ffi/
H A Dffi.stub.php7 final class FFI class
27 public static function cast(FFI\CType|string $type, $ptr): FFI\CData {}
32 public static function typeof(FFI\CData $ptr): FFI\CType {}
34 public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
37 public static function addr(FFI\CData $ptr): FFI\CData {}
40 public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
43 public static function alignof(FFI\CData|FFI\CType $ptr): int {}
46 * @param FFI\CData|string $from
54 * @param string|FFI\CData $ptr1
56 * @param string|FFI\CData $ptr2
[all …]
H A Dffi_arginfo.h50 ZEND_ARG_OBJ_TYPE_MASK(ZEND_SEND_PREFER_REF, ptr, FFI\\CData|FFI\\CType, 0, NULL)
124 ZEND_METHOD(FFI, cdef);
125 ZEND_METHOD(FFI, load);
126 ZEND_METHOD(FFI, scope);
127 ZEND_METHOD(FFI, new);
128 ZEND_METHOD(FFI, free);
129 ZEND_METHOD(FFI, cast);
130 ZEND_METHOD(FFI, type);
131 ZEND_METHOD(FFI, typeof);
133 ZEND_METHOD(FFI, addr);
[all …]

Completed in 24 milliseconds

12345