Home
last modified time | relevance | path

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

1234

/PHP-8.1/ext/ffi/tests/
H A D034.phpt2 FFI 034: FFI::typeof(), FFI::sizeof(), FFI::alignof()
9 $p1 = FFI::new("uint8_t[2]");
10 $p2 = FFI::new("uint16_t[2]");
11 $p3 = FFI::new("uint32_t[2]");
12 var_dump(FFI::sizeof($p1), FFI::sizeof($p2), FFI::sizeof($p3));
13 var_dump(FFI::alignof($p1), FFI::alignof($p2), FFI::alignof($p3));
14 var_dump(FFI::sizeof(FFI::typeof($p1)), FFI::sizeof(FFI::typeof($p2)), FFI::sizeof(FFI::typeof($p3)…
15 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::new(FFI::type($str));
13 $type = FFI::type($str);
14 return FFI::new($type);
24 return FFI::typeof(FFI::new($str));
26 $data = FFI::new($str);
27 return FFI::typeof($data);
37 return FFI::cast(FFI::type($str), FFI::new($str));
39 $type = FFI::type($str);
40 return FFI::cast($type, FFI::new($str));
[all …]
H A D033.phpt2 FFI 033: FFI::new(), FFI::free(), FFI::type(), FFI::typeof(), FFI::arrayType()
9 $p1 = FFI::new("uint8_t[2]");
13 $t1 = FFI::typeof($p1);
16 $p4 = FFI::new($t1);
19 $t2 = FFI::type("uint16_t[2]");
21 $p4 = FFI::new($t2);
24 $t2 = FFI::type("uint32_t");
26 $t3 = FFI::arrayType($t2, [2, 2]);
30 object(FFI\CData:uint8_t[2])#%d (2) {
42 object(FFI\CType:uint8_t[2])#%d (0) {
[all …]
H A D040.phpt2 FFI 040: Support for scalar types
15 $x = FFI::new("int");
18 var_dump(FFI::typeof($x));
20 $p = FFI::addr($x);
24 var_dump(FFI::sizeof($x));
25 var_dump(FFI::alignof($x));
26 FFI::memset($x, ord("a"), 4);
27 var_dump(FFI::string($x, 4));
31 $y = FFI::new("int[2]");
36 $p = FFI::addr($y[0]);
[all …]
H A D045.phpt2 FFI 045: FFI::isNull()
9 var_dump(FFI::isNull(FFI::new("int*")));
10 $i = FFI::new("int");
11 var_dump(FFI::isNull(FFI::addr($i)));
13 var_dump(FFI::isNull(null));
18 var_dump(FFI::isNull(FFI::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 $a = FFI::new("int[3]");
12 $b = FFI::new("int[4]");
13 var_dump(FFI::memcmp($b, $a, FFI::sizeof($a)));
14 FFI::memcpy($b, $a, FFI::sizeof($a));
16 var_dump(FFI::memcmp($b, $a, FFI::sizeof($a)));
17 FFI::memset($a, -1, FFI::sizeof($a));
22 object(FFI\CData:int32_t[4])#%d (4) {
33 object(FFI\CData:int32_t[3])#%d (3) {
H A D027.phpt2 FFI 027: Incomplete and variable length arrays
10 $p = FFI::new("int[*]");
16 FFI::cdef("static int (*foo)[*];");
22 FFI::cdef("typedef int foo[*];");
28 FFI::cdef("static void foo(int[*][*]);");
34 var_dump(FFI::sizeof(FFI::new("int[0]")));
39 var_dump(FFI::sizeof(FFI::new("int[]")));
44 var_dump(FFI::sizeof(FFI::cast("int[]", FFI::new("int[2]"))));
55 $f = FFI::cdef("typedef int(*foo)[];");
67 $f = FFI::cdef("typedef int foo[];");
[all …]
H A Dgh7867.phpt2 GH-7867 (FFI::cast() from pointer to array is broken)
9 $value = FFI::new('char[26]');
12 $slice = FFI::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 D023.phpt2 FFI 023: GCC struct extensions
10 var_dump(FFI::sizeof(FFI::new("struct {}")));
14 var_dump(FFI::sizeof(FFI::new("struct {int a}")));
15 var_dump(FFI::sizeof(FFI::new("struct {int a; int b}")));
19 FFI\Exception: Cannot instantiate FFI\CData of zero size
H A D014.phpt2 FFI 014: Size of nested types
9 var_dump(FFI::sizeof(FFI::new("uint32_t[2]")));
10 var_dump(FFI::sizeof(FFI::new("uint32_t([2])")));
11 var_dump(FFI::sizeof(FFI::new("uint32_t([2])[2]")));
H A D036.phpt2 FFI 036: Type memory management
9 $type = FFI::type("int*");
13 //$buf = FFI::new("int*[1]"); /* this loses type and crash */
14 $buf = FFI::new(FFI::arrayType($type, [1]));
20 $int = FFI::new("int");
22 var_dump(foo(FFI::addr($int)));
25 object(FFI\CData:int32_t*)#%d (1) {
H A D013.phpt2 FFI 013: Declaration priorities and constrains
9 $a = FFI::new("int[1][2][3]");
15 var_dump(FFI::new("void"));
21 var_dump(FFI::new("void[1]"));
26 FFI::cdef("static int foo(int)[5];");
32 FFI::cdef("static int foo[5](int);");
38 FFI::cdef("static int foo(int)(int);");
44 FFI::cdef("typedef int foo[2][];");
50 FFI::cdef("typedef int foo[][2];");
60 FFI\ParserException: void type is not allowed at line 1
[all …]
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 D006.phpt2 FFI 006: Pointer assignment
9 $v = FFI::new("int*[2]");
10 $v[1] = FFI::new("int[1]", false);
13 FFI::free($v[1]);
17 object(FFI\CData:int32_t*[2])#%d (2) {
21 object(FFI\CData:int32_t*)#%d (1) {
26 object(FFI\CData:int32_t*[2])#%d (2) {
H A D035.phpt2 FFI 035: FFI::new() not-owned
9 $p = FFI::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::new("int[3]");
10 FFI::memset($a, ord("a"), FFI::sizeof($a));
11 var_dump(FFI::string($a, FFI::sizeof($a)));
H A D020.phpt2 FFI 020: read-only
10 $p = FFI::new("struct {int x; const int y;}");
18 $p = FFI::new("struct {const int x; int y;}");
26 $p = FFI::new("const struct {int x; int y;}");
33 $p = FFI::new("const int[10]");
40 $p = FFI::new("const int * [1]");
47 $p = FFI::new("int * const [1]");
54 $f = FFI::cdef("typedef int * const t[1];");
66 FFI\Exception: Attempt to assign read-only location
67 FFI\Exception: Attempt to assign read-only location
[all …]
H A D005.phpt2 FFI 005: Array assignment
9 $m = FFI::new("int[2][2]");
10 $v = FFI::new("int[2]");
16 object(FFI\CData:int32_t[2][2])#%d (2) {
18 object(FFI\CData:int32_t[2])#%d (2) {
25 object(FFI\CData:int32_t[2])#%d (2) {
H A D007.phpt2 FFI 007: Pointer comparison
9 $v = FFI::new("int*[3]");
10 $v[0] = FFI::new("int[1]", false);
11 $v[1] = FFI::new("int[1]", false);
16 FFI::free($v[0]);
17 FFI::free($v[1]);
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 Dweak_reference_004.phpt2 Using FFI Types for keys of a WeakMap
11 $ffi = \FFI::cdef('');
12 $cdata_value = \FFI::new('int');
13 $cdata_array = \FFI::new('int[1]');
14 $cdata_free = \FFI::new('int[1]', false);
15 \FFI::free($cdata_free);
16 $ctype = \FFI::type('int');
H A D025.phpt2 FFI 025: direct work with primitive types
9 $x = FFI::new("int");
17 $x = FFI::new("char");
26 object(FFI\CData:int32_t)#%d (1) {
30 object(FFI\CData:int32_t)#%d (1) {
36 object(FFI\CData:char)#%d (1) {
40 object(FFI\CData:char)#%d (1) {
H A D047.phpt2 FFI 047: FFI::CData->cdata meaning
9 $x = FFI::new("int");
13 $x = FFI::new("int*");
21 $x = FFI::new("struct {int cdata;}");
30 object(FFI\CData:int32_t)#%d (1) {
35 object(FFI\CData:struct <anonymous>)#%d (1) {
/PHP-8.1/ext/ffi/
H A Dffi.stub.php8 final class FFI class
16 …public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): …
25 public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
30 public static function typeof(FFI\CData $ptr): FFI\CType {}
32 public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
35 public static function addr(FFI\CData $ptr): FFI\CData {}
38 public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
41 public static function alignof(FFI\CData|FFI\CType $ptr): int {}
44 * @param FFI\CData|string $from
52 * @param string|FFI\CData $ptr1
[all …]
H A Dffi_arginfo.h50 ZEND_ARG_OBJ_TYPE_MASK(ZEND_SEND_PREFER_REF, ptr, FFI\\CData|FFI\\CType, 0, NULL)
125 ZEND_METHOD(FFI, cdef);
126 ZEND_METHOD(FFI, load);
127 ZEND_METHOD(FFI, scope);
128 ZEND_METHOD(FFI, new);
129 ZEND_METHOD(FFI, free);
130 ZEND_METHOD(FFI, cast);
131 ZEND_METHOD(FFI, type);
132 ZEND_METHOD(FFI, typeof);
134 ZEND_METHOD(FFI, addr);
[all …]

Completed in 38 milliseconds

1234