line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
MODULE = FFI::Platypus PACKAGE = FFI::Platypus::Record |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
int |
4
|
|
|
|
|
|
|
_ffi_record_ro(self) |
5
|
|
|
|
|
|
|
SV* self |
6
|
|
|
|
|
|
|
CODE: |
7
|
11
|
50
|
|
|
|
|
if(SvROK(self)) |
8
|
11
|
|
|
|
|
|
self = SvRV(self); |
9
|
11
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
croak("Null record error"); |
11
|
11
|
|
|
|
|
|
RETVAL = SvREADONLY(self) ? 1 : 0; |
12
|
|
|
|
|
|
|
OUTPUT: |
13
|
|
|
|
|
|
|
RETVAL |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
void |
16
|
|
|
|
|
|
|
_accessor(perl_name, path_name, type, offset) |
17
|
|
|
|
|
|
|
const char *perl_name |
18
|
|
|
|
|
|
|
ffi_pl_string path_name; |
19
|
|
|
|
|
|
|
ffi_pl_type *type |
20
|
|
|
|
|
|
|
int offset |
21
|
|
|
|
|
|
|
PROTOTYPE: $$$$ |
22
|
|
|
|
|
|
|
PREINIT: |
23
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
24
|
|
|
|
|
|
|
CV *cv; |
25
|
66
|
|
|
|
|
|
void *function=NULL; |
26
|
|
|
|
|
|
|
/* not the correct prototype */ |
27
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint8(); |
28
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint16(); |
29
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint32(); |
30
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint64(); |
31
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint8(); |
32
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint16(); |
33
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint32(); |
34
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint64(); |
35
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_float(); |
36
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_double(); |
37
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_opaque(); |
38
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint8_array(); |
39
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint16_array(); |
40
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint32_array(); |
41
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_uint64_array(); |
42
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint8_array(); |
43
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint16_array(); |
44
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint32_array(); |
45
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_sint64_array(); |
46
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_float_array(); |
47
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_double_array(); |
48
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_opaque_array(); |
49
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_string_ro(); |
50
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_string_rw(); |
51
|
|
|
|
|
|
|
extern void ffi_pl_record_accessor_string_fixed(); |
52
|
|
|
|
|
|
|
CODE: |
53
|
66
|
|
|
|
|
|
Newx(member, 1, ffi_pl_record_member); |
54
|
66
|
|
|
|
|
|
member->offset = offset; |
55
|
|
|
|
|
|
|
|
56
|
66
|
100
|
|
|
|
|
switch(type->type_code & FFI_PL_SHAPE_MASK) |
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
case FFI_PL_SHAPE_ARRAY: |
59
|
16
|
|
|
|
|
|
member->count = type->extra[0].array.element_count; |
60
|
16
|
|
|
|
|
|
break; |
61
|
|
|
|
|
|
|
default: |
62
|
50
|
|
|
|
|
|
member->count = 1; |
63
|
50
|
|
|
|
|
|
break; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
66
|
|
|
|
|
|
switch(type->type_code) |
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT8: |
69
|
5
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint8; |
70
|
5
|
|
|
|
|
|
break; |
71
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT8: |
72
|
2
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint8; |
73
|
2
|
|
|
|
|
|
break; |
74
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT16: |
75
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint16; |
76
|
1
|
|
|
|
|
|
break; |
77
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT16: |
78
|
2
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint16; |
79
|
2
|
|
|
|
|
|
break; |
80
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT32: |
81
|
2
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint32; |
82
|
2
|
|
|
|
|
|
break; |
83
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT32: |
84
|
9
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint32; |
85
|
9
|
|
|
|
|
|
break; |
86
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT64: |
87
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint64; |
88
|
1
|
|
|
|
|
|
break; |
89
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT64: |
90
|
2
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint64; |
91
|
2
|
|
|
|
|
|
break; |
92
|
|
|
|
|
|
|
case FFI_PL_TYPE_FLOAT: |
93
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_float; |
94
|
1
|
|
|
|
|
|
break; |
95
|
|
|
|
|
|
|
case FFI_PL_TYPE_DOUBLE: |
96
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_double; |
97
|
1
|
|
|
|
|
|
break; |
98
|
|
|
|
|
|
|
case FFI_PL_TYPE_OPAQUE: |
99
|
3
|
|
|
|
|
|
function = ffi_pl_record_accessor_opaque; |
100
|
3
|
|
|
|
|
|
break; |
101
|
|
|
|
|
|
|
case FFI_PL_TYPE_STRING: |
102
|
12
|
|
|
|
|
|
switch(type->sub_type) |
103
|
|
|
|
|
|
|
{ |
104
|
|
|
|
|
|
|
case FFI_PL_TYPE_STRING_RO: |
105
|
4
|
|
|
|
|
|
member->count = 1; |
106
|
4
|
|
|
|
|
|
function = ffi_pl_record_accessor_string_ro; |
107
|
4
|
|
|
|
|
|
break; |
108
|
|
|
|
|
|
|
case FFI_PL_TYPE_STRING_RW: |
109
|
8
|
|
|
|
|
|
member->count = 1; |
110
|
8
|
|
|
|
|
|
function = ffi_pl_record_accessor_string_rw; |
111
|
8
|
|
|
|
|
|
break; |
112
|
|
|
|
|
|
|
} |
113
|
12
|
|
|
|
|
|
break; |
114
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT8 | FFI_PL_SHAPE_ARRAY: |
115
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint8_array; |
116
|
1
|
|
|
|
|
|
break; |
117
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT8 | FFI_PL_SHAPE_ARRAY: |
118
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint8_array; |
119
|
1
|
|
|
|
|
|
break; |
120
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT16 | FFI_PL_SHAPE_ARRAY: |
121
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint16_array; |
122
|
1
|
|
|
|
|
|
break; |
123
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT16 | FFI_PL_SHAPE_ARRAY: |
124
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint16_array; |
125
|
1
|
|
|
|
|
|
break; |
126
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT32 | FFI_PL_SHAPE_ARRAY: |
127
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint32_array; |
128
|
1
|
|
|
|
|
|
break; |
129
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT32 | FFI_PL_SHAPE_ARRAY: |
130
|
4
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint32_array; |
131
|
4
|
|
|
|
|
|
break; |
132
|
|
|
|
|
|
|
case FFI_PL_TYPE_UINT64 | FFI_PL_SHAPE_ARRAY: |
133
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_uint64_array; |
134
|
1
|
|
|
|
|
|
break; |
135
|
|
|
|
|
|
|
case FFI_PL_TYPE_SINT64 | FFI_PL_SHAPE_ARRAY: |
136
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_sint64_array; |
137
|
1
|
|
|
|
|
|
break; |
138
|
|
|
|
|
|
|
case FFI_PL_TYPE_FLOAT | FFI_PL_SHAPE_ARRAY: |
139
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_float_array; |
140
|
1
|
|
|
|
|
|
break; |
141
|
|
|
|
|
|
|
case FFI_PL_TYPE_DOUBLE | FFI_PL_SHAPE_ARRAY: |
142
|
1
|
|
|
|
|
|
function = ffi_pl_record_accessor_double_array; |
143
|
1
|
|
|
|
|
|
break; |
144
|
|
|
|
|
|
|
case FFI_PL_TYPE_OPAQUE | FFI_PL_SHAPE_ARRAY: |
145
|
3
|
|
|
|
|
|
function = ffi_pl_record_accessor_opaque_array; |
146
|
3
|
|
|
|
|
|
break; |
147
|
|
|
|
|
|
|
case FFI_PL_TYPE_RECORD: |
148
|
9
|
|
|
|
|
|
member->count = type->extra[0].record.size; |
149
|
9
|
|
|
|
|
|
function = ffi_pl_record_accessor_string_fixed; |
150
|
9
|
|
|
|
|
|
break; |
151
|
|
|
|
|
|
|
default: |
152
|
0
|
|
|
|
|
|
Safefree(member); |
153
|
0
|
|
|
|
|
|
XSRETURN_PV("type not supported"); |
154
|
|
|
|
|
|
|
break; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
66
|
50
|
|
|
|
|
if(path_name == NULL) |
158
|
0
|
|
|
|
|
|
path_name = "unknown"; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
/* |
161
|
|
|
|
|
|
|
* this ifdef is needed for Perl 5.8.8 support. |
162
|
|
|
|
|
|
|
* once we don't need to support 5.8.8 we can |
163
|
|
|
|
|
|
|
* remove this workaround (the ndef'd branch) |
164
|
|
|
|
|
|
|
*/ |
165
|
|
|
|
|
|
|
#ifdef newXS_flags |
166
|
66
|
|
|
|
|
|
cv = newXSproto(perl_name, function, path_name, "$;$"); |
167
|
|
|
|
|
|
|
#else |
168
|
|
|
|
|
|
|
newXSproto(perl_name, function, path_name, "$;$"); |
169
|
|
|
|
|
|
|
cv = get_cv(perl_name,0); |
170
|
|
|
|
|
|
|
#endif |
171
|
|
|
|
|
|
|
|
172
|
66
|
|
|
|
|
|
CvXSUBANY(cv).any_ptr = (void*) member; |
173
|
66
|
|
|
|
|
|
XSRETURN_EMPTY; |
174
|
|
|
|
|
|
|
|