| 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: typedef_names |
| 13 |
|
| # |
| 14 |
|
| # WRITTEN BY: Marcus Holland-Moritz ON: Jan 2002 |
| 15 |
|
| # CHANGED BY: ON: |
| 16 |
|
| # |
| 17 |
|
| ################################################################################ |
| 18 |
|
| |
| 19 |
|
| void |
| 20 |
|
| CBC::typedef_names() |
| 21 |
|
| PREINIT: |
| 22 |
63 |
| CBC_METHOD(typedef_names); |
| 23 |
|
| ListIterator tli, ti; |
| 24 |
|
| TypedefList *pTDL; |
| 25 |
|
| Typedef *pTypedef; |
| 26 |
63 |
| int count = 0; |
| 27 |
|
| U32 context; |
| 28 |
|
| |
| 29 |
|
| PPCODE: |
| 30 |
|
| CT_DEBUG_METHOD; |
| 31 |
|
| |
| 32 |
63 |
▶ | CHECK_PARSE_DATA; |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_PARSE_DATA; |
6 |
57 |
63 |
|
| 33 |
57 |
▶ | CHECK_VOID_CONTEXT; |
Branch: 2 branches
| Branch | True | False | Total |
| CHECK_VOID_CONTEXT; |
6 |
51 |
57 |
| CHECK_VOID_CONTEXT; |
4 |
2 |
6 |
|
| 34 |
|
| |
| 35 |
51 |
| context = GIMME_V; |
| 36 |
|
| |
| 37 |
1114 |
▶ | LL_foreach(pTDL, tli, THIS->cpi.typedef_lists) |
Branch: 2 branches
| Branch | True | False | Total |
| LL_foreach(pTDL, tli, THIS->cpi.typedef_lists) |
1063 |
51 |
1114 |
| LL_foreach(pTDL, tli, THIS->cpi.typedef_lists) |
1063 |
51 |
1114 |
|
| 38 |
3217 |
▶ | LL_foreach(pTypedef, ti, pTDL->typedefs) |
Branch: 2 branches
| Branch | True | False | Total |
| LL_foreach(pTypedef, ti, pTDL->typedefs) |
1091 |
1063 |
2154 |
| LL_foreach(pTypedef, ti, pTDL->typedefs) |
1091 |
1063 |
2154 |
|
| 39 |
1091 |
▶ | if (is_typedef_defined(pTypedef)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (is_typedef_defined(pTypedef)) |
1091 |
0 |
1091 |
|
| 40 |
|
| { |
| 41 |
1091 |
▶ | if (context == G_ARRAY) |
Branch: 1 branch
| Branch | True | False | Total |
| if (context == G_ARRAY) |
692 |
399 |
1091 |
|
| 42 |
692 |
▶ | XPUSHs(sv_2mortal(newSVpv(pTypedef->pDecl->identifier, 0))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv(pTypedef->pDecl->identifier, 0))); |
0 |
692 |
692 |
|
| 43 |
1091 |
| count++; |
| 44 |
|
| } |
| 45 |
|
| |
| 46 |
51 |
▶ | if (context == G_ARRAY) |
Branch: 1 branch
| Branch | True | False | Total |
| if (context == G_ARRAY) |
43 |
8 |
51 |
|
| 47 |
43 |
| XSRETURN(count); |
| 48 |
|
| else |
| 49 |
8 |
| XSRETURN_IV(count); |
| 50 |
|
| |
| 51 |
|
| |
| 52 |
|
| ################################################################################ |
| 53 |
|
| # |
| 54 |
|
| # METHOD: typedef |
| 55 |
|
| # |
| 56 |
|
| # WRITTEN BY: Marcus Holland-Moritz ON: Jan 2002 |
| 57 |
|
| # CHANGED BY: ON: |
| 58 |
|
| # |
| 59 |
|
| ################################################################################ |
| 60 |
|
| |
| 61 |
|
| void |
| 62 |
|
| CBC::typedef(...) |
| 63 |
|
| PREINIT: |
| 64 |
473 |
| CBC_METHOD(typedef); |
| 65 |
|
| Typedef *pTypedef; |
| 66 |
|
| U32 context; |
| 67 |
|
| |
| 68 |
|
| PPCODE: |
| 69 |
|
| CT_DEBUG_METHOD; |
| 70 |
|
| |
| 71 |
473 |
▶ | CHECK_PARSE_DATA; |
Branch: 1 branch
| Branch | True | False | Total |
| CHECK_PARSE_DATA; |
6 |
467 |
473 |
|
| 72 |
467 |
▶ | CHECK_VOID_CONTEXT; |
Branch: 2 branches
| Branch | True | False | Total |
| CHECK_VOID_CONTEXT; |
6 |
461 |
467 |
| CHECK_VOID_CONTEXT; |
4 |
2 |
6 |
|
| 73 |
|
| |
| 74 |
461 |
| context = GIMME_V; |
| 75 |
|
| |
| 76 |
461 |
▶ | if (context == G_SCALAR && items != 2) |
Branch: 2 branches
| Branch | True | False | Total |
| if (context == G_SCALAR && items != 2) |
69 |
392 |
461 |
| if (context == G_SCALAR && items != 2) |
9 |
60 |
69 |
|
| 77 |
9 |
▶ | XSRETURN_IV(items > 1 ? items-1 : HT_count(THIS->cpi.htTypedefs)); |
Branch: 1 branch
| Branch | True | False | Total |
| XSRETURN_IV(items > 1 ? items-1 : HT_count(THIS->cpi.htTypedefs)); |
1 |
8 |
9 |
|
| 78 |
|
| |
| 79 |
452 |
▶ | NEED_PARSE_DATA; |
Branch: 2 branches
| Branch | True | False | Total |
| NEED_PARSE_DATA; |
452 |
0 |
452 |
| NEED_PARSE_DATA; |
2 |
450 |
452 |
|
| 80 |
|
| |
| 81 |
452 |
▶ | if (items > 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items > 1) |
418 |
34 |
452 |
|
| 82 |
|
| { |
| 83 |
|
| int i; |
| 84 |
|
| |
| 85 |
897 |
▶ | for (i = 1; i < items; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i < items; i++) |
479 |
418 |
897 |
|
| 86 |
|
| { |
| 87 |
479 |
| const char *name = SvPV_nolen(ST(i)); |
| 88 |
|
| |
| 89 |
479 |
| pTypedef = HT_get(THIS->cpi.htTypedefs, name, 0, 0); |
| 90 |
|
| |
| 91 |
479 |
▶ | if (pTypedef) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pTypedef) |
466 |
13 |
479 |
|
| 92 |
466 |
| PUSHs(sv_2mortal(get_typedef_def(aTHX_ &THIS->cfg, pTypedef))); |
| 93 |
|
| else |
| 94 |
13 |
| PUSHs(&PL_sv_undef); |
| 95 |
|
| } |
| 96 |
|
| |
| 97 |
418 |
| XSRETURN(items-1); |
| 98 |
|
| } |
| 99 |
|
| else |
| 100 |
|
| { |
| 101 |
|
| ListIterator tli, ti; |
| 102 |
|
| TypedefList *pTDL; |
| 103 |
34 |
| int size = HT_count(THIS->cpi.htTypedefs); |
| 104 |
|
| |
| 105 |
34 |
▶ | if (size <= 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (size <= 0) |
16 |
18 |
34 |
|
| 106 |
16 |
| XSRETURN_EMPTY; |
| 107 |
|
| |
| 108 |
18 |
▶ | EXTEND(SP, size); |
Branch: 2 branches
| Branch | True | False | Total |
| EXTEND(SP, size); |
18 |
0 |
18 |
| EXTEND(SP, size); |
0 |
18 |
18 |
|
| 109 |
|
| |
| 110 |
258 |
▶ | LL_foreach(pTDL, tli, THIS->cpi.typedef_lists) |
Branch: 2 branches
| Branch | True | False | Total |
| LL_foreach(pTDL, tli, THIS->cpi.typedef_lists) |
240 |
18 |
258 |
| LL_foreach(pTDL, tli, THIS->cpi.typedef_lists) |
240 |
18 |
258 |
|
| 111 |
486 |
▶ | LL_foreach(pTypedef, ti, pTDL->typedefs) |
Branch: 2 branches
| Branch | True | False | Total |
| LL_foreach(pTypedef, ti, pTDL->typedefs) |
246 |
240 |
486 |
| LL_foreach(pTypedef, ti, pTDL->typedefs) |
246 |
240 |
486 |
|
| 112 |
246 |
| PUSHs(sv_2mortal(get_typedef_def(aTHX_ &THIS->cfg, pTypedef))); |
| 113 |
|
| |
| 114 |
18 |
| XSRETURN(size); |
| 115 |
|
| } |
| 116 |
|
| |