| 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 |
|
| # FUNCTION: native |
| 13 |
|
| # |
| 14 |
|
| # WRITTEN BY: Marcus Holland-Moritz ON: Aug 2004 |
| 15 |
|
| # CHANGED BY: ON: |
| 16 |
|
| # |
| 17 |
|
| ################################################################################ |
| 18 |
|
| # |
| 19 |
|
| # DESCRIPTION: Get property of the native platform. |
| 20 |
|
| # |
| 21 |
|
| ################################################################################ |
| 22 |
|
| |
| 23 |
|
| SV * |
| 24 |
|
| native(...) |
| 25 |
|
| PREINIT: |
| 26 |
93 |
| CBC_METHOD(native); |
| 27 |
|
| int method_call; |
| 28 |
|
| |
| 29 |
|
| CODE: |
| 30 |
93 |
▶ | method_call = items > 0 && sv_isobject(ST(0)); |
Branch: 2 branches
| Branch | True | False | Total |
| method_call = items > 0 && sv_isobject(ST(0)); |
92 |
1 |
93 |
| method_call = items > 0 && sv_isobject(ST(0)); |
66 |
26 |
92 |
|
| 31 |
|
| |
| 32 |
93 |
▶ | if (items > (method_call ? 2 : 1)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items > (method_call ? 2 : 1)) |
66 |
27 |
93 |
| if (items > (method_call ? 2 : 1)) |
12 |
81 |
93 |
|
| 33 |
12 |
| Perl_croak(aTHX_ "Usage: Convert::Binary::C::native(property)"); |
| 34 |
|
| |
| 35 |
81 |
▶ | CHECK_VOID_CONTEXT; |
Branch: 2 branches
| Branch | True | False | Total |
| CHECK_VOID_CONTEXT; |
12 |
69 |
81 |
| CHECK_VOID_CONTEXT; |
8 |
4 |
12 |
|
| 36 |
|
| |
| 37 |
69 |
▶ | if (items == (method_call ? 1 : 0)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items == (method_call ? 1 : 0)) |
2 |
67 |
69 |
|
| 38 |
|
| { |
| 39 |
2 |
| RETVAL = get_native_property(aTHX_ NULL); |
| 40 |
|
| } |
| 41 |
|
| else |
| 42 |
|
| { |
| 43 |
67 |
| const char *property = (const char *)SvPV_nolen(ST(items-1)); |
| 44 |
|
| |
| 45 |
67 |
| RETVAL = get_native_property(aTHX_ property); |
| 46 |
|
| |
| 47 |
67 |
▶ | if (RETVAL == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (RETVAL == NULL) |
8 |
59 |
67 |
|
| 48 |
8 |
| Perl_croak(aTHX_ "Invalid property '%s'", property); |
| 49 |
|
| } |
| 50 |
|
| |
| 51 |
|
| OUTPUT: |
| 52 |
|
| RETVAL |
| 53 |
|
| |