line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* DO NOT MODIFY THIS FILE it is generated from these files: |
2
|
|
|
|
|
|
|
* inc/template/accessor.tt |
3
|
|
|
|
|
|
|
* inc/template/accessor_wrapper.tt |
4
|
|
|
|
|
|
|
* inc/run/generate_record_accessor.pl |
5
|
|
|
|
|
|
|
*/ |
6
|
|
|
|
|
|
|
#include "EXTERN.h" |
7
|
|
|
|
|
|
|
#include "perl.h" |
8
|
|
|
|
|
|
|
#include "XSUB.h" |
9
|
|
|
|
|
|
|
#include "ppport.h" |
10
|
|
|
|
|
|
|
#include "ffi_platypus.h" |
11
|
|
|
|
|
|
|
#include "ffi_platypus_guts.h" |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
10
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint8) |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
17
|
|
|
|
|
|
|
SV *self; |
18
|
|
|
|
|
|
|
char *ptr1; |
19
|
|
|
|
|
|
|
uint8_t *ptr2; |
20
|
|
|
|
|
|
|
|
21
|
10
|
|
|
|
|
|
dVAR; dXSARGS; |
22
|
|
|
|
|
|
|
|
23
|
10
|
50
|
|
|
|
|
if(items == 0) |
24
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
25
|
|
|
|
|
|
|
|
26
|
10
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
27
|
|
|
|
|
|
|
|
28
|
10
|
|
|
|
|
|
self = ST(0); |
29
|
10
|
50
|
|
|
|
|
if(SvROK(self)) |
30
|
10
|
|
|
|
|
|
self = SvRV(self); |
31
|
|
|
|
|
|
|
|
32
|
10
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
croak("Null record error"); |
34
|
|
|
|
|
|
|
|
35
|
10
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
36
|
10
|
|
|
|
|
|
ptr2 = (uint8_t*) &ptr1[member->offset]; |
37
|
|
|
|
|
|
|
|
38
|
10
|
100
|
|
|
|
|
if(items > 1) |
39
|
|
|
|
|
|
|
{ |
40
|
7
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
|
|
|
croak("record is read-only"); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else |
45
|
|
|
|
|
|
|
{ |
46
|
7
|
50
|
|
|
|
|
*ptr2 = (uint8_t) SvUV(ST(1)); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
10
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
51
|
7
|
|
|
|
|
|
XSRETURN_EMPTY; |
52
|
|
|
|
|
|
|
|
53
|
3
|
|
|
|
|
|
XSRETURN_UV(*ptr2); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint8_array) |
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
59
|
|
|
|
|
|
|
SV *self; |
60
|
|
|
|
|
|
|
SV *arg; |
61
|
|
|
|
|
|
|
SV **item; |
62
|
|
|
|
|
|
|
AV *av; |
63
|
|
|
|
|
|
|
char *ptr1; |
64
|
|
|
|
|
|
|
int i; |
65
|
|
|
|
|
|
|
uint8_t *ptr2; |
66
|
|
|
|
|
|
|
|
67
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
68
|
|
|
|
|
|
|
|
69
|
5
|
50
|
|
|
|
|
if(items == 0) |
70
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
71
|
|
|
|
|
|
|
|
72
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
73
|
|
|
|
|
|
|
|
74
|
5
|
|
|
|
|
|
self = ST(0); |
75
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
76
|
5
|
|
|
|
|
|
self = SvRV(self); |
77
|
|
|
|
|
|
|
|
78
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
79
|
5
|
|
|
|
|
|
ptr2 = (uint8_t*) &ptr1[member->offset]; |
80
|
|
|
|
|
|
|
|
81
|
5
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
|
|
|
croak("record is read-only"); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
5
|
100
|
|
|
|
|
if(items > 2) |
87
|
|
|
|
|
|
|
{ |
88
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
89
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
90
|
|
|
|
|
|
|
{ |
91
|
1
|
|
|
|
|
|
arg = ST(2); |
92
|
1
|
50
|
|
|
|
|
ptr2[i] = SvUV(arg); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else |
95
|
|
|
|
|
|
|
{ |
96
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
4
|
100
|
|
|
|
|
else if(items > 1) |
100
|
|
|
|
|
|
|
{ |
101
|
2
|
|
|
|
|
|
arg = ST(1); |
102
|
3
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
103
|
|
|
|
|
|
|
{ |
104
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
105
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
106
|
|
|
|
|
|
|
{ |
107
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
108
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
109
|
|
|
|
|
|
|
{ |
110
|
3
|
50
|
|
|
|
|
ptr2[i] = SvUV(*item); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else |
113
|
|
|
|
|
|
|
{ |
114
|
0
|
|
|
|
|
|
ptr2[i] = 0; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
else |
119
|
|
|
|
|
|
|
{ |
120
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
121
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
122
|
|
|
|
|
|
|
{ |
123
|
1
|
|
|
|
|
|
XSRETURN_UV(ptr2[i]); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
else |
126
|
|
|
|
|
|
|
{ |
127
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
128
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
134
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
135
|
|
|
|
|
|
|
|
136
|
2
|
|
|
|
|
|
av = newAV(); |
137
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
138
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
139
|
|
|
|
|
|
|
{ |
140
|
6
|
|
|
|
|
|
sv_setuv(*av_fetch(av, i, 1), ptr2[i]); |
141
|
|
|
|
|
|
|
} |
142
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
143
|
2
|
|
|
|
|
|
XSRETURN(1); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint8) |
147
|
|
|
|
|
|
|
{ |
148
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
149
|
|
|
|
|
|
|
SV *self; |
150
|
|
|
|
|
|
|
char *ptr1; |
151
|
|
|
|
|
|
|
int8_t *ptr2; |
152
|
|
|
|
|
|
|
|
153
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
154
|
|
|
|
|
|
|
|
155
|
5
|
50
|
|
|
|
|
if(items == 0) |
156
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
157
|
|
|
|
|
|
|
|
158
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
159
|
|
|
|
|
|
|
|
160
|
5
|
|
|
|
|
|
self = ST(0); |
161
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
162
|
5
|
|
|
|
|
|
self = SvRV(self); |
163
|
|
|
|
|
|
|
|
164
|
5
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
croak("Null record error"); |
166
|
|
|
|
|
|
|
|
167
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
168
|
5
|
|
|
|
|
|
ptr2 = (int8_t*) &ptr1[member->offset]; |
169
|
|
|
|
|
|
|
|
170
|
5
|
100
|
|
|
|
|
if(items > 1) |
171
|
|
|
|
|
|
|
{ |
172
|
2
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
173
|
|
|
|
|
|
|
{ |
174
|
0
|
|
|
|
|
|
croak("record is read-only"); |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
else |
177
|
|
|
|
|
|
|
{ |
178
|
2
|
50
|
|
|
|
|
*ptr2 = (int8_t) SvIV(ST(1)); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
5
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
183
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
184
|
|
|
|
|
|
|
|
185
|
3
|
|
|
|
|
|
XSRETURN_IV(*ptr2); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint8_array) |
189
|
|
|
|
|
|
|
{ |
190
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
191
|
|
|
|
|
|
|
SV *self; |
192
|
|
|
|
|
|
|
SV *arg; |
193
|
|
|
|
|
|
|
SV **item; |
194
|
|
|
|
|
|
|
AV *av; |
195
|
|
|
|
|
|
|
char *ptr1; |
196
|
|
|
|
|
|
|
int i; |
197
|
|
|
|
|
|
|
int8_t *ptr2; |
198
|
|
|
|
|
|
|
|
199
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
200
|
|
|
|
|
|
|
|
201
|
5
|
50
|
|
|
|
|
if(items == 0) |
202
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
203
|
|
|
|
|
|
|
|
204
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
205
|
|
|
|
|
|
|
|
206
|
5
|
|
|
|
|
|
self = ST(0); |
207
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
208
|
5
|
|
|
|
|
|
self = SvRV(self); |
209
|
|
|
|
|
|
|
|
210
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
211
|
5
|
|
|
|
|
|
ptr2 = (int8_t*) &ptr1[member->offset]; |
212
|
|
|
|
|
|
|
|
213
|
5
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
214
|
|
|
|
|
|
|
{ |
215
|
0
|
|
|
|
|
|
croak("record is read-only"); |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
5
|
100
|
|
|
|
|
if(items > 2) |
219
|
|
|
|
|
|
|
{ |
220
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
221
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
222
|
|
|
|
|
|
|
{ |
223
|
1
|
|
|
|
|
|
arg = ST(2); |
224
|
1
|
50
|
|
|
|
|
ptr2[i] = SvIV(arg); |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
else |
227
|
|
|
|
|
|
|
{ |
228
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
} |
231
|
4
|
100
|
|
|
|
|
else if(items > 1) |
232
|
|
|
|
|
|
|
{ |
233
|
2
|
|
|
|
|
|
arg = ST(1); |
234
|
3
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
235
|
|
|
|
|
|
|
{ |
236
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
237
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
238
|
|
|
|
|
|
|
{ |
239
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
240
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
241
|
|
|
|
|
|
|
{ |
242
|
3
|
50
|
|
|
|
|
ptr2[i] = SvIV(*item); |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
else |
245
|
|
|
|
|
|
|
{ |
246
|
0
|
|
|
|
|
|
ptr2[i] = 0; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
else |
251
|
|
|
|
|
|
|
{ |
252
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
253
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
254
|
|
|
|
|
|
|
{ |
255
|
1
|
|
|
|
|
|
XSRETURN_IV(ptr2[i]); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
else |
258
|
|
|
|
|
|
|
{ |
259
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
260
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
266
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
267
|
|
|
|
|
|
|
|
268
|
2
|
|
|
|
|
|
av = newAV(); |
269
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
270
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
271
|
|
|
|
|
|
|
{ |
272
|
6
|
|
|
|
|
|
sv_setiv(*av_fetch(av, i, 1), ptr2[i]); |
273
|
|
|
|
|
|
|
} |
274
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
275
|
2
|
|
|
|
|
|
XSRETURN(1); |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
1
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint16) |
279
|
|
|
|
|
|
|
{ |
280
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
281
|
|
|
|
|
|
|
SV *self; |
282
|
|
|
|
|
|
|
char *ptr1; |
283
|
|
|
|
|
|
|
uint16_t *ptr2; |
284
|
|
|
|
|
|
|
|
285
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
286
|
|
|
|
|
|
|
|
287
|
1
|
50
|
|
|
|
|
if(items == 0) |
288
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
289
|
|
|
|
|
|
|
|
290
|
1
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
291
|
|
|
|
|
|
|
|
292
|
1
|
|
|
|
|
|
self = ST(0); |
293
|
1
|
50
|
|
|
|
|
if(SvROK(self)) |
294
|
1
|
|
|
|
|
|
self = SvRV(self); |
295
|
|
|
|
|
|
|
|
296
|
1
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
297
|
0
|
|
|
|
|
|
croak("Null record error"); |
298
|
|
|
|
|
|
|
|
299
|
1
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
300
|
1
|
|
|
|
|
|
ptr2 = (uint16_t*) &ptr1[member->offset]; |
301
|
|
|
|
|
|
|
|
302
|
1
|
50
|
|
|
|
|
if(items > 1) |
303
|
|
|
|
|
|
|
{ |
304
|
1
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
305
|
|
|
|
|
|
|
{ |
306
|
0
|
|
|
|
|
|
croak("record is read-only"); |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
else |
309
|
|
|
|
|
|
|
{ |
310
|
1
|
50
|
|
|
|
|
*ptr2 = (uint16_t) SvUV(ST(1)); |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
1
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
50
|
|
|
|
|
|
315
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
316
|
|
|
|
|
|
|
|
317
|
0
|
|
|
|
|
|
XSRETURN_UV(*ptr2); |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint16_array) |
321
|
|
|
|
|
|
|
{ |
322
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
323
|
|
|
|
|
|
|
SV *self; |
324
|
|
|
|
|
|
|
SV *arg; |
325
|
|
|
|
|
|
|
SV **item; |
326
|
|
|
|
|
|
|
AV *av; |
327
|
|
|
|
|
|
|
char *ptr1; |
328
|
|
|
|
|
|
|
int i; |
329
|
|
|
|
|
|
|
uint16_t *ptr2; |
330
|
|
|
|
|
|
|
|
331
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
332
|
|
|
|
|
|
|
|
333
|
5
|
50
|
|
|
|
|
if(items == 0) |
334
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
335
|
|
|
|
|
|
|
|
336
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
337
|
|
|
|
|
|
|
|
338
|
5
|
|
|
|
|
|
self = ST(0); |
339
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
340
|
5
|
|
|
|
|
|
self = SvRV(self); |
341
|
|
|
|
|
|
|
|
342
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
343
|
5
|
|
|
|
|
|
ptr2 = (uint16_t*) &ptr1[member->offset]; |
344
|
|
|
|
|
|
|
|
345
|
5
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
346
|
|
|
|
|
|
|
{ |
347
|
0
|
|
|
|
|
|
croak("record is read-only"); |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
|
350
|
5
|
100
|
|
|
|
|
if(items > 2) |
351
|
|
|
|
|
|
|
{ |
352
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
353
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
354
|
|
|
|
|
|
|
{ |
355
|
1
|
|
|
|
|
|
arg = ST(2); |
356
|
1
|
50
|
|
|
|
|
ptr2[i] = SvUV(arg); |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
else |
359
|
|
|
|
|
|
|
{ |
360
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
361
|
|
|
|
|
|
|
} |
362
|
|
|
|
|
|
|
} |
363
|
4
|
100
|
|
|
|
|
else if(items > 1) |
364
|
|
|
|
|
|
|
{ |
365
|
2
|
|
|
|
|
|
arg = ST(1); |
366
|
3
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
367
|
|
|
|
|
|
|
{ |
368
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
369
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
370
|
|
|
|
|
|
|
{ |
371
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
372
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
373
|
|
|
|
|
|
|
{ |
374
|
3
|
50
|
|
|
|
|
ptr2[i] = SvUV(*item); |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
else |
377
|
|
|
|
|
|
|
{ |
378
|
0
|
|
|
|
|
|
ptr2[i] = 0; |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
} |
382
|
|
|
|
|
|
|
else |
383
|
|
|
|
|
|
|
{ |
384
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
385
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
386
|
|
|
|
|
|
|
{ |
387
|
1
|
|
|
|
|
|
XSRETURN_UV(ptr2[i]); |
388
|
|
|
|
|
|
|
} |
389
|
|
|
|
|
|
|
else |
390
|
|
|
|
|
|
|
{ |
391
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
392
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
} |
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
|
397
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
398
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
399
|
|
|
|
|
|
|
|
400
|
2
|
|
|
|
|
|
av = newAV(); |
401
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
402
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
403
|
|
|
|
|
|
|
{ |
404
|
6
|
|
|
|
|
|
sv_setuv(*av_fetch(av, i, 1), ptr2[i]); |
405
|
|
|
|
|
|
|
} |
406
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
407
|
2
|
|
|
|
|
|
XSRETURN(1); |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
|
410
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint16) |
411
|
|
|
|
|
|
|
{ |
412
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
413
|
|
|
|
|
|
|
SV *self; |
414
|
|
|
|
|
|
|
char *ptr1; |
415
|
|
|
|
|
|
|
int16_t *ptr2; |
416
|
|
|
|
|
|
|
|
417
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
418
|
|
|
|
|
|
|
|
419
|
5
|
50
|
|
|
|
|
if(items == 0) |
420
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
421
|
|
|
|
|
|
|
|
422
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
423
|
|
|
|
|
|
|
|
424
|
5
|
|
|
|
|
|
self = ST(0); |
425
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
426
|
5
|
|
|
|
|
|
self = SvRV(self); |
427
|
|
|
|
|
|
|
|
428
|
5
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
429
|
0
|
|
|
|
|
|
croak("Null record error"); |
430
|
|
|
|
|
|
|
|
431
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
432
|
5
|
|
|
|
|
|
ptr2 = (int16_t*) &ptr1[member->offset]; |
433
|
|
|
|
|
|
|
|
434
|
5
|
100
|
|
|
|
|
if(items > 1) |
435
|
|
|
|
|
|
|
{ |
436
|
2
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
437
|
|
|
|
|
|
|
{ |
438
|
0
|
|
|
|
|
|
croak("record is read-only"); |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
else |
441
|
|
|
|
|
|
|
{ |
442
|
2
|
50
|
|
|
|
|
*ptr2 = (int16_t) SvIV(ST(1)); |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
|
446
|
5
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
447
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
448
|
|
|
|
|
|
|
|
449
|
3
|
|
|
|
|
|
XSRETURN_IV(*ptr2); |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
|
452
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint16_array) |
453
|
|
|
|
|
|
|
{ |
454
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
455
|
|
|
|
|
|
|
SV *self; |
456
|
|
|
|
|
|
|
SV *arg; |
457
|
|
|
|
|
|
|
SV **item; |
458
|
|
|
|
|
|
|
AV *av; |
459
|
|
|
|
|
|
|
char *ptr1; |
460
|
|
|
|
|
|
|
int i; |
461
|
|
|
|
|
|
|
int16_t *ptr2; |
462
|
|
|
|
|
|
|
|
463
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
464
|
|
|
|
|
|
|
|
465
|
5
|
50
|
|
|
|
|
if(items == 0) |
466
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
467
|
|
|
|
|
|
|
|
468
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
469
|
|
|
|
|
|
|
|
470
|
5
|
|
|
|
|
|
self = ST(0); |
471
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
472
|
5
|
|
|
|
|
|
self = SvRV(self); |
473
|
|
|
|
|
|
|
|
474
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
475
|
5
|
|
|
|
|
|
ptr2 = (int16_t*) &ptr1[member->offset]; |
476
|
|
|
|
|
|
|
|
477
|
5
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
478
|
|
|
|
|
|
|
{ |
479
|
0
|
|
|
|
|
|
croak("record is read-only"); |
480
|
|
|
|
|
|
|
} |
481
|
|
|
|
|
|
|
|
482
|
5
|
100
|
|
|
|
|
if(items > 2) |
483
|
|
|
|
|
|
|
{ |
484
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
485
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
486
|
|
|
|
|
|
|
{ |
487
|
1
|
|
|
|
|
|
arg = ST(2); |
488
|
1
|
50
|
|
|
|
|
ptr2[i] = SvIV(arg); |
489
|
|
|
|
|
|
|
} |
490
|
|
|
|
|
|
|
else |
491
|
|
|
|
|
|
|
{ |
492
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
} |
495
|
4
|
100
|
|
|
|
|
else if(items > 1) |
496
|
|
|
|
|
|
|
{ |
497
|
2
|
|
|
|
|
|
arg = ST(1); |
498
|
3
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
499
|
|
|
|
|
|
|
{ |
500
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
501
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
502
|
|
|
|
|
|
|
{ |
503
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
504
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
505
|
|
|
|
|
|
|
{ |
506
|
3
|
50
|
|
|
|
|
ptr2[i] = SvIV(*item); |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
else |
509
|
|
|
|
|
|
|
{ |
510
|
0
|
|
|
|
|
|
ptr2[i] = 0; |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
else |
515
|
|
|
|
|
|
|
{ |
516
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
517
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
518
|
|
|
|
|
|
|
{ |
519
|
1
|
|
|
|
|
|
XSRETURN_IV(ptr2[i]); |
520
|
|
|
|
|
|
|
} |
521
|
|
|
|
|
|
|
else |
522
|
|
|
|
|
|
|
{ |
523
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
524
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
} |
527
|
|
|
|
|
|
|
} |
528
|
|
|
|
|
|
|
|
529
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
530
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
531
|
|
|
|
|
|
|
|
532
|
2
|
|
|
|
|
|
av = newAV(); |
533
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
534
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
535
|
|
|
|
|
|
|
{ |
536
|
6
|
|
|
|
|
|
sv_setiv(*av_fetch(av, i, 1), ptr2[i]); |
537
|
|
|
|
|
|
|
} |
538
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
539
|
2
|
|
|
|
|
|
XSRETURN(1); |
540
|
|
|
|
|
|
|
} |
541
|
|
|
|
|
|
|
|
542
|
7
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint32) |
543
|
|
|
|
|
|
|
{ |
544
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
545
|
|
|
|
|
|
|
SV *self; |
546
|
|
|
|
|
|
|
char *ptr1; |
547
|
|
|
|
|
|
|
uint32_t *ptr2; |
548
|
|
|
|
|
|
|
|
549
|
7
|
|
|
|
|
|
dVAR; dXSARGS; |
550
|
|
|
|
|
|
|
|
551
|
7
|
50
|
|
|
|
|
if(items == 0) |
552
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
553
|
|
|
|
|
|
|
|
554
|
7
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
555
|
|
|
|
|
|
|
|
556
|
7
|
|
|
|
|
|
self = ST(0); |
557
|
7
|
50
|
|
|
|
|
if(SvROK(self)) |
558
|
7
|
|
|
|
|
|
self = SvRV(self); |
559
|
|
|
|
|
|
|
|
560
|
7
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
561
|
0
|
|
|
|
|
|
croak("Null record error"); |
562
|
|
|
|
|
|
|
|
563
|
7
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
564
|
7
|
|
|
|
|
|
ptr2 = (uint32_t*) &ptr1[member->offset]; |
565
|
|
|
|
|
|
|
|
566
|
7
|
100
|
|
|
|
|
if(items > 1) |
567
|
|
|
|
|
|
|
{ |
568
|
4
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
569
|
|
|
|
|
|
|
{ |
570
|
0
|
|
|
|
|
|
croak("record is read-only"); |
571
|
|
|
|
|
|
|
} |
572
|
|
|
|
|
|
|
else |
573
|
|
|
|
|
|
|
{ |
574
|
4
|
50
|
|
|
|
|
*ptr2 = (uint32_t) SvUV(ST(1)); |
575
|
|
|
|
|
|
|
} |
576
|
|
|
|
|
|
|
} |
577
|
|
|
|
|
|
|
|
578
|
7
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
579
|
4
|
|
|
|
|
|
XSRETURN_EMPTY; |
580
|
|
|
|
|
|
|
|
581
|
3
|
|
|
|
|
|
XSRETURN_UV(*ptr2); |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
|
584
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint32_array) |
585
|
|
|
|
|
|
|
{ |
586
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
587
|
|
|
|
|
|
|
SV *self; |
588
|
|
|
|
|
|
|
SV *arg; |
589
|
|
|
|
|
|
|
SV **item; |
590
|
|
|
|
|
|
|
AV *av; |
591
|
|
|
|
|
|
|
char *ptr1; |
592
|
|
|
|
|
|
|
int i; |
593
|
|
|
|
|
|
|
uint32_t *ptr2; |
594
|
|
|
|
|
|
|
|
595
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
596
|
|
|
|
|
|
|
|
597
|
5
|
50
|
|
|
|
|
if(items == 0) |
598
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
599
|
|
|
|
|
|
|
|
600
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
601
|
|
|
|
|
|
|
|
602
|
5
|
|
|
|
|
|
self = ST(0); |
603
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
604
|
5
|
|
|
|
|
|
self = SvRV(self); |
605
|
|
|
|
|
|
|
|
606
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
607
|
5
|
|
|
|
|
|
ptr2 = (uint32_t*) &ptr1[member->offset]; |
608
|
|
|
|
|
|
|
|
609
|
5
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
610
|
|
|
|
|
|
|
{ |
611
|
0
|
|
|
|
|
|
croak("record is read-only"); |
612
|
|
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
|
614
|
5
|
100
|
|
|
|
|
if(items > 2) |
615
|
|
|
|
|
|
|
{ |
616
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
617
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
618
|
|
|
|
|
|
|
{ |
619
|
1
|
|
|
|
|
|
arg = ST(2); |
620
|
1
|
50
|
|
|
|
|
ptr2[i] = SvUV(arg); |
621
|
|
|
|
|
|
|
} |
622
|
|
|
|
|
|
|
else |
623
|
|
|
|
|
|
|
{ |
624
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
625
|
|
|
|
|
|
|
} |
626
|
|
|
|
|
|
|
} |
627
|
4
|
100
|
|
|
|
|
else if(items > 1) |
628
|
|
|
|
|
|
|
{ |
629
|
2
|
|
|
|
|
|
arg = ST(1); |
630
|
3
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
631
|
|
|
|
|
|
|
{ |
632
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
633
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
634
|
|
|
|
|
|
|
{ |
635
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
636
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
637
|
|
|
|
|
|
|
{ |
638
|
3
|
50
|
|
|
|
|
ptr2[i] = SvUV(*item); |
639
|
|
|
|
|
|
|
} |
640
|
|
|
|
|
|
|
else |
641
|
|
|
|
|
|
|
{ |
642
|
0
|
|
|
|
|
|
ptr2[i] = 0; |
643
|
|
|
|
|
|
|
} |
644
|
|
|
|
|
|
|
} |
645
|
|
|
|
|
|
|
} |
646
|
|
|
|
|
|
|
else |
647
|
|
|
|
|
|
|
{ |
648
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
649
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
650
|
|
|
|
|
|
|
{ |
651
|
1
|
|
|
|
|
|
XSRETURN_UV(ptr2[i]); |
652
|
|
|
|
|
|
|
} |
653
|
|
|
|
|
|
|
else |
654
|
|
|
|
|
|
|
{ |
655
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
656
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
657
|
|
|
|
|
|
|
} |
658
|
|
|
|
|
|
|
} |
659
|
|
|
|
|
|
|
} |
660
|
|
|
|
|
|
|
|
661
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
662
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
663
|
|
|
|
|
|
|
|
664
|
2
|
|
|
|
|
|
av = newAV(); |
665
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
666
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
667
|
|
|
|
|
|
|
{ |
668
|
6
|
|
|
|
|
|
sv_setuv(*av_fetch(av, i, 1), ptr2[i]); |
669
|
|
|
|
|
|
|
} |
670
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
671
|
2
|
|
|
|
|
|
XSRETURN(1); |
672
|
|
|
|
|
|
|
} |
673
|
|
|
|
|
|
|
|
674
|
23
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint32) |
675
|
|
|
|
|
|
|
{ |
676
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
677
|
|
|
|
|
|
|
SV *self; |
678
|
|
|
|
|
|
|
char *ptr1; |
679
|
|
|
|
|
|
|
int32_t *ptr2; |
680
|
|
|
|
|
|
|
|
681
|
23
|
|
|
|
|
|
dVAR; dXSARGS; |
682
|
|
|
|
|
|
|
|
683
|
23
|
50
|
|
|
|
|
if(items == 0) |
684
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
685
|
|
|
|
|
|
|
|
686
|
23
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
687
|
|
|
|
|
|
|
|
688
|
23
|
|
|
|
|
|
self = ST(0); |
689
|
23
|
50
|
|
|
|
|
if(SvROK(self)) |
690
|
23
|
|
|
|
|
|
self = SvRV(self); |
691
|
|
|
|
|
|
|
|
692
|
23
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
693
|
0
|
|
|
|
|
|
croak("Null record error"); |
694
|
|
|
|
|
|
|
|
695
|
23
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
696
|
23
|
|
|
|
|
|
ptr2 = (int32_t*) &ptr1[member->offset]; |
697
|
|
|
|
|
|
|
|
698
|
23
|
100
|
|
|
|
|
if(items > 1) |
699
|
|
|
|
|
|
|
{ |
700
|
11
|
100
|
|
|
|
|
if(SvREADONLY(self)) |
701
|
|
|
|
|
|
|
{ |
702
|
2
|
|
|
|
|
|
croak("record is read-only"); |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
else |
705
|
|
|
|
|
|
|
{ |
706
|
9
|
50
|
|
|
|
|
*ptr2 = (int32_t) SvIV(ST(1)); |
707
|
|
|
|
|
|
|
} |
708
|
|
|
|
|
|
|
} |
709
|
|
|
|
|
|
|
|
710
|
21
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
711
|
9
|
|
|
|
|
|
XSRETURN_EMPTY; |
712
|
|
|
|
|
|
|
|
713
|
12
|
|
|
|
|
|
XSRETURN_IV(*ptr2); |
714
|
|
|
|
|
|
|
} |
715
|
|
|
|
|
|
|
|
716
|
69
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint32_array) |
717
|
|
|
|
|
|
|
{ |
718
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
719
|
|
|
|
|
|
|
SV *self; |
720
|
|
|
|
|
|
|
SV *arg; |
721
|
|
|
|
|
|
|
SV **item; |
722
|
|
|
|
|
|
|
AV *av; |
723
|
|
|
|
|
|
|
char *ptr1; |
724
|
|
|
|
|
|
|
int i; |
725
|
|
|
|
|
|
|
int32_t *ptr2; |
726
|
|
|
|
|
|
|
|
727
|
69
|
|
|
|
|
|
dVAR; dXSARGS; |
728
|
|
|
|
|
|
|
|
729
|
69
|
50
|
|
|
|
|
if(items == 0) |
730
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
731
|
|
|
|
|
|
|
|
732
|
69
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
733
|
|
|
|
|
|
|
|
734
|
69
|
|
|
|
|
|
self = ST(0); |
735
|
69
|
50
|
|
|
|
|
if(SvROK(self)) |
736
|
69
|
|
|
|
|
|
self = SvRV(self); |
737
|
|
|
|
|
|
|
|
738
|
69
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
739
|
69
|
|
|
|
|
|
ptr2 = (int32_t*) &ptr1[member->offset]; |
740
|
|
|
|
|
|
|
|
741
|
69
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
100
|
|
|
|
|
|
742
|
|
|
|
|
|
|
{ |
743
|
4
|
|
|
|
|
|
croak("record is read-only"); |
744
|
|
|
|
|
|
|
} |
745
|
|
|
|
|
|
|
|
746
|
65
|
100
|
|
|
|
|
if(items > 2) |
747
|
|
|
|
|
|
|
{ |
748
|
8
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
749
|
8
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
750
|
|
|
|
|
|
|
{ |
751
|
8
|
|
|
|
|
|
arg = ST(2); |
752
|
8
|
50
|
|
|
|
|
ptr2[i] = SvIV(arg); |
753
|
|
|
|
|
|
|
} |
754
|
|
|
|
|
|
|
else |
755
|
|
|
|
|
|
|
{ |
756
|
8
|
|
|
|
|
|
warn("illegal index %d", i); |
757
|
|
|
|
|
|
|
} |
758
|
|
|
|
|
|
|
} |
759
|
57
|
100
|
|
|
|
|
else if(items > 1) |
760
|
|
|
|
|
|
|
{ |
761
|
49
|
|
|
|
|
|
arg = ST(1); |
762
|
55
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
763
|
|
|
|
|
|
|
{ |
764
|
6
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
765
|
73
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
766
|
|
|
|
|
|
|
{ |
767
|
67
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
768
|
67
|
100
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
769
|
|
|
|
|
|
|
{ |
770
|
27
|
50
|
|
|
|
|
ptr2[i] = SvIV(*item); |
771
|
|
|
|
|
|
|
} |
772
|
|
|
|
|
|
|
else |
773
|
|
|
|
|
|
|
{ |
774
|
40
|
|
|
|
|
|
ptr2[i] = 0; |
775
|
|
|
|
|
|
|
} |
776
|
|
|
|
|
|
|
} |
777
|
|
|
|
|
|
|
} |
778
|
|
|
|
|
|
|
else |
779
|
|
|
|
|
|
|
{ |
780
|
43
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
781
|
43
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
782
|
|
|
|
|
|
|
{ |
783
|
43
|
|
|
|
|
|
XSRETURN_IV(ptr2[i]); |
784
|
|
|
|
|
|
|
} |
785
|
|
|
|
|
|
|
else |
786
|
|
|
|
|
|
|
{ |
787
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
788
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
789
|
|
|
|
|
|
|
} |
790
|
|
|
|
|
|
|
} |
791
|
|
|
|
|
|
|
} |
792
|
|
|
|
|
|
|
|
793
|
22
|
100
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
794
|
5
|
|
|
|
|
|
XSRETURN_EMPTY; |
795
|
|
|
|
|
|
|
|
796
|
17
|
|
|
|
|
|
av = newAV(); |
797
|
17
|
|
|
|
|
|
av_fill(av, member->count-1); |
798
|
215
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
799
|
|
|
|
|
|
|
{ |
800
|
198
|
|
|
|
|
|
sv_setiv(*av_fetch(av, i, 1), ptr2[i]); |
801
|
|
|
|
|
|
|
} |
802
|
17
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
803
|
17
|
|
|
|
|
|
XSRETURN(1); |
804
|
|
|
|
|
|
|
} |
805
|
|
|
|
|
|
|
|
806
|
1
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint64) |
807
|
|
|
|
|
|
|
{ |
808
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
809
|
|
|
|
|
|
|
SV *self; |
810
|
|
|
|
|
|
|
char *ptr1; |
811
|
|
|
|
|
|
|
uint64_t *ptr2; |
812
|
|
|
|
|
|
|
|
813
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
814
|
|
|
|
|
|
|
|
815
|
1
|
50
|
|
|
|
|
if(items == 0) |
816
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
817
|
|
|
|
|
|
|
|
818
|
1
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
819
|
|
|
|
|
|
|
|
820
|
1
|
|
|
|
|
|
self = ST(0); |
821
|
1
|
50
|
|
|
|
|
if(SvROK(self)) |
822
|
1
|
|
|
|
|
|
self = SvRV(self); |
823
|
|
|
|
|
|
|
|
824
|
1
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
825
|
0
|
|
|
|
|
|
croak("Null record error"); |
826
|
|
|
|
|
|
|
|
827
|
1
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
828
|
1
|
|
|
|
|
|
ptr2 = (uint64_t*) &ptr1[member->offset]; |
829
|
|
|
|
|
|
|
|
830
|
1
|
50
|
|
|
|
|
if(items > 1) |
831
|
|
|
|
|
|
|
{ |
832
|
1
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
833
|
|
|
|
|
|
|
{ |
834
|
0
|
|
|
|
|
|
croak("record is read-only"); |
835
|
|
|
|
|
|
|
} |
836
|
|
|
|
|
|
|
else |
837
|
|
|
|
|
|
|
{ |
838
|
1
|
50
|
|
|
|
|
*ptr2 = (uint64_t) SvUV(ST(1)); |
839
|
|
|
|
|
|
|
} |
840
|
|
|
|
|
|
|
} |
841
|
|
|
|
|
|
|
|
842
|
1
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
50
|
|
|
|
|
|
843
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
844
|
|
|
|
|
|
|
|
845
|
0
|
|
|
|
|
|
XSRETURN_UV(*ptr2); |
846
|
|
|
|
|
|
|
} |
847
|
|
|
|
|
|
|
|
848
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_uint64_array) |
849
|
|
|
|
|
|
|
{ |
850
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
851
|
|
|
|
|
|
|
SV *self; |
852
|
|
|
|
|
|
|
SV *arg; |
853
|
|
|
|
|
|
|
SV **item; |
854
|
|
|
|
|
|
|
AV *av; |
855
|
|
|
|
|
|
|
char *ptr1; |
856
|
|
|
|
|
|
|
int i; |
857
|
|
|
|
|
|
|
uint64_t *ptr2; |
858
|
|
|
|
|
|
|
|
859
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
860
|
|
|
|
|
|
|
|
861
|
5
|
50
|
|
|
|
|
if(items == 0) |
862
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
863
|
|
|
|
|
|
|
|
864
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
865
|
|
|
|
|
|
|
|
866
|
5
|
|
|
|
|
|
self = ST(0); |
867
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
868
|
5
|
|
|
|
|
|
self = SvRV(self); |
869
|
|
|
|
|
|
|
|
870
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
871
|
5
|
|
|
|
|
|
ptr2 = (uint64_t*) &ptr1[member->offset]; |
872
|
|
|
|
|
|
|
|
873
|
5
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
874
|
|
|
|
|
|
|
{ |
875
|
0
|
|
|
|
|
|
croak("record is read-only"); |
876
|
|
|
|
|
|
|
} |
877
|
|
|
|
|
|
|
|
878
|
5
|
100
|
|
|
|
|
if(items > 2) |
879
|
|
|
|
|
|
|
{ |
880
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
881
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
882
|
|
|
|
|
|
|
{ |
883
|
1
|
|
|
|
|
|
arg = ST(2); |
884
|
1
|
50
|
|
|
|
|
ptr2[i] = SvUV(arg); |
885
|
|
|
|
|
|
|
} |
886
|
|
|
|
|
|
|
else |
887
|
|
|
|
|
|
|
{ |
888
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
889
|
|
|
|
|
|
|
} |
890
|
|
|
|
|
|
|
} |
891
|
4
|
100
|
|
|
|
|
else if(items > 1) |
892
|
|
|
|
|
|
|
{ |
893
|
2
|
|
|
|
|
|
arg = ST(1); |
894
|
3
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
895
|
|
|
|
|
|
|
{ |
896
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
897
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
898
|
|
|
|
|
|
|
{ |
899
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
900
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
901
|
|
|
|
|
|
|
{ |
902
|
3
|
50
|
|
|
|
|
ptr2[i] = SvUV(*item); |
903
|
|
|
|
|
|
|
} |
904
|
|
|
|
|
|
|
else |
905
|
|
|
|
|
|
|
{ |
906
|
0
|
|
|
|
|
|
ptr2[i] = 0; |
907
|
|
|
|
|
|
|
} |
908
|
|
|
|
|
|
|
} |
909
|
|
|
|
|
|
|
} |
910
|
|
|
|
|
|
|
else |
911
|
|
|
|
|
|
|
{ |
912
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
913
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
914
|
|
|
|
|
|
|
{ |
915
|
1
|
|
|
|
|
|
XSRETURN_UV(ptr2[i]); |
916
|
|
|
|
|
|
|
} |
917
|
|
|
|
|
|
|
else |
918
|
|
|
|
|
|
|
{ |
919
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
920
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
921
|
|
|
|
|
|
|
} |
922
|
|
|
|
|
|
|
} |
923
|
|
|
|
|
|
|
} |
924
|
|
|
|
|
|
|
|
925
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
926
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
927
|
|
|
|
|
|
|
|
928
|
2
|
|
|
|
|
|
av = newAV(); |
929
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
930
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
931
|
|
|
|
|
|
|
{ |
932
|
6
|
|
|
|
|
|
sv_setuv(*av_fetch(av, i, 1), ptr2[i]); |
933
|
|
|
|
|
|
|
} |
934
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
935
|
2
|
|
|
|
|
|
XSRETURN(1); |
936
|
|
|
|
|
|
|
} |
937
|
|
|
|
|
|
|
|
938
|
1
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint64) |
939
|
|
|
|
|
|
|
{ |
940
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
941
|
|
|
|
|
|
|
SV *self; |
942
|
|
|
|
|
|
|
char *ptr1; |
943
|
|
|
|
|
|
|
int64_t *ptr2; |
944
|
|
|
|
|
|
|
|
945
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
946
|
|
|
|
|
|
|
|
947
|
1
|
50
|
|
|
|
|
if(items == 0) |
948
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
949
|
|
|
|
|
|
|
|
950
|
1
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
951
|
|
|
|
|
|
|
|
952
|
1
|
|
|
|
|
|
self = ST(0); |
953
|
1
|
50
|
|
|
|
|
if(SvROK(self)) |
954
|
1
|
|
|
|
|
|
self = SvRV(self); |
955
|
|
|
|
|
|
|
|
956
|
1
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
957
|
0
|
|
|
|
|
|
croak("Null record error"); |
958
|
|
|
|
|
|
|
|
959
|
1
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
960
|
1
|
|
|
|
|
|
ptr2 = (int64_t*) &ptr1[member->offset]; |
961
|
|
|
|
|
|
|
|
962
|
1
|
50
|
|
|
|
|
if(items > 1) |
963
|
|
|
|
|
|
|
{ |
964
|
1
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
965
|
|
|
|
|
|
|
{ |
966
|
0
|
|
|
|
|
|
croak("record is read-only"); |
967
|
|
|
|
|
|
|
} |
968
|
|
|
|
|
|
|
else |
969
|
|
|
|
|
|
|
{ |
970
|
1
|
50
|
|
|
|
|
*ptr2 = (int64_t) SvIV(ST(1)); |
971
|
|
|
|
|
|
|
} |
972
|
|
|
|
|
|
|
} |
973
|
|
|
|
|
|
|
|
974
|
1
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
50
|
|
|
|
|
|
975
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
976
|
|
|
|
|
|
|
|
977
|
0
|
|
|
|
|
|
XSRETURN_IV(*ptr2); |
978
|
|
|
|
|
|
|
} |
979
|
|
|
|
|
|
|
|
980
|
5
|
|
|
|
|
|
XS(ffi_pl_record_accessor_sint64_array) |
981
|
|
|
|
|
|
|
{ |
982
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
983
|
|
|
|
|
|
|
SV *self; |
984
|
|
|
|
|
|
|
SV *arg; |
985
|
|
|
|
|
|
|
SV **item; |
986
|
|
|
|
|
|
|
AV *av; |
987
|
|
|
|
|
|
|
char *ptr1; |
988
|
|
|
|
|
|
|
int i; |
989
|
|
|
|
|
|
|
int64_t *ptr2; |
990
|
|
|
|
|
|
|
|
991
|
5
|
|
|
|
|
|
dVAR; dXSARGS; |
992
|
|
|
|
|
|
|
|
993
|
5
|
50
|
|
|
|
|
if(items == 0) |
994
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
995
|
|
|
|
|
|
|
|
996
|
5
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
997
|
|
|
|
|
|
|
|
998
|
5
|
|
|
|
|
|
self = ST(0); |
999
|
5
|
50
|
|
|
|
|
if(SvROK(self)) |
1000
|
5
|
|
|
|
|
|
self = SvRV(self); |
1001
|
|
|
|
|
|
|
|
1002
|
5
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
1003
|
5
|
|
|
|
|
|
ptr2 = (int64_t*) &ptr1[member->offset]; |
1004
|
|
|
|
|
|
|
|
1005
|
5
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
{ |
1007
|
0
|
|
|
|
|
|
croak("record is read-only"); |
1008
|
|
|
|
|
|
|
} |
1009
|
|
|
|
|
|
|
|
1010
|
5
|
100
|
|
|
|
|
if(items > 2) |
1011
|
|
|
|
|
|
|
{ |
1012
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
1013
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
{ |
1015
|
1
|
|
|
|
|
|
arg = ST(2); |
1016
|
1
|
50
|
|
|
|
|
ptr2[i] = SvIV(arg); |
1017
|
|
|
|
|
|
|
} |
1018
|
|
|
|
|
|
|
else |
1019
|
|
|
|
|
|
|
{ |
1020
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
1021
|
|
|
|
|
|
|
} |
1022
|
|
|
|
|
|
|
} |
1023
|
4
|
100
|
|
|
|
|
else if(items > 1) |
1024
|
|
|
|
|
|
|
{ |
1025
|
2
|
|
|
|
|
|
arg = ST(1); |
1026
|
3
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
{ |
1028
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
1029
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
1030
|
|
|
|
|
|
|
{ |
1031
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
1032
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
{ |
1034
|
3
|
50
|
|
|
|
|
ptr2[i] = SvIV(*item); |
1035
|
|
|
|
|
|
|
} |
1036
|
|
|
|
|
|
|
else |
1037
|
|
|
|
|
|
|
{ |
1038
|
0
|
|
|
|
|
|
ptr2[i] = 0; |
1039
|
|
|
|
|
|
|
} |
1040
|
|
|
|
|
|
|
} |
1041
|
|
|
|
|
|
|
} |
1042
|
|
|
|
|
|
|
else |
1043
|
|
|
|
|
|
|
{ |
1044
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
1045
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
{ |
1047
|
1
|
|
|
|
|
|
XSRETURN_IV(ptr2[i]); |
1048
|
|
|
|
|
|
|
} |
1049
|
|
|
|
|
|
|
else |
1050
|
|
|
|
|
|
|
{ |
1051
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
1052
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
1053
|
|
|
|
|
|
|
} |
1054
|
|
|
|
|
|
|
} |
1055
|
|
|
|
|
|
|
} |
1056
|
|
|
|
|
|
|
|
1057
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
1058
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
1059
|
|
|
|
|
|
|
|
1060
|
2
|
|
|
|
|
|
av = newAV(); |
1061
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
1062
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
1063
|
|
|
|
|
|
|
{ |
1064
|
6
|
|
|
|
|
|
sv_setiv(*av_fetch(av, i, 1), ptr2[i]); |
1065
|
|
|
|
|
|
|
} |
1066
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
1067
|
2
|
|
|
|
|
|
XSRETURN(1); |
1068
|
|
|
|
|
|
|
} |
1069
|
|
|
|
|
|
|
|
1070
|
1
|
|
|
|
|
|
XS(ffi_pl_record_accessor_float) |
1071
|
|
|
|
|
|
|
{ |
1072
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
1073
|
|
|
|
|
|
|
SV *self; |
1074
|
|
|
|
|
|
|
char *ptr1; |
1075
|
|
|
|
|
|
|
float *ptr2; |
1076
|
|
|
|
|
|
|
|
1077
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
1078
|
|
|
|
|
|
|
|
1079
|
1
|
50
|
|
|
|
|
if(items == 0) |
1080
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
1081
|
|
|
|
|
|
|
|
1082
|
1
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
1083
|
|
|
|
|
|
|
|
1084
|
1
|
|
|
|
|
|
self = ST(0); |
1085
|
1
|
50
|
|
|
|
|
if(SvROK(self)) |
1086
|
1
|
|
|
|
|
|
self = SvRV(self); |
1087
|
|
|
|
|
|
|
|
1088
|
1
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1089
|
0
|
|
|
|
|
|
croak("Null record error"); |
1090
|
|
|
|
|
|
|
|
1091
|
1
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
1092
|
1
|
|
|
|
|
|
ptr2 = (float*) &ptr1[member->offset]; |
1093
|
|
|
|
|
|
|
|
1094
|
1
|
50
|
|
|
|
|
if(items > 1) |
1095
|
|
|
|
|
|
|
{ |
1096
|
1
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
1097
|
|
|
|
|
|
|
{ |
1098
|
0
|
|
|
|
|
|
croak("record is read-only"); |
1099
|
|
|
|
|
|
|
} |
1100
|
|
|
|
|
|
|
else |
1101
|
|
|
|
|
|
|
{ |
1102
|
1
|
50
|
|
|
|
|
*ptr2 = (float) SvNV(ST(1)); |
1103
|
|
|
|
|
|
|
} |
1104
|
|
|
|
|
|
|
} |
1105
|
|
|
|
|
|
|
|
1106
|
1
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
50
|
|
|
|
|
|
1107
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
1108
|
|
|
|
|
|
|
|
1109
|
0
|
|
|
|
|
|
XSRETURN_NV(*ptr2); |
1110
|
|
|
|
|
|
|
} |
1111
|
|
|
|
|
|
|
|
1112
|
7
|
|
|
|
|
|
XS(ffi_pl_record_accessor_float_array) |
1113
|
|
|
|
|
|
|
{ |
1114
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
1115
|
|
|
|
|
|
|
SV *self; |
1116
|
|
|
|
|
|
|
SV *arg; |
1117
|
|
|
|
|
|
|
SV **item; |
1118
|
|
|
|
|
|
|
AV *av; |
1119
|
|
|
|
|
|
|
char *ptr1; |
1120
|
|
|
|
|
|
|
int i; |
1121
|
|
|
|
|
|
|
float *ptr2; |
1122
|
|
|
|
|
|
|
|
1123
|
7
|
|
|
|
|
|
dVAR; dXSARGS; |
1124
|
|
|
|
|
|
|
|
1125
|
7
|
50
|
|
|
|
|
if(items == 0) |
1126
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
1127
|
|
|
|
|
|
|
|
1128
|
7
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
1129
|
|
|
|
|
|
|
|
1130
|
7
|
|
|
|
|
|
self = ST(0); |
1131
|
7
|
50
|
|
|
|
|
if(SvROK(self)) |
1132
|
7
|
|
|
|
|
|
self = SvRV(self); |
1133
|
|
|
|
|
|
|
|
1134
|
7
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
1135
|
7
|
|
|
|
|
|
ptr2 = (float*) &ptr1[member->offset]; |
1136
|
|
|
|
|
|
|
|
1137
|
7
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
{ |
1139
|
0
|
|
|
|
|
|
croak("record is read-only"); |
1140
|
|
|
|
|
|
|
} |
1141
|
|
|
|
|
|
|
|
1142
|
7
|
100
|
|
|
|
|
if(items > 2) |
1143
|
|
|
|
|
|
|
{ |
1144
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
1145
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
{ |
1147
|
1
|
|
|
|
|
|
arg = ST(2); |
1148
|
1
|
50
|
|
|
|
|
ptr2[i] = SvNV(arg); |
1149
|
|
|
|
|
|
|
} |
1150
|
|
|
|
|
|
|
else |
1151
|
|
|
|
|
|
|
{ |
1152
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
1153
|
|
|
|
|
|
|
} |
1154
|
|
|
|
|
|
|
} |
1155
|
6
|
100
|
|
|
|
|
else if(items > 1) |
1156
|
|
|
|
|
|
|
{ |
1157
|
4
|
|
|
|
|
|
arg = ST(1); |
1158
|
5
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
{ |
1160
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
1161
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
1162
|
|
|
|
|
|
|
{ |
1163
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
1164
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
{ |
1166
|
2
|
50
|
|
|
|
|
ptr2[i] = SvNV(*item); |
1167
|
|
|
|
|
|
|
} |
1168
|
|
|
|
|
|
|
else |
1169
|
|
|
|
|
|
|
{ |
1170
|
1
|
|
|
|
|
|
ptr2[i] = 0.0; |
1171
|
|
|
|
|
|
|
} |
1172
|
|
|
|
|
|
|
} |
1173
|
|
|
|
|
|
|
} |
1174
|
|
|
|
|
|
|
else |
1175
|
|
|
|
|
|
|
{ |
1176
|
3
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
1177
|
3
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
{ |
1179
|
3
|
|
|
|
|
|
XSRETURN_NV(ptr2[i]); |
1180
|
|
|
|
|
|
|
} |
1181
|
|
|
|
|
|
|
else |
1182
|
|
|
|
|
|
|
{ |
1183
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
1184
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
1185
|
|
|
|
|
|
|
} |
1186
|
|
|
|
|
|
|
} |
1187
|
|
|
|
|
|
|
} |
1188
|
|
|
|
|
|
|
|
1189
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
1190
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
1191
|
|
|
|
|
|
|
|
1192
|
2
|
|
|
|
|
|
av = newAV(); |
1193
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
1194
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
1195
|
|
|
|
|
|
|
{ |
1196
|
6
|
|
|
|
|
|
sv_setnv(*av_fetch(av, i, 1), ptr2[i]); |
1197
|
|
|
|
|
|
|
} |
1198
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
1199
|
2
|
|
|
|
|
|
XSRETURN(1); |
1200
|
|
|
|
|
|
|
} |
1201
|
|
|
|
|
|
|
|
1202
|
1
|
|
|
|
|
|
XS(ffi_pl_record_accessor_double) |
1203
|
|
|
|
|
|
|
{ |
1204
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
1205
|
|
|
|
|
|
|
SV *self; |
1206
|
|
|
|
|
|
|
char *ptr1; |
1207
|
|
|
|
|
|
|
double *ptr2; |
1208
|
|
|
|
|
|
|
|
1209
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
1210
|
|
|
|
|
|
|
|
1211
|
1
|
50
|
|
|
|
|
if(items == 0) |
1212
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
1213
|
|
|
|
|
|
|
|
1214
|
1
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
1215
|
|
|
|
|
|
|
|
1216
|
1
|
|
|
|
|
|
self = ST(0); |
1217
|
1
|
50
|
|
|
|
|
if(SvROK(self)) |
1218
|
1
|
|
|
|
|
|
self = SvRV(self); |
1219
|
|
|
|
|
|
|
|
1220
|
1
|
50
|
|
|
|
|
if(!SvOK(self)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1221
|
0
|
|
|
|
|
|
croak("Null record error"); |
1222
|
|
|
|
|
|
|
|
1223
|
1
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
1224
|
1
|
|
|
|
|
|
ptr2 = (double*) &ptr1[member->offset]; |
1225
|
|
|
|
|
|
|
|
1226
|
1
|
50
|
|
|
|
|
if(items > 1) |
1227
|
|
|
|
|
|
|
{ |
1228
|
1
|
50
|
|
|
|
|
if(SvREADONLY(self)) |
1229
|
|
|
|
|
|
|
{ |
1230
|
0
|
|
|
|
|
|
croak("record is read-only"); |
1231
|
|
|
|
|
|
|
} |
1232
|
|
|
|
|
|
|
else |
1233
|
|
|
|
|
|
|
{ |
1234
|
1
|
50
|
|
|
|
|
*ptr2 = (double) SvNV(ST(1)); |
1235
|
|
|
|
|
|
|
} |
1236
|
|
|
|
|
|
|
} |
1237
|
|
|
|
|
|
|
|
1238
|
1
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
50
|
|
|
|
|
|
1239
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
1240
|
|
|
|
|
|
|
|
1241
|
0
|
|
|
|
|
|
XSRETURN_NV(*ptr2); |
1242
|
|
|
|
|
|
|
} |
1243
|
|
|
|
|
|
|
|
1244
|
7
|
|
|
|
|
|
XS(ffi_pl_record_accessor_double_array) |
1245
|
|
|
|
|
|
|
{ |
1246
|
|
|
|
|
|
|
ffi_pl_record_member *member; |
1247
|
|
|
|
|
|
|
SV *self; |
1248
|
|
|
|
|
|
|
SV *arg; |
1249
|
|
|
|
|
|
|
SV **item; |
1250
|
|
|
|
|
|
|
AV *av; |
1251
|
|
|
|
|
|
|
char *ptr1; |
1252
|
|
|
|
|
|
|
int i; |
1253
|
|
|
|
|
|
|
double *ptr2; |
1254
|
|
|
|
|
|
|
|
1255
|
7
|
|
|
|
|
|
dVAR; dXSARGS; |
1256
|
|
|
|
|
|
|
|
1257
|
7
|
50
|
|
|
|
|
if(items == 0) |
1258
|
0
|
|
|
|
|
|
croak("This is a method, you must provide at least the object"); |
1259
|
|
|
|
|
|
|
|
1260
|
7
|
|
|
|
|
|
member = (ffi_pl_record_member*) CvXSUBANY(cv).any_ptr; |
1261
|
|
|
|
|
|
|
|
1262
|
7
|
|
|
|
|
|
self = ST(0); |
1263
|
7
|
50
|
|
|
|
|
if(SvROK(self)) |
1264
|
7
|
|
|
|
|
|
self = SvRV(self); |
1265
|
|
|
|
|
|
|
|
1266
|
7
|
50
|
|
|
|
|
ptr1 = (char*) SvPV_nolen(self); |
1267
|
7
|
|
|
|
|
|
ptr2 = (double*) &ptr1[member->offset]; |
1268
|
|
|
|
|
|
|
|
1269
|
7
|
100
|
|
|
|
|
if(items > 1 && SvREADONLY(self)) |
|
|
50
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
{ |
1271
|
0
|
|
|
|
|
|
croak("record is read-only"); |
1272
|
|
|
|
|
|
|
} |
1273
|
|
|
|
|
|
|
|
1274
|
7
|
100
|
|
|
|
|
if(items > 2) |
1275
|
|
|
|
|
|
|
{ |
1276
|
1
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
1277
|
1
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
{ |
1279
|
1
|
|
|
|
|
|
arg = ST(2); |
1280
|
1
|
50
|
|
|
|
|
ptr2[i] = SvNV(arg); |
1281
|
|
|
|
|
|
|
} |
1282
|
|
|
|
|
|
|
else |
1283
|
|
|
|
|
|
|
{ |
1284
|
1
|
|
|
|
|
|
warn("illegal index %d", i); |
1285
|
|
|
|
|
|
|
} |
1286
|
|
|
|
|
|
|
} |
1287
|
6
|
100
|
|
|
|
|
else if(items > 1) |
1288
|
|
|
|
|
|
|
{ |
1289
|
4
|
|
|
|
|
|
arg = ST(1); |
1290
|
5
|
100
|
|
|
|
|
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) |
|
|
50
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
{ |
1292
|
1
|
|
|
|
|
|
av = (AV*) SvRV(arg); |
1293
|
4
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
1294
|
|
|
|
|
|
|
{ |
1295
|
3
|
|
|
|
|
|
item = av_fetch(av, i, 0); |
1296
|
3
|
50
|
|
|
|
|
if(item != NULL && SvOK(*item)) |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
{ |
1298
|
2
|
50
|
|
|
|
|
ptr2[i] = SvNV(*item); |
1299
|
|
|
|
|
|
|
} |
1300
|
|
|
|
|
|
|
else |
1301
|
|
|
|
|
|
|
{ |
1302
|
1
|
|
|
|
|
|
ptr2[i] = 0.0; |
1303
|
|
|
|
|
|
|
} |
1304
|
|
|
|
|
|
|
} |
1305
|
|
|
|
|
|
|
} |
1306
|
|
|
|
|
|
|
else |
1307
|
|
|
|
|
|
|
{ |
1308
|
3
|
50
|
|
|
|
|
i = SvIV(ST(1)); |
1309
|
3
|
50
|
|
|
|
|
if(i >= 0 && i < member->count) |
|
|
50
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
{ |
1311
|
3
|
|
|
|
|
|
XSRETURN_NV(ptr2[i]); |
1312
|
|
|
|
|
|
|
} |
1313
|
|
|
|
|
|
|
else |
1314
|
|
|
|
|
|
|
{ |
1315
|
0
|
|
|
|
|
|
warn("illegal index %d", i); |
1316
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
1317
|
|
|
|
|
|
|
} |
1318
|
|
|
|
|
|
|
} |
1319
|
|
|
|
|
|
|
} |
1320
|
|
|
|
|
|
|
|
1321
|
4
|
50
|
|
|
|
|
if(GIMME_V == G_VOID) |
|
|
100
|
|
|
|
|
|
1322
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
1323
|
|
|
|
|
|
|
|
1324
|
2
|
|
|
|
|
|
av = newAV(); |
1325
|
2
|
|
|
|
|
|
av_fill(av, member->count-1); |
1326
|
8
|
100
|
|
|
|
|
for(i=0; i < member->count; i++) |
1327
|
|
|
|
|
|
|
{ |
1328
|
6
|
|
|
|
|
|
sv_setnv(*av_fetch(av, i, 1), ptr2[i]); |
1329
|
|
|
|
|
|
|
} |
1330
|
2
|
|
|
|
|
|
ST(0) = newRV_inc((SV*)av); |
1331
|
2
|
|
|
|
|
|
XSRETURN(1); |
1332
|
|
|
|
|
|
|
} |
1333
|
|
|
|
|
|
|
|