xs/record_simple.c

filter: Statementstmt 84.7% 500 / 590 Branchbran 68.4% 315 / 460 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 77.6% 815 / 1050 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/FFI/Platypus/Memory.pm ↑ Summary xs/record_string.c »
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 10 10
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 10 0 10
30 10 self = SvRV(self);
31  
32 10 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 10 10
33 0 croak("Null record error");
34  
35 10 ptr1 = (char*) SvPV_nolen(self);
36 10 ptr2 = (uint8_t*) &ptr1[member->offset];
37  
38 10 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 7 3 10
39 {
40 7 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 7 7
41 {
42 0 croak("record is read-only");
43 }
44 else
45 {
46 7 *ptr2 = (uint8_t) SvUV(ST(1));
47 }
48 }
49  
50 10 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 7 3 10
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
76 5 self = SvRV(self);
77  
78 5 ptr1 = (char*) SvPV_nolen(self);
79 5 ptr2 = (uint8_t*) &ptr1[member->offset];
80  
81 5 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 3 2 5
if(items > 1 && SvREADONLY(self)) 0 3 3
82 {
83 0 croak("record is read-only");
84 }
85  
86 5 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 4 5
87 {
88 1 i = SvIV(ST(1));
89 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
90 {
91 1 arg = ST(2);
92 1 ptr2[i] = SvUV(arg);
93 }
94 else
95 {
96 0 warn("illegal index %d", i);
97 }
98 }
99 4 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 2 2 4
100 {
101 2 arg = ST(1);
102 2 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 1 2
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
103 {
104 1 av = (AV*) SvRV(arg);
105 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
106 {
107 3 item = av_fetch(av, i, 0);
108 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 3 0 3
109 {
110 3 ptr2[i] = SvUV(*item);
111 }
112 else
113 {
114 0 ptr2[i] = 0;
115 }
116 }
117 }
118 else
119 {
120 1 i = SvIV(ST(1));
121 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
134 2 XSRETURN_EMPTY;
135  
136 2 av = newAV();
137 2 av_fill(av, member->count-1);
138 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
162 5 self = SvRV(self);
163  
164 5 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 5 5
165 0 croak("Null record error");
166  
167 5 ptr1 = (char*) SvPV_nolen(self);
168 5 ptr2 = (int8_t*) &ptr1[member->offset];
169  
170 5 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 2 3 5
171 {
172 2 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 2 2
173 {
174 0 croak("record is read-only");
175 }
176 else
177 {
178 2 *ptr2 = (int8_t) SvIV(ST(1));
179 }
180 }
181  
182 5 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 3 5
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
208 5 self = SvRV(self);
209  
210 5 ptr1 = (char*) SvPV_nolen(self);
211 5 ptr2 = (int8_t*) &ptr1[member->offset];
212  
213 5 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 3 2 5
if(items > 1 && SvREADONLY(self)) 0 3 3
214 {
215 0 croak("record is read-only");
216 }
217  
218 5 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 4 5
219 {
220 1 i = SvIV(ST(1));
221 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
222 {
223 1 arg = ST(2);
224 1 ptr2[i] = SvIV(arg);
225 }
226 else
227 {
228 0 warn("illegal index %d", i);
229 }
230 }
231 4 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 2 2 4
232 {
233 2 arg = ST(1);
234 2 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 1 2
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
235 {
236 1 av = (AV*) SvRV(arg);
237 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
238 {
239 3 item = av_fetch(av, i, 0);
240 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 3 0 3
241 {
242 3 ptr2[i] = SvIV(*item);
243 }
244 else
245 {
246 0 ptr2[i] = 0;
247 }
248 }
249 }
250 else
251 {
252 1 i = SvIV(ST(1));
253 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
266 2 XSRETURN_EMPTY;
267  
268 2 av = newAV();
269 2 av_fill(av, member->count-1);
270 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 1 1
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 1 0 1
294 1 self = SvRV(self);
295  
296 1 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 1 1
297 0 croak("Null record error");
298  
299 1 ptr1 = (char*) SvPV_nolen(self);
300 1 ptr2 = (uint16_t*) &ptr1[member->offset];
301  
302 1 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 1 0 1
303 {
304 1 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 1 1
305 {
306 0 croak("record is read-only");
307 }
308 else
309 {
310 1 *ptr2 = (uint16_t) SvUV(ST(1));
311 }
312 }
313  
314 1 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 1 0 1
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
340 5 self = SvRV(self);
341  
342 5 ptr1 = (char*) SvPV_nolen(self);
343 5 ptr2 = (uint16_t*) &ptr1[member->offset];
344  
345 5 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 3 2 5
if(items > 1 && SvREADONLY(self)) 0 3 3
346 {
347 0 croak("record is read-only");
348 }
349  
350 5 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 4 5
351 {
352 1 i = SvIV(ST(1));
353 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
354 {
355 1 arg = ST(2);
356 1 ptr2[i] = SvUV(arg);
357 }
358 else
359 {
360 0 warn("illegal index %d", i);
361 }
362 }
363 4 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 2 2 4
364 {
365 2 arg = ST(1);
366 2 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 1 2
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
367 {
368 1 av = (AV*) SvRV(arg);
369 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
370 {
371 3 item = av_fetch(av, i, 0);
372 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 3 0 3
373 {
374 3 ptr2[i] = SvUV(*item);
375 }
376 else
377 {
378 0 ptr2[i] = 0;
379 }
380 }
381 }
382 else
383 {
384 1 i = SvIV(ST(1));
385 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
398 2 XSRETURN_EMPTY;
399  
400 2 av = newAV();
401 2 av_fill(av, member->count-1);
402 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
426 5 self = SvRV(self);
427  
428 5 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 5 5
429 0 croak("Null record error");
430  
431 5 ptr1 = (char*) SvPV_nolen(self);
432 5 ptr2 = (int16_t*) &ptr1[member->offset];
433  
434 5 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 2 3 5
435 {
436 2 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 2 2
437 {
438 0 croak("record is read-only");
439 }
440 else
441 {
442 2 *ptr2 = (int16_t) SvIV(ST(1));
443 }
444 }
445  
446 5 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 3 5
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
472 5 self = SvRV(self);
473  
474 5 ptr1 = (char*) SvPV_nolen(self);
475 5 ptr2 = (int16_t*) &ptr1[member->offset];
476  
477 5 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 3 2 5
if(items > 1 && SvREADONLY(self)) 0 3 3
478 {
479 0 croak("record is read-only");
480 }
481  
482 5 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 4 5
483 {
484 1 i = SvIV(ST(1));
485 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
486 {
487 1 arg = ST(2);
488 1 ptr2[i] = SvIV(arg);
489 }
490 else
491 {
492 0 warn("illegal index %d", i);
493 }
494 }
495 4 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 2 2 4
496 {
497 2 arg = ST(1);
498 2 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 1 2
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
499 {
500 1 av = (AV*) SvRV(arg);
501 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
502 {
503 3 item = av_fetch(av, i, 0);
504 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 3 0 3
505 {
506 3 ptr2[i] = SvIV(*item);
507 }
508 else
509 {
510 0 ptr2[i] = 0;
511 }
512 }
513 }
514 else
515 {
516 1 i = SvIV(ST(1));
517 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
530 2 XSRETURN_EMPTY;
531  
532 2 av = newAV();
533 2 av_fill(av, member->count-1);
534 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 7 7
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 7 0 7
558 7 self = SvRV(self);
559  
560 7 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 7 7
561 0 croak("Null record error");
562  
563 7 ptr1 = (char*) SvPV_nolen(self);
564 7 ptr2 = (uint32_t*) &ptr1[member->offset];
565  
566 7 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 4 3 7
567 {
568 4 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 4 4
569 {
570 0 croak("record is read-only");
571 }
572 else
573 {
574 4 *ptr2 = (uint32_t) SvUV(ST(1));
575 }
576 }
577  
578 7 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 4 3 7
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
604 5 self = SvRV(self);
605  
606 5 ptr1 = (char*) SvPV_nolen(self);
607 5 ptr2 = (uint32_t*) &ptr1[member->offset];
608  
609 5 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 3 2 5
if(items > 1 && SvREADONLY(self)) 0 3 3
610 {
611 0 croak("record is read-only");
612 }
613  
614 5 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 4 5
615 {
616 1 i = SvIV(ST(1));
617 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
618 {
619 1 arg = ST(2);
620 1 ptr2[i] = SvUV(arg);
621 }
622 else
623 {
624 0 warn("illegal index %d", i);
625 }
626 }
627 4 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 2 2 4
628 {
629 2 arg = ST(1);
630 2 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 1 2
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
631 {
632 1 av = (AV*) SvRV(arg);
633 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
634 {
635 3 item = av_fetch(av, i, 0);
636 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 3 0 3
637 {
638 3 ptr2[i] = SvUV(*item);
639 }
640 else
641 {
642 0 ptr2[i] = 0;
643 }
644 }
645 }
646 else
647 {
648 1 i = SvIV(ST(1));
649 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
662 2 XSRETURN_EMPTY;
663  
664 2 av = newAV();
665 2 av_fill(av, member->count-1);
666 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 23 23
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 23 0 23
690 23 self = SvRV(self);
691  
692 23 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 23 23
693 0 croak("Null record error");
694  
695 23 ptr1 = (char*) SvPV_nolen(self);
696 23 ptr2 = (int32_t*) &ptr1[member->offset];
697  
698 23 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 11 12 23
699 {
700 11 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 2 9 11
701 {
702 2 croak("record is read-only");
703 }
704 else
705 {
706 9 *ptr2 = (int32_t) SvIV(ST(1));
707 }
708 }
709  
710 21 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 9 12 21
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 69 69
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 69 0 69
736 69 self = SvRV(self);
737  
738 69 ptr1 = (char*) SvPV_nolen(self);
739 69 ptr2 = (int32_t*) &ptr1[member->offset];
740  
741 69 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 61 8 69
if(items > 1 && SvREADONLY(self)) 4 57 61
742 {
743 4 croak("record is read-only");
744 }
745  
746 65 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 8 57 65
747 {
748 8 i = SvIV(ST(1));
749 8 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 8 0 8
if(i >= 0 && i < member->count) 8 0 8
750 {
751 8 arg = ST(2);
752 8 ptr2[i] = SvIV(arg);
753 }
754 else
755 {
756 0 warn("illegal index %d", i);
757 }
758 }
759 57 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 49 8 57
760 {
761 49 arg = ST(1);
762 49 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 6 43 49
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 6 0 6
763 {
764 6 av = (AV*) SvRV(arg);
765 73 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 67 6 73
766 {
767 67 item = av_fetch(av, i, 0);
768 67 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 27 40 67
if(item != NULL && SvOK(*item)) 27 0 27
769 {
770 27 ptr2[i] = SvIV(*item);
771 }
772 else
773 {
774 40 ptr2[i] = 0;
775 }
776 }
777 }
778 else
779 {
780 43 i = SvIV(ST(1));
781 43 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 43 0 43
if(i >= 0 && i < member->count) 43 0 43
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 5 17 22
794 5 XSRETURN_EMPTY;
795  
796 17 av = newAV();
797 17 av_fill(av, member->count-1);
798 215 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 198 17 215
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 1 1
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 1 0 1
822 1 self = SvRV(self);
823  
824 1 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 1 1
825 0 croak("Null record error");
826  
827 1 ptr1 = (char*) SvPV_nolen(self);
828 1 ptr2 = (uint64_t*) &ptr1[member->offset];
829  
830 1 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 1 0 1
831 {
832 1 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 1 1
833 {
834 0 croak("record is read-only");
835 }
836 else
837 {
838 1 *ptr2 = (uint64_t) SvUV(ST(1));
839 }
840 }
841  
842 1 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 1 0 1
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
868 5 self = SvRV(self);
869  
870 5 ptr1 = (char*) SvPV_nolen(self);
871 5 ptr2 = (uint64_t*) &ptr1[member->offset];
872  
873 5 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 3 2 5
if(items > 1 && SvREADONLY(self)) 0 3 3
874 {
875 0 croak("record is read-only");
876 }
877  
878 5 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 4 5
879 {
880 1 i = SvIV(ST(1));
881 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
882 {
883 1 arg = ST(2);
884 1 ptr2[i] = SvUV(arg);
885 }
886 else
887 {
888 0 warn("illegal index %d", i);
889 }
890 }
891 4 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 2 2 4
892 {
893 2 arg = ST(1);
894 2 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 1 2
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
895 {
896 1 av = (AV*) SvRV(arg);
897 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
898 {
899 3 item = av_fetch(av, i, 0);
900 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 3 0 3
901 {
902 3 ptr2[i] = SvUV(*item);
903 }
904 else
905 {
906 0 ptr2[i] = 0;
907 }
908 }
909 }
910 else
911 {
912 1 i = SvIV(ST(1));
913 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
926 2 XSRETURN_EMPTY;
927  
928 2 av = newAV();
929 2 av_fill(av, member->count-1);
930 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 1 1
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 1 0 1
954 1 self = SvRV(self);
955  
956 1 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 1 1
957 0 croak("Null record error");
958  
959 1 ptr1 = (char*) SvPV_nolen(self);
960 1 ptr2 = (int64_t*) &ptr1[member->offset];
961  
962 1 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 1 0 1
963 {
964 1 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 1 1
965 {
966 0 croak("record is read-only");
967 }
968 else
969 {
970 1 *ptr2 = (int64_t) SvIV(ST(1));
971 }
972 }
973  
974 1 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 1 0 1
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 5 5
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 5 0 5
1000 5 self = SvRV(self);
1001  
1002 5 ptr1 = (char*) SvPV_nolen(self);
1003 5 ptr2 = (int64_t*) &ptr1[member->offset];
1004  
1005 5 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 3 2 5
if(items > 1 && SvREADONLY(self)) 0 3 3
1006 {
1007 0 croak("record is read-only");
1008 }
1009  
1010 5 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 4 5
1011 {
1012 1 i = SvIV(ST(1));
1013 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
1014 {
1015 1 arg = ST(2);
1016 1 ptr2[i] = SvIV(arg);
1017 }
1018 else
1019 {
1020 0 warn("illegal index %d", i);
1021 }
1022 }
1023 4 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 2 2 4
1024 {
1025 2 arg = ST(1);
1026 2 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 1 2
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
1027 {
1028 1 av = (AV*) SvRV(arg);
1029 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
1030 {
1031 3 item = av_fetch(av, i, 0);
1032 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 3 0 3
1033 {
1034 3 ptr2[i] = SvIV(*item);
1035 }
1036 else
1037 {
1038 0 ptr2[i] = 0;
1039 }
1040 }
1041 }
1042 else
1043 {
1044 1 i = SvIV(ST(1));
1045 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
1058 2 XSRETURN_EMPTY;
1059  
1060 2 av = newAV();
1061 2 av_fill(av, member->count-1);
1062 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 1 1
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 1 0 1
1086 1 self = SvRV(self);
1087  
1088 1 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 1 1
1089 0 croak("Null record error");
1090  
1091 1 ptr1 = (char*) SvPV_nolen(self);
1092 1 ptr2 = (float*) &ptr1[member->offset];
1093  
1094 1 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 1 0 1
1095 {
1096 1 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 1 1
1097 {
1098 0 croak("record is read-only");
1099 }
1100 else
1101 {
1102 1 *ptr2 = (float) SvNV(ST(1));
1103 }
1104 }
1105  
1106 1 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 1 0 1
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 7 7
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 7 0 7
1132 7 self = SvRV(self);
1133  
1134 7 ptr1 = (char*) SvPV_nolen(self);
1135 7 ptr2 = (float*) &ptr1[member->offset];
1136  
1137 7 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 5 2 7
if(items > 1 && SvREADONLY(self)) 0 5 5
1138 {
1139 0 croak("record is read-only");
1140 }
1141  
1142 7 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 6 7
1143 {
1144 1 i = SvIV(ST(1));
1145 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
1146 {
1147 1 arg = ST(2);
1148 1 ptr2[i] = SvNV(arg);
1149 }
1150 else
1151 {
1152 0 warn("illegal index %d", i);
1153 }
1154 }
1155 6 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 4 2 6
1156 {
1157 4 arg = ST(1);
1158 4 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 3 4
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
1159 {
1160 1 av = (AV*) SvRV(arg);
1161 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
1162 {
1163 3 item = av_fetch(av, i, 0);
1164 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 2 1 3
1165 {
1166 2 ptr2[i] = SvNV(*item);
1167 }
1168 else
1169 {
1170 1 ptr2[i] = 0.0;
1171 }
1172 }
1173 }
1174 else
1175 {
1176 3 i = SvIV(ST(1));
1177 3 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 3 0 3
if(i >= 0 && i < member->count) 3 0 3
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
1190 2 XSRETURN_EMPTY;
1191  
1192 2 av = newAV();
1193 2 av_fill(av, member->count-1);
1194 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 1 1
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 1 0 1
1218 1 self = SvRV(self);
1219  
1220 1 ▶ if(!SvOK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(!SvOK(self)) 0 1 1
1221 0 croak("Null record error");
1222  
1223 1 ptr1 = (char*) SvPV_nolen(self);
1224 1 ptr2 = (double*) &ptr1[member->offset];
1225  
1226 1 ▶ if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 1) 1 0 1
1227 {
1228 1 ▶ if(SvREADONLY(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvREADONLY(self)) 0 1 1
1229 {
1230 0 croak("record is read-only");
1231 }
1232 else
1233 {
1234 1 *ptr2 = (double) SvNV(ST(1));
1235 }
1236 }
1237  
1238 1 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 1 0 1
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 ▶ if(items == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(items == 0) 0 7 7
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 ▶ if(SvROK(self))
Branch: 1 branch
BranchTrueFalseTotal
if(SvROK(self)) 7 0 7
1264 7 self = SvRV(self);
1265  
1266 7 ptr1 = (char*) SvPV_nolen(self);
1267 7 ptr2 = (double*) &ptr1[member->offset];
1268  
1269 7 ▶ if(items > 1 && SvREADONLY(self))
Branch: 2 branches
BranchTrueFalseTotal
if(items > 1 && SvREADONLY(self)) 5 2 7
if(items > 1 && SvREADONLY(self)) 0 5 5
1270 {
1271 0 croak("record is read-only");
1272 }
1273  
1274 7 ▶ if(items > 2)
Branch: 1 branch
BranchTrueFalseTotal
if(items > 2) 1 6 7
1275 {
1276 1 i = SvIV(ST(1));
1277 1 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 1 0 1
if(i >= 0 && i < member->count) 1 0 1
1278 {
1279 1 arg = ST(2);
1280 1 ptr2[i] = SvNV(arg);
1281 }
1282 else
1283 {
1284 0 warn("illegal index %d", i);
1285 }
1286 }
1287 6 ▶ else if(items > 1)
Branch: 1 branch
BranchTrueFalseTotal
else if(items > 1) 4 2 6
1288 {
1289 4 arg = ST(1);
1290 4 ▶ if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV)
Branch: 2 branches
BranchTrueFalseTotal
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 3 4
if(SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVAV) 1 0 1
1291 {
1292 1 av = (AV*) SvRV(arg);
1293 4 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 3 1 4
1294 {
1295 3 item = av_fetch(av, i, 0);
1296 3 ▶ if(item != NULL && SvOK(*item))
Branch: 2 branches
BranchTrueFalseTotal
if(item != NULL && SvOK(*item)) 3 0 3
if(item != NULL && SvOK(*item)) 2 1 3
1297 {
1298 2 ptr2[i] = SvNV(*item);
1299 }
1300 else
1301 {
1302 1 ptr2[i] = 0.0;
1303 }
1304 }
1305 }
1306 else
1307 {
1308 3 i = SvIV(ST(1));
1309 3 ▶ if(i >= 0 && i < member->count)
Branch: 2 branches
BranchTrueFalseTotal
if(i >= 0 && i < member->count) 3 0 3
if(i >= 0 && i < member->count) 3 0 3
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 ▶ if(GIMME_V == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if(GIMME_V == G_VOID) 2 2 4
1322 2 XSRETURN_EMPTY;
1323  
1324 2 av = newAV();
1325 2 av_fill(av, member->count-1);
1326 8 ▶ for(i=0; i < member->count; i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i < member->count; i++) 6 2 8
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  
« blib/lib/FFI/Platypus/Memory.pm ↑ Summary xs/record_string.c »