| 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: feature |
| 13 |
|
| # |
| 14 |
|
| # WRITTEN BY: Marcus Holland-Moritz ON: Mar 2002 |
| 15 |
|
| # CHANGED BY: ON: |
| 16 |
|
| # |
| 17 |
|
| ################################################################################ |
| 18 |
|
| # |
| 19 |
|
| # DESCRIPTION: Check if the module was compiled with a certain feature. |
| 20 |
|
| # |
| 21 |
|
| ################################################################################ |
| 22 |
|
| |
| 23 |
|
| void |
| 24 |
|
| feature(...) |
| 25 |
|
| PREINIT: |
| 26 |
48 |
| CBC_METHOD(feature); |
| 27 |
|
| int method_call; |
| 28 |
|
| const char *feat; |
| 29 |
|
| |
| 30 |
|
| PPCODE: |
| 31 |
48 |
▶ | method_call = items > 0 && sv_isobject(ST(0)); |
Branch: 2 branches
| Branch | True | False | Total |
| method_call = items > 0 && sv_isobject(ST(0)); |
42 |
6 |
48 |
| method_call = items > 0 && sv_isobject(ST(0)); |
19 |
23 |
42 |
|
| 32 |
|
| |
| 33 |
48 |
▶ | if (items != (method_call ? 2 : 1)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items != (method_call ? 2 : 1)) |
19 |
29 |
48 |
| if (items != (method_call ? 2 : 1)) |
24 |
24 |
48 |
|
| 34 |
24 |
| Perl_croak(aTHX_ "Usage: Convert::Binary::C::feature(feat)"); |
| 35 |
|
| |
| 36 |
24 |
▶ | CHECK_VOID_CONTEXT; |
Branch: 2 branches
| Branch | True | False | Total |
| CHECK_VOID_CONTEXT; |
12 |
12 |
24 |
| CHECK_VOID_CONTEXT; |
8 |
4 |
12 |
|
| 37 |
|
| |
| 38 |
12 |
| feat = (const char *)SvPV_nolen(ST(items-1)); |
| 39 |
|
| |
| 40 |
12 |
| switch (*feat) |
| 41 |
|
| { |
| 42 |
6 |
| case 'd': |
| 43 |
6 |
▶ | if (strEQ(feat, "debug")) |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(feat, "debug")) |
6 |
0 |
6 |
|
| 44 |
|
| #ifdef CBC_DEBUGGING |
| 45 |
|
| XSRETURN_YES; |
| 46 |
|
| #else |
| 47 |
6 |
| XSRETURN_NO; |
| 48 |
|
| #endif |
| 49 |
0 |
| break; |
| 50 |
|
| |
| 51 |
5 |
| case 'i': |
| 52 |
5 |
▶ | if (strEQ(feat, "ieeefp")) |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(feat, "ieeefp")) |
5 |
0 |
5 |
|
| 53 |
|
| #ifdef CBC_HAVE_IEEE_FP |
| 54 |
5 |
| XSRETURN_YES; |
| 55 |
|
| #else |
| 56 |
|
| XSRETURN_NO; |
| 57 |
|
| #endif |
| 58 |
0 |
| break; |
| 59 |
|
| } |
| 60 |
|
| |
| 61 |
1 |
| XSRETURN_UNDEF; |
| 62 |
|
| |