FreeDB.xs

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 29 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/Net/FreeDB.pm ↑ Summary lib/linux.h »
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4  
5 #include "lib/discid.h"
6 #include <stdio.h>
7 #include <stdlib.h>
8  
9 static int
10 0 not_here(char *s)
11 {
12 0 croak("%s not implemented on this architecture", s);
13 return -1;
14 }
15  
16 static double
17 0 constant(char *name, int len, int arg)
18 {
19 0 errno = EINVAL;
20 0 return 0;
21 }
22  
23 MODULE = Net::FreeDB PACKAGE = Net::FreeDB
24  
25 PROTOTYPES: ENABLE
26  
27 double
28 constant(sv,arg)
29 PREINIT:
30 STRLEN len;
31 INPUT:
32 SV * sv
33 char * s = SvPV(sv, len);
34 int arg
35 CODE:
36 0 RETVAL = constant(s,len,arg);
37 OUTPUT:
38 RETVAL
39  
40 char*
41 discid(char* dev)
42 INIT:
43 char id[30];
44 struct discdata data;
45 CODE:
46 0 data = get_disc_id(dev);
47 0 POST_CALL:
48 0 ▶ if (data.num_of_trks == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if (data.num_of_trks == -1) { 0 0 0
49 0 RETVAL = "";
50 } else {
51 0 sprintf(id, "%08x", (unsigned int)data.discid);
52 0 RETVAL = id;
53 }
54 OUTPUT:
55 RETVAL
56  
57 SV*
58 discinfo(char* dev)
59 INIT:
60 int i;
61 char id[30];
62 struct discdata data;
63 0 HV* hash = newHV();
64 0 AV* tracks = newAV();
65 PPCODE:
66 0 data = get_disc_id(dev);
67  
68 0 ▶ for (i = 0; i < (data.num_of_trks); i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < (data.num_of_trks); i++) { 0 0 0
69 0 av_push(tracks, newSVnv(data.track_offsets[i]));
70 }
71
72 0 sprintf(id, "%08x", (unsigned int)data.discid);
73 0 hv_store(hash, "ID", 2, newSVpv(id, 0), 0);
74 0 hv_store(hash, "NUM_TRKS", 8, newSVnv(data.num_of_trks), 0);
75 0 hv_store(hash, "TRACKS", 6, newRV_inc((SV*)tracks), 0);
76 0 hv_store(hash, "SECONDS", 7, newSVnv(data.seconds), 0);
77  
78 0 ▶ XPUSHs(newRV((SV*)hash));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(newRV((SV*)hash)); 0 0 0
79  
« blib/lib/Net/FreeDB.pm ↑ Summary lib/linux.h »