| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Unicode::Map 0.112 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Documentation at end of file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright (C) 1998, 1999, 2000 Martin Schwartz. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # Contact: Martin Schwartz <martin@nacho.de> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | package Unicode::Map; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use vars qw($VERSION $WARNINGS @ISA $DEBUG); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | $VERSION='0.112'; # Michael Changes it to 0.112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | require DynaLoader; @ISA=qw(DynaLoader); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | bootstrap Unicode::Map $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | sub NOISE () { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | sub MAGIC () { 0xB827 } # magic word | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | sub M_END () { 0 } # end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | sub M_INF () { 1 } # infinite subsequent entries (default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | sub M_BYTE () { 2 } # 1..255 subsequent entries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | sub M_VER () { 4 } # (Internal) file format revision. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | sub M_AKV () { 6 } # key1, val1, key2, val2, ... (default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sub M_AKAV () { 7 } # key1, key2, ..., val1, val2, ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | sub M_PKV () { 8 } # partial key value mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | sub M_CKn () { 10 } # compress keys not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | sub M_CK () { 11 } # compress keys (default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | sub M_CVn () { 13 } # compress values not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | sub M_CV () { 14 } # compress values (default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ## The next entries are for info, only. They are stored as unicode strings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | sub I_NAME () { 20 } # Character Set Name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | sub I_ALIAS () { 21 } # Character Set alias name (several entries allowed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | sub I_VER () { 22 } # Mapfile revision | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | sub I_AUTH () { 23 } # Mapfile authRess | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | sub I_INFO () { 24 } # Some userEss definable string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | sub WARN_DEFAULT () { 0x0000 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | sub WARN_DEPRECATION () { 0x1000 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | sub WARN_COMPATIBILITY () { 0x2000 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ## --- Init --------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3 | my $MAP_Pathname = 'Unicode/Map'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 3 | my $MAP_Path = $INC{"Unicode/Map.pm"}; $MAP_Path=~s/\.pm//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 3 | ▶ | die "Can't find base directory of Unicode::Map!" unless $MAP_Path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 3 | my @order = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | { 1=>"C", 2=>"n", 3=>"N", 4=>"N" }, # standard ("Network order") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | { 1=>"C", 2=>"v", 3=>"V", 4=>"V" }, # reverse ("Vax order") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | my %registry = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 | my %mappings = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | my $registry_loaded = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 3 | $WARNINGS = WARN_DEFAULT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 3 | _init_registry(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ## --- public conversion methods ------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # For compatibility with Unicode::Map8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub to8 { goto &from_unicode } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to8: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 10 | ▶ | sub from_unicode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_unicode: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 10 | my $S = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 10 | ▶ | if ( $#_==0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 9 | $S -> _to ("TO_CUS", $S->_csid(), @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | _deprecated ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | $S -> _to ("TO_CUS", @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 9 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=21.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # $ref||undef = Unicode::Map->new("ISO-8859-1") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # Note: usage like below is deprecated. It is not compatible with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # Unicode::Map8. Support will vanish soon! martin [2000-Jun-19] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # I<$Map> = new Unicode::Map; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # I<$utf16> = I<$Map> -> to_unicode ("ISO-8859-1", "Hello world!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # => $_16bit == "\0H\0e\0l\0l\0o\0 \0w\0o\0r\0l\0d\0!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # I<$locale> = I<$Map> -> from_unicode ("ISO-8859-7", I<$_16bit>); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # => $_8bit == "Hello world!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 9 | my ($proto, $parH) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 9 | ▶ | my $S = bless ({}, ref($proto) || $proto); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 9 | $S -> _noise ( NOISE ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 9 | ▶ | return unless $S -> _load_registry ( ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 9 | ▶ | if (!$parH) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | _deprecated ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 8 | my $csid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 8 | ▶ | if (!ref($parH)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # Compatible to Unicode::Map8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 7 | $csid = $parH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1 | _deprecated ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | ▶ | if ( $parH->{"STARTUP"} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $S -> Startup ( $parH->{"STARTUP"} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1 | $csid = $parH -> { "ID" }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 8 | ▶ | if ( $csid ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 8 | ▶ | return 0 unless $S -> _csid ( $S->_real_id($csid) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 9 | $S; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # Deprecated! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | ▶ | sub noise { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
noise: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | _deprecated ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Defines the verbosity of messages to user sent via I<$Startup>. Can be no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # messages at all (n=0), some information (n=1) or some more information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # (n=3). Default is n=1. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # I<$Map> -> noise (I<$n>) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 1 | _noise ( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 42 | ▶ | sub _noise { shift->_member("P_NOISE", @_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_noise: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # Unicode::Map.xs -> reverse_unicode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # Usage is deprecated! Use Unicode::String::byteswap instead! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # I<$string> = I<$Map> -> reverse_unicode (I<$string>) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # One Unicode character, precise one utf16 character, consists of two | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # bytes. Therefore it is important, in which order these bytes are stored. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # As far as I could figure out, Unicode characters are assumed to be in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # "Network order" (0x1234 => 0x12, 0x34). Alas, many PC Windows documents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # store Unicode characters internally in "Vax order" (0x1234 => 0x34, 0x12). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # With this method you can convert "Vax mode" -> "Network mode" and vice versa. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # reverse_unicode changes the original variable if in a void context. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # in scalar or list context returns a new created string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | ▶ | sub reverse_unicode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reverse_unicode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | _deprecated ( "see: Unicode::String::byteswap" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | &_reverse_unicode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | # For compatibility with Unicode::Map8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | sub to16 { goto &to_unicode } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to16: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 6 | ▶ | sub to_unicode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_unicode: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 6 | my $S = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 6 | ▶ | if ( $#_==0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 5 | $S -> _to ("TO_UNI", $S->_csid(), @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | _deprecated ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | $S -> _to ("TO_UNI", @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ## --- public maintainance methods ---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub alias { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alias: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | @{$registry{$_[1]} -> {"ALIAS"}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub dest { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dest: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | _deprecated ( "'dest' is now 'mapping'" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | goto &mapping; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub mapping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mapping: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | return shift -> _mapping ( shift() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | sub id { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | shift->_real_id(shift()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | sub ids { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ids: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | (sort {$a cmp $b} grep {!/^GENERIC$/i} keys %registry); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $registry{$_[1]} -> {"INFO"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub read_text_mapping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_text_mapping: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my ($S, $csid, $textpath, $style) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | return 0 if !($csid = $S->id($csid)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | $S->_msg("reading") if $S->_noise>0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $S->_read_text_mapping($csid, $textpath, $style); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub src { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
src: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $registry{$_[1]} -> {"SRC"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub srcURL { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
srcURL: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $registry{$_[1]} -> {"SRCURL"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | sub style { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
style: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $registry{$_[1]} -> {"STYLE"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub write_binary_mapping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_binary_mapping: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | _incompatible ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my ($S, $csid, $binpath) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | return 0 unless ( $csid = $S->id($csid) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | $binpath = $S->_mapping($csid) if !$binpath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | return 0 unless $binpath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | $S->_msg("writing") if $S->_noise>0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $S->_write_IMap_to_binary($csid, $binpath); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ## --- Application program interface -------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 6 | ▶ | sub Startup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Startup: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 6 | _deprecated ( "module Startup shouldn't be used any longer" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 6 | shift->_member("STARTUP", @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | ## --- private methods ---------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 70 | ▶ | sub _member { my $S=shift; my $n=shift if @_; $S->{$n}=shift if @_; $S->{$n}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_member: called CC=3 SCAR=11.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 22 | ▶ | sub _csid { shift->_member("P_CSID", @_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_csid: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | sub _error { my $S=shift; $S->Startup ? $S->Startup->error(@_) : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 6 | ▶ | sub _msg { my $S=shift; $S->Startup ? $S->Startup->msg(@_) : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_msg: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | sub _msg_fin { my $S=shift; $S->Startup ? $S->Startup->msg_finish(@_) : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_msg_fin: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub _IMap { shift->_member("I", @_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_IMap: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 5 | ▶ | sub _mapping { $registry{$_[1]} -> {"MAP"} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mapping: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | sub _dump { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | my $S = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | print "Dumping Mapping $S:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | if ($S->Startup) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | print " - Startup object: ".$S->Startup."\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | print " - no Startup object\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if (%registry) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | print " - Mapping: " . (keys %registry) . " entries defined.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | print " - No mappings!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | if ($S->_IMap) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | print " - IMap:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | my ($k,$v); while(($k,$v)=each %{$S->_IMap}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | printf " %10s => %s\n", $k, $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | if (%mappings) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | print " - Mappings:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | my ($k,$v); while(($k,$v)=each %mappings) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | printf " %10s => %s\n", $k, $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 24 | ▶ | sub _real_id { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_real_id: called CC=11 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 24 | my ($S, $csid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 24 | ▶ | if (!%registry) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | return $S->_error("No mapping definitions!\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 24 | ▶ | return $csid if defined $registry{$csid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my $id=""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my (@tmp, $k, $v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | while (($k,$v) = each %registry) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | next if !$k || !$v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$k and $v
MC/DC0%0/2
$k and $v
$k
$v
Truth table0%0/3
A and B
A= $kB= $v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if ($csid =~ /^$k$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $id=$k; last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | for (@{$v->{"ALIAS"}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | if (/^$csid$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $id=$k; last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | while (($k, $v) = each %registry) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | return $S->_error("Character Set $csid not defined!") if !$id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 16 | ▶ | sub _to { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_to: called CC=10 SCAR=25.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # 1||0 = $S -> _to ("TO_UNI"||"TO_CUS", $csid, $src||$srcR, $destR, $o, $l) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # $text||"" = $S -> _to ("TO_UNI"||"TO_CUS", $csid, $src||$srcR, "", $o, $l) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 16 | my ($S, $to, $csid, $srcR, $destR, $o, $l) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 16 | ▶ | return 0 if !($csid = $S->_real_id($csid)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 16 | ▶ | return 0 if !$S->_load_TMap($csid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 16 | my ($cs1, $n1, $cs2, $n2, $tmp) = (0, 0, 0, 0, ""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 16 | my (@M, @C); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 16 | my $destbuf = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 16 | ▶ | my $srcbuf = ref($srcR) ? $$srcR : $srcR; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 16 | my $C = $mappings{$csid}->{$to}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 16 | ▶ | if ($S->_noise>2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | $S->_msg("mapping ".(($to=~/^to_unicode$/i) ? "to Unicode" : "to $csid")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 16 | my ($csa,$na,$csb,$nb); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | my @n = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # Sort the partial mappings according to their left side's total | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # length, descending order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 16 | ($csa, $na) = split/,/,$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 22 | ($csb, $nb) = split/,/,$b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 22 | $csb*$nb <=> $csa*$na | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } keys %$C; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 16 | ▶ | if ($#n==0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | ($cs1, $n1, $cs2, $n2) = split /,/,$n[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | $destbuf = $S->_map_hash($srcbuf, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 4 | ▶ | $C->{$n[0]}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$o || undef
$l || undef
MC/DC0%0/1
$o || undef
$o
MC/DC0%0/1
$l || undef
$l
Truth table50%1/2
A
A= $o
Truth table50%1/2
A
A= $l
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | $n1*$cs1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | $o||undef, $l||undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | $destbuf = $S->_map_hashlist($srcbuf, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | [map $C->{$_}, @n], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 12 | [map {($cs1,$n1)=split/,/; int($cs1*$n1)} @n], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | $o, $l | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 16 | ▶ | if ($destR) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $$destR=$destbuf; 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 16 | $destbuf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 3 | ▶ | sub _init_registry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init_registry: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 3 | %registry = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 3 | $registry_loaded = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 3 | _add_registry_entry("GENERIC", "GENERIC", "GENERIC"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 3 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | sub _unload_registry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unload_registry: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | _init_registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | ## --- Binary to TMap ----------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # TMap structure: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # %T = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # $CSID => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # TO_CUS => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # "$cs_a1,$n_a1,$cs_a2,$n_a2" => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # "str_a1_1" => "str_a2_1", ... , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # "str_a1_n" => "str_a2_n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | # }, ... , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # "$cs_x1,$n_x1,$cs_x2,$n_x2" => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # "str_x1_1" => "str_x2_1", ... , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # "str_x1_n" => "str_x2_n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # TO_UNI => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # "$cs_a2,$n_a2,$cs_a1,$n_a1" => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # "str_a2_1" => "str_a1_1", ... , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # "str_a2_n" => "str_a1_n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # }, ... , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | # "$csx2,$nx2,$csx1,$nx1" => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | # "str_x2_1" => "str_x1_1", ... , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # "str_x2_n" => "str_x1_n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 16 | ▶ | sub _load_TMap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_TMap: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 16 | my ($S, $csid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 16 | ▶ | return 1 if $mappings{$csid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 5 | ▶ | return 0 if !$S->_read_binary_to_TMap($csid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 5 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 5 | ▶ | sub _read_binary_to_TMap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_binary_to_TMap: called CC=11 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 5 | my ($S, $csid) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 5 | my %U = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 5 | my %C = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 5 | my $buf = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # read file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 5 | my $file = $S->_mapping($csid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 5 | ▶ | return $S->_error ("Cannot find mapping file for id \"$csid\"!") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | unless -f $file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 5 | ▶ | return $S->_error ("Cannot open binary mapping \"$file\"!") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | if !open(MAP1, $file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 5 | binmode MAP1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 5 | my $size = read MAP1, $buf, -s $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 5 | close MAP1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 5 | ▶ | return $S->_error ("Error while reading mapping \"$file\"!") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | if ($size != -s $file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 5 | ▶ | if ($size>0x1000) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 3 | ▶ | $S->_msg("loading mapfile \"$csid\"") if $S->_noise>0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 2 | ▶ | $S->_msg("loading mapfile \"$csid\"") if $S->_noise>2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 5 | ▶ | return $S->_error ("Error in binary map file!\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | if !$S->_read_binary_mapping($buf, 0, \%U, \%C) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 5 | ▶ | if ($size>0x1000) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 3 | ▶ | $S->_msg("loaded") if $S->_noise>0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 2 | ▶ | $S->_msg("loaded") if $S->_noise>2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 5 | $mappings{$csid} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | TO_CUS => \%C, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | TO_UNI => \%U | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # $S->_dump_TMap ($mappings{$csid}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 5 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | sub _dump_TMap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump_TMap: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | my ($S, $TMap) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | print "\nDumping TMap $TMap\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my ($pat1, $pat2, $up1, $up2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | foreach (keys %$TMap) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my $subTMap = $TMap->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | print "SubTMap $_:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | my @n = sort {(split/,/,$b)[0] <=> (split/,/,$a)[0]} keys %$subTMap; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | for (@n) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my ($cs1, $n1, $cs2, $n2) = split /,/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | print " Submapping $cs1 bytes ($n1 times) => " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | ."$cs2 bytes ($n2 times):\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $s=""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $pat1 = ("%0".($cs1*2)."x ") x $n1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $pat2 = ("%0".($cs2*2)."x ") x $n2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | $up1 = ($order[0]->{$cs1}).$n1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | $up2 = ($order[0]->{$cs2}).$n2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my $subsubTMap = $subTMap->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | for (sort keys %$subsubTMap) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | printf " $pat1 => $pat2\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | unpack($up1, $_), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | unpack($up2, $subsubTMap->{$_}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | print "Dumping done.\n\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | ## --- Text (Unicode, Keld) to IMap --------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub _read_text_mapping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_text_mapping: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my ($S, $id, $path, $style) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | ▶ | $S->_IMap({}) if !defined $S->_IMap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | return $S->_error("Bad charset id") if (!$id || !$registry{$id}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$id and $registry{$id}
MC/DC0%0/2
$id and $registry{$id}
$id
$registry{$id}
Truth table0%0/3
A and B
A= $idB= $registry{$id}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | if ($style =~ /^keld$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $S->_read_text_keld_to_IMap($id, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } elsif ($style =~ /^reverse$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | $S->_read_text_unicode_to_IMap($id, $path, 2, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | ▶ | } elsif (!$style || $style=~/^unicode$/i) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $style or $style =~ /^unicode$/i
MC/DC0%0/2
not $style or $style =~ /^unicode$/i
not $style
$style =~ /^unicode$/i
Truth table0%0/3
not(A) or B
A= not $styleB= $style =~ /^unicode$/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $S->_read_text_unicode_to_IMap($id, $path, 1, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | my ($vendor, $unicode) = ($style =~ /^\s*(\d+)\s+(\d+)/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | if ($vendor && $unicode) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$vendor and $unicode
MC/DC0%0/2
$vendor and $unicode
$vendor
$unicode
Truth table0%0/3
A and B
A= $vendorB= $unicode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $S->_read_text_unicode_to_IMap($id, $path, $vendor, $unicode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | return $S->_error("Unknown style '$style'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | sub _read_text_keld_to_IMap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_text_keld_to_IMap: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | my ($S, $csid, $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my %U = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | my ($k, $v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my $com = ""; my $esc = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | return 0 unless my @file = $S -> readTextFile ( $path ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | while ( @file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | $_ = shift ( @file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | s/$com.*// if $com; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | s/^\s+//; s/\s+$//; next if !$_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | last if /^CHARMAP/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ($k, $v) = split /\s+/,$_,2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | if ($k =~ /<comment_char>/i) { $com = $v; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | if ($k =~ /<escape_char>/i) { $esc = $v; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | my (@l, $f, $t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my $escx = $esc."x"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | while ( @file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $_ = shift ( @file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | s/$com.*// if $com; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | next if ! /$escx([^\s]+)\s+<U([^>]+)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $U{length($1)*4}->{hex($1)} = hex($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | # $S->_dump_IMap(\%U); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $S->_IMap->{$csid} = \%U; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 3 | ▶ | sub readTextFile { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readTextFile: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 3 | my ( $S, $filePath ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 3 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 3 | ▶ | return $S->_error ( "No text file specified!" ) unless $filePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 3 | ▶ | return $S->_error ( "Can't find text file \"$filePath\"!" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | unless -f $filePath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 3 | ▶ | return $S->_error ( "Cannot open text file \"$filePath\"!" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | unless open ( FILE, $filePath ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 3 | undef $/; my $file = <FILE>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 3 | ▶ | close FILE or warn ( "Oops: can't close file '$filePath'! ($!)" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 3 | return map "$_\n", split /\r\n|\r|\n/, $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | sub _read_text_unicode_to_IMap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_text_unicode_to_IMap: not called CC=23 SCAR=62.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | # Converts map files like created by Unicode Inc. to IMap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 3 | ▶ | no strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | my ($S, $csid, $file, $row_vendor, $row_unicode) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | my %U = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | return 0 unless my @file = $S -> readTextFile ( $file ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | my (@l, $f, $t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my $hex = '(?:0x)?([^\s]+)\s+'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | my $hexgap = '(?:0x)?[^\s]+\s+'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | my ($min, $max) = ($row_vendor, $row_unicode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | ($min, $max) = ($row_unicode, $row_vendor) if $row_unicode<$row_vendor; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | my $gap1 = $hexgap x ($min - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | my $gap2 = $hexgap x ($max - $min - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | if ($row_vendor > $row_unicode) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | $row_unicode=1; $row_vendor=2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | $row_unicode=2; $row_vendor=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | # Info fields in comments: (at this release still unused) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | my $Name = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | my $Unicode_version = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | my $Table_version = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | my $Date = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | my $Authresses = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | my $comment_info = 1; my $comment_authress=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | while( @file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $_ = shift ( @file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | if ($comment_info && !/#/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$comment_info and not /#/
MC/DC0%0/2
$comment_info and not /#/
$comment_info
not /#/
Truth table0%0/3
A and not(B)
A= $comment_infoB= not /#/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | $comment_info = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | if ($comment_info) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | if ($comment_authress && (/^#\s*$/ || /^#[^:]:/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$comment_authress and /^#\s*$/ || /^#[^:]:/
/^#\s*$/ or /^#[^:]:/
MC/DC0%0/3
$comment_authress and /^#\s*$/ || /^#[^:]:/
$comment_authress
/^#\s*$/
/^#[^:]:/
Truth table0%0/4
A and B or C
A= $comment_authressB= /^#\s*$/C= /^#[^:]:/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | $comment_authress = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | if (/#\s*name\S*:\s*(.*$)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $Name = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | if (/#\s*unicode\s*version\S*:\s*(.*$)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $Unicode_version = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | if (/#\s*table\s*version\S*:\s*(.*$)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | $Table_version = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | if (/#\s*date\S*:\s*(.*$)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | $Date = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | if ($comment_authress) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | $Authresses .= ", $1" if /^#\s*(.+$)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } elsif (/#\s*Author\S*:\s*(.*$)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $Authresses = $1; $comment_authress=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | s/#.*$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | next if !$_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | next if ! /^$gap1$hex$gap2$hex/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | ($f, $t) = ($$row_vendor, $$row_unicode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | $f =~ s/0x//ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | $t =~ s/0x//ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | if ( index($f,"+")>=0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | # The left side contains one or more "+". Handling this way: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | # The key becomes an 8 bit string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $f =~ s/\s*\+\s*//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | my $fs = pack ( "H*", $f ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | if (index($t, "+")<0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | my $list = "8,".length($fs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $U { $list } -> { $fs } = hex ( $t ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | @l = map hex($_), split /\+/, $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | my $list = "8,".length($fs).",".($#l+1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | $U { $list } -> { $fs } = [@l]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | if (index($t, "+")<0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | $U{length($f)*4}->{hex($f)} = hex($t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | @l = map hex($_), split /\+/, $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | $U{(length($f)*4).",1,".($#l+1)}->{hex($f)} = [@l]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # $S->_dump_IMap(\%U); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | $S->_IMap->{$csid} = \%U; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | sub _dump_IMap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump_IMap: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | # Dump IMap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | my ($S, $U) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | print "\nDumping IMap entry.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | my ($U1, @list); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | for (keys %{$U}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | my $size = $_ / 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | $U1 = $U->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | for (sort {$a <=> $b} keys %{$U1}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | printf ((" %0$size"."x => "), $_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | ▶ | if (ref($U1->{$_})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | @list = @{$U1->{$_}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | printf "(".("%04x " x ($#list+1)).")\n", @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | printf "%04x\n", $U1->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | ## --- IMap to binary ----------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | ▶ | sub _write_IMap_to_binary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_IMap_to_binary: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my ($S, $csid, $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | return $S->_error("Integer Map \"$csid\" not loaded!\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | if !(my $IMap = $S->_IMap->{$csid}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | ▶ | return $S->_error("Cannot open output table \"$path\"!") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | if !open (MAP4, ">$path"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | binmode MAP4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | my $str = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | $str .= _map_binary_begin(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | $str .= _map_binary_stream(I_NAME, $S->_to_unicode($csid)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | $str .= _map_binary_mode(M_BYTE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | $str .= _map_binary_mode(M_PKV); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | my ($from, $from_n, $to_n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | for (keys %{$IMap}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ($from, $from_n, $to_n) = split /\s*,\s*/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | my $subMapping = $S->_map_binary_submapping ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | $IMap->{$_}, $from, $from_n||1, 16, $to_n||1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$from_n || 1
$to_n || 1
MC/DC0%0/1
$from_n || 1
$from_n
MC/DC0%0/1
$to_n || 1
$to_n
Truth table0%0/2
A
A= $from_n
Truth table0%0/2
A
A= $to_n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | return 0 unless $subMapping; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $str .= $subMapping; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | $str .= _map_binary_mode(M_END); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | print MAP4 "$str"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | close (MAP4); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | sub _to_unicode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_to_unicode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my ($S, $txt) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | $S -> to_unicode ($ENV{LC_CTYPE}, \$txt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | ▶ | sub _map_binary_begin { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_binary_begin: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | pack($order[0]->{2}, MAGIC); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | sub _map_binary_end { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_binary_end: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | pack("C", M_END); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | ▶ | sub _map_binary_submapping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_binary_submapping: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | my ($S, $mapH, $size1, $n1, $size2, $n2) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | ▶ | return $S->_error ("No IMap specified!") if (!$mapH || !%$mapH); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$mapH and %$mapH
MC/DC0%0/2
$mapH and %$mapH
$mapH
%$mapH
Truth table0%0/3
A and B
A= $mapHB= %$mapH
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | if ($n2*$size2>0xffff) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | return $S->_error ("Bad n character mapping! Too many chars!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | my $bs1S = $order[0]->{int(($size1+7)/8)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my $bs2S = $order[0]->{int(($size2+7)/8)}.$n2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | return $S->_error ("'From' characters have zero size!") if !$bs1S; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | my $str = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my $sig = pack ("C4", ($size1, $n1, $size2, $n2)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | my @key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | if ( $n1==1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | @key = sort {$a <=> $b} keys %$mapH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | @key = sort keys %$mapH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | my @val = map $mapH->{$_}, @key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | my $max = $#key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | if ($n1>1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | $str .= _map_binary_mode(M_AKV); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $str .= _map_binary_mode(M_BYTE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | $str .= $sig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | my $n = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | while ( @key ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | if ( $n==0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | $n = $#key + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | ▶ | if ( $n>255 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | $n = 255; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | $str .= pack ( "C", $n ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $str .= shift ( @key ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | my $val = shift ( @val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | ▶ | if ( $n2==1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | $str .= pack ( $bs2S, $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | $str .= pack ( $bs2S, @$val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | $n--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | my ($kkey, $kbegin, $kend, $kn, $vkey, $vbegin, $vend, $vn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | ▶ | if ($n2==1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | $str .= _map_binary_mode(M_PKV); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | $str .= $sig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | $kkey = _list_to_intervals(\@key, 0, $#key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | while (@$kkey) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | $kbegin = shift(@$kkey); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | $kend = shift(@$kkey); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | #print "kbegin=$kbegin kend=$kend klen=".($kend-$kbegin+1)."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | $str .= pack("C", $kend-$kbegin+1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | $str .= pack($bs1S, $key[$kbegin]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | $vkey = _list_to_intervals(\@val, $kbegin, $kend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | ▶ | while (@$vkey) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | $vbegin = shift (@$vkey); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | $vend = shift (@$vkey); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | $str .= pack("C", $vend-$vbegin+1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | $str .= pack($bs2S, $val[$vbegin]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | $str .= _map_binary_mode(M_CVn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | $str .= $sig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | $kkey = _list_to_intervals(\@key, 0, $#key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | ▶ | while (@$kkey) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | $kbegin = shift(@$kkey); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | $kend = shift(@$kkey); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | $str .= pack("C", $kend-$kbegin+1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | $str .= pack($bs1S, $key[$kbegin]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | for ($kbegin..$kend) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | $str .= pack($bs2S, @{$val[$_]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | $str .= _map_binary_mode(M_END); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | sub _map_binary_mode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_binary_mode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | my ($mode) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | return "\0".pack("C", $mode)."\0"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | sub _map_binary_stream { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_binary_stream: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | my ($mode, $str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | if (length($str) > 255) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | $str = substr($str, 0, 255); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | my $len = length($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | return "\0".pack("C2", $mode, $len).$str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | ## --- registry file ------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | # Registry entries: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | # ALIAS => [a list of equivalent charset ids] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | # INFO => some occult information about this charset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | # MAP => the path to the binary mapfile of this charset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | # SRC => the path to the textual mapfile of this charset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | # SRCURL => an URL where to get the textual mapfile of this charset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | # STYLE => describes what type of textual mapfile this is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | # Registry example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | # registry = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | # "ISO-8859-3" => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | # "ALIAS" => ["ISO-IR-109","ISO_8859-3:1988","LATIN3","L3"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | # "INFO" => "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | # "MAP" => "/usr/lib/perl5/.../Unicode/Map/ISO/8859-3.map", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | # "SRC" => "/usr/local/Unicode/ISO8859/8859-3.TXT", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | # "SRCURL" => "ftp://ftp.unicode.org/MAPPINGS/ISO8859/8859-3.TXT", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | # "STYLE" => "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | # ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 9 | ▶ | sub _load_registry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_registry: called CC=26 SCAR=33.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # The REGISTRY loaded once and reused later. Runtime modifications of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | # REGISTRY will remain unnoticed! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 9 | ▶ | return 1 if $registry_loaded; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 3 | my ($S) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 3 | ▶ | $S->_msg("loading unicode registry") if $S->_noise>2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 3 | my $path = $S -> _get_path ( "REGISTRY" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 3 | ▶ | return 0 unless my @file = $S -> readTextFile ( $path ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 3 | my %var = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 3 | my ($k, $v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 3 | ▶ | while ( @file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 156 | $_ = shift ( @file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | # Skip everything until DEFINE marker... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 156 | ▶ | s/#.*//; s/^\s+//; s/\s+$//; next if !$_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 3 | ▶ | last if /^DEFINE:/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 3 | ▶ | while ( @file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 111 | $_ = shift ( @file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 111 | ▶ | s/#.*//; s/^\s+//; s/\s+$//; next if !$_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 21 | ▶ | last if /^DATA:/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 18 | ($k, $v) = split /\s*[= ]\s*/,$_,2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 18 | $k=~s/^\$//; $v=~s/^"(.*)"$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 18 | ▶ | if ( defined $ENV{$k} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | # User environment overrides file settings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | $v = $ENV { $k }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 18 | ▶ | if ($v!~s/^'(.*)'$/$1/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 18 | my @check; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | # parse environment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 18 | ▶ | @check=(); while ($v=~/\$(\w+|\$)/g) { push (@check, $1) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 18 | for (@check) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 9 | ▶ | if ( defined $ENV{$_} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | # User environment has ranges before registry and magics. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | $v =~ s/\$$_/$ENV{$_}/g | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } elsif ( $_ eq '$' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | # Magic value $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 3 | $v =~ s/\$\$/$MAP_Path/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | } elsif ( defined $var{$_} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | # Apply registry variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 6 | $v =~ s/\$$_/$var{$_}/g | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | # Error, undefined value! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | warn ("Error in file REGISTRY: Variable '$_' not defined!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | # parse home tilde | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 18 | ▶ | if (($v eq '~') || ($v=~/^~\//)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$v eq "~" or $v =~ m[^~/]
MC/DC50%1/2
$v eq "~" or $v =~ m[^~/]
$v eq "~"
$v =~ m[^~/]
Truth table66%2/3
A or B
A= $v eq "~"B= $v =~ m[^~/]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 3 | $v =~ s/^~/_getHomeDir()/e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 18 | $var{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 3 | my ($name, $map, $src, $srcURL, $style, @alias, $info); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 3 | my %arg_s = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | "name"=>\$name, "map"=>\$map, "src"=>\$src, "srcurl"=>\$srcURL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | "style"=>\$style, "info"=>\$info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 3 | my %arg_a = ("alias"=>\@alias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 3 | $name=""; $map=""; $src=""; $srcURL=""; $style=""; @alias=(); $info=""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 3 | ▶ | while ( @file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 2250 | $_ = shift ( @file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 2250 | s/#.*//; s/^\s+//; s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 2250 | ▶ | if (!$_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 699 | ▶ | $S->_add_registry_entry ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | $name, $src, $map, $srcURL, $style, \@alias, $info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | ) if $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 699 | $name=""; $map=""; $src=""; $srcURL=""; $style=""; @alias=(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 699 | $info=""; next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 1551 | ($k, $v) = split /\s*[: ]\s*/,$_,2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 1551 | for (keys %var) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 9306 | $v =~ s/\$$_/$var{$_}/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 1551 | $k = lc($k); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 1551 | ▶ | if ($arg_s{$k}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 1092 | ${$arg_s{$k}} = $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | } elsif ($arg_a{$k}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 459 | push (@{$arg_a{$k}}, $v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 3 | ▶ | $S->_msg_fin("done") if $S->_noise>2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 3 | $registry_loaded=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 3 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 3 | ▶ | sub _getHomeDir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_getHomeDir: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | $ENV{HOME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 3 | ▶ | || eval ( '(getpwuid($<))[7]' ) # for systems not supporting getpwuid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ENV{"HOME"} or eval "(getpwuid(\$<))[7]"
MC/DC0%0/2
$ENV{"HOME"} or eval "(getpwuid(\$<))[7]"
$ENV{"HOME"}
eval "(getpwuid(\$<))[7]"
Truth table33%1/3
A or B
A= $ENV{"HOME"}B= eval "(getpwuid(\$<))[7]"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | || "/"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 273 | ▶ | sub _add_registry_entry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_registry_entry: called CC=7 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 273 | my ($S, $name, $src, $map, $srcURL, $style, $aliasL, $info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 273 | ▶ | $registry{$name} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition80%8/10
$map || ''
$info || ''
$src || ''
$srcURL || ''
$style || ''
MC/DC100%1/1
$map || ''
$map
MC/DC0%0/1
$info || ''
$info
MC/DC0%0/1
$src || ''
$src
MC/DC100%1/1
$srcURL || ''
$srcURL
MC/DC100%1/1
$style || ''
$style
Truth table100%2/2
A
A= $map
Truth table50%1/2
A
A= $info
Truth table50%1/2
A
A= $src
Truth table100%2/2
A
A= $srcURL
Truth table100%2/2
A
A= $style
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | "ALIAS" => $aliasL ? [@$aliasL] : [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | "MAP" => $map || "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | "INFO" => $info || "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | "SRC" => $src || "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | "SRCURL" => $srcURL || "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | "STYLE" => $style || "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | sub _dump_registry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump_registry: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | my ($k, $v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | print "\nDumping registry definition:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | ▶ | while (($k, $v) = each %registry) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | print "Name: $k\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | printf " src: %s\n", $v->{"SRC"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | printf " srcURL: %s\n", $v->{"SRC"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | printf " style: %s\n", $v->{"STYLE"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | printf " map: %s\n", $v->{"MAP"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | printf " info: %s\n", $v->{"INFO"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | print " alias: " . join (", ", @{$v->{"ALIAS"}}) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | print "done.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | ## --- misc --------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 3 | ▶ | sub _get_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_path: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 3 | my ($S, $path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 3 | ▶ | return $S->_error("Cannot find mapfile base directory!") if !$MAP_Path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 3 | $path =~ s/^\/+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 3 | return "$MAP_Path/$path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | ▶ | sub _list_to_intervals { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_list_to_intervals: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | my ($listR, $start, $end) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | my @split = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | my ($begin, $i, $partend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | $i=$start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | ▶ | while ($i<=$end) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | $begin = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | $partend = $begin+254; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | ▶ | while ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$i < $end and $i < $partend and $$listR[$i + 1] == $listR->[$i] + 1
$i < $end and $i < $partend
MC/DC0%0/3
$i < $end and $i < $partend and $$listR[$i + 1] == $listR->[$i] + 1
$i < $end
$i < $partend
$$listR[$i + 1] == $listR->[$i] + 1
Truth table0%0/4
A and B and C
A= $i < $endB= $i < $partendC= $$listR[$i + 1] == $listR->[$i] + 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | ($i<$end) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | ($i<$partend) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | ($listR->[$i+1]==($listR->[$i]+1)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | $i++ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | push (@split, ($begin, $i)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | \@split; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 13 | ▶ | sub _deprecated { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_deprecated: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 13 | my ( $msg ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 13 | ▶ | if ( $WARNINGS & WARN_DEPRECATION ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 7 | my $s = "Deprecated usage!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 7 | ▶ | $s .= " ($msg)" if $msg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 7 | carp ( $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 13 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 6 | ▶ | sub _incompatible { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_incompatible: called CC=3 SCAR=16.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 6 | my ( $msg ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 6 | ▶ | if ( $WARNINGS & WARN_COMPATIBILITY ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | my $s = "Incompatible usage!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | ▶ | $s .= " ($msg)" if $msg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | carp ( $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 6 | 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 3 | "Atomkraft? Nein, danke!" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||