Home
last modified time | relevance | path

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

1234

/PHP-8.0/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 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 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 D040.phpt2 FFI 040: Support for scalar types
14 $x = FFI::new("int");
17 var_dump(FFI::typeof($x));
19 $p = FFI::addr($x);
23 var_dump(FFI::sizeof($x));
24 var_dump(FFI::alignof($x));
25 FFI::memset($x, ord("a"), 4);
26 var_dump(FFI::string($x, 4));
30 $y = FFI::new("int[2]");
35 $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 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 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 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 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 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 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 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 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.phpt26 $ffi = FFI::cdef($header);
29 $ffi = FFI::cdef($header, 'php_zend_test.dll');
30 } catch (FFI\Exception $ex) {
31 $ffi = FFI::cdef($header, ffi_get_php_dll_name());
42 object(FFI\CData:struct bug80847_02)#%d (1) {
44 object(FFI\CData:struct bug80847_01)#%d (2) {
51 object(FFI\CData:struct bug80847_02)#%d (1) {
53 object(FFI\CData:struct bug80847_01)#%d (2) {
60 object(FFI\CData:struct bug80847_02)#%d (1) {
62 object(FFI\CData:struct bug80847_01)#%d (2) {
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 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 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.0/ext/ffi/
H A Dffi.stub.php7 final class FFI class
24 public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
29 public static function typeof(FFI\CData $ptr): FFI\CType {}
31 public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
34 public static function addr(FFI\CData $ptr): FFI\CData {}
37 public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
40 public static function alignof(FFI\CData|FFI\CType $ptr): int {}
43 * @param FFI\CData|string $from
51 * @param string|FFI\CData $ptr1
53 * @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)
86 ZEND_METHOD(FFI, cdef);
87 ZEND_METHOD(FFI, load);
88 ZEND_METHOD(FFI, scope);
89 ZEND_METHOD(FFI, new);
90 ZEND_METHOD(FFI, free);
91 ZEND_METHOD(FFI, cast);
92 ZEND_METHOD(FFI, type);
93 ZEND_METHOD(FFI, typeof);
95 ZEND_METHOD(FFI, addr);
[all …]

Completed in 37 milliseconds

1234