| 1 | |||||||||||||||||||||||||||||
| 2 | =head1 NAME | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | Cz::Sort - Czech sort | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | =cut | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | # Here starts the Cz::Sort namespace | ||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||
| 11 | package Cz::Sort; | ||||||||||||||||||||||||||||
| 12 | 7 | ▶ | no locale; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use integer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use vars qw( @ISA @EXPORT $VERSION $DEBUG ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 7 | @ISA = qw( Exporter ); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # | ||||||||||||||||||||||||||||
| 20 | # We implicitly export czcmp, czsort, cscmp and cssort functions. | ||||||||||||||||||||||||||||
| 21 | # Since these are the only ones that can be used by ordinary users, | ||||||||||||||||||||||||||||
| 22 | # it should not cause big harm. | ||||||||||||||||||||||||||||
| 23 | # | ||||||||||||||||||||||||||||
| 24 | 7 | @EXPORT = qw( czsort czcmp cssort cscmp ); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 7 | $VERSION = '0.68'; | |||||||||||||||||||||||||||
| 27 | 7 | $DEBUG = 0; | |||||||||||||||||||||||||||
| 28 | 692 | ▶ | sub DEBUG { $DEBUG; } | ||||||||||||||||||||||||||
|
Subroutine
DEBUG: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # | ||||||||||||||||||||||||||||
| 31 | # The table with sorting definitions. | ||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||
| 33 | 7 | my @def_table = ( | |||||||||||||||||||||||||||
| 34 | 'aA áÁ â ãà äÄ ±¡', | ||||||||||||||||||||||||||||
| 35 | 'bB', | ||||||||||||||||||||||||||||
| 36 | 'cC æÆ çÇ', 'èÈ', | ||||||||||||||||||||||||||||
| 37 | 'dD ïÏ ðÐ', | ||||||||||||||||||||||||||||
| 38 | 'eE éÉ ìÌ ëË êÊ', | ||||||||||||||||||||||||||||
| 39 | 'fF', | ||||||||||||||||||||||||||||
| 40 | 'gG', | ||||||||||||||||||||||||||||
| 41 | 'hH', | ||||||||||||||||||||||||||||
| 42 | '<ch><Ch><CH>', | ||||||||||||||||||||||||||||
| 43 | 'iI íÍ îÎ', | ||||||||||||||||||||||||||||
| 44 | 'jJ', | ||||||||||||||||||||||||||||
| 45 | 'kK', | ||||||||||||||||||||||||||||
| 46 | 'lL åÅ µ¥ ³£', | ||||||||||||||||||||||||||||
| 47 | 'mM', | ||||||||||||||||||||||||||||
| 48 | 'nN ñÑ òÒ', | ||||||||||||||||||||||||||||
| 49 | 'oO óÓ ôÔ öÖ õÕ', | ||||||||||||||||||||||||||||
| 50 | 'pP', | ||||||||||||||||||||||||||||
| 51 | 'qQ', | ||||||||||||||||||||||||||||
| 52 | 'rR àÀ', 'øØ', | ||||||||||||||||||||||||||||
| 53 | 'sS ¶¦ ºª', '¹©', | ||||||||||||||||||||||||||||
| 54 | 'ß', | ||||||||||||||||||||||||||||
| 55 | 'tT »« þÞ', | ||||||||||||||||||||||||||||
| 56 | 'uU úÚ ùÙ üÜ ûÛ', | ||||||||||||||||||||||||||||
| 57 | 'vV', | ||||||||||||||||||||||||||||
| 58 | 'wW', | ||||||||||||||||||||||||||||
| 59 | 'xX', | ||||||||||||||||||||||||||||
| 60 | 'yY ýÝ', | ||||||||||||||||||||||||||||
| 61 | 'zZ ¿¯ ¼¬', '¾®', | ||||||||||||||||||||||||||||
| 62 | '0', '1', '2', '3', | ||||||||||||||||||||||||||||
| 63 | '4', '5', '6', '7', | ||||||||||||||||||||||||||||
| 64 | '8', '9', | ||||||||||||||||||||||||||||
| 65 | ' .,;?!:"`\'', | ||||||||||||||||||||||||||||
| 66 | ' -|/\\()[]<>{}', | ||||||||||||||||||||||||||||
| 67 | ' @&§%$', | ||||||||||||||||||||||||||||
| 68 | ' _^=+×*÷#¢~', | ||||||||||||||||||||||||||||
| 69 | ' ÿ·°¨½¸²', | ||||||||||||||||||||||||||||
| 70 | ' ¤', | ||||||||||||||||||||||||||||
| 71 | ); | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | # | ||||||||||||||||||||||||||||
| 74 | # Conversion table will hold four arrays, one for each pass. They will | ||||||||||||||||||||||||||||
| 75 | # be created on the fly if they are needed. We also need to hold | ||||||||||||||||||||||||||||
| 76 | # information (regexp) about groups of letters that need to be considered | ||||||||||||||||||||||||||||
| 77 | # as one character (ch). | ||||||||||||||||||||||||||||
| 78 | # | ||||||||||||||||||||||||||||
| 79 | 7 | my @table = ( ); | |||||||||||||||||||||||||||
| 80 | 7 | my @regexp = ( '.', '.', '.', '.' ); | |||||||||||||||||||||||||||
| 81 | 7 | my @multiple = ( {}, {}, {}, {} ); | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | # | ||||||||||||||||||||||||||||
| 84 | # Make_table will build sorting table for given level. | ||||||||||||||||||||||||||||
| 85 | # | ||||||||||||||||||||||||||||
| 86 | sub make_table | ||||||||||||||||||||||||||||
| 87 | 28 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
make_table: called CC=10 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 88 | 28 | my $level = shift; | |||||||||||||||||||||||||||
| 89 | 28 | @{$table[$level]} = ( undef ) x 256; | |||||||||||||||||||||||||||
| 90 | 28 | @{$table[$level]}[ord ' ', ord "\t"] = (0, 0); | |||||||||||||||||||||||||||
| 91 | 28 | my $i = 1; | |||||||||||||||||||||||||||
| 92 | 28 | my $irow = 0; | |||||||||||||||||||||||||||
| 93 | 28 | ▶ | while (defined $def_table[$irow]) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | { | ||||||||||||||||||||||||||||
| 95 | 1344 | my $def_row = $def_table[$irow]; | |||||||||||||||||||||||||||
| 96 | 1344 | ▶ | next if $level <= 2 and $def_row =~ /^ /; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$level <= 2 and $def_row =~ /^ /
MC/DC100%2/2
$level <= 2 and $def_row =~ /^ /
$level <= 2
$def_row =~ /^ /
Truth table100%3/3
A and B
A= $level <= 2B= $def_row =~ /^ /
| |||||||||||||||||||||||||||||
| 97 | 1218 | ▶ | while ($def_row =~ /<([cC].*?)>|(.)/sg) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||
| 99 | 5453 | my $match = $+; | |||||||||||||||||||||||||||
| 100 | 5453 | ▶ | if ($match eq ' ') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||
| 102 | 1050 | ▶ | if ($level == 1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 252 | { $i++; } | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | else | ||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||
| 107 | 4403 | ▶ | if (length $match == 1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 4319 | { $table[$level][ord $match] = $i; } | |||||||||||||||||||||||||||
| 109 | else | ||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||
| 111 | 84 | $multiple[$level]{$match} = $i; | |||||||||||||||||||||||||||
| 112 | 84 | $regexp[$level] = $match . "|" . $regexp[$level]; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | 4403 | ▶ | if ($level >= 2) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | 2359 | { $i++; } | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | 1218 | ▶ | $i++ if $level < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | continue | ||||||||||||||||||||||||||||
| 121 | 1344 | { $irow++; } | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | # | ||||||||||||||||||||||||||||
| 125 | # Create the tables now. | ||||||||||||||||||||||||||||
| 126 | # | ||||||||||||||||||||||||||||
| 127 | 7 | for (0 .. 3) | |||||||||||||||||||||||||||
| 128 | 28 | { make_table($_); } | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | # | ||||||||||||||||||||||||||||
| 131 | # Compare two scalar, according to the tables. | ||||||||||||||||||||||||||||
| 132 | # | ||||||||||||||||||||||||||||
| 133 | sub czcmp | ||||||||||||||||||||||||||||
| 134 | 112 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
czcmp: called CC=56 SCAR=40.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 135 | 112 | my ($a, $b) = (shift, shift); | |||||||||||||||||||||||||||
| 136 | 112 | ▶ | print STDERR "czcmp: $a/$b\n" if DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 112 | my ($a1, $b1) = ($a, $b); | |||||||||||||||||||||||||||
| 138 | 112 | my $level = 0; | |||||||||||||||||||||||||||
| 139 | 112 | while (1) | |||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||
| 141 | 568 | my ($ac, $bc, $a_no, $b_no, $ax, $bx) = ('', '', 0, 0, | |||||||||||||||||||||||||||
| 142 | undef, undef); | ||||||||||||||||||||||||||||
| 143 | 568 | ▶ | if ($level == 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||
| 145 | 474 | ▶ | while (not defined $ax and not $a_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ax or $a_no
MC/DC100%2/2
defined $ax or $a_no
defined $ax
$a_no
Truth table100%3/3
A or B
A= defined $axB= $a_no
| |||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||
| 147 | 492 | ▶ | $a =~ /$regexp[$level]/sg or $a_no = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 492 | $ac = $&; | |||||||||||||||||||||||||||
| 149 | $ax = ( length $ac == 1 ? | ||||||||||||||||||||||||||||
| 150 | $table[$level][ord $ac] | ||||||||||||||||||||||||||||
| 151 | 492 | ▶ | : ${$multiple[$level]}{$ac} ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 152 | if defined $ac; | ||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | 474 | ▶ | while (not defined $bx and not $b_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $bx or $b_no
MC/DC100%2/2
defined $bx or $b_no
defined $bx
$b_no
Truth table100%3/3
A or B
A= defined $bxB= $b_no
| |||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||
| 156 | 495 | ▶ | $b =~ /$regexp[$level]/sg or $b_no = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 495 | $bc = $&; | |||||||||||||||||||||||||||
| 158 | $bx = ( length $bc == 1 ? | ||||||||||||||||||||||||||||
| 159 | $table[$level][ord $bc] | ||||||||||||||||||||||||||||
| 160 | 495 | ▶ | : ${$multiple[$level]}{$bc} ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 161 | if defined $bc; | ||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | else | ||||||||||||||||||||||||||||
| 165 | { | ||||||||||||||||||||||||||||
| 166 | 94 | ▶ | while (not defined $ax and not $a_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ax or $a_no
MC/DC100%2/2
defined $ax or $a_no
defined $ax
$a_no
Truth table100%3/3
A or B
A= defined $axB= $a_no
| |||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||
| 168 | 100 | ▶ | $a1 =~ /$regexp[$level]/sg or $a_no = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | 100 | $ac = $&; | |||||||||||||||||||||||||||
| 170 | $ax = ( length $ac == 1 ? | ||||||||||||||||||||||||||||
| 171 | $table[$level][ord $ac] | ||||||||||||||||||||||||||||
| 172 | 100 | ▶ | : ${$multiple[$level]}{$ac} ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 173 | if defined $ac; | ||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | 94 | ▶ | while (not defined $bx and not $b_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $bx or $b_no
MC/DC100%2/2
defined $bx or $b_no
defined $bx
$b_no
Truth table100%3/3
A or B
A= defined $bxB= $b_no
| |||||||||||||||||||||||||||||
| 176 | { | ||||||||||||||||||||||||||||
| 177 | 98 | ▶ | $b1 =~ /$regexp[$level]/sg or $b_no = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 98 | $bc = $&; | |||||||||||||||||||||||||||
| 179 | $bx = ( length $bc == 1 ? | ||||||||||||||||||||||||||||
| 180 | $table[$level][ord $bc] | ||||||||||||||||||||||||||||
| 181 | 98 | ▶ | : ${$multiple[$level]}{$bc} ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 182 | if defined $bc; | ||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 568 | ▶ | print STDERR "level $level: ac: $ac -> $ax; bc: $bc -> $bx ($a_no, $b_no)\n" if DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 568 | ▶ | return -1 if $a_no and not $b_no; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$a_no and not $b_no
MC/DC100%2/2
$a_no and not $b_no
$a_no
not $b_no
Truth table100%3/3
A and not(B)
A= $a_noB= not $b_no
| |||||||||||||||||||||||||||||
| 189 | 556 | ▶ | return 1 if not $a_no and $b_no; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $a_no and $b_no
MC/DC100%2/2
not $a_no and $b_no
not $a_no
$b_no
Truth table100%3/3
not(A) and B
A= not $a_noB= $b_no
| |||||||||||||||||||||||||||||
| 190 | 538 | ▶ | if ($a_no and $b_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$a_no and $b_no
MC/DC50%1/2
$a_no and $b_no
$a_no
$b_no
Truth table66%2/3
A and B
A= $a_noB= $b_no
| |||||||||||||||||||||||||||||
| 191 | { | ||||||||||||||||||||||||||||
| 192 | 20 | ▶ | if ($level == 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 12 | { $level = 1; next; } | |||||||||||||||||||||||||||
| 194 | 8 | last; | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 518 | ▶ | return -1 if ($ax < $bx); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | 486 | ▶ | return 1 if ($ax > $bx); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 444 | ▶ | if ($ax == 0 and $bx == 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ax == 0 and $bx == 0
MC/DC50%1/2
$ax == 0 and $bx == 0
$ax == 0
$bx == 0
Truth table66%2/3
A and B
A= $ax == 0B= $bx == 0
| |||||||||||||||||||||||||||||
| 201 | { | ||||||||||||||||||||||||||||
| 202 | 14 | ▶ | if ($level == 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | 8 | { $level = 1; next; } | |||||||||||||||||||||||||||
| 204 | 6 | $level = 0; next; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 8 | for $level (2 .. 3) | |||||||||||||||||||||||||||
| 208 | { | ||||||||||||||||||||||||||||
| 209 | 10 | while (1) | |||||||||||||||||||||||||||
| 210 | { | ||||||||||||||||||||||||||||
| 211 | 12 | my ($ac, $bc, $a_no, $b_no, $ax, $bx) | |||||||||||||||||||||||||||
| 212 | = ('', '', 0, 0, undef, undef); | ||||||||||||||||||||||||||||
| 213 | 12 | ▶ | while (not defined $ax and not $a_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ax or $a_no
MC/DC100%2/2
defined $ax or $a_no
defined $ax
$a_no
Truth table100%3/3
A or B
A= defined $axB= $a_no
| |||||||||||||||||||||||||||||
| 214 | { | ||||||||||||||||||||||||||||
| 215 | 15 | ▶ | $a =~ /$regexp[$level]/sg or $a_no = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 15 | $ac = $&; | |||||||||||||||||||||||||||
| 217 | $ax = ( length $ac == 1 ? | ||||||||||||||||||||||||||||
| 218 | $table[$level][ord $ac] | ||||||||||||||||||||||||||||
| 219 | 15 | ▶ | : ${$multiple[$level]}{$ac} ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 220 | if defined $ac; | ||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | 12 | ▶ | while (not defined $bx and not $b_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $bx or $b_no
MC/DC100%2/2
defined $bx or $b_no
defined $bx
$b_no
Truth table100%3/3
A or B
A= defined $bxB= $b_no
| |||||||||||||||||||||||||||||
| 223 | { | ||||||||||||||||||||||||||||
| 224 | 13 | ▶ | $b =~ /$regexp[$level]/sg or $b_no = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 225 | 13 | $bc = $&; | |||||||||||||||||||||||||||
| 226 | $bx = ( length $bc == 1 ? | ||||||||||||||||||||||||||||
| 227 | $table[$level][ord $bc] | ||||||||||||||||||||||||||||
| 228 | 13 | ▶ | : ${$multiple[$level]}{$bc} ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 229 | if defined $bc; | ||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 12 | ▶ | print STDERR "level $level: ac: $ac -> $ax; bc: $bc -> $bx ($a_no, $b_no)\n" if DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | 12 | ▶ | return -1 if $a_no and not $b_no; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$a_no and not $b_no
MC/DC0%0/2
$a_no and not $b_no
$a_no
not $b_no
Truth table66%2/3
A and not(B)
A= $a_noB= not $b_no
| |||||||||||||||||||||||||||||
| 234 | 12 | ▶ | return 1 if not $a_no and $b_no; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $a_no and $b_no
MC/DC0%0/2
not $a_no and $b_no
not $a_no
$b_no
Truth table66%2/3
not(A) and B
A= not $a_noB= $b_no
| |||||||||||||||||||||||||||||
| 235 | 12 | ▶ | if ($a_no and $b_no) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$a_no and $b_no
MC/DC50%1/2
$a_no and $b_no
$a_no
$b_no
Truth table66%2/3
A and B
A= $a_noB= $b_no
| |||||||||||||||||||||||||||||
| 236 | 2 | { last; } | |||||||||||||||||||||||||||
| 237 | 10 | ▶ | return -1 if ($ax < $bx); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 6 | ▶ | return 1 if ($ax > $bx); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | 0 | return 0; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 7 | 1; | |||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | # | ||||||||||||||||||||||||||||
| 247 | # Cssort does the real thing. | ||||||||||||||||||||||||||||
| 248 | # | ||||||||||||||||||||||||||||
| 249 | sub czsort | ||||||||||||||||||||||||||||
| 250 | 12 | ▶ | { sort { my $result = czcmp($a, $b); } @_; } | ||||||||||||||||||||||||||
|
Subroutine
czsort: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 7 | *cscmp = *czcmp; | |||||||||||||||||||||||||||
| 253 | 7 | *cssort = *czsort; | |||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 7 | 1; | |||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | __END__ | ||||||||||||||||||||||||||||