line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "ffi_platypus.h" |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
ffi_type * |
5
|
2756
|
|
|
|
|
|
ffi_pl_type_to_libffi_type(ffi_pl_type *type) |
6
|
|
|
|
|
|
|
{ |
7
|
2756
|
|
|
|
|
|
int type_code = type->type_code; |
8
|
2756
|
100
|
|
|
|
|
if((type_code & FFI_PL_SHAPE_MASK) == FFI_PL_SHAPE_CUSTOM_PERL) |
9
|
189
|
|
|
|
|
|
type_code = type_code & ~(FFI_PL_SHAPE_MASK); |
10
|
2756
|
100
|
|
|
|
|
if((type_code & FFI_PL_SHAPE_MASK) == FFI_PL_SHAPE_OBJECT) |
11
|
44
|
|
|
|
|
|
type_code = type_code & ~(FFI_PL_SHAPE_MASK); |
12
|
2756
|
|
|
|
|
|
switch(type_code) |
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
case FFI_PL_TYPE_VOID: |
15
|
182
|
|
|
|
|
|
return &ffi_type_void; |
16
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT8: |
17
|
51
|
|
|
|
|
|
return &ffi_type_sint8; |
18
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT16: |
19
|
49
|
|
|
|
|
|
return &ffi_type_sint16; |
20
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT32: |
21
|
411
|
|
|
|
|
|
return &ffi_type_sint32; |
22
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT64: |
23
|
49
|
|
|
|
|
|
return &ffi_type_sint64; |
24
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT8: |
25
|
108
|
|
|
|
|
|
return &ffi_type_uint8; |
26
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT16: |
27
|
74
|
|
|
|
|
|
return &ffi_type_uint16; |
28
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT32: |
29
|
64
|
|
|
|
|
|
return &ffi_type_uint32; |
30
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT64: |
31
|
206
|
|
|
|
|
|
return &ffi_type_uint64; |
32
|
|
|
|
|
|
|
case FFI_PL_TYPE_FLOAT: |
33
|
82
|
|
|
|
|
|
return &ffi_type_float; |
34
|
|
|
|
|
|
|
case FFI_PL_TYPE_DOUBLE: |
35
|
92
|
|
|
|
|
|
return &ffi_type_double; |
36
|
|
|
|
|
|
|
#ifdef FFI_PL_PROBE_LONGDOUBLE |
37
|
|
|
|
|
|
|
case FFI_PL_TYPE_LONG_DOUBLE: |
38
|
24
|
|
|
|
|
|
return &ffi_type_longdouble; |
39
|
|
|
|
|
|
|
#endif |
40
|
|
|
|
|
|
|
#if FFI_PL_PROBE_COMPLEX |
41
|
|
|
|
|
|
|
case FFI_PL_TYPE_COMPLEX_FLOAT: |
42
|
16
|
|
|
|
|
|
return &ffi_type_complex_float; |
43
|
|
|
|
|
|
|
case FFI_PL_TYPE_COMPLEX_DOUBLE: |
44
|
16
|
|
|
|
|
|
return &ffi_type_complex_double; |
45
|
|
|
|
|
|
|
#endif |
46
|
|
|
|
|
|
|
case FFI_PL_TYPE_OPAQUE: |
47
|
|
|
|
|
|
|
case FFI_PL_TYPE_STRING: |
48
|
|
|
|
|
|
|
case FFI_PL_TYPE_CLOSURE: |
49
|
|
|
|
|
|
|
case FFI_PL_TYPE_RECORD: |
50
|
828
|
|
|
|
|
|
return &ffi_type_pointer; |
51
|
|
|
|
|
|
|
case FFI_PL_TYPE_RECORD_VALUE: |
52
|
9
|
50
|
|
|
|
|
return type->extra[0].record.meta != NULL ? &type->extra[0].record.meta->ffi_type : NULL; |
53
|
|
|
|
|
|
|
} |
54
|
495
|
50
|
|
|
|
|
switch(type_code & (FFI_PL_SHAPE_MASK)) |
55
|
|
|
|
|
|
|
{ |
56
|
|
|
|
|
|
|
case FFI_PL_SHAPE_POINTER: |
57
|
|
|
|
|
|
|
case FFI_PL_SHAPE_ARRAY: |
58
|
495
|
|
|
|
|
|
return &ffi_type_pointer; |
59
|
|
|
|
|
|
|
default: |
60
|
0
|
|
|
|
|
|
fprintf(stderr, "FFI::Platypus: internal error: type = %04x\n", type_code); |
61
|
0
|
|
|
|
|
|
fflush(stderr); |
62
|
0
|
|
|
|
|
|
return NULL; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |