xsubs/def.xs

filter: Statementstmt 92.5% 25 / 27 Branchbran 88.4% 23 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 90.5% 48 / 53 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xsubs/feature.xs ↑ Summary xsubs/compound.xs »
1 ################################################################################
2 #
3 # Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the same terms as Perl itself.
6 #
7 ################################################################################
8  
9  
10 ################################################################################
11 #
12 # METHOD: def
13 #
14 # WRITTEN BY: Marcus Holland-Moritz ON: Mar 2002
15 # CHANGED BY: ON:
16 #
17 ################################################################################
18  
19 char *
20 CBC::def(type)
21 const char *type
22  
23 PREINIT:
24 267 CBC_METHOD(def);
25 MemberInfo mi;
26 267 ▶ const char *member = NULL;
Branch: 1 branch
BranchTrueFalseTotal
const char *member = NULL; 267 0 267
27  
28 CODE:
29 CT_DEBUG_METHOD1("'%s'", type);
30  
31 297 ▶ CHECK_VOID_CONTEXT;
Branch: 2 branches
BranchTrueFalseTotal
CHECK_VOID_CONTEXT; 12 255 267
CHECK_VOID_CONTEXT; 8 4 12
32  
33 255 ▶ if (get_type_spec(THIS, type, &member, &mi.type) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if (get_type_spec(THIS, type, &member, &mi.type) == 0) 30 225 255
34 30 XSRETURN_UNDEF;
35  
36 225 ▶ if (mi.type.ptr == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (mi.type.ptr == NULL) 4 221 225
37 4 RETVAL = "basic";
38 else
39 {
40 221 void *ptr = mi.type.ptr;
41 221 switch (GET_CTYPE(ptr))
42 {
43 143 case TYP_TYPEDEF:
44 143 ▶ RETVAL = is_typedef_defined((Typedef *) ptr) ? "typedef" : "";
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = is_typedef_defined((Typedef *) ptr) ? "typedef" : ""; 137 6 143
45 143 break;
46  
47 75 case TYP_STRUCT:
48 75 ▶ if (((Struct *) ptr)->declarations)
Branch: 1 branch
BranchTrueFalseTotal
if (((Struct *) ptr)->declarations) 73 2 75
49 73 ▶ RETVAL = ((Struct *) ptr)->tflags & T_STRUCT ? "struct" : "union";
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ((Struct *) ptr)->tflags & T_STRUCT ? "struct" : "union"; 62 11 73
50 else
51 2 RETVAL = "";
52 75 break;
53  
54 3 case TYP_ENUM:
55 3 ▶ RETVAL = ((EnumSpecifier *) ptr)->enumerators ? "enum" : "";
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = ((EnumSpecifier *) ptr)->enumerators ? "enum" : ""; 3 0 3
56 3 break;
57  
58 0 default:
59 0 fatal("Invalid type (%d) in " XSCLASS "::%s( '%s' )",
60 GET_CTYPE(ptr), method, type);
61 break;
62 }
63 221 ▶ if (member && *member != '\0' && *RETVAL != '\0')
Branch: 3 branches
BranchTrueFalseTotal
if (member && *member != '\0' && *RETVAL != '\0') 221 0 221
if (member && *member != '\0' && *RETVAL != '\0') 26 195 221
if (member && *member != '\0' && *RETVAL != '\0') 22 4 26
64 {
65 22 mi.pDecl = NULL;
66 22 mi.level = 0;
67 44 RETVAL = get_member(aTHX_ &mi, member, NULL, CBC_GM_DONT_CROAK | CBC_GM_NO_OFFSET_SIZE_CALC)
68 22 ▶ ? "member" : "";
Branch: 1 branch
BranchTrueFalseTotal
? "member" : ""; 11 11 22
69 }
70 }
71  
72 OUTPUT:
73 RETVAL
74  
« xsubs/feature.xs ↑ Summary xsubs/compound.xs »