blib/lib/UI/KeyboardLayout.pm

filter: Statementstmt 2.9% 140 / 4750 Branchbran 0.1% 6 / 3246 Conditioncond 0.1% 3 / 2528 MC/DCmcdc 0.0% 0 / 1382 Subroutinesub 4.9% 12 / 241 Podpod 0.0% 0 / 192 totaltotal 1.3% 161 / 12339 CC 3033 SCAR 88.5
CC
3033
Cov
1%
massage_full
41006.0
massage_faces
25122.0
parse_NameList
22650.0
CRAP 6994.4
↑ Summary
1 package UI::KeyboardLayout;
2
3 1 our $VERSION;
4 1 $VERSION = "0.7901";
5
6 1 ▶binmode $DB::OUT, ':utf8' if $DB::OUT; # (older) Perls had "Wide char in Print" in debugger otherwise
Branch: 1 branch
BranchTrueFalseTotal
if $DB::OUT 0 1 1
7 1 ▶binmode $DB::LINEINFO, ':utf8' if $DB::LINEINFO; # (older) Perls had "Wide char in Print" in debugger otherwise
Branch: 1 branch
BranchTrueFalseTotal
if $DB::LINEINFO 0 1 1
8
9 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶BEGIN { my $n = ($ENV{UI_KEYBOARDLAYOUT_DEBUG} || 0);
Subroutine BEGIN: called CC=4 SCAR=14.2
Condition50%1/2
$ENV{'UI_KEYBOARDLAYOUT_DEBUG'} || 0
l!l
01
MC/DC0%0/1
$ENV{'UI_KEYBOARDLAYOUT_DEBUG'} || 0
$ENV{'UI_KEYBOARDLAYOUT_DEBUG'}
Truth table50%1/2
A
A= $ENV{'UI_KEYBOARDLAYOUT_DEBUG'}
Aresult
11
00
12 1 ▶ if ($n =~ /^0x/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n =~ /^0x/i) { } 0 1 1
13 0 $n = hex $n;
14 } else {
15 1 $n += 0;
16 }
17 1 eval "sub debug() { $n }";
18 # 1 2 4 8 0x10 0x20
19 1 my @dbg = (qw( debug_face_layout_recipes debug_GUESS_MASSAGE debug_OPERATOR debug_import debug_stacking debug_noid ),
20 # 0x40 0x80 0x100 0x200 0x400 0x800 0x1000
21 qw(warnSORTEDLISTS printSORTEDLISTS warnSORTCOMPOSE warnDO_COMPOSE warnCACHECOMP dontCOMPOSE_CACHE warnUNRES),
22 # 0x2000 0x4000 0x8000 0x10000
23 qw(debug_STACKING printSkippedComposeKey warnReached debug_stacking_ord),
24 '_debug_PERL_dollar1_scoping');
25 1 my $c = 0; # printSORTEDLISTS: Dumpvalue to STDOUT (implementation detail!)
26 1 my @dbg_b = map $n & (1<<$_), 0..31;
27 1 for (@dbg) {
28 18 eval "sub $_ () {$dbg_b[$c++]}";
29 }
30 }
31 sub debug_PERL_dollar1_scoping () { debug & 0x1000000 }
32
33 1 my $ctrl_after = 1; # In "pairs of nonShift/Shift-columns" (1 simplifies output of BACK/ESCAPE/RETURN/CANCEL)
34 1 my $create_alpha_ctrl = 2; # Separate Ctrl and Ctrl-Shift ???
35 0 ▶my %start_SEC = (FKEYS => [96, 24, sub { my($self,$u,$v)=@_; 'F' . (1+$u-$v->[0]) }],
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 ARROWS => [128, 16,
37 0 ▶ sub { my($self,$u,$v)=@_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 0 (qw(HOME UP PRIOR DIVIDE LEFT CLEAR RIGHT MULTIPLY END DOWN NEXT SUBTRACT INSERT DELETE RETURN ADD))[$u-$v->[0]]}],
39 NUMPAD => [144, 16,
40 0 ▶ sub { my($self,$u,$v)=@_;
Subroutine __ANON__: not called CC=2 SCAR=14.6
41 0 ▶ ((map { ($_ > 10 ? 'F' : "NUMPAD") . $_} 7..9,14,4..6,15,1..3,16,0), 'DECIMAL')[$u-$v->[0]]}]);
Branch: 1 branch
BranchTrueFalseTotal
$_ > 10 ? : 0 0 0
42 1 my $LAST_SEC = -1e100;
43 1 ▶$LAST_SEC < $_->[0] + $_->[1] and $LAST_SEC = $_->[0] + $_->[1] for values %start_SEC;
Branch: 1 branch
BranchTrueFalseTotal
$LAST_SEC < $_->[0] + $_->[1] and $LAST_SEC = $_->[0] + $_->[1] 2 1 3
44
45 1 my $maxEntityLen = 111; # Avoid overflow of prefix char above 0fff in kbdutool (but now can channel them to smaller values)
46 1 my $avoid_overlong_synonims_Entity = 20; # These two are currently disabled
47
48 133 ▶sub toU($) { substr+(qq(\x{fff}).shift),1 } # Some bullshit one must do to make perl's Unicode 8-bit-aware (!)
Subroutine toU: called CC=1 SCAR=0.0
Pod undocumented
49
50 #use subs qw(chr lc);
51 1 ▶use subs qw(chr lc uc ucfirst);
Subroutine BEGIN: called CC=1 SCAR=0.0
52
53 #BEGIN { *CORE::GLOGAL::chr = sub ($) { toU CORE::chr shift };
54 # *CORE::GLOGAL::lc = sub ($) { CORE::lc toU shift };
55 #}
56 ### Remove ß ẞ :
57 ## my %fix = qw( ԥ Ԥ ԧ Ԧ ӏ Ӏ ɀ Ɀ ꙡ Ꙡ ꞑ Ꞑ ꞧ Ꞧ ɋ Ɋ ꞩ Ꞩ ȿ Ȿ ꞓ Ꞓ ꞥ Ꞥ ); # Perl 5.8.8 uc is wrong with palochka, 5.10 with z with swash tail
58 1 my %fix = qw( ԥ Ԥ ԧ Ԧ ӏ Ӏ ɀ Ɀ ꙡ Ꙡ ꞑ Ꞑ ꞧ Ꞧ ɋ Ɋ ß ẞ ꞩ Ꞩ ȿ Ȿ ꞓ Ꞓ ꞥ Ꞥ ℊ Ɡ ϳ Ϳ ); # Perl 5.8.8 uc is wrong with palochka, 5.10 with z with swash tail
59 1 my %unfix = reverse %fix;
60
61 88 ▶sub chr($) { local $^W = 0; toU CORE::chr shift } # Avoid illegal character 0xfffe etc warnings...
Subroutine chr: called CC=1 SCAR=0.0
62 0 ▶sub lc($) { my $in = shift; $unfix{$in} || CORE::lc toU $in }
Subroutine lc: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$unfix{$in} or CORE::lc &toU($in) 0 0 0
63 45 ▶sub uc($) { my $in = shift; $fix{$in} || CORE::uc toU $in }
Subroutine uc: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$fix{$in} or CORE::uc &toU($in) 0 45 45
64 0 ▶sub ucfirst($) { my $in = shift; $fix{$in} || CORE::ucfirst toU $in }
Subroutine ucfirst: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$fix{$in} or CORE::ucfirst &toU($in) 0 0 0
65
66 # We use this for printing, not for reading (so we can use //o AFTER the UCD is read)
67 1 my $rxCombining = qr/\p{NonspacingMark}/; # The initial version matches what Perl knows
68 1 my $rxZW = qr/\p{Line_Break: ZW}|[\xAD\x{200b}-\x{200f}\x{2060}-\x{2064}\x{fe00}-\x{fe0f}]/;
69
70 0 ▶sub rxCombining { $rxCombining }
Subroutine rxCombining: not called CC=1 SCAR=6.9
Pod undocumented
71
72 =pod
73
74 =encoding UTF-8
75
76 =head1 NAME
77
78 UI::KeyboardLayout - Module for designing keyboard layouts
79
80 =head1 SYNOPSIS
81
82 #!/usr/bin/perl -wC31
83 use UI::KeyboardLayout;
84 use strict;
85
86 # Download from http://www.unicode.org/Public/UNIDATA/
87 UI::KeyboardLayout::->set_NamesList("$ENV{HOME}/Downloads/NamesList.txt");
88
89 UI::KeyboardLayout::->set__value('ComposeFiles', # CygWin too
90 ['/usr/share/X11/locale/en_US.UTF-8/Compose']);
91 # http://cgit.freedesktop.org/xorg/proto/xproto/plain/keysymdef.h
92 UI::KeyboardLayout::->set__value('KeySyms',
93 ['/usr/share/X11/include/keysymdef.h']);
94 UI::KeyboardLayout::->set__value('EntityFiles',
95 ["$ENV{HOME}/Downloads/bycodes.html"]);
96 UI::KeyboardLayout::->set__value('rfc1345Files',
97 ["$ENV{HOME}/Downloads/rfc1345.html"]);
98
99 my $i = do {local $/; open $in, '<', 'MultiUni.kbdd' or die; <$in>};
100 # Init from in-memory copy of the configfile
101 # Combines new()->parse_add_configfile()->massage_full():
102 my $k = UI::KeyboardLayout:: -> new_from_configfile_string($i)
103 -> fill_win_template( 1, [qw(faces CyrillicPhonetic)] );
104 print $k; # optional arguments 'dummy' (and possibly 'dummyname')
105 # to fill_win_template() to make an 'extra-dummy' version
106
107 open my $f, '<', "$ENV{HOME}/Downloads/NamesList.txt" or die;
108 my $k = UI::KeyboardLayout::->new();
109 my ($d,$c,$names,$blocks,$extraComb,$uniVersion) = $k->parse_NameList($f);
110 close $f or die;
111 $k->print_decompositions($d);
112 $k->print_compositions ($c);
113 # selected print
114 $l->print_compositions_ch_filter( [qw(<super> <pseudo-fake-super> <pseudo-manual-superize>)] );
115
116 UI::KeyboardLayout::->set_NamesList("$ENV{HOME}/Downloads/NamesList.txt",
117 "$ENV{HOME}/Downloads/DerivedAge.txt");
118 my $l = UI::KeyboardLayout::->new();
119 $l->print_compositions;
120 $l->print_decompositions;
121
122 UI::KeyboardLayout::->set_NamesList("$ENV{HOME}/Downloads/NamesList-6.1.0d8.txt",
123 "$ENV{HOME}/Downloads/DerivedAge-6.1.0d13.txt"));
124 # Combines new()->parse_add_configfile()->massage_full():
125 my $l = UI::KeyboardLayout::->new_from_configfile('examples/EurKey++.kbdd');
126
127 for my $F (qw(US CyrillicPhonetic)) {
128 # Open file, select()
129 print $l->fill_win_template(1,[qw(faces US)]);
130 $l->print_coverage(q(US));
131 print $l->fill_osx_template([qw[faces US)]);
132 }
133
134 perl -wC31 UI-KeyboardLayout\examples\grep_nameslist.pl "\b(ALPHA|BETA|GAMMA|DELTA|EPSILON|ZETA|ETA|THETA|IOTA|KAPPA|LAMDA|MU|NU|XI|OMICRON|PI|RHO|SIGMA|TAU|UPSILON|PHI|CHI|PSI|OMEGA)\b" ~/Downloads/NamesList.txt >out-greek
135
136 =head1 AUTHORS
137
138 Ilya Zakharevich, ilyaz@cpan.org
139
140 =head1 DESCRIPTION
141
142 In this section, a "keyboard" has a certain "character repertoir" (which characters may be
143 entered using this keyboard), and a mapping associating a character in the repertoir
144 to a keypress or to several (sequential or simultaneous) keypresses. A small enough keyboard
145 may have a pretty arbitrary mapping and remain useful (witness QUERTY
146 vs Dvorak vs Colemac). However, if a keyboard has a sufficiently large repertoir,
147 there must be a strong logic ("orthogonality") in this association - otherwise
148 the most part of the repertoir will not be useful (except for people who have an
149 extraordinary memory - and are ready to invest part of it into the keyboard).
150
151 "Character repertoir" needs of different people vary enormously; observing
152 the people around me, I get a very narrow point of view. But it is the best
153 I can do; what I observe is that many of them would use 1000-2000 characters
154 if they had a simple way to enter them; and the needs of different people do
155 not match a lot. So to be helpful to different people, a keyboard should have
156 at least 2000-3000 different characters in the repertoir. (Some ballpark
157 comparisons: L<MES-3B|http://web.archive.org/web/20000815100817/http://www.egt.ie/standards/iso10646/pdf/cwa13873.pdf>
158 has about 2800 characters; L<Adobe Glyph list|http://en.wikipedia.org/wiki/Adobe_Glyph_List> corresponds
159 to about 3600 Unicode characters.)
160
161 To access these characters, how much structure one needs to carry in memory? One can
162 make a (trivial) estimate from below: on Windows, the standard US keyboard allows
163 entering 100 - or 104 - characters (94 ASCII keys, SPACE, ENTER, TAB - moreover, C-ENTER,
164 BACKSPACE and C-BACKSPACE also produce characters; so do C-[, C-] and C-\
165 C-Break in most layouts!). If one needs about 30 times more, one could do
166 with 5 different ways to "mogrify" a character; if these mogrifications
167 are "orthogonal", then there are 2^5 = 32 ways of combining them, and
168 one could access 32*104 = 3328 characters.
169
170 Of course, the characters in a "reasonable repertoir" form a very amorphous
171 mass; there is no way to introduce a structure like that which is "natural"
172 (so there is a hope for "ordinary people" to keep it in memory). So the
173 complexity of these mogrification is not in their number, but in their
174 "nature". One may try to decrease this complexity by having very easy to
175 understand mogrifications - but then there is no hope in having 5 of them
176 - or 10, or 15, or 20.
177
178 However, we B<know> that many people I<are> able to memorise the layout of
179 70 symbols on a keyboard. So would they be able to handle, for example, 30
180 different "natural" mogrifications? And how large a repertoir of characters
181 one would be able to access using these mogrifications?
182
183 This module does not answer these questions directly, but it provides tools
184 for investigating them, and tools to construct the actually working keyboard
185 layouts based on these ideas. It consists of the following principal
186 components:
187
188 =over 4
189
190 =item Unicode table examiner
191
192 distills relations between different Unicode characters from the Unicode tables,
193 and combines the results with user-specified "manual mogrification" rules.
194 From these automatic/manual mogrifications, it constructs orthogonal scaffolding
195 supporting Unicode characters (we call it I<composition/decomposition>, but it
196 is a major generalization of the corresponding Unicode consortium's terms).
197
198 =item Layout constructor
199
200 allows building keyboard layouts based on the above mogrification rules, and
201 on other visual and/or logical directives. It combines the bulk-handling
202 ability of automatic rule-based approach with a flexibility provided by
203 a system of manual overrides. (The rules are read from a F<.kbdd> L<I<Keyboard
204 Description> file|/"Keyboard description files">.
205
206 =item System-specific software layouts
207
208 may be created basing on the "theoretical layout" made by the layout
209 constructor — currently only on Windows (only via F<KBDUTOOL> route) and OS X.
210
211 =item Report/Debugging framework
212
213 creates human-readable descriptions of the layout, and/or debugging reports on
214 how the layout creation logic proceeded.
215
216 =back
217
218 The last (and, probably, the most important) component of the distribution is
219 L<an example keyboard layout|http://k.ilyaz.org/iz> created using this toolset.
220
221 =head1 Keyboard description files
222
223 =head2 Syntax
224
225 I could not find an appropriate existing configuration file format, so was
226 farced to invent yet-another-config-file-format. Sorry...
227
228 Config file is for initialization of a tree implementing a hash of hashes of
229 hashes etc whole leaves are either strings or arrays of strings, and keys are
230 words. The file consists of I<"sections">; each section fills a certain hash
231 in the tree.
232
233 Sections are separated by "section names" which are sequences of word
234 character and C</> (possibly empty) enclosed in square brackets.
235 C<[]> is a root hash, then C<[word]> is a hash reference by key C<word> in the
236 root hash, then C<[word/another]> is a hash referenced by element of the hash
237 referenced by C<[word]> etc. Additionally, a section separator may look like
238 C<< [visual -> wordsAndSlashes] >>.
239
240 Sections are of two type: normal and visual. A normal section
241 consists of comments (starting with C<#>) and assignments. An assignment is
242 in one of 4 forms:
243
244 word=value
245 +word=value
246 @word=value,value,value,value
247 /word=value/value/value/value
248
249 The first assigns a string C<value> to the key C<word> in the hash of the
250 current section. The second adds a value to an array referenced by the key
251 C<word>; the other two add several values. Trailing whitespace is stripped.
252
253 Any string value without end-of-line characters and trailing whitespace
254 can be added this way (and values without commas or without slash can
255 be added in bulk to arrays). In particular, there may be no whitespace before
256 C<=> sign, and the whitespace after C<=> is a part of the value.
257
258 Visual sections consist of comments, assignments, and C<content>, which
259 is I<the rest> of the section. Comments
260 after the last assignment become parts of the content. The content is
261 preserved as a whole, and assigned to the key C<unparsed_data>; trailing
262 whitespace is stripped. (This is the way to insert a value containing
263 end-of-line-characters.)
264
265 In the context of this distribution, the intent of visual sections is to be
266 parsed by a postprocessor. So the only purpose of explicit assignments in a
267 visual section is to configure how I<the rest> is parsed; after the parsing
268 is done (and the result is copied elsewhere in the tree) these values should
269 better be not used.
270
271 =head2 Semantic of visual sections
272
273 Two types of visual sections are supported: C<DEADKEYS> and C<KBD>. A content of
274 C<DEADKEYS> section is just an embedded (part of) F<.klc> file. We can read deadkey
275 mappings and deadkey names from such sections. The name of the section becomes the
276 name of the mapping functions which may be used inside the C<Diacritic_*> rule
277 (or in a recipe for a computed layer).
278
279 C<KBD> sections come in two styles: freehand and rectangular. In this section we
280 focus on the freehand style
281
282 A content of a freehand C<KBD> section consists of C<#>-comment lines and "the mapping
283 lines"; every "mapping line" encodes one row in a keyboard (in one or several
284 layouts). (But the make up of rows of this keyboard may be purely imaginary;
285 it is normal to have a "keyboard" with one row of numbers 0...9.)
286 Configuration settings specify how many lines are per row, and how many layers
287 are encoded by every line, and what are the names of these layers:
288
289 visual_rowcount # how many config lines per row of keyboard
290 visual_per_row_counts # Array of length visual_rowcount
291 visual_prefixes # Array of chars; <= visual_rowcount (miss=SPACE)
292 prefix_repeat # How many times prefix char is repeated (n/a to SPACE)
293 in_key_separator # If several layers per row, splits a key-descr
294 layer_names # Where to put the resulting keys array
295 in_key_separator2 # If one of entries is longer than 1 char, join by this
296 # (optional)
297
298 Each line consists of a prefix (which is ignored except for sanity checking), and
299 whitespace-separated list of key descriptions. (Whitespace followed by a
300 combining character is not separating.) Each key description is split using
301 C<in_key_separator> into slots, one slot per layout. (The leading
302 C<in_key_separator> is not separating.) Each key/layout
303 description consists of one or two entries. An entry is either two dashes
304 C<--> (standing for empty), or a hex number of length >=4, or a string.
305 (A hex numbers must be separated by C<.> from neighbor word
306 characters.) A loner character which has a different uppercase is
307 auto-replicated in uppercase (more precisely, titlecase) form. Missing or empty key/layout description
308 gives two empty entries (note that the leading key/layout description cannot
309 be empty; same for "the whole key description" - use the leading C<-->.
310
311 If one of the entries in a slot is a string of length ≥ 2, one must separate
312 the entries by C<in_key_separator2>. Likewise, if a slot has only one entry,
313 and it is longer than 1 char, it must be started or terminated by C<in_key_separator2>.
314
315 To simplify BiDi keyboards, a line may optionally be prefixed with the L<C<LRO/RLO>|http://en.wikipedia.org/wiki/Unicode_character_property#Bidirectional_writing>
316 character; if so, it may optionally be ended by spaces and the L<C<PDF>|http://en.wikipedia.org/wiki/Unicode_character_property#Bidirectional_writing> character.
317 For compatibility with other components, layer names should not contain characters C<+()[]>.
318
319 For example, with suitable configuration settings the first two config-lines of the table below may describe a first row of a
320 certain keyboard (with two keys!) in 5 layouts:
321
322 111 1①/₁¹/--𐋡 2②/₂²/--𐋢
323 222 [1]‼{1}/002f.o [2]‼{2}/+±
324 111 a/α/ⲁ s/σ/ⲥ d/δ/ⲇ
325 222 𝒶/𝕒 𝓈/𝕤 𝒹/𝕕
326
327 If so, the third and the fourth row would describe the second row of the keyboard (with 3 keys). Assuming C<in_key_separator=/>,
328 the first and the third row concern 3 layouts, while the second and the fourth concern 2 more layouts. (So this corresponds to
329 C<visual_per_row_counts=3,2>.)
330
331 Assuming C<in_key_separator=‼>, the 4th layout (the first one in the even rows — starting with C<222>) has on the top-left key
332 C<[1]> in the unshifted position, and C<{1}> in the shifted one. The third layout on this key has nothing in the unshifted
333 position, and C<𐋡> in the shifted one. The second layout on the bottom-right key produces C<σ> and C<Σ> in the unshifted/shifted
334 positions. Likewise the 5th one produces C<𝕤> and C<𝕊> (if this module has access to Unicode tables allowing it to guess that
335 C<𝕤/𝕊> “behave like” a case-pair — this is not specified in Unicode, but may be guessed by the names of these characters).
336
337 For the top-left key in 5th layout, we needed hex to encode the content (which is C</>) since it coincides with the separator.
338
339 =head2 Rectangular visual layout tables
340
341 TBC ........................
342
343 If a layer C<NAME> is define visually as a part of a list of layers, then the layer C<NAME²> is defined made of this layer (in the
344 unshifted position) and the next layer “shifted up”. Similarly, the layer C<NAME²⁺> is mad of the next 2 layers after
345 those in C<NAME²>.
346
347 Likewise, for RECT visual layers, C<NAME₁> is the corresponding layers in the next row of rectangles; C<NAME₂>, C<NAME₂₊> are made
348 as above of pairs of corresponding layers in the next row of rectangles. Moreover, the face C<NAME⁴> is a shortcut for
349 C<Layers(NAME²+Name²⁺)>, and C<NAME₄> for C<Layers(NAME²+Name₂)>.
350
351 TBC ........................ (some accessible not only from rectangular…)
352
353 =head2 Inclusion of F<.klc> files
354
355 Instead of including a F<.klc> file (or its part) verbatim in a visual
356 section, one can make a section C<DEADKEYS/NAME/name1/nm2> with
357 a key C<klc_filename>. Filename will be included and parsed as a C<DEADKEYS>
358 visual section (with name C<DEADKEYS/name1/nm2>???). (Currently only UTF-16
359 files are supported.)
360
361 =head2 Metadata
362
363 A metadata entry is either a string, or an array. A string behaves as
364 if were an array with the string repeated sufficiently many times. Each
365 personality defines C<MetaData_Index> which chooses the element of the arrays.
366 The entries
367
368 COMPANYNAME LAYOUTNAME COPYR_YEARS LOCALE_NAME LOCALE_ID
369 DLLNAME SORT_ORDER_ID_ LANGUAGE_NAME
370
371 should be defined in the personality section, or above this section in the
372 configuration tree. (Used when output Windows F<.klc> files and OS X
373 F<.keylayout> files.)
374
375 OSX_ADD_VERSION OSX_LAYOUTNAME
376
377 The first one is the ordinal of the word after which to insert the version
378 into C<LAYOUTNAME> (OS X allows layout names longer than the limit of 64 UTF-16
379 codepoints of Windows); the second one allows a completely different name.
380
381 Optional metadata currently consists only of C<VERSION> key (the protocol
382 version; hardwired now as C<1.0>) and keys C<LRM_RLM ALTGR SHIFTLOCK> defining
383 what goes into the C<ATTRIBUTES> section of F<.klc> file (the latter may also
384 be specified in a face's section, or its parents).
385
386 =head2 Layers and Faces
387
388 An "abstract" I<layer> is, essentially, just two arrays of “generated characters”: one
389 for the un-C<Shift>ed state, and one for C<Shift>ed state. A “generated characters”
390 may be also a prefix keypress ("redirecting" to a different face); it may also have
391 an attached metadata (for example, by which rules this character was generated, and
392 which "ornaments" to use when one "visualizes" this keybinding.
393
394 Most layers are just intermediate "building blocks" for constructing other layers.
395 However, many layers are going to be output to the final description of the keyboard.
396 For the latter layers, the position in the array should be thought of as associated
397 (by the tables outside of the context of the layer) with particular physical key
398 of the keyboard. These positions are split into several intervals corresponding to
399 different "isles" of the keyboard: the main isle, numeric isle, movement/insert/del
400 keys, and function keys.
401
402 The layers are defined by the visual sections of the keyboard definition, and by
403 I<layer recipes> (well, one can also define layers by embedding/importing tables
404 in MSKLC’s format). The format of the visual sections is designed to define things
405 "organized in row". Every "generalized character" in a layer either comes from a
406 visual section, or is produced by a "recipe rule" from (another) character from
407 (another) layer. (So they carry "a chain of provenance".)
408
409 A I<face> consists of several layers (typically two: one for C<AltGr> not pressed,
410 and one for C<AltGr> pressed) and a lot of associated metadata,
411
412 =head2 Layer/Face/Prefix-key Recipes
413
414 The sections C<layer_recipes> and C<face_recipes> contain instructions how
415 to build Layers and Faces out of simpler elements. Similar recipes appear
416 as values of C<DeadKey_Map*> entries in a face. Such a "recipe" is
417 executed with I<parameters>: a base face name, a layer number, and a prefix
418 character (the latter is undefined when the recipe is a layer recipe or
419 face recipe). (The recipe is free to ignore the parameters; for example, most
420 recipes ignore the prefix character even when they are "prefix key" recipes.)
421
422 The recipes and the visual sections are the most important components of the description
423 of a keyboard group.
424
425 To construct layers of a face, a face recipe is executed several times with different
426 "layer number" parameter. In contrast, in simplest cases a layer recipe is executed
427 once. However, when the layer is a part of a compound ("parent") recipe, it inherits
428 the "parameters" from the parent. In particular, it may be executed several times with
429 different face name (if used in different faces), or with different layer number (if used
430 - explicitly or explicitly - in different layer slots; for example, C<Mutator(LayerName)>
431 in a face/prefix-key recipe will execute the C<LayerName> recipe separately for all the
432 layer numbers; or one can use C<Layers(Empty+LayerName)> together with
433 C<Layers(LayerName+Other)>). Depending on the recipe, these calls may result in the same layout
434 of the resulting layers, or in different layouts.
435
436 A recipe may be of three kinds: it is either a "first comer wins" which is a space-separated collection of
437 simpler recipes, or C<SELECTOR(COMPONENTS)>, or a "mutator": C<MUTATOR(BASE)> or just C<MUTATOR>. (There is
438 also a syntax of mutator of different form: C<prefix=HEX> or C<prefixNOTSAME=HEX>; see below.)
439 All recipes must be C<()>-balanced
440 and C<[]>-balanced; so must be the C<MUTATOR>s; in turn, the C<BASE> is either a
441 layer name, or another recipe. A layer name must be defined either in a visual C<KBD> section,
442 or be a key in the C<layer_recipes> section (so it should not have C<+()[]> characters),
443 or be the literal C<Empty>.
444 When C<MUTATOR(BASE)> is processed, first, the resulting layer(s) of the C<BASE> recipe
445 are calculated; then the layer(s) are processed by the C<MUTATOR> (one key at a time).
446
447 The most important C<SELECTOR> keywords are C<Face> (with argument a face name, defined either
448 via a C<faces/FACENAME> section, or via C<face_recipes>) and C<Layers> (with argument
449 of the form C<LAYER_NAME+LAYER_NAME+...>, with layer names defined as above). Both
450 select the layer (out of a face, or out of a list) with number equal to the "layer number parameter" in the context
451 of the recipe. The C<FlipLayers> builder is similar to C<Face>, but chooses the "other"
452 layer ("cyclically the next" layer if more than 2 are present).
453
454 The other selectors are C<Self>, C<LinkFace> and C<FlipLayersLinkFace>; they
455 operate on the base face or face associated to the base face. B<NOTE:> when C<NAME> is a name of a “personality” face (which
456 is construted in steps for its C<Layers> declaration, C<LinkFace> and specific C<VK>-keys), C<Face(NAME)> is based only on this
457 C<Layers> declaration. Use C<FullFace(NAME)> to address the “synthesized” state of the face (the result depends on which moment
458 this state is accessed!). (Likewise for C<FullFlipLayers>.) See also L<"Implementation details: C<FullFace(FNAME)>">.
459
460 The selector C<Shortcut(FACE_RECIPE_NAME)> is same as Face(), but does not reset the active prefix, and makes no caching (so
461 may be used in different contexts with different results).
462
463 The simplest forms of C<MUTATORS> are C<Id, lc, uc, ucfirst, Empty> (note that
464 C<uc>/C<lc>/C<ucfirst> return C<undefined> when case-conversion results in no
465 change; use C<maybe_uc>/C<maybe_lc>/C<maybe_ucfirst> if one wants them to behave
466 as Perl operators). Recall that a layer
467 is nothing more than a structure associating a pair "unshifted/shifted character" to the key number, and that
468 these characters may be undefined. These simplest mutators modify these characters
469 independently of their key numbers and shift state (with C<Empty> making all of
470 them undefined). Similar user-defined simple mutators are C<ByPairs[PAIRS]>;
471 here C<PAIRS> consists of pairs "FROM TO" of characters (with optional spaces between pairs);
472 characters not appearing as FROM become undefined by C<ByPairs>.
473 (As usual, characters may be replaced by hex numbers with 4 or more hex digits;
474 separate the number from a neighboring word character by C<.> [dot].)
475
476 The C<Flat>/C<Inv> variants: TBC ................
477
478 All mutators must have a form C<WORD> or C<WORD[PARAMETERS]>, with C<PARAMETERS>
479 C<(),[]>-balanced. Other simple mutators are C<dectrl> (converts
480 control-char [those between 0x00 and 0x1f] to the corresponding [uppercase] character),
481 C<ShiftFromTo[FROM,TO]> (adds a constant to the [numerical code of the] input character
482 so that C<FROM> becomes C<TO>), C<SelectRX[PERL_REGEXP]> (keeps input characters
483 which match, converts everything else to C<undefined>), C<FromTo[LAYER_FROM,LAYER_TO]>
484 (similar to C<ByPairs>, but pairs all characters in the layers based on their position),
485 C<DefinedTo[CHAR]> (all defined characters are converted to C<CHAR>; if C<CHAR> is C<undef>,
486 this “undefines” these positions in whatever follows this part of the recipe).
487
488 The mutator C<Imported[NAME]> is similar to C<ByPairs>, but takes the F<.klc>-style
489 visual C<DEADKEYS/NAME> section as the description of the mutation. C<NAME> may
490 be followed by a character as in C<NAME,CHAR>; if not, C<CHAR> is the prefix key from
491 the recipe's execution parameters.
492
493 The simple mutator C<ByPairs> has flavors: one can append C<Prefix> or C<InvPrefix>
494 to the name, and the resulting bindings become prefix keys (with C<Inv>, the
495 prefix followed by C<CHAR> behaves as the non-C<Inv> prefix followed by C<AltGr-CHAR>).
496 (I<The behaviour> of these prefix keys should be defined elsewhere; for example, by
497 C<DeadKey_Map****>.)
498
499 Some mutators pay attention not only to what the character is, but how it is
500 accessible on the given key: such are C<FlipShift>, C<FlipLayers>,
501 C<FromToFlipShift[LAYER_FROM,LAYER_TO]>. Some other mutators also take into
502 account how the key is positioned with respect to the other keys.
503
504 C<ByColumns[CHARS]> assigns a character
505 to a particular column of the keyboard. Which keys are in which columns is
506 governed by how the corresponding
507 visual layer is formatted (shifted to the right by C<keyline_offsets> array of the
508 visual layer). This visual layer is one associated to the face by the
509 C<geometry_via_layer> key (and the face is the parameter face of the
510 mutator). C<CHARS> is a comma-separated list;
511 empty positions map to the undefined character.
512
513 C<ByRows[MUTATORS]> chooses a mutator based on the row of the keyboard. On the top row,
514 it is the first mutator which is chosen, etc. The list C<MUTATORS> is separated by C<///>
515 surrounded by whitespace.
516
517 The mutator C<InheritPrefixKeys[FACE_FROM]> converts some non-prefix characters to prefix
518 characters; the conversion happens if the argument of the mutator coincides with
519 what is at the corresponding position in C<FACE_FROM>, and this position contains
520 a prefix character. (Nowadays this mutator is not very handy — most of its uses
521 may be accomplished by having I<inheritable> prefix characters in appropriate faces.)
522
523 The mutators C<NotId(BASEFACE FACES)>, C<NotSameKey(BASEFACE FACES)> process their
524 argument in a special way: the characters in C<FACES> which duplicated the characters
525 present (on the same key, and possibly with the same modifiers) in C<BASEFACE> are
526 ignored. The remaining characters are combined “as usual” with “the first comer wins”.
527
528 The most important mutator is C<Mutate> (and its flavors). (See L<The C<Mutate[RULES]> mutator>.)
529
530 Note that C<Id(LAYERNAME)> is similar to a selector;
531 it is the only way to insert a
532 layer without a selector, since a bareword is interpreted as a C<MUTATOR>; C<Id(LAYERNAME)> is a synonym
533 of C<Layers(LAYERNAME+LAYERNAME+...)> (repeated as many times as there are layers
534 in the parameter "base face").
535
536
537 The recipes in a space-separated list of recipes ("first comer wins") are
538 interpreted independently to give a collection of layers to combine; then,
539 for every key numbers and both shift states, one takes the leftmost recipe
540 which produces a defined character for this position, and the result is put
541 into the resulting layer.
542
543 Keep in mind that to understand what a recipe does, one should trace
544 its description right-to-left order: for example, C<ByPairs[.:](FlipLayers)> creates
545 a layout where C<:> is at position of C<.>, but on the second [=other] layer (essentially,
546 if the base layout is the standard one, it binds the character C<:> to the keypress C<AltGr-.>).
547
548 To simplify formatting of F<.kbdd> files, a recipe may be an array reference.
549 The string may be split on spaces (but not after comma or C<|>), or split after comma or C<|>.
550 (Another good alternative is to use the-split-line C<+>-syntax for assignments.)
551
552 =head2 The C<prefix=HEX> or C<prefixNOTSAME=HEX> and C<prefixNOTSAMEcase=HEX> mutators
553
554 The former case imports a fully defined face corresponding to the prefix key C<HEX>.
555 The other cases do likewise, but massage the base layer in the positions without a “new” binding.
556 Here a binding is “new” if not present I<on the same key> in the base face (on any layer/C<Shift>-state).
557
558 More precisely, the imported positions on this key on other layers with “new bindins” may be
559 copied to “non-new” positions in layer 0. Here the same C<Shift>-state is either preserved,
560 or — unless in the last flavor — “raised”,
561 as in copying from C<AltGr> to C<Shift> — if this adds a not-yet-created binding. (The first “new”
562 binding wins — although this may be important only with more than 2 layers.)
563
564 (Compare with the C<prefixNOTSAME=HEX> field of
565 L<the C<@output_layers> configuration variable|"More than 2 layers and/or exotic modifier keys"> — but
566 there a binding is not “new” if it is present I<anywhere> on the base face.)
567
568 B<WARNING:> there is no attempt to resolve infinite loops of importing. In particular,
569 C<prefix=> should not create circular dependency between prefixes, or be used in “principal”
570 (=non-DeadKey) face.
571
572 =head2 The C<NOID()>, C<NotSameKey()>
573
574 TBC ......................
575
576 =head2 The C<Mutate[RULES]> mutator
577
578 The essense of C<Mutate> is to have several mutation rules and choose I<the best>
579 of the results of application of these rules. Grouping the rules allows
580 one a flexible way to control what I<the best> actually means. The rules may
581 be separated by comma, by C<|>, or by C<|||> (interchangeable with C<||||>).
582
583 The simplest case of competition between results produced by different rules is for rules in different
584 C<|>-separated groups: then “the earlier rule producing results wins”. However, the rules not separated
585 by C<|> I<compete by “quality”> of their results.
586
587 The I<quality> of the generated characters is a list C<UNICODE_AGE, HONEST,
588 UNICODE_BLOCK, IN_CASE_PAIR, FROM_NON_ALTGR_POSITION>
589 with lexicographical order (the earlier element is stronger that ones after it).
590 Here C<HONEST> describes whether a character is generated by
591 Unicode compositing (versus “compatibility compositing” or other
592 “artificially generated” mogrifiers); the older age wins, as well as
593 honest compositing, earlier Unicode blocks, as well as case pairs and
594 characters from non-C<AltGr>-positions. (Experience shows that these rules
595 have a pretty good correlation with being “more suitable for human consumption”.)
596
597 Moreover, quality in case-pairs is equalized by assigning the strongest
598 I<quality> of two. Such pairs are always considered “tied together” when
599 they compete with other characters. (In particular, if a single character
600 with higher quality occupies one of C<Shifted/Unshifted> positions, a
601 case pair with lower quality is completely ignored; so the “other” position
602 may be taken by a single character with yet lower quality.)
603
604 In addition, the characters which lost the competition for
605 non-C<AltGr>-positions are considered I<again> on C<AltGr>-positions. (With
606 boosted priority compared to mutated C<AltGr>-characters; see above.)
607
608 This mutator comes in several flavors: one can append to its name
609 C<SpaceOK>/C<Hack>/C<DupsOK>/C<32OK> (in this
610 order). Unless C<SpaceOK> is specified, it will not modify characters on a key
611 which produces C<SPACE> when used without modifiers. Unless C<32OK> is specified, it
612 will not produce Unicode characters after C<0xFFFF> (the default is to follow
613 the brain-damaged semantic of prefix keys on Windows). Unless C<DupsOK> is
614 specified, the result is optimized by removing duplicates (per key) generated
615 by application of C<RULES>. With the C<Hack> modifier, the generated characters
616 are not counted as “obtained by logical rules” when statistics for the generated
617 keyboard layout are calculated.
618
619 =head2 Macro-ization of recipes
620
621 … is acteually described inside the following section.
622
623 =head2 Linked prefixes
624
625 On top of what is explained above, there is a way to arrange “linking” of two prefix keys;
626 this linking allows characters which cannot be fit on one (prefixed) key to
627 “migrate” to unassigned positions on the otherwise-prefixed key. (This is
628 similar to migration from non-C<AltGr>-position to C<AltGr>-position.)
629 This is achieved by using mutator rules of the following form:
630
631 primary = +PRE-GROUPS1|||SHARED||||POST-GROUPS1
632 secondary = PRE-GROUPS2||||PRE-GROUPS1|||SHARED||||POST-GROUPS2
633
634 Groups with digits are not shared (specific to a particular prefix); C<SHARED> is
635 (effectively) reverted when accessed from the secondary prefix; for the
636 secondary key, the recipies from C<SHARED> which were used in the primary
637 key are removed from C<SHARED>, and are appended to the end of C<POST-GROUPS2>;
638 the C<PRE-GROUPS1> are skipped when finding assignments for the secondary
639 prefix.
640
641 In the primary recipe, C<|||> and C<||||> are interchangeable with C<|>.
642 Moreover, if C<POST-GROUPS2> is empty, the secondary recipe should be written as
643
644 secondary = PRE-GROUPS2|||PRE-GROUPS1|||SHARED
645
646 if C<PRE-GROUPS1> is empty, this should be written as one of
647
648 secondary = PRE-GROUPS2|||SHARED
649 secondary = PRE-GROUPS2||||SHARED
650 secondary = PRE-GROUPS2||||SHARED||||POST-GROUPS2
651
652 These rules are to allow macro-ization of the common parts of the primary
653 and secondary recipe. (Although macro-ization may be useful for non-paired
654 recipes too!) Put the common parts as a value of the key
655 C<Named_DIA_Recipe__***> (here C<***> denotes a word), and replace them by
656 the macro C<< <NAMED-***> >> in the recipes.
657
658 B<Implementation>: the primary key recipe starts with the C<+> character; it
659 forces interpretation of C<|||> and C<||||> as of ordinary C<|>.
660
661 If not I<primary>, the top-level groups are formed by C<||||> (if present), otherwise by C<|||>.
662 The number of top-level groups should be at most 3. The second of C<||||>-groups
663 may have at most 2 C<|||>-groups; there should be no other subdivision. This way,
664 there may be up to 4 groups with different roles.
665
666 The second of 3 toplevel C<|||>-groups, or the first of two sublevel C<|||>-groups
667 is the “skip” group. The last of two or three toplevel C<|||>-groups (or of
668 sublevel C<|||>-groups, or the 2nd toplevel C<||||>-group without subdivisions) is the
669 inverted group; the 3rd of toplevel C<||||>-groups is the “extra” group.
670
671 “Penalize/prohibit” lists start anew in every top-level group.
672
673 =head2 Atomic mogrifying rules
674
675 As explained above, the individual RULES in C<Mutate[RULES]> may be
676 separated by C<,> or C<|>, or C<|||> or C<||||>. Such an individual
677 rule is a combination of I<atomic mogrifying rules> combined by C<+> operators,
678 and/or preceded by C<-> prefix (with understanding that C<+-> must
679 be replaced by C<-->). The prefix C<-> means I<inversion> of the
680 rule; the operator C<+> is the composition of the rules.
681
682 B<Example:> the atomic mogrifying rule C<< <super> >> converts its input character into
683 its superscript forms (if such forms exist; for example, C<a> may
684 be converted to C<ᵃ> or C<ª>). The atomic rules C<lc>, C<uc>, C<ucfirst>
685 behave the same as the corresponding MUTATORs. The atomic rule C<dectrl>
686 converts a control-character to the corresponding “uppercase” character:
687 C<^A> is converted to C<A>, and C<^\> is converted to C<\>. (The last
688 4 rules cannot be inverted by C<->.)
689
690 The composition is performed (as usual) from right to left (the part on the right
691 is executed first (“as usual”; compare with C<log sin I<x>>). B<Example:> the
692 indivial rule C<< <super>+lc+dectrl >> converts C<^A> to C<ᵃ> or C<ª>.
693
694 Any combining Unicode character defines the corresponding atomic mogrifier. It
695 may result in the corresponding
696 L<precomposed form|https://en.wikipedia.org/wiki/Precomposed_character>; additionally,
697 it is extended “to commute with”
698
699 In addition to rules listed above, the atomic mogrifiers may be of the
700 following types:
701
702 =over
703
704 =item *
705
706 A hex number with ≥4 digits, or a character: implements the composition
707 inverting (compatibility or not) Unicode decompositions into “the base” and
708 “the combining character”; such mogrifier matches the composing character,
709 and sends the base to “the composed form”.
710
711 Here “Unicode decompositions” are either deduced from explicit Unicode decomposition
712 rules (with compatibility decompositions having lower priority), or deduced
713 basing on splitting the name of the character into suitable parts.
714
715 =item *
716
717 C<< <pseudo-upgrade> >> is an inversion of a Unicode decomposition which goes from
718 1 character to 1 character.
719
720 =item *
721
722 Flavors of characters C<< <FLAVOR> >> from the Unicode tables come from Unicode
723 1-character to 1-character decompositions
724 marked with C<< <FLAVOR> >>. B<Example:> C<< <sub> >> for a subscript form;
725 or C<< <final> >>.
726
727 =item *
728
729 C<< <font=font␣name> >> rules convert a letter (and a digit) to the corresponding
730 codepoint in L<Unicode Math Alphabets|https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols>.
731 (Replace spaces in the “name of the font” [such as C<DOUBLE STRUCK>] by dash=C<-> and lowercase it; so the corresponding
732 rule is C<< <font=double-struck> >>.)
733
734 =item *
735
736 Calculated rules C<< <pseudo-calculated-***> >> are extracted by a
737 heuristic algorithm which tries to parse the Unicode name of the character.
738
739 For the best understanding of what these rules produce, inspect
740 results of print_compositions(), print_decompositions() methods documented
741 in L<"SYNOPSIS">. The following “keywords” are processed by the algorithm:
742
743 WITH, OVER, ABOVE, PRECEDED BY, BELOW (only with LONG DASH)
744
745 in the Unicode name are considered “to be separators”; and
746
747 COMBINING CYRILLIC LETTER, BARRED, SLANTED, APPROXIMATELY, ASYMPTOTICALLY,
748 SMALL (not near LETTER), ALMOST, SQUARED, BIG, N-ARY, LARGE, LUNATE,
749 SIDEWAYS DIAERESIZED, SIDEWAYS OPEN, INVERTED, ARCHAIC, EPIGRAPHIC,
750 SCRIPT, LONG, MATHEMATICAL, AFRICAN, INSULAR, VISIGOTHIC, MIDDLE-WELSH,
751 BROKEN, TURNED, INSULAR, SANS-SERIF, REVERSED, OPEN, CLOSED, DOTLESS, TAILLESS, FINAL
752 BAR, SYMBOL, OPERATOR, SIGN, ROTUNDA, LONGA, IN TRIANGLE, SMALL CAPITAL (as smallcaps)
753
754 are mogrifiers. For an C<APL FUNCTIONAL SYMBOL>, one scans for
755
756 QUAD, UNDERBAR, TILDE, DIAERESIS, VANE, STILE, JOT, OVERBAR, BAR
757
758 In particular, the mogrifier C<< <pseudo-calculated-operator> >> may convert the character
759 C<\> (named C<REVERSE SOLIDUS>) to the Unicode character C<U+29f5=⧵> with the name
760 C<REVERSE SOLIDUS OPERATOR>.
761
762 =item *
763
764 Additionally, C<esh/eng/ezh> are considered C<pseudo-phonetized> variants of
765 their middle letter, as well as C<SCHWA> of C<0>.
766
767 =item *
768
769 C<< <pseudo-fake-***> >> rules are obtained by scanning the names of the Unicode characters for
770
771 WHITE, BLACK, CIRCLED, BUT NOT
772
773 as well as for C<UM> (as C<umify>), paleo-Latin digraphs and C<CON/VEND>
774 (as C<paleocontraction-by-last>), doubled-letters
775 (as C<doubleletter>), C<MIDDLE-WELSH> doubled-letters
776 (as C<doubleletter-middle-welsh>), C<MODIFIER LETTER> (possibly with C<RAISED>
777 or C<LOW>; as C<sub/super>).
778
779 For example, C<△> may be converted to C<▲=BLACK UP-POINTING TRIANGLE> by C<< <pseudo-fake-black> >>.
780
781 =item *
782
783 C<< <pseudo-faked-***> >> rules are, first: the special case C<calculated-SYMBOL> converting C<MICRO SIGN> (C<µ>) to
784 C<GREEK LETTER MU> (C<μ>). In addition, C<greekize> converts a Latin letter into B<the Latin variant of the corresponding Greek
785 letter> (e.g., C<f> ⇝ C<LATIN SMALL LETTER PHI=ɸ>). Finally, C<latinize> does the same, but “starting with a Greek letter”.
786
787 =item *
788
789 C<< <subst-***> >> Explicitly defined named substitution rules. A rule is defined in C<Substitutions> section of F<.kbdd>. E.g.,
790 the row
791
792 @Zuang_tones=2ƨ,3з,4ч,5ƽ,6ƅ,@Ƨ,#З,$Ч,%Ƽ,^Ƅ
793
794 defines the rule C<< <subst-Zuang_tones> >> which, in particular, converts C<#> to C<U+0417=З>.
795
796 =item *
797
798 Manual prearranged rules C<< <pseudo-manual-***> >> are like C<< <subst-***> >>, but use the tables builtin into this Perl module.
799 Currently the following rules are defined:
800
801 phonetized phonetize2 phonetize3 phonetize0 # different “priorities” of translation
802 paleo greek2coptic latin2extracoptic
803 addline addhline addvline addtilde adddot adddottop addleft addright
804 sharpen unsharpen whiten quasisynon amplify turnaround superize subize subize2
805 aplbox round hattify
806
807 They are intended “to do what the name says”. For example, C<addleft> either adds left arrow, or adds something on the left of
808 the glyph.
809
810 =item *
811
812 C<< <reveal-substkey> >> if it is the only mogrifier, or is at the right end of a mogrifier composition chain: processes only
813 “the substitution=mirroring keys” (see L<"Input substitution in atomic mogrifiers"> below).
814
815 (Obsolete synonym: C<< <reveal-greenkey> >> ???)
816
817 =item *
818
819 C<< <any-***> >> and C<< <any1-***> >> rules (may be prepended by C<reverse->, as well as C<other-> may be put before these
820 stars). The tail C<***> is several words (connected by C<->), optionally appended by a list (joined by C<->) of C<!> followed
821 by several words-connected-by-C<->.
822
823 For example, applying C<< <any-hook-!above> >> is equivalent to joining the results of applying all atomic mogrifiers having C<hook>
824 in their name (as well as 1-character mutators having it in their lower-case Unicode name), but not having C<above> in these names.
825 (Note that C<hook> would not be looked at immediately after C<< < >> — but as a special case, C<< <font=***> >> mogrifiers can be
826 matched by C<font>.)
827
828 C<reverse-> flips the order of the list of found atomic mogrifiers. With C<any1-> the mogrifiers having the word C<AND> in their name
829 are omitted (so C<< <any1-acute> >> is similar to C<< <any-acute-!AND> >> — and they would not convert C<s> to
830 C<ṥ=U+1E65=LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE>).
831
832 Currently, C<other-> omits exact matches for the supplied match-string. (It seems that intent was to omit matches where the
833 part inside C<< < > >> is an exact match???
834
835 =back
836
837 =head2 Input substitution in atomic mogrifiers
838
839 There are situations when “logically defined” mogrifiers are not enough. For example, suppose that my mogrifiers produce “very
840 logical results” when applied to characters C<△> and C<□> — however, I want them to give the same results when applied to characters
841 C<3> and C<4>. For this, we may declare that a keypress producing C<3> also has “an invisible output C<△>”; likewise for C<4> and
842 C<□>.
843
844 Such “substitution keys” are defined in the C<AlternCharSubstitutions>, C<AlternCharSubstitutionLayers> and
845 C<AlternCharSubstitutionFaces> array directives similar to
846
847 @AlternCharSubstitutions=3△,4□,0338∕,06ff÷
848 @AlternCharSubstitutionLayers=Blue,Blue-AltGr
849
850 here in addition to every key binding being “mirrored” by the corresponding binding in layers C<Blue> + C<Blue-AltGr>, a binding
851 resulting in the combining-slash C<U+0338=◌̸> is “mirrored” by the binding producing C<U+2215=DIVISION SLASH=∕>. When mogrifiers
852 are applied to a key binding, they are also applied to the “mirrored bindings”, and the results “compete for being included” all
853 together (on equal footings).
854
855 =head2 The C<AssignTo> directive
856
857 This is a pseudo-mutator restricting the assignment to special “extension chunks” of a face or a layer. Recall that usually, to
858 understand how a particular “position in a layers” corrresponds to a key in a physical keyboard, this module inspects the binding
859 in the C<BaseLayer> — which is assumed to be “as expected”. However, some keys are not expected do not produce characters, so
860 cannot be identified this way. To circuvent this, we allow chunks-with-known-maps-to-physical keys, named C<FKEYS> (24 standard
861 keys up to C<F24>), C<ARROWS> and C<NUMPAD> (16 keys arranged in the order of the left table in:
862
863 789/ ⌈⊓⌉⧄
864 456* ⊏□⊐⊠
865 123- ⌊⊔⌋⊟
866 0.↲+ ▭⊡▯⊞
867
868  — so one can easily assign the them using rectangle-block). For example, defining layers C<IsleDigits> and C<DirCharsRect> by
869 these blocks, the mutator
870
871 AssignTo[ARROWS,16](Id(RectArr))
872  
873 Would bind the arrow keys (on the numeric keyboard, and — on Windows — elsewhere) to the shapes on the right. (In the defined
874 layer, pressing C<End> produces C<⌊>.) Likewise, with
875
876 AssignTo[ARROWS,16](FromTo[ 7√ 9ℊ ](FlipShift(Id(IsleDigits))))
877
878 pressing C<Shift-Home> produces C<√>.
879
880  TBC ..................
881
882
883 =head2 The C<Mutate2Self> mutator
884
885 Finds “the most convenient default bindings” for the “diacritic key map” when the
886 following key is non-alphanumeric. This is based on “the ID” of the prefix key
887 (this is, for example, in the definition of C<DeadKey_Map0138> the ID is C<U+0138>.
888
889 This ID should be a value in the C<Diacritics> section of F<.kbdd>. The first such
890 row is taken, and one of the characters in (one of the 7) corresponding lists is
891 returned.
892
893 B<Warning:> in “real keyboard layout”, this is most probably used only as a
894 fallback — so many of these bindings are going to be overwritten by “other mutators”
895 in the recipe describing the action of a prefix key. (Nevertheless, the list below is
896 made to cover as many of the characters in the sublists accessible as possible,
897 I<effectively assuming> that many of these bindings are not overwritten. — This is an
898 obvious contradiction of intents! — Partially remedied by multiple alternative ways of access…)
899
900 The unifying factor is that “spacing variants” of diacritics are accessed mostly via C<Space>,
901 and the “combining variants” are accessed mostly C<AltGr>-modified non-alphabetic keys.
902 For example, currently:
903
904 =over 4
905
906 =item *
907
908 A double-press of the diacritic key returns the first I<combining character>
909 (“non-spacing”) from this list.
910
911 =item *
912
913 Sends C<Space> to the first I<spacing modifier> character of this list (ignoring ASCII chars: those up to C<~=U+007e>).
914
915 Likewise, the other characters bound to C<Space> (with C<Shift> and C<AltGr>-modifiers)
916 are sent to the following Unicode spacing modifiers in the lists. (More such spacing
917 modifiers are produced by control-characters — see below.)
918
919 =item *
920
921 Sends C<|> and C<\> to the first two elements of the “vertical-etc” or “prime-like-or-centered” sublists of
922 spacing characters.
923
924 =item *
925
926 Likewise, combining these with C<AltGr> produces combining characters of similar types (penalizing the first 2 in each “non-primary”
927 subgroup).
928
929 =item *
930
931 Sends C</> and C<?> to the second pair of elements of the “prime-like-or-centered” sublist of
932 spacing characters (penalizing as above).
933
934 =item *
935
936 Sends C<-> and C<_> to the second pair of elements of the “lowered” sublist (and the following sublists) of
937 spacing characters (penalizing as above).
938
939 =item *
940
941 Likewise, modifying these with C<AltGr> produces combining characters of similar types.
942
943 =item *
944
945 Likewise, modifying C<;> and C<:> with C<AltGr> produces the first two of math-combining-characters-for-symbols (or other
946 combining chars, penalizing as above).
947
948 =item *
949
950 Likewise, C<[ { ] }> (and C<-> and C<_> with C<AltGr>) produce the third (etc.) math-combining-character-for-symbols (or other
951 combining chars, penalizing as above).
952
953 =item *
954
955 C<'> and C<"> (possibly modified by C<AltGr>) produce the second (and the following) combining characters in the list (penalizing
956 as above).
957
958 =item *
959
960 As a last resort for combining characters, C<AltGr>-modified C<` 1 2 3 4 5 6 7 8 9 0 = [ ] , .> access third-etc.
961 combining characters (penalizing as above).
962
963 =item *
964
965 As a last resort for spacing characters: in addition to what is produced by C<Space> (possibly modified by C<Shift> etc.), more
966 spacing modifiers are produced by control-characters emitted by a special key (such as C<Enter>, C<Tab>, C<Ctrl-Enter>,
967 C<Esc> and C<Ctrl>-variants of C<[ ] \> — or C<Esc> — then C<Backspace>, then C<Ctrl>
968 variants of C<Backspace _ ^ @> — which is the same as C<2>).
969
970 (When choosing which non-spacing modifier to choos, the first 2 elements in each
971 sublist are penalized — they may be easier entered by other ways described above.)
972
973 =back
974
975 =head2 Other mutators
976
977 C<IfPrefix[PREFIX1,PREFIX2,…](RECIPES)> (and C<IfNotPrefox>). — Suitable for
978 putting into default bindings. TBC ...................
979
980 =head2 Pseudo-mutators for generation of documentation/etc.
981
982 A few mutators do not introduce any characters (in other words, they behave as
983 C<Empty>) but are used for their side effects: in prefix-key recipes,
984 C<PrefixDocs[STRING]> introduces documentation of what the prefix key is intended
985 for. Moreover, C<X11symbol[NAME]> gives the “symbol name C<NAME> for C<X11>” keysymbol
986 (such as C<dead_lowline>) generated by this prefix key.
987
988 Likewise, C<HTML_classes[HOW]> allows adding CSS classes to highlight
989 parts of HTML output generated by this module, the parts corresponding to selected
990 characters in a face.
991
992 C<HOW> is a comma-separated list, every triple in the
993 list being C<WHERE,HTML_CLASS,CHARACTERS>. C<WHERE> is one of C<k>/C<K> (which
994 add formatting to the key containing one of the C<CHARACTERS>) or C<c>/C<C>
995 (which add formatting to an individual character displayed on the key),
996 one can add a digit to C<WHERE> to limit to a particular layer in the face
997 (useful when a character appears several times in a face).
998 The lower-case variants select characters basing on the I<base face> of a key.
999 One can also append C<=CONTEXT> to C<WHERE>, then the class is added only if
1000 C<CONTEXT> appears as one of the options for the HTML output generator.
1001
1002 The CSS rules generated by this module support several classes directly; the
1003 rest should be supported by the user-supplied rules. The classes with existing
1004 support are: on keys
1005
1006 to_w from_w # generate arrows between keys
1007 from_nw from_ne to_nw to_ne # generate arrows between keys; will yellow-outline
1008 pure # unless combined with this
1009 red-bg green-bg blue-bg # tint the key as the whole (as background)
1010
1011 On characters
1012
1013 very-special need-learn may-guess # provide green/brown/yellow-outlines
1014 special # provide blue outline (thick unless combined with
1015 thinspecial # <-- this)
1016
1017 options oneRow, startKey, cntKeys: TBC .......................
1018
1019 =head2 Extra CSS classes for documentation
1020
1021 In additional, several CSS classes are auto-generated basing on Unicode
1022 properties of the character. TBC ........................
1023
1024 =head2 Debugging mutators
1025
1026 If the bit 0x40 of the environment variable C<UI_KEYBOARDLAYOUT_DEBUG>
1027 (decimal or C<0xHEX>) is set, debugging output for mutators is enabled:
1028
1029 r ║ ║ ┆ ║ ṙ ṛ ┆ ║ ║ ║ ║ ⓡ ┆
1030 ║ ║ ┆ ║ Ṙ Ṛ ┆ ║ ║ ║ ║ Ⓡ ┆
1031 ║ ║ ặ ┆ ║ ┆ ║ ║ ║ ║ ┆
1032 ║ ║ Ặ ┆ ║ ┆ ║ ║ ║ ║ ┆
1033 Extracted [ …list… ] deadKey=00b0
1034
1035 The output contains a line per character assigned to the keyboard key (if
1036 there are 2 layers, each with lc/uc variants, there are 4 lines); empty lines are
1037 omitted. The first column indicates the base character (lc of the 1st layer) of
1038 the key; the separator C<║> indicates C<|>-groups in the mutator. Above, the first
1039 group produces no mutations, the second group mutates only the characters in
1040 the second layer, and the third group produces two mutations per a character in
1041 the first layer. The 7th group is also producing mogrifications on the 1st layer.
1042
1043 The next example clarifies C<┆>-separator: to the left of it are mogrifications which
1044 come in case pairs, to the right are mogrifications where mogrified-lc is not
1045 a case pair of mogrified-uc:
1046
1047 t ║ ║ ᵵ ║ ꞇ ┆ ʇ ║ ┆ ║
1048 ║ ║ ║ Ꞇ ┆ ᴛ ║ ┆ ║
1049 ║ ║ ║ ┆ ║ ꝧ ┆ ║
1050 ║ ║ ║ ┆ ║ Ꝧ ┆ ║
1051 Extracted [ …list… ] deadKey=02dc
1052
1053 In this one, C<│> separates mogrifications with different priorities (based on
1054 Unicode ages, whether the atomic mogrifier was compatibility/synthetic one, and the
1055 Unicode block).
1056
1057 / ║ ║ ║ ║ ║ │ ∴ ║ ║
1058 ║ ║ ║ ║ ║ │ ≘ ≗ ║ ║
1059 ║ ║ ║ ║ ║ / │ ⊘ ║ ║
1060 Extracted [ …list… ] deadKey=00b0
1061
1062 For secondary mogrifiers, where the distinction between C<|||> and C<|>
1063 matters, some of the C<║>-separators are replaced by C<┃>. Additionally,
1064 there are two rounds of extraction: first the characters corresponding
1065 to the primary mogrifier are TMP-extracted (from the groups PRE-GROUPS1,
1066 COMMON); then what is the extracted from COMMON is put back at the
1067 effective end (at the end of POST-GROUPS2, or, if no such, at
1068 the beginning of COMMON):
1069
1070 t ║ ║ ᵵ ┃ ┃ ʇ │ │ ꞇ ┆ ║
1071 ║ ║ ┃ ┃ │ ᴛ │ Ꞇ ┆ ║
1072 ║ ║ ┃ ┃ │ │ ꝧ ┆ ║
1073 ║ ║ ┃ ┃ │ │ Ꝧ ┆ ║
1074 TMP Extracted: <…list…> from layers 0 0 | 0 0
1075 t ║ ║ ᵵ ┃ ꞇ ┆ ʇ ┋ ┃ ┆ │ ┆ │ ┆ ║
1076 ║ ║ ┃ Ꞇ ┆ ᴛ ┋ ┃ ┆ │ ┆ │ ┆ ║
1077 ║ ║ ┃ ┆ ┋ ┃ ┆ │ ┆ │ ꝧ ┆ ║
1078 ║ ║ ┃ ┆ ┋ ┃ ┆ │ ┆ │ Ꝧ ┆ ║
1079 Extracted [ …list… ] deadKey=02dc
1080
1081 In the second part of the debugging output, the part of common which is put
1082 back is separated by C<┋>.
1083
1084 When bit 0x80 is set, much more lower-level debugging info is printed. The
1085 arrays at separate depth mean: group number, priority, not-cased-pair, layer
1086 number, subgroup, is-uc. When bit 0x100 is set, the debugging output for
1087 combining atomic mogrifiers is enabled.
1088
1089 =head2 Personalities
1090
1091 A personality C<NAME> is defined in the section C<faces/NAME>. (C<NAME> may
1092 include slashes - untested???)
1093
1094 An array C<layers> gives the list of layers forming the face. (As of version
1095 0.03, only 2 layers are supported.) The string C<LinkFace> is a “fallback”
1096 face: if a keypress is not defined by C<layers>, it would be taken from
1097 C<LinkFace>; additionally, it affects the C<Compose> key bindings: for example,
1098 if C<LinkFace> has C<g> where C<layers> has C<γ>, and there is a binding for
1099 C<Compose g>, the same binding applies for C<Compose γ>.
1100
1101 TBC .........
1102
1103 =head2 Substitutions
1104
1105 In section C<Substitutions> one defines composition rules which may be
1106 used on par with composition rules extracted from I<Unicode Character Database>.
1107 An array C<FOO> is converted to a hash accessible as C<< <subst-FOO> >> from
1108 a C<Diacritic> filter of satellite face processor. An element of the the array
1109 must consist of two characters (the first is mapped to the second one). If
1110 both characters have upper-case variants, the translation between these variants
1111 is also included.
1112
1113 =head2 Classification of diacritics
1114
1115 The section C<Diacritics> contains arrays each describing a class of
1116 diacritic marks. Each array may contain up to 7 elements, each
1117 consising of diacritic marks in the order of similarity to the
1118 "principal" mark of the array. Combining characters may be
1119 preceded by horizontal space. Seven elements should contain:
1120
1121 Surrogate chars; 8bit chars; Modifiers
1122 Modifiers below (or above if the base char is below)
1123 Vertical (or Comma-like or Doubled or Dotlike or Rotated or letter-like) Modifiers
1124 Prime-like or Centered modifiers
1125 Combining
1126 Combining below (or above if base char is below)
1127 Vertical combining and dotlike Combining
1128
1129 These lists determine what a C<Mutate2Self> filter of satellite face processor
1130 will produce when followed by whitespace characters
1131 (possibly with modifiers) C<SPACE ENTER TAB BACKSPACE>. (So, if F<.kbdd> file
1132 uses C<Mutate2Self>) this determines what diacritic prefix keys produce.
1133
1134 =head2 Compose Key
1135
1136 The scalar configuration variable C<ComposeKey> controls the ID of the prefix
1137 key to access F<.Compose> composition rules. The rules are read from files
1138 in the class/object variable; set this variable with
1139
1140 $self->set__value('ComposeFiles', [@Files]); # Class name (instead of $self) is OK here
1141
1142 The format of the files is the same as for X11’s F<.Compose> (but C<includes> are
1143 not supported); only compositions starting with C<< <Multi_Key> >>, having no
1144 deadkeys, and (on Windows) expanding to 1 UTF-16 codepoint are processed. (See
1145 L<“systematic” parts of rules in the standard
1146 F<.XCompose>|"“Systematic” parts of rules in a few .XCompose"> — see lines with postfix C<s>.)
1147
1148 Repeating this prefix twice accesses characters via their HTML/MathML entity names. The files
1149 are as above (the variable name is C<EntityFiles>); the format is the same as in
1150 F<bycodes.html>.
1151
1152 Repeating this prefix 3 times accesses characters via their C<rfc1345> codes;
1153 the variable C<rfc1345Files> contains files in the format of F<rfc1345.html>.
1154 It is recommended to download these files (or the later flavors)
1155
1156 http://www.x.org/releases/X11R7.6/doc/libX11/Compose/en_US.UTF-8.html
1157 http://www.w3.org/TR/xml-entity-names/bycodes.html
1158 http://tools.ietf.org/html/rfc1345
1159
1160 See L<"SYNOPSIS"> for an example. Note that this mechanism does not assign this
1161 prefix key to any particular position on the keyboard layout; this should be
1162 done elsewhere. Implementation detail: if some of these 3 maps cannot be created,
1163 they are skipped (so less than 3 chained maps are created).
1164
1165 For more control, one can make this configuration variable into an array. The
1166 value C<KEY> is equivalent to the array with elements
1167
1168 ComposeFiles,dotcompose,warn,KEY
1169 EntityFiles,entity,warn,,KEY
1170 rfc1345Files,rfc1345,warn,,KEY
1171
1172 Five comma-separated fields are: the variable controlling the filelist,
1173 the type of files in the filelist (in addition to 3 listed types only the
1174 type C<literal> — see below — is supported now), whether to warn when a particular flavor
1175 of composition table could not be loaded, the global access prefix, the prefix
1176 for access from the previous element (chained access), pre-previous etc.
1177
1178 If C<ComposeFiles> (etc.) has more than 1 file, bindings from earlier files
1179 take precedence over bindings from the later ones. If the same sequence is
1180 bound several times inside a file, a later binding takes precedence.
1181
1182 For the type C<literal>, the first element of these 5 gives the bindings separated
1183 by C<|||>; if an empty binding is present (as in C<⎄=>), it should be the only one.
1184 Each binding is the output, followed by C<=>, followed by the accessor keys.
1185
1186 =head2 Names of prefix keys
1187
1188 Section C<DEADKEYS> defines naming of prefix keys. If not named there (or in
1189 processed F<.klc> files), the C<PrefixDocs> property will be used; if none,
1190 Unicode name of the character will be used.
1191
1192 =head2 More than 2 layers and/or exotic modifier keys
1193
1194 This is controlled by C<output_layers>, C<mods_keys_KBD>, C<modkeys_vk> and C<layers_mods_keys>
1195 configuration arrays. The array C<modkeys_vk> is converted to a hash mapping “a new symbol”
1196 (arbitrary) for a modifier key to the tail of the corresponding Windows’ C<VK_>-code.
1197 For example, one can request that the modifier key known to this F<.kbdd> file as C<rM> is
1198 triggered by C<VK_RGROUPSHIFT> (likewise for C<M>) by using the array
1199
1200 @modkeys_vk=M,GROUPSHIFT,rM,RGROUPSHIFT
1201
1202 C<@mods_keys_KBD> describes
1203 L<the C<KBD>-bits in the Windows’ key-modifers-bitmap|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">
1204 raised by every modifier. This array is converted to a hash, the keys can be one of C<S C A>
1205 (for C<Shift>, C<Ctrl>, C<Alt>) possibly prepended by C<l> or C<r> (for “left” and “right”
1206 flavors), as well as the keys defined in C<modkeys_vk> hash. The values are combinations
1207 of C<S C A K X Y Z T U V W> (for bits from 0x001 to 0x400); the bits C<X Y> have aliases
1208 C<R L> (for C<Roya> and C<Loya>).
1209
1210 For example,
1211
1212 @mods_keys_KBD=lC,CL,lA,AK,rA,CALZ,M,CAT,rC,CAR
1213
1214 describes the bindings from L<"A convenient assignment of KBD* bitmaps to modifier keys">.
1215
1216 C<@layers_mods_keys> is the list giving the collection of modifiers keys (such as C<lA>, C<C> or C<rC>, etc.)
1217 triggering the given layer. (Since a layer already covers two states of C<Shift> key, it should not appear.)
1218 For example, if layer 0 is the default (no modifiers), layer 1 is triggered by C<AltGr> (which is C<rA> as “right-C<Alt>),
1219 and layer 2 is triggered by C<AltGr-Menu> (with C<Menu> known to this C<.kbdd> as C<M> — defined by C<@modkeys_vk>), then use
1220
1221 @layers_mods_keys=,rA,rAM
1222
1223 (We do not describe here how to redefine C<Menu> key to send C<VK_RGROUPSHIFT>; currently one seems to need to edit the
1224 generated C<.h> file; TBC ..................................)
1225
1226 Finally, C<@output_layers> describes how to “fill” these layers. Currently, the elements may be numbers (the ordinal of the layer
1227 of the current face), or have the form C<prefixNOTSAME=HEX> or C<prefixNOTSAMEcase=HEX> or C<prefix=HEX>. Here C<HEX> (such as
1228 C<9f03>) is the “id” of a diacritic defined elsewhere in the F<.kbdd> file. (For example, by defining C<DeadKey_Map9f03>.)
1229
1230 @output_layers=0,1,prefixNOTSAME=9f03
1231
1232 These “fake” prefix keys are considered to be “fake” and are not emitted “as prefix keys” in the generated C<MSKLC> keyboard
1233 description.
1234
1235 With C<NOTSAME>, the layers of the C<HEX>-face are “squeezed” into one layer. For this, whatever is accessible anywhere on the
1236 “non-extra” layers of the base face is considered “free”, so the content of the higher layers of the C<HEX>-face may be “moved to
1237 its 0th layer”. Moreover (unless C<case> is specified), if C<key> and C<AltGr-key> are “not free”, but C<Shift-key> is “free”, then
1238 the content of C<AltGr-key> is moved to the C<Shift-key>.
1239
1240 =head2 Apple keyboards
1241
1242 The mneumonics (“terminator”) shown after C<AltGr_Invert>-prefix or C<Compose>-prefix keys are pressed are controlled by the
1243 settings C<AltGr_Invert_Show> and C<ComposeKey_Show>. For other prefix keys this is controlled by C<Show[NNNN]> directive on the
1244 C<DeadKey_Map> descriptor.
1245
1246 The name of the layout is controlled via C<LAYOUTNAME> with C<OSX_ADD_VERSION>, or by C<OSX_LAYOUTNAME>.
1247
1248 Duplication of keys on Mac is controlled by the setting C<@Apple_Duplicate> (has a sane default: C<PC_Menu>, C<F20> duplicate
1249 ISO-keys, etc.). The format is TBC .................
1250
1251 Extra Apple bindings may be inserted by (temporarily???) C<Apple_Override> (by C<Mods+VK> or by C<Prefix+Char>). TBC .........
1252
1253 =head2 More settings describing the keyboard
1254
1255 C<CapsLOCKoverride>: Face recipe to use where the “naive rules” of behaviour of C<CapsLock> are not enough. It is enough if
1256 this recipe defines only the “tricky” positions: the positions in the map which should be affected by C<CapsLock> in the way that
1257 this module cannot deduce.
1258
1259 C<AltGrInv_AltGr_as_Ctrl>: not used???!!!
1260
1261 C<@skip_extra_layers_WIN>: lists C<VK_>-codes (with C<VK_> omitted) of keys on which “extra layers” should be ignored.
1262
1263 C<Prefix_Base_Altern>: the recipe for the face used on Windows as an “alternative base” for generation of prefix key maps. For
1264 example, when we want to access the binding at the position of C<F9>-key of the target keymap, but the base face does not
1265 emit anything at this position, on Windows such position is not accessible. However, if C<Kana-F9> emits a string, then
1266 using the face for C<Kana->prefix as C<Prefix_Base_Altern> allows pressing C<Kana-F9> after the prefix key to reach the binding
1267 at the position of C<F9>.
1268
1269 C<WindowsEmitDeadkeyDescrREX> matches the DeadKey descriptions to not include into the generated DLL (to save space).
1270 See L<Windows’ limits for size of the layout DLL|"If data in KEYNAME_DEAD takes too much space, keyboard is mis-installed, and “Language Bar” goes crazy">.
1271 (A nice value with a lot of Compose bindings is C<< ^(?!.*\bCompose\s+(Compose\b|(?!key)\S+)) >>.)
1272
1273 For “unusual” keys, one can use the C<VK> subsection of the face to describe
1274 its scancode. The keys in this subsection are C<VK_>-names (with omitted C<VK_>), they all define arrays.
1275 the first entry in the array is the scancode. (Or it may be a list of scancodes, separated by C<|>. The last scancode is
1276 “the main one” — if there are bindings, this scancode is used on the line of the C<LAYOUT> section of the emitted F<.kbdd> file.
1277 (Although this distinction is going to be eventually lost in the generated C<.C> file!)
1278 If the first entry is empty, the C<VK_>-code is translated to a scancode using the hardwired
1279 tables. The (optional) remaining entries are the bindings of this key (with the trailing C<@> denoting prefix keys), as in:
1280
1281 @SPACE=,0020,0138@,0192@,00a0@
1282
1283 defining C<Space> as emitting C<space=0x20> and C<Shift-Space> as the deadkey C<0x0138> (the following values are for the
1284 corresponding C<AltGr> bindings).
1285
1286 (This C<VK> subsection may be inherited from the [grand]parents of the given C<face/******> section.)
1287
1288 For more settings, such as C<@Prefix_Force_Altern> — as well as the settings listed below: TBC ..................
1289
1290 Diacritics_Limits/ALL
1291 [face_shortcuts]
1292
1293 ExtraScanCodesWin
1294 Auto_Diacritic_Start
1295 Flip_AltGr_Key
1296 Diacritic_if_undef
1297 DeadChar_DefaultTranslation
1298 DeadChar_32bitTranslation replacement char used (instead of "?") when a prefix map results in a multi-codepoint value
1299 (such values cannot be emitted on Windows) or when it is in AltGr-invertor map, and results
1300 in a prefix key which accesses this same prefix map (so this “gives a loop of length 1).
1301 faceDeadKeys
1302 ExportDeadKeys
1303 extra_report_DeadChar
1304 char2key_prefer_first
1305 char2key_prefer_last
1306 Import_Prefix_Keys (Amended by DeadKey_Add*** recipes)
1307 chainAltGr
1308 PrefixChains
1309 DeadKey_Map
1310 TableSummaryAddHTML
1311 faceDeadKeys2
1312 LayoutTable_add_double_prefix_keys
1313
1314 =head2 CAVEATS for German/French/BÉPO/Neo keyboards
1315
1316 Non-US keycaps: the character "a" is on C<(VK_)A>, but its scancode is now different.
1317 E.g., French's A is on 0x10, which is US's Q. Our table of scancodes is
1318 currently hardwired. Some pictures and tables are available on
1319
1320 http://bepo.fr/wiki/Pilote_Windows
1321
1322 With this module, the scancode and the C<VK_>-code for a position in a layout
1323 are calculated via the C<BaseLayer> configuration variable; the first recognized
1324 character at the given position of this layer is translated to
1325 the C<VK_>-code (using a hardwired table). The hardwired mapping of C<VK_>-codes
1326 to scancodes can be modified via the C<VK> subsection.
1327
1328 =head1 Keyboards: on ease of access (What makes an easy-to-use keyboard layout)
1329
1330 The content of this section has no I<direct> relationship to the functionality
1331 of this module. However, we feel that it is better that the user of this
1332 module understands these concerns. Moreover, it is these concerns which
1333 lead to the principles underlying the functionality of this module.
1334
1335 =head2 On the needs of keyboard layout users
1336
1337 Let's start with trivialities: different people have different needs
1338 with respect to keyboard layouts. For a moment, ignore the question
1339 of the repertoir of characters available via keyboard; then the most
1340 crucial distinction corresponds to a certain scale. In absense of
1341 a better word, we use a provisional name "the required typing speed".
1342
1343 One example of people on the "quick" (or "rabid"?) pole of this scale are
1344 people who type a lot of text which is either "already prepared", or for
1345 which the "quality of prose" is not crucial. Quite often, these people may
1346 type in access of 100 words per minute. For them, the most important
1347 questions are of physical exhaustion from typing. The position
1348 of most frequent letters relative to the "rest" finger position, whether
1349 frequently typed together letters are on different hands (or at least
1350 not on the same/adjacent fingers), the distance fingers must travel
1351 when typing common words, how many keypresses are needed to reach
1352 a letter/symbol which is not "on the face fo the keyboard" - their
1353 primary concerns are of this kind.
1354
1355 On the other, "deliberate", pole these concerns cease to be crucial.
1356 On this pole are people who type while they "create" the text, and
1357 what takes most of their focus is this "creation" process. They may
1358 "polish their prose", or the text they write may be overburdened by
1359 special symbols - anyway, what they concentrate on is not the typing itself.
1360
1361 For them, the details of the keyboard layout are important mostly in
1362 the relation to how much they I<distract> the writer from the other
1363 things the writer is focused on. The primary question is now not
1364 "how easy it is to type this", but "how easy it is to I<recall> how
1365 to type this". The focus transfers from the mechanics of finger movements
1366 to the psycho/neuro/science of memory.
1367
1368 These questions are again multifaceted: there are symbols one encounters
1369 every minute; after you recall once how to access them, most probably
1370 you won't need to recall them again - until you have a long interval when
1371 you do not type. The situation is quite different with symbols you need
1372 once per week - most probably, each time you will need to call them again
1373 and again. If such rarely used symbols/letters are frequenct (since I<many>
1374 of them appear), it is important to have an easy way to find how to type them;
1375 on the other hand, probably there is very little need for this way to
1376 be easily memorizable. And for symbols which you need once per day, one needs
1377 both an easy way to find how to type them, I<and> the way to type them should
1378 better be easily memorizable.
1379
1380 Now add to this the fact that for different people (so: different usage
1381 scenarios) this division into "all the time/every minute/every day/every week"
1382 categories is going to be different. And one should not forget important
1383 scenario of going to vacation: when you return, you need to "reboot" your
1384 typing skills from the dormant state.
1385
1386 =head2 On “mixing” several “allied” layouts
1387
1388 On the other hand, note that the questions discussed above are more or less
1389 orthogonal: if the logic of recollection requires ω to be related in some
1390 way to the W-key,
1391 then it does not matter where the W-key is on the keyboard - the same logic
1392 is applicable to the QWERTY base layou t, or BÉPO one, or Colemak, or Dvorak.
1393 This module concerns itself I<only> with the questions of "consistency" and
1394 the related question of "the ease of recall"; we care only about which symbols
1395 relate to which "base keys", and do not care about where the base key sit on
1396 the physical keyboard.
1397
1398 B<EXCEPTIONS:> The “main island” of the keyboard contains a 4×10 rectangle
1399 of keys. So if a certain collection of special keys may be easily memorized
1400 as a rectangular table, it is nice to be able to map this table to the
1401 physical keyboard layout. This module contains tool making this task easy.
1402
1403 Now consider the question of the character repertoir: a person may need ways
1404 to type "continuously" in several languages; quite often one must must type
1405 a “standalone” foreign word in a sentence; in addition to this, there may
1406 be a need to I<occasionally> type "standalone" characters or symbols outside
1407 the repertoir of these languages. Moreover, these languages may use different
1408 scripts (such as Polish/Bulgarian/Greek/Arabic/Japanese), or may share a
1409 "bulk" of their characters, and differ only in some "exceptional letters".
1410 To add insult to injury, these "exceptional letters" may be rare in the language
1411 (such as ÿ in French or à in Swedish) or may have a significant letter frequency
1412 (such as é in French) or be somewhere in between (such as ñ in Spanish).
1413
1414 And the non-language symbols do not need to be the I<math> symbols (although
1415 often they are). An Engish-language discussion of etimology at the coffee table
1416 may lead to a need to write down a word in polytonic greek, or old norse;
1417 next moment one would need to write a phonetic transcription in IPA/APA
1418 symbols. A discussion of keyboard layout may involve writing down symbols
1419 for non-character keys of the keyboard. A typography freak would optimize
1420 a document by fine-tuned whitespaces. Almost everybody needs arrows symbols,
1421 and many people would use box drawing characters if they had a simple access
1422 to them.
1423
1424 Essentially, this means that as far as it does not impacts other accessibility
1425 goals, it makes sense to have unified memorizable access to as many
1426 symbols/characters as possible. (An example of impacting other aspects:
1427 MicroSoft's (and IBM's) "US International" keyboards steal characters C<`~'^">:
1428 typing them produces "unexpected results" - they are deadkeys. This
1429 significantly simplifies entering characters with accents, but makes it
1430 harder to enter non-accented characters.)
1431
1432 =head2 The simplest rules of design of “large” keyboard layouts
1433
1434 One of the most known principles of design of human-machine interaction
1435 is that "simple common tasks should be simple to perform, and complicated
1436 tasks should be possible to perform". I strongly disagree with this
1437 principle - IMO, it lacks a very important component: "a gradual increase
1438 in complexity". When a certain way of doing things is easy to perform, and another
1439 similar way is still "possible to perform", but on a very elevated level
1440 of complexity, this leads to a significant psychological barrier erected
1441 between these two ways. Even when switching from the first way to the other one
1442 has significant benefits, this barrier leads to self-censorship. Essentially,
1443 people will
1444 ignore the benefits even if they exceed the penalty of "the elevated level of
1445 complexity" mentioned above. And IMO self-censorship is the worst type of
1446 censorship. (There is a certain similarity between this situation and that
1447 of "self-fulfilled prophesies". "People won't want to do this, so I would not
1448 make it simpler to do" - and now people do not want to do this...)
1449
1450 So I would add another clause to the law above: "and moderately complicated
1451 tasks should remain moderately hard to perform". What does it tell us in
1452 the situation of keyboard layout? One can separate several levels of
1453 complexity.
1454
1455 =over 10
1456
1457 =item Basic:
1458
1459 There should be some "base keyboards": keyboard layouts used for continuous
1460 typing in a certain language or script. Access from one base keyboard to
1461 letters of another should be as simple as possible.
1462
1463 =item By parts:
1464
1465 If a symbol can be thought of as a combination of certain symbols accessible
1466 on the base keyboard, one should be able to "compose" the symbol: enter it
1467 by typing a certain "composition prefix" key then the combination (as far
1468 as the combination is unambiguously associated to one symbol).
1469
1470 The "thoughts" above should be either obvious (as in "combining a and e should
1471 give æ") or governed by simple mneumonic rules; the rules should cover as
1472 wide a range as possible (as in "Greek/Coptic/Hebrew/Russian letters are
1473 combined as G/C/H/R and the corresponding Latin letter; the correspondence is
1474 phonetic, or, in presence of conflicts, visual").
1475
1476 =item Quick access:
1477
1478 As many non-basic letters as possible (of those expected to appear often)
1479 should be available via shortcuts. Same should be applicable to starting
1480 sequences of composition rules (such as "instead of typing C<StartCompose>
1481 and C<'> one can type C<AltGr-'>).
1482
1483 =item Smart access
1484
1485 Certain non-basic characters may be accessible by shortcuts which are not
1486 based on composition rules. However, these shortcuts should be deducible
1487 by using simple mneumonic rules (such as "to get a vowel with `-accent,
1488 type C<AltGr>-key with the physical keyboard's key sitting below the vowel key").
1489
1490 =item Superdeath:
1491
1492 If everything else fails, the user should be able to enter a character by
1493 its Unicode number (preferably in the most frequently referenced format:
1494 hexadecimal).
1495
1496 =back
1497
1498 =over
1499
1500 B<NOTE:> This does not seem to be easily achievable, but it looks like a very nifty
1501 UI: a certain HotKey is reserved (e.g., C<AltGr-AppMenu>);
1502 when it is tapped, and a character-key is pressed (for example, B<B>) a
1503 menu-driven interface pops up where user may navigate to different variants
1504 of B, Beta, etc - each of variants with a hotkey to reach I<NOW>, and with
1505 instructions how to reach it later from the keyboard without this UI.
1506
1507 Also: if a certain timeout passes after pressing the initial HotKey, an instruction
1508 what to do next should appear.
1509
1510 =back
1511
1512 =head2 The finer rules of design of “large” keyboard layouts
1513
1514 Here are the finer points elaborating on the levels of complexity discussed above:
1515
1516 =over 4
1517
1518 =item 1
1519
1520 It looks reasonable to allow "fuzzy mneumonic rules": the rules which specify
1521 several possible variants where to look for the shortcut (up to 3-4 variants).
1522 If/when one forgets the keying of the shortcut, but remembers such a rule,
1523 a short experiment with these positions allows one to reconstruct the lost
1524 memory.
1525
1526 =item 2
1527
1528 The "base keyboards" (those used for continuous typing in a certain language
1529 or script) should be identical to some "standard" widely used keyboards.
1530 These keyboards should differ from each other in position of keys used by the
1531 scripts only; the "punctuation keys" should be in the same position. If a
1532 script B has more letters than a script A, then a lot of
1533 "punctuation" on the layout A will be replaced by letters in the layout B.
1534 This missing punctuation should be made available by pressing a modifier
1535 (C<AltGr>? compare with L<MicroSoft's Vietnamese keyboard|http://www.microsoft.com/resources/msdn/goglobal/keyboards/kbdvntc.html>'s top row).
1536
1537 =item 3
1538
1539 If more than one base keyboard is used, there must be a quick access:
1540 if one needs to enter one letter from layout B when the active layout is A, one
1541 should not be forced to switch to B, type the letter, then switch back
1542 to A. It should better be available I<also> on a prefixed combination "C<Quick_Access_Key letter>".
1543
1544 =item 4
1545
1546 One should consider what the C<Quick_Access_Key> does when the layouts A
1547 and B are identical on a particular key (e.g., punctuation). One can go with the "Occam's
1548 razor" approach and make the C<Quick_Access_Key> prefix into the do-nothing identity map.
1549 The alternative is make it access some symbols useful both for
1550 script A and script B. It is a judgement call.
1551
1552 Note that there is a gray area when layouts A and B are not identical,
1553 but a key C<K> produces punctuation in layout A, and a letter in layout
1554 B. Then when in layout B, this punctuation is available on C<AltGr-key>,
1555 so, in principle, C<Quick_Access_Key> would duplicate the functionality
1556 of C<AltGr>. Compare with "there is more than one way to do it" below;
1557 remember that OS (or misbehaving applications) may make some keypresses
1558 "unavailable". I feel that in these situations, “having duplication” is
1559 a significant advantage over “having some extra symbols available”.
1560
1561 =item 5
1562
1563 The considerations in two preceding parts are applicable also in the
1564 case when there are more “allied” layouts than A and B. Ways to make it possible
1565 are numerous: one can have several alternative C<Quick_Access_Key>’s, B<and> one
1566 can use a I<repeated> prefix key C<Quick_Access_Key>. With a large enough
1567 collection of layouts, a combination of both approaches may be visualized
1568 as a chain of layout
1569
1570 S< >… C<L_Quick³ L_Quick² L_Quick> B<Base> C<R_Quick R_Quick² R_Quick³> …
1571
1572 here we have two quick access prefix keys, the left one C<L_Quick>, and the right one
1573 C<R_Quick>. Superscripts C<² ³ …> mean “pressing the prefix key several times”;
1574 the prefix keys move one left/right along the chain of layouts.
1575
1576 =item 6
1577
1578 The three preceding parts were concerned with entering one character from
1579 an “allied” layout. To address another frequent need, entering one word
1580 from an “allied” layout, yet another approach may be needed. The solution may
1581 be to use a certain combination of modifier keys. (How to choose useful
1582 combinations? See: L<"A convenient assignment of KBD* bitmaps to modifier keys">.)
1583
1584 (Using “exotic” modifier keys may be impossible in some badly coded applications.
1585 This should not stop one from implementing this feature: sometimes one has a choice
1586 from several applications performing the same task. Moreover, since this feature
1587 is a “frill”, there is no pressing need to have it I<always> available.)
1588
1589 =item 7
1590
1591 Paired symbols (such as such as ≤≥, «», ‹›, “”, ‘’ should be put on paired
1592 keyboard's keys: <> or [] or ().
1593
1594 =item 8
1595
1596 "Directional symbols" (such as arrows) should be put either on numeric keypad
1597 or on a 3×3 subgrid on the letter-part of the keyboard (such as QWE/ASD/ZXC).
1598 (Compare with [broken?] implementation in L<Neo2|http://www.mzuther.de/en/contents/osd-neo2>.)
1599
1600 =item 9
1601
1602 for symbols that are naturally thought of as sitting in a table, one can
1603 create intuitive mapping of quite large tables to the keyboard. Split each
1604 key in halves by a horizontal line, think of C<Shift-key> as sitting in the
1605 top half. Then ignoring C<`~> key and most of punctuation on the right
1606 hand side, keyboard becomes an 8×10 grid. Taking into account C<AltGr>
1607 modifier (either as an extra bit, or as splitting a key by a horizontal line),
1608 one can map up to 8×10×2 (or 8×20) table to a keyboard.
1609
1610 B<Example:> Think of L<IPA consonants|http://en.wikipedia.org/wiki/International_Phonetic_Alphabet#Consonants>.
1611
1612 =item 10
1613
1614 Cheatsheets are useful. And there are people who are ready to dedicate a
1615 piece of their memory to where on a layout is a particularly useful to them
1616 symbol. So even if there is no logical position for a certain symbol, but
1617 there is an empty slot on layout, one should not hesitate in using this slot.
1618
1619 However, this I<will be> distractive to people who do not want to dedicate
1620 their memory to "special cases". So it makes sense to have three kinds of
1621 cheatsheets for layouts: one with special cases ignored (useful for most
1622 people), one with all general cases ignored (useful for checks "is this
1623 symbol available in some place I do not know about" and for memorization),
1624 and one with all the bells and whistles.
1625
1626 (Currently this module allows emitting HTML keyboard layouts with such
1627 information indicated by classes in markup. The details may be treated
1628 by the CSS rules.)
1629
1630 =item 11
1631
1632 "There is more than one way to do it" is not a defect, it is an asset.
1633 If it is a reasonable expectation to find a symbol X on keypress K', and
1634 the same holds for keypress K'' I<and> they both do not conflict with other
1635 "being intuitive" goals, go with both variants. Same for 3 variants, 4
1636 - now you get my point.
1637
1638 B<Example:> The standard Russian phonetic layout has Ё on the C<^>-key; on the
1639 other hand, Ё is a variant of Е; so it makes sense to have Ё available on
1640 C<AltGr-Е> as well. Same for Ъ and Ь.
1641
1642 =item 12
1643
1644 Dead keys which are "abstract" (as opposed to being related to letters
1645 engraved on physical keyboard) should better be put on modified state
1646 of "zombie" keys of the keyboard (C<SPACE>, C<TAB>, C<CAPSLOCK>, C<MENU_ACCESS>).
1647
1648 B<NOTE:> Making C<Shift-Space> a prefix key may lead to usability issues
1649 for people used to type CAPITALIZED PHRASES by keeping C<Shift> pressed
1650 all the time. As a minimum, the symbols accessed via C<Shift-SPACE key>
1651 should be strikingly different from those produced by C<key> so that
1652 such problems are noted ASAP. Example: on the first sight, producing
1653 C<NO-BREAK SPACE> on C<Shift-Space Shift-Space> or C<Shift-Space Space>
1654 looks like a good idea. Do not do this: the visually undistinguishable
1655 C<NO-BREAK SPACE> would lead to significantly hard-to-debug problems if
1656 it was unintentional.
1657
1658 =back
1659
1660
1661 =head2 Explanation of keyboard layout terms used in the docs
1662
1663 The aim of this module is to make keyboard layout design as simple as
1664 possible. It turns out that even very elaborate designs can be made
1665 quickly and the process is not very error-prone. It looks like certain
1666 venues not tried before are now made possible; at least I'm not aware of
1667 other attempts in this direction. One can make layouts which can be
1668 "explained" very concisely, while they contain thousand(s) of accessible
1669 letters.
1670
1671 Unfortunately, being on unchartered territories, in my explanations I'm
1672 forced to use home-grown terms. So be patient with me... The terms are
1673 I<keyboard layout group>, I<keyboard>, I<face> and I<layer>. (One may want compare them
1674 with what ISO 9995 does: L<http://en.wikipedia.org/wiki/ISO/IEC_9995>…. On
1675 the other hand, most parts of ISO 9995 look as remote from being ergonomic
1676 [in the sense discussed in these sections] as one may imagine!)
1677
1678 In what follows,
1679 the words I<letter> and I<character> are used interchangeably. A I<key>
1680 means a physical key on a keyboard tapped (possibly together with
1681 one of modifiers C<Shift>, C<AltGr> - or, rarely, L<[right] C<Control>|http://www.microsoft.com/resources/msdn/goglobal/keyboards/kbdcan.html>;
1682 more advanced layouts may use “extra” modifiers). The key C<AltGr>
1683 is often marked as such on the keycap, otherwise it is just the "right" C<Alt> key; at least
1684 on Windows, for many simple layouts it can be replaced by C<Control-Alt>. What is a I<prefix key>?
1685 Tapping such a key does not produce any letter, but modifies what the next
1686 keypress would do (sometimes it is called a I<dead key>; in C<ISO 9995> terms,
1687 it is probably a I<latching key>. Sometimes, prefix keys may be “chained”; then
1688 insertion of a character happens not on the second keypress, but on the third one [or fourth/etc]).
1689
1690 To describe which character (or a prefix) is produced by a keypress one must describe
1691 I<the context>: which prefix keys were already tapped, and which modifier keys are
1692 currently pressed. It is natural to consider the C<Shift> modifier specially: let’s
1693 remove it from the context; now given a context, a keypress may produce two characters:
1694 one with C<Shift>, one without. A I<layer> describe such a pair of characters (or
1695 prefixes) for every key of the keyboard.
1696
1697 So, the plain I<layer> is the part of keyboard layout accessible by using only
1698 non-prefix keys (possibly in combination with C<Shift>). Many keyboard layouts
1699 have up to 2 additional layers accessible without prefix keys: the C<AltGr>-layer and C<Control>-layer.
1700
1701 On the simplest layouts, such as "US" or "Russian", there is no prefix keys or “extra”
1702 modifier keys -
1703 but this is only feasible for languages which use very few characters with
1704 diacritic marks. However, note that most layouts do not use
1705 C<Control>-layer - sometimes it is claimed that this causes problems with
1706 system/application interaction.
1707
1708 A I<face> consists of the layers of the layout accessible with a particular
1709 combination of prefix keys. The I<primary face> consists of the plain layer
1710 and “additional prefix-less layers” of the layout;
1711 it is the part of layout accessible without switching "sticky state" and
1712 without using prefix keys. There may be up to 3 layers (Plain, C<AltGr>, C<rightControl>)
1713 per face on the standard Windows keyboard layouts. A I<secondary face> is a face exposed after pressing
1714 a prefix key (or a chain of prefix keys).
1715
1716 A I<personality> is a collection of faces: the primary face, plus one face per
1717 a defined prefix-key (or a prefix chain). Finally, a I<keyboard layout group> is a collection of personalities
1718 (switchable by sticky keys [like C<CapsLock>] and/or in other system-specific ways)
1719 designed to work smoothly together. For example, in multi-script settings, there may be:
1720
1721 =over 4
1722
1723 =item *
1724
1725 one personality per script (e.g., Latin/Greek/Cyrillic/Arabic);
1726
1727 =item *
1728
1729 every personality may have several script-specific additional (“satellite”) faces (one per a particular diacritic for Latin
1730 personality, one for regional/historic “flavors” for Cyrillic personality, one per aspiration type for Greek personality, etc);
1731
1732 =item *
1733
1734 every personality may also have “liason” faces accessing the base faces of other personalities;
1735
1736 =item *
1737
1738 with chained prefixes, it is easy to design intuitive ways to access satellite faces of other personalities;
1739 then every personality will also contain the satellite faces of I<other> personalities (on different prefix chains!).
1740
1741 =item *
1742
1743 For access to “technical symbols” (currencies/math/IPA etc), the personalities may share a certain collection
1744 of faces assigned to the same prefix keys.
1745
1746 =back
1747
1748 =head2 Example of keyboard layout groups
1749
1750 Start with a I<very> elaborate example (it is more or less a simplified variant
1751 of the L<C<izKeys> layout|http://k.ilyaz.org>. A keyboard layout group may consist of
1752 phonetically matched Latin and Cyrillic personalities, and visually matched Greek
1753 and Math personalities. Several prefix-keys may be shared by all 4 of these
1754 personalities; in addition, there would be 4 prefix-keys allowing access to primary
1755 faces of these 4 personalities from other personalities of the group. Also, there
1756 may be specialised prefix keys tuned for particular need of entering Latin script,
1757 Cyrillic script, Greek script, and Math.
1758
1759 Suppose that there are 8 specialized-for-Latin prefix-keys (for example, name them
1760
1761 grave/tilde/hat/breve/ring_above/macron/acute/diaeresis
1762
1763 although in practice each one of them may do more than the name suggests).
1764 Then the Latin personality will have the following 13 faces:
1765
1766 Primary/Latin-Primary/Cyrillic-Primary/Greek-Primary/Math-Primary
1767 grave/tilde/hat/breve/ring_above/macron/acute/diaeresis
1768
1769 B<NOTE:> Here Latin-Primary is the face one gets when one presses
1770 the Access-Latin prefix-key when in Latin mode; it may be convenient to define
1771 it to be the same as Primary - or maybe not. For example, if one defines it
1772 to be Greek-Primary, then this prefix-key has a convenient semantic of flipping
1773 between Latin and Greek modes for the next typed character: when in
1774 Latin, C<Latin-PREFIX-KEY a> would enter α, when in Greek, the same keypresses
1775 [now meaning "Latin-PREFIX-KEY α"] would enter "a".
1776
1777 Assume that the only “extra” modifier used by the layout is C<AltGr>. Then each of
1778 these faces would consists of two layers: the plain one, and the C<AltGr>-
1779 one. For example, pressing C<AltGr> with a key on Greek face could add
1780 diaeresis to a vowel, or use a modified ("final" or "symbol") "glyph" for
1781 a consonant (as in σ/ς θ/ϑ). Or, on Latin face, C<AltGr-a> may produce æ. Or, on a
1782 Cyrillic personality, AltGr-я (ya) may produce ѣ (yat').
1783
1784 Likewise, the Greek personality may define special prefix-keys to access polytonic
1785 greek vowels. “Chaining” these prefix keys after the C<Greek-Primary> prefix
1786 key would make it possible to enter polytonic Greek letters from non-Greek
1787 personalities without switching to the Greek personality.
1788
1789 With such a keyboard layout group, to type one Greek word in a Cyrillic text one
1790 would switch to the Greek personality, then back to Cyrillic; but when all one
1791 need to type now is only one Greek letter, it may be easier to use the
1792 "Greek-PREFIX-KEY letter" combination, and save switching back to the
1793 Cyrillic personality. (Of course, for this to work the letter should be
1794 on the primary face of the Greek personality.)
1795
1796 How to make it possible to easily enter a short Greek word when in Cyrillic mode?
1797 If one uses one more “extra” modifier key (say, C<ApplicationMenu>), one could
1798 reserve combinations of modifiers with this key to “use” other personality. Say,
1799 C<ApplicationMenu-b> would enter Greek β, C<AltGr-ApplicationMenu-b> would enter
1800 Cyrillic б, etc.
1801
1802 =head2 “Onion rings” approach to keyboard layout groups
1803
1804 Looks too complicated? Try to think about it in a different way: there
1805 are many faces in a keyboard layout group; break them into 3 "onion rings":
1806
1807 =over 4
1808
1809 =item I<CORE> faces
1810
1811 one can "switch to a such a face" and type continuously using
1812 this face without pressing prefix keys. In other words, these faces
1813 can be made "active" (in an OS-dependent way).
1814
1815 When one CORE face is active, the letters in another CORE face are still
1816 accessible by pressing one particular prefix key before each of these
1817 letters. This prefix key does not depend on which core face is
1818 currently "active".
1819
1820 =item I<Universally accessible> faces
1821
1822 one cannot "switch to them", however, letters
1823 in these faces are accessible by pressing one particular prefix key
1824 before this letter. This prefix key does not depend on which
1825 core face is currently "active".
1826
1827 =item I<satellite> faces
1828
1829 one cannot "switch to them", and letters in these faces
1830 are accessible from one particular core face only. One must press a
1831 prefix key before every letter in such faces.
1832
1833 (In presence of “chained prefixes”, the description is less direct:
1834 these faces are much easier to access from one particular CORE face.
1835 From another CORE face, one must preceed this prefix key by the
1836 access-that-CORE-face prefix.)
1837
1838 =back
1839
1840 For example, when entering a mix of Latin/Cyrillic scripts and math,
1841 it makes sense to make the base-Latin and base-Cyrillic faces into
1842 the core; it is convenient when (several) Math faces and a Greek face
1843 can be made universally accessible. On the other hand, faces containing
1844 diacritized Latin letters and diacritized Cyrillic letters should better
1845 be made satellite; this avoids a proliferation of prefix keys which would
1846 make typing slower.
1847
1848 Comparing to the terms of the preceding section, the CORE faces correspond
1849 to personalities. A personality I<imports> the base face from other personalities;
1850 it may also import satellite faces from other personalities.
1851
1852 In a personality, one should make access to satellite faces, the imported
1853 CORE faces, and the universally accessible faces as simple as possible.
1854 If “other” satellite faces are imported, the access to them may be more
1855 cumbersome.
1856
1857 =head2 Large Latin layouts: on access to diacritic marks
1858
1859 Every prefix key has a numeric I<ID>. On Windows, there are situations
1860 when this numeric ID may be visible to the user. (This module makes every
1861 effort to make this happen as rarely as possible. However, this effort
1862 blows up the size of the layout DLL, and at some moment one may hit the
1863 L<Windows’ limits for size of the layout DLL|"If data in KEYNAME_DEAD takes too much space, keyboard is mis-installed, and “Language Bar” goes crazy">.
1864 To reduce the size of the DLL, the module makes a triage, and won’t protect the ID from leaking in some rare cases.)
1865 When such a leak happens, what the user sees is the character with this codepoint.
1866 So it makes sense to choose the ID to be the codepoint of a character “related
1867 to what the prefix key ‘does’”.
1868
1869 The logic: if the prefix keys add some diacritic, the ID should be the
1870 I<primary non-ASCII spacing modifier letter> related to this diacritic: either
1871 C<Latin-1>’s 8-bit characters with high bit set, or
1872 if none with the needed glyph, suitable non-Latin-1 "spacing modifier letters" or
1873 "spacing clones of diacritics".
1874
1875 If followed by “special keys”, one should be able to access other related
1876 modifier letters and combining characters (see L<"Classification of diacritics">
1877 and the section C<Diacritics> in L<the example
1878 layout|https://search.cpan.org/~ilyaz/UI-KeyboardLayout/examples/izKeys.kbdd>);
1879 one possible convenient choice is:
1880
1881 =over 4
1882
1883 =item The second press of the prefix key
1884
1885 The principal combining mark;
1886
1887 =item SPACE
1888
1889 The primary non-ASCII spacing modifier letter;
1890
1891 =item SPACE-related (NBSP, or C<Shift-SPACE>, or C<AltGr-SPACE>)
1892
1893 The secondary/ternary/etc modifier letter;
1894
1895 =item digits (possibly with C<Shift> and/or C<AltGr>)
1896
1897 related combining marks (with C<Shift> and/or C<AltGr>, other categories
1898 from L<"Classification of diacritics">).
1899
1900 =item C<'> or C<"> (possibly with C<AltGr>)
1901
1902 secondary/ternary/etc combining marks (or, if these are on
1903 digits, replace by prime-shape modifier chars).
1904
1905 =back
1906
1907 =head2 The choice of prefix keys
1908
1909 Some stats on prefix keys: C<ISO 9995-3> uses 41 prefix keys for diacritics (but 15 are fake, see below!);
1910 L<Apple’s C<US Extended> uses 24|http://www.macfreek.nl/memory/Mac_Keyboard_Layout> (not counting prefix №, action=specials
1911 on L<the code for this layout|https://raw.github.com/lreddie/ukelele-steps/master/USExtended.keylayout>:
1912
1913 "'@2#3%5^67*8AaCcEeGghHjJ KkMmNnQqRrsUuvwWYyZz‘’“ default=terminator
1914 №ʺʹƧƨƐɛƼƽƄƅ⁊ȢȣƏəƆɔƎǝƔɣƕǶƞȠ K’ĸƜɯŊŋƢƣƦʀſƱʊʌƿǷȜȝƷʒʻʼʽ №
1915
1916 ); bépo uses 20, while EurKey uses 8, and L<Apple’s C<US> uses 5|http://www.macfreek.nl/memory/Mac_Keyboard_Layout>.
1917 On the other end of spectrum, there are 10 US keyboard keys with "calculatable" relation to Latin diacritics:
1918
1919 `~^-'",./? --- grave/tilde/hat/macron/acute/diaeresis/cedilla/dot/stroke/hook-above
1920
1921 To this list one may add a "calculatable" key C<$> as I<the currency prefix>;
1922 on the other hand, one should probably remove C<?> since C<AltGr-?> should better
1923 be "set in stone" to denote C<¿>. If one adds Greek, then the calculatable positions
1924 for aspiration are on C<[ ]> (or on C<( )>). Of widely used Latin diacritics, this
1925 leaves out I<ring/hacek/breve/horn/ogonek/comma> (and doubled I<grave/acute>);
1926 these diacritics should be either “mixed in” with similar "calculatable" diacritics
1927 (for example, <AltGr-,> may either create a character with cedilla, or with
1928 ogonek — depending on the character), or should be assigned on less intuitive positions.
1929
1930 Extra prefix keys of L<C<ISO 9995-3>|http://www.pentzlin.com/info2-9995-3-V3.pdf>:
1931 I<breve↓/circumflex↓/comma↑/dot↓/↺breve/long-solidus/low-line/macron↓/short-stroke/vertical-line↑↓>.
1932 Additionally, the following diacritics produce only 4 precomposed characters: ṲṳḀḁ, so their use as prefix characters is questionable:
1933 I<candrabindu/comma↗↓/diaeresis↓/²breve(↓)/²↺breve/²macron(↓)/²tilde/²vertical-line↑↓/=↓/hook↑/ring↓>
1934 (Here ↓ is a shortcut for C<below>, same with ↑ for C<above>, and ↗ for C<above right>; ↺ means C<inverted>, and ² means C<double>.
1935 Combined arrows expand to multiple diacritics.)
1936
1937 (Keep in mind that this list is just a conjecture; the standard does not distinguish combining characters
1938 and prefix keys, so it is not clear which keypresses produce combining characters, and which are prefix keys.)
1939
1940 =head2 What follows is partially deprecated
1941
1942 Parts of following subsections is better explained in
1943 L<visual description of the izKeys layout|http://k.ilyaz.org/iz/windows/izKeys-visual-maps.html>;
1944 some other parts duplicate
1945
1946 =head2 On principles of intuitive design of Latin keyboard
1947
1948 Using tricks described below, it is easy to create a convenient map of vowels
1949 with 3 diacritics `¨´ to the QWERTY keyboad. However, some common
1950 (meaning: from Latin-1–10 of ISO 8859) letters from Latin alphabet
1951 cannot be composed this way; they are B<ÆÐÞÇIJØŒß>
1952 (one may need to add B<ªº>, as well as B<¡¿> for non-alphabetical symbols). It is crucial
1953 that these letters may be entered by an intuitively clear key of the keyboard.
1954 There is an obvious ASCII letter associated to each of these (e.g., B<T> associated to the thorn
1955 B<Þ>), and in the best world just pressing this letter with C<AltGr>-modifier
1956 would produce the desired symbol.
1957
1958 Note that ª may be associated to @; then º may be mapped to the nearby 2.
1959
1960 There is only one conflict: both B<Ø>,B<Œ> "want" to be entered as C<AltGr-O>;
1961 this is the ONLY piece of arbitrariness in the design so far. After
1962 resolving this conflict, C<AltGr>-keys B<!2ASDCTIO?> are assigned their meanings,
1963 and cannot carry other letters (call them the “stuck in stone keys”).
1964
1965 (Other keys "stuck in stone" are dead keys: it is important to have the
1966 glyph etched on these keyboard's keys similar to the task they perform.)
1967
1968 Then there are several non-alphabetical symbols accessible through ISO 8859
1969 encodings. Assigning them C<AltGr>- access is another important task to perform.
1970 Some of these symbols come in pairs, such as ≤≥, «», ‹›, “”, ‘’; it makes
1971 sense to assign them to paired keyboard's keys: <> or [] or ().
1972
1973 However, this task is in conflict of interests with yet another (!) task, so
1974 let us explain the needs answered by that task first.
1975
1976 One can always enter accented letters using dead keys; but many people desire a
1977 quickier way to access them, by just pressing AltGr-key (possibly with
1978 shift). The most primitive keyboard designs (such as IBM International
1979 or Apple’s US (Extended)
1980
1981 http://www.borgendale.com/uls.htm
1982 http://www.macfreek.nl/memory/Mac_Keyboard_Layout
1983
1984 ) omit this step and assign only the NECESSARY letters for AltGr- access.
1985 (Others, like MicroSoft International, assign only a very small set.)
1986
1987 This problem breaks into two tasks, choosing a repertoir of letters which
1988 will be typable this way, and map them to the keys of the keyboard.
1989 For example, EurKey choses to use ´¨`-accented characters B<AEUIO> (except
1990 for B<Ỳ>), plus B<ÅÑ>; MicroSoft International does C<ÄÅÉÚÍÓÖÁÑß> only (and IBM
1991 International does
1992 none); Bepo does only B<ÉÈÀÙŸ> (but also has the Azeri B<Ə> available - which is
1993 not in ISO 8819 - and has B<Ê> on the 105th key "C<2nd \|>"),
1994 L<Mac US|http://web.archive.org/web/20061126222551/http://homepage.mac.com/thgewecke/kblayout.jpg> has none
1995 (at least if one does not count uc characters without lc counterparts), same for L<Mac Extended|http://www.typophile.com/node/62127>
1996
1997 http://bepo.fr/wiki/Manuel
1998 http://bepo.fr/wiki/Utilisateur:Masaru # old version of .klc
1999 http://www.jlg-utilities.com/download/us_jlg.klc
2000 http://tlt.its.psu.edu/suggestions/international/accents/codemacext.html
2001 or look for "a graphic of the special characters" on
2002 http://web.archive.org/web/20080717203026/http://homepage.mac.com/thgewecke/mlingos9.html
2003
2004 =head2 Our solution
2005
2006 First, the answer (the alternative, illustrated description is on
2007 L<the visual maps list|http://k.ilyaz.org/windows/izKeys-visual-maps.html#altgr-latin>):
2008
2009 =over 10
2010
2011 =item Rule 0:
2012
2013 non-ASCII letters which are not accented by B<` ´ ¨ ˜ ˆ ˇ ° ¯ ⁄> are entered by
2014 C<AltGr>-keys "obviously associated" to them. Supported: B<ÆÐÞÇIJŒß>.
2015
2016 =item Rule 0a:
2017
2018 Same is applicable to B<Ê> and B<Ñ>.
2019
2020 =item Rule 1:
2021
2022 Vowels B<AEYUIO> accented by B<¨´`> are assigned the so called I<"natural position">:
2023 3 “alphabetic” rows of keyboard are allocated to accents (B<¨> is the top, B<´> is the middle, B<`> is
2024 the bottom row of 3 alphabetic-rows on keyboard - so B<À> is on B<ZXCV>-row),
2025 and are on the same diagonal as the base letter. For left-hand
2026 vowels (B<A>,B<E>) the diagonal is in the direction of \, for right hand
2027 voweles (B<Y>,B<U>,B<I>,B<O>) - in the direction of /.
2028
2029 =item Rule 1a:
2030
2031 If the "natural position" is occupied, the neighbor key in the
2032 direction of "the other diagonal" is chosen. (So for B<A>,B<E> it is
2033 the /-diagonal, and for right-hand vowels B<YUIO> it is the \-diag.)
2034
2035 =item Rule 1b:
2036
2037 This neighbor key is below unless the key is on bottom row - then it is above.
2038
2039 Supported by rules "1": all but B<ÏËỲ>.
2040
2041 =item Rule 2:
2042
2043 Additionally, B<Å>,B<Ø>,B<Ì> are available on keys B<R>,B<P>,B<V>.
2044 B<ª> is on B<@>, and B<º> is on the nearby B<2>.
2045
2046 =back
2047
2048 =head2 Clarification:
2049
2050 B<0.> If you remember only Rule 0, you still can enter all Latin-1 letter using
2051 Rule 0; all you need to remember that most of the dead keys are at “obvious”
2052 positions: for L<C<izKeys>|http://k.ilyaz.org> it is B<`';"~^.,-/> for B<`´¨¨˜ˆ°¸¯ ̸>
2053 (B<¨> is repeated on B<;">!) and B<6> for B<ˇ> (memorizable as “opposite” of B<^> for B<ˆ>).
2054
2055 (What the rule 0 actually says is: "You do not need to memorize me". ;-)
2056
2057 (If you need a diacritic which is only I<similar> to one of the listed diacritics,
2058 there is a good chance that the dead key above L<will do what you need|"On possibilities of merging 2 diacritics on one prefix key">.)
2059
2060 B<1.> If all you remember are rules 1,1a, you can calculate the position of the
2061 AltGr-key for AEYUIO accented by `´¨ up to a choice of 3 keys (the "natural
2062 key" and its 2 neighbors) - which are quick to try all if you forgot the
2063 precise position. If you remember rules 1,1ab, then this choice is down to
2064 2 possible candidates.
2065
2066 Essentially, all you must remember in details is that the "natural positions"
2067 form a B<V-shape> — \ on left, / on right, and in case of bad luck you
2068 should move in the direction of other diagonal one step. Then a letter is
2069 either in its "obvious position", or in one of 3 modifications of the
2070 “natural position”.
2071
2072 Note that these rules cover I<ALL> the Latin letters appearing in
2073 Latin-1..Latin-10, I<provided> we resolve the B<Œ/Ø>-conflict by putting B<Œ> to the key B<O> (since
2074 B<Ø> may be entered using C<AltGr->B</ O>)!
2075
2076 =head2 Motivations:
2077
2078 It is important to have a logical way to quickly understand whether a letter
2079 is quickly accessible from a keyboard, and on which key. (Or, maybe, to find
2080 a small set of keys on which a letter may be present — then, if one forgets,
2081 it is possible to quickly un-forget by trying a small number of keys).
2082
2083 In fact, the problem of choosing “the optimal” assignment (by minimizing the
2084 rules to remember) has almost unique solution. Understanding this solution
2085 (to a problem which is essentially combinatorial optimization) may be a great help
2086 in memorizing the rules.
2087
2088 The idea: we assign alphabetical Latin characters only to alphabetical keys
2089 on the keyboard; this frees the way to use (paired) symbol keys to enter (paired)
2090 Unicode symbols. Now observe the diagonals on the alphabetic part of the
2091 keyboard: \-diagonals (like B<EDC>) and /-diagonals (like B<UHB>). Each diagonal
2092 contains 3 (or less) alphabetic keys; what we want is to assign ¨-accent to the top
2093 one, ´-accent to the middle one, and `-accent to the bottom one.
2094
2095 On the left-hand part of the keyboard, use \-diagonals, on the right-hand
2096 part use /-diagonals; now each diagonal contains EXACTLY 3 alphabetic keys.
2097 Moreover, the diagonals which contain vowels B<AEYUIO> do not intersect!
2098
2099 If we have not decided to have keys set in stone, this would be all - we
2100 would get "completely predictable" access to B<´¨`>-accented characters B<AEUIO>.
2101 For example, B<Ÿ> would be accessible on C<AltGr->B<Y>, B<Ý> on C<AltGr->B<G>, B<Ỳ> on C<AltGr->B<V>.
2102 Unfortunately, the diagonals contain keys C<ASDCIO> set in stone. So we need
2103 a way to "move away" from these keys. The rule is very simple: we move
2104 one step away in the direction of "other" diagonal (/-diagonal on the left
2105 half, and \-diagonal on the right half) one step down (unless we start
2106 on keys B<A>, B<C> where "down" is impossible and we move up to B<W> or B<F>).
2107
2108 Examples: B<Ä> is on B<Q>, B<Á> "wants to be" on B<A> (used for C<Æ>), so it is moved to
2109 C<W>; B<Ö> wants to be on B<O> (already used for B<Ø> or B<Œ>), and is moved away to B<L>;
2110 B<È> wants to be on B<C> (occupied by B<Ç>), but is moved away to B<F>.
2111
2112 There is no way to enter B<Ï> using this layout (unless we agree to move it
2113 to the "8*" key, which may conflict with convenience of entering typographic
2114 quotation marks). Fortunately, this letter is rare (comparing even to B<Ë>
2115 which is quite frequent in Dutch). So there is no big deal that it is not
2116 available for "handy" input - remember that one can always use deadkeys.
2117
2118 http://en.wikipedia.org/wiki/Letter_frequency#Relative_frequencies_of_letters_in_other_languages
2119
2120 Note that the keys B<P> and B<R> are not engaged by this layout; since B<P>
2121 is a neighbor of B<O>, it is natural to use it to resolve the conflict
2122 between B<Ø> or B<Œ> (which both want to be set in stone on B<O>). This leaves
2123 only the key B<R> unengaged; but what we do not cover are two keys B<Å> and B<Ñ>
2124 which are relatively frequent in Latin-derived European languages.
2125
2126 Note that B<Ì> is moderately frequent in Italian, but B<Ñ> is much more frequent
2127 in Spanish. Since B<Ì> and B<Ñ> want to be on the same key (which on many keyboards is taken by
2128 B<Ñ>), it makes sense to prefer B<Ñ>… Likewise, B<Ê> is much more frequent
2129 than B<Ë>; switch them.
2130
2131 This leaves only the key B<R> unassigned, I<AND> a very rare B<Ỳ> on B<B>. In
2132 L<C<izKeys>|http://k.ilyaz.org>, one puts B<Å> and B<Ì> there. This completes
2133 the explanation of the rule 2.
2134
2135 =head2 On possibilities of merging 2 diacritics on one prefix key
2136
2137 With many diacritics, and the limited mnemonically-viable positions on
2138 the keyboard, it makes sense to merge several diacritics on the same prefix key.
2139 Possible candidates are cedilla/ogonek/comma-below (on C<AltGr-,>),
2140 dot-above/ring-above/dot-below (on C<AltGr-.>), caron/breve, circumflex/inverted-breve (on C<AltGr-^>).
2141 In some cases, only one of the diacretics would be applicable to a particular character.
2142 Otherwise, one must decide which of several choices to prefer. The notes below may be
2143 useful when designing such preferences. (This module can take most of such choices
2144 automatically due to knowledge of L<Unicode ages|http://www.unicode.org/Public/UNIDATA/DerivedAge.txt>
2145 of characters; this age correlates well with expected frequency of use.)
2146
2147 Another trick discussed below is implementing a rare diacritic X by applying the diacritic Y to a character
2148 with pre-composed diacritic Z.
2149
2150 U-caron: ǔ, Ǔ which is used to indicate u in the third tone of Chinese language pinyin.
2151 But U-breve ŭ/Ŭ is used in Latin encodings.
2152 Ǧ/ǧ (G with caron) is used, but only in "exotic" or old languages (has no
2153 combined form - while G-breve ğ/Ğ is in Latin encodings.
2154 A-breve Ă: A-caron Ǎ is not in Latin-N; apparently, is used only in pinyin,
2155 zarma, Hokkien, vietnamese, IPA, transliteration of Old Latin, Bible and Cyrillic's big yus.
2156
2157 In EurKey: only a takes breve, the rest take caron (including G but not U)
2158
2159 Merging ° and dot-accent ˙ in Latin-N: only A and U take °, and they
2160 do not take dot-accent. In EurKey: also small w,y take ring accent; same in
2161 Bepo - but they do not take dot accent in Latin-N.
2162
2163 Double-´ and cornu (both on a,u only) can be taken by ¨ or ˙ on letters with
2164 ¨ precombined (in Unicode ¨ is not precombined with diaeresis or dots).
2165 But one must special-case Ë and Ï and Ø (have Ê and IJ instead; IJ takes no accents,
2166 but Ê takes acute, grave, tilde and dot below...)! Æ takes acute and macron; Ø takes acute.
2167
2168 Actually, cornu=horn is only on o,u, so using dot/ring on ö and ü is very viable...
2169
2170 So for using AltGr-letter after deadkeys: diaeresis can take dot above, hat and wedge, diaeresis.
2171 Likewise, ` and ´ are not precombined together (but there is a combined
2172 combining mark). So one can do something else on vowels (ogonek?).
2173
2174 Applying ´ to `-accented forms: we do not have ỳ (on AltGr-keys), so must use "the natural position"
2175 which is mixed with Ñ (takes no accents) and Ç (takes acute!!!).
2176
2177 s, t do not precombine with `; so can use for the "alternative cedilla".
2178
2179 Only a/u/w/y take ring, and they do not take cedilla. Can merge.
2180
2181 Bepo's hook above; ảɓƈɗẻểƒɠɦỉƙɱỏƥʠʂɚƭủʋⱳƴỷȥ ẢƁƇƊẺỂƑƓỈƘⱮỎƤƬỦƲⱲƳỶȤ
2182
2183 perl -wlnae "next unless /HOOK/; push @F, shift @F; print qq(@F)" NamesList.txt | sort | less
2184
2185 Of capital letters only T and Y take different kinds of hooks... (And for T both are in Latin-Extended-B...)
2186
2187
2188 =head1 Useful tidbits from Unicode mailing list
2189
2190 =for html
2191 <a name=Useful_tidbits_from_Unicode_mailing_list_(unsorted)></a>
2192
2193 =head2 On keyboards
2194
2195 On MS keyboard (absolutely wrong!)
2196
2197 http://unicode.org/mail-arch/unicode-ml/y2012-m05/0268.html
2198
2199 Symbols for Keyboard keys:
2200
2201 http://unicode.org/mail-arch/unicode-ml/Archives-Old/UML009/0204.html
2202 “Menu key” variations:
2203 http://unicode.org/mail-arch/unicode-ml/Archives-Old/UML009/0239.html
2204 Role of ISO/IEC 9995, switchable keycaps
2205 http://unicode.org/mail-arch/unicode-ml/Archives-Old/UML009/0576.html
2206
2207 On the other hand, having access to text only math symbols makes it possible to implement it in computer languages, making source code easier to read.
2208
2209 Right now, I feel there is a lack of keyboard maps. You can develop them on your own, but that is very time consuming.
2210
2211 http://unicode.org/mail-arch/unicode-ml/y2011-m04/0117.html
2212
2213 Fallback in “smart keyboards” interacting with Text-Service unaware applications
2214
2215 http://unicode.org/mail-arch/unicode-ml/y2014-m03/0165.html
2216
2217 Keyboards - agreement (5 scripts at end)
2218
2219 ftp://ftp.cen.eu/CEN/Sectors/List/ICT/CWAs/CWA-16108-2010-MEEK.pdf
2220
2221 Need for a keyboard, keyman examples; why "standard" keyboards are doomed
2222
2223 http://unicode.org/mail-arch/unicode-ml/y2010-m01/0015.html
2224 http://unicode.org/mail-arch/unicode-ml/y2010-m01/0022.html
2225 http://unicode.org/mail-arch/unicode-ml/y2010-m01/0036.html
2226 http://unicode.org/mail-arch/unicode-ml/y2010-m01/0053.html
2227
2228 =head2 History of Unicode
2229
2230 Unicode in 1889
2231
2232 http://www.archive.org/stream/unicodeuniversa00unkngoog#page/n3/mode/2up
2233
2234 Structure of development of Unicode
2235
2236 http://unicode.org/mail-arch/unicode-ml/y2006-m07/0056.html
2237 http://unicode.org/mail-arch/unicode-ml/y2005-m07/0099.html
2238 I don't have a problem with Unicode. It is what it is; it cannot
2239 possibly be all things to all people:
2240 http://unicode.org/mail-arch/unicode-ml/y2005-m07/0101.html
2241
2242 Control characters’ names
2243
2244 http://unicode.org/mail-arch/unicode-ml/y2014-m03/0036.html
2245
2246 Compromizes vs reality
2247
2248 http://unicode.org/mail-arch/unicode-ml/y2010-m02/0106.html
2249 http://unicode.org/mail-arch/unicode-ml/y2010-m02/0117.html
2250
2251 Stability of normalization
2252
2253 http://unicode.org/mail-arch/unicode-ml/y2005-m07/0055.html
2254
2255 Universality vs affordability
2256
2257 http://unicode.org/mail-arch/unicode-ml/y2007-m07/0157.html
2258
2259 Drachma
2260
2261 http://unicode.org/mail-arch/unicode-ml/y2012-m05/0167.html
2262 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3866.pdf
2263
2264 w-ring is a stowaway
2265
2266 http://unicode.org/mail-arch/unicode-ml/y2012-m04/0043.html
2267
2268 History of squared pH (and about what fits into ideographic square)
2269
2270 http://unicode.org/mail-arch/unicode-ml/y2012-m02/0123.html
2271 http://unicode.org/mail-arch/unicode-ml/y2013-m09/0111.html
2272
2273 Silly quotation marks: 201b, 201f
2274
2275 http://en.wikipedia.org/wiki/Quotation_mark_glyphs
2276 http://unicode.org/mail-arch/unicode-ml/y2006-m06/0300.html
2277 http://unicode.org/mail-arch/unicode-ml/y2006-m06/0317.html
2278 http://en.wikipedia.org/wiki/Comma
2279 http://en.wikipedia.org/wiki/%CA%BBOkina
2280 http://en.wikipedia.org/wiki/Saltillo_%28linguistics%29
2281 http://unicode.org/mail-arch/unicode-ml/y2006-m06/0367.html
2282 http://unicode.org/unicode/reports/tr8/
2283 under "4.6 Apostrophe Semantics Errata"
2284
2285 OHM: In modern usage, for new documents, this character should not be used
2286
2287 http://unicode.org/mail-arch/unicode-ml/y2011-m08/0060.html
2288
2289 Uppercase eszett ß ẞ
2290
2291 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0007.html
2292 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0008.html
2293 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0142.html
2294 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0045.html
2295 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0147.html
2296 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0170.html
2297 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0196.html
2298
2299 Should not use (roman numerals)
2300
2301 http://unicode.org/mail-arch/unicode-ml/y2007-m11/0253.html
2302
2303 Colors in Unicode names
2304
2305 http://unicode.org/mail-arch/unicode-ml/y2011-m03/0100.html
2306
2307 Xerox and interrobang
2308
2309 http://unicode.org/mail-arch/unicode-ml/y2005-m04/0035.html
2310
2311 Tibetian (history of encoding, relative difficulty of handling comparing to cousins)
2312
2313 http://unicode.org/mail-arch/unicode-ml/y2013-m04/0036.html
2314 http://unicode.org/mail-arch/unicode-ml/y2013-m04/0040.html
2315
2316 Translation of 8859 to 10646 for Latvian was MECHANICAL
2317
2318 http://unicode.org/mail-arch/unicode-ml/y2013-m06/0057.html
2319
2320 Hyphens:
2321
2322 http://unicode.org/mail-arch/unicode-ml/y2009-m10/0038.html
2323
2324 NOT and BROKEN BAR
2325
2326 http://unicode.org/mail-arch/unicode-ml/y2007-m12/0207.html
2327 http://www.cs.tut.fi/~jkorpela/latin1/ascii-hist.html#5C
2328
2329 Combining power of generative features - implementor's view
2330
2331 http://unicode.org/mail-arch/unicode-ml/y2004-m09/0145.html
2332
2333 =head2 Greek and about
2334
2335 OXIA vs TONOS
2336
2337 http://www.tlg.uci.edu/~opoudjis/unicode/unicode_gkbkgd.html#oxia
2338
2339 Greek letters for non-Greek
2340
2341 http://stephanus.tlg.uci.edu/~opoudjis/unicode/unicode_interloping.html#ipa
2342
2343 Macron and breve in Greek dictionaries
2344
2345 http://www.unicode.org/mail-arch/unicode-ml/y2013-m08/0011.html
2346
2347 LAMBDA vs LAMDA
2348
2349 http://unicode.org/mail-arch/unicode-ml/y2010-m06/0063.html
2350
2351 COMBINING GREEK YPOGEGRAMMENI equilibristic (depends on a vowel?)
2352
2353 http://unicode.org/mail-arch/unicode-ml/y2006-m06/0299.html
2354 http://unicode.org/mail-arch/unicode-ml/y2006-m06/0308.html
2355 http://www.tlg.uci.edu/~opoudjis/unicode/unicode_adscript.html
2356 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0046.html
2357
2358 =head2 Latin, Cyrillic, Hebrew, etc
2359
2360 Book Spine reading direction
2361
2362 http://www.artlebedev.com/mandership/122/
2363
2364 What is a "Latin" char
2365
2366 http://unicode.org/forum/viewtopic.php?f=23&t=102
2367
2368 Federal vs regional aspects of Latinization (a lot of flak; cp1251)
2369
2370 http://peoples.org.ru/stenogramma.html
2371
2372 Yiddish digraphs
2373
2374 http://unicode.org/mail-arch/unicode-ml/y2011-m10/0121.html
2375
2376 Cyrillic Script, Unicode status (+combining)
2377
2378 http://scriptsource.org/cms/scripts/page.php?item_id=entry_detail&uid=ngc339csy8
2379 http://scriptsource.org/cms/scripts/page.php?item_id=entry_detail&uid=ktxptbccph
2380
2381 The IBM 1401 Hebrew Letter Key
2382
2383 http://www.qsm.co.il/Hebrew/HebKey.htm
2384
2385 GOST 10859
2386
2387 http://unicode.org/mail-arch/unicode-ml/y2009-m09/0082.html
2388 http://www.mailcom.com/besm6/ACPU-128.jpg
2389
2390 Hebrew char input
2391
2392 http://rishida.net/scripts/pickers/hebrew/
2393 http://rishida.net/scripts/uniview/#title
2394
2395 Cyrillic soup
2396
2397 http://czyborra.com/charsets/cyrillic.html
2398
2399 How to encode Latin-in-fraktur
2400
2401 http://unicode.org/mail-arch/unicode-ml/y2007-m01/0279.html
2402 http://unicode.org/mail-arch/unicode-ml/y2007-m01/0263.html
2403
2404 The presentation of the existing COMBINING CEDILLA which has three major forms [ȘșȚț and Latvian Ģģ]
2405
2406 http://unicode.org/mail-arch/unicode-ml/y2013-m06/0045.html
2407 http://unicode.org/mail-arch/unicode-ml/y2013-m06/0066.html
2408
2409 =head2 Math and technical texts
2410
2411 Missing: .... skew-orthogonal complement
2412
2413 Math Almost-Text encoding
2414
2415 http://unicode.org/notes/tn28/UTN28-PlainTextMath-v3.pdf
2416 http://unicode.org/mail-arch/unicode-ml/y2011-m10/0018.html
2417 For me 1/2/3/4 means unambiguously ((1/2)/3)/4, i.e. 1/(2*3*4)
2418
2419 Unicode mostly encodes characters that are in use or have been
2420 encoded in other standards. While not semantically agnostic, it is
2421 much less oriented towards semantic clarifications and
2422 distinctions than many people might hope for (and this includes
2423 me, some of the time at least).
2424
2425 Horizontal/vertical line/arrow extensions
2426
2427 http://unicode.org/charts/PDF/U2300.pdf
2428 http://unicode.org/mail-arch/unicode-ml/y2003-m07/0513.html
2429 http://std.dkuug.dk/JTC1/SC2/WG2/docs/n2508.htm
2430
2431 Pretty-printing text math
2432
2433 http://code.google.com/p/sympy/wiki/PrettyPrinting
2434
2435 Sub/Super on a terminal
2436
2437 http://unicode.org/mail-arch/unicode-ml/y2008-m07/0028.html
2438
2439 CR symbols
2440
2441 http://unicode.org/mail-arch/unicode-ml/y2006-m07/0163.html
2442
2443 Math layout
2444
2445 http://unicode.org/mail-arch/unicode-ml/y2007-m01/0303.html
2446
2447 Attempts of classification
2448
2449 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n4384.pdf
2450 http://std.dkuug.dk/JTC1/SC2/WG2/
2451
2452 Buttons Target Also=not-in-series-of-n4384
2453 square 1🞌 2⬝ 3🞍 4▪ 5◾ 6◼ 7■ s⬛ (solid=s⬛)
2454 box 1□ 2🞎 3🞏 4🞐 5🞑 6🞒 7🞓 o⬜ 1🞔 2▣ 3🞕 🞖 =white square (open=o⬜) also: ▫◽◻⌑⧈⬚⸋⊡
2455 black circle 1⋅ 2∙ 3🞄 4⦁ 5⦁ 6⚫ 7● also: ·
2456 ring 1○ 2⭘ 3🞆 4🞆 5🞇 6🞈 7🞉 1⊙ 2🞊 3⦿ 🞋 =white circle also: ⊚⌾◌⚪⚬⨀◦⦾
2457 black diamond 1🞗 2🞘 3⬩ 4🞙 5⬥ 6◆
2458 white diamond ◇ 1🞚 2◈ 3🞛 🞜 also: ⋄
2459 black lozenge 1🞝 2🞞 3⬪ 4🞟 5⬧ 6⧫
2460 white lozenge ◊ 🞠
2461 cross 1🞡 2🞢 3🞣 4🞤 5🞥 6🞦 7🞧
2462 saltire 1🞨 2🞩 3🞪 4🞫 5🞬 6🞭 7🞮 ≈ times (rotated cross)
2463 5-asterisk 1🞯 2🞰 3🞱 4🞲 5🞳 6🞴
2464 6-asterisk 1🞵 2🞶 3🞷 4🞸 5🞹 6🞺
2465 8-asterisk 1🞻 2🞼 3🞽 4🞾 5🞿
2466 centered n-gon 3⯅ 4⯀ 5⬟ 6⬣ 8⯃
2467 cent on-corner 3⯆ 4⯁ 5⯂ 6⬢ 8⯄ (also ⯇ ⯈)
2468 light star 3🟀 4🟄 5🟉 6✶ 8🟎 12🟒
2469 medium star 3🟁 4🟅 5★ 6🟋 8🟏 12🟓
2470 (heavy) star 3🟂 4🟆 5🟊 6🟌 8🟐 12✹
2471 pinwheel 3🟃 4🟇 5✯ 6🟍 8🟑 12🟔 lighter: ✵
2472
2473 =head2 Unicode and linguists
2474
2475 Linguists mailing lists
2476
2477 http://unicode.org/mail-arch/unicode-ml/y2009-m06/0066.html
2478
2479 Obsolete IPA
2480
2481 http://unicode.org/mail-arch/unicode-ml/y2009-m01/0487.html
2482 http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[%3Asubhead%3D%2F%28%3Fi%29archaic%2F%3A]+&g=
2483
2484 Teutonista (vowel guide p11, kbd p13)
2485
2486 http://www.sprachatlas.phil.uni-erlangen.de/materialien/Teuthonista_Handbuch.pdf
2487
2488 Glottals
2489
2490 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0151.html
2491 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0163.html
2492 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0202.html
2493 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0205.html
2494
2495 =head2 Spaces, invisible characters, VS
2496
2497 Substitute blank
2498
2499 http://unicode.org/mail-arch/unicode-ml/y2011-m07/0101.html
2500
2501 Representing invisible characters
2502
2503 http://unicode.org/mail-arch/unicode-ml/y2011-m07/0094.html
2504
2505 Ignorable glyphs
2506
2507 http://unicode.org/mail-arch/unicode-ml/y2007-m08/0132.html
2508 http://unicode.org/mail-arch/unicode-ml/y2007-m08/0138.html
2509 http://unicode.org/mail-arch/unicode-ml/y2007-m08/0120.html
2510
2511 HOWTO: (non)dummy VS in fonts
2512
2513 http://unicode.org/mail-arch/unicode-ml/y2007-m08/0118.html
2514
2515 ZWSP ZWNJ WJ SHY NON-BREAKING HYPHEN
2516
2517 http://unicode.org/mail-arch/unicode-ml/y2007-m08/0123.html
2518 http://unicode.org/mail-arch/unicode-ml/y2007-m07/0188.html
2519 http://unicode.org/mail-arch/unicode-ml/y2007-m07/0199.html
2520 http://unicode.org/mail-arch/unicode-ml/y2007-m07/0201.html
2521 http://unicode.org/mail-arch/unicode-ml/y2007-m06/0122.html
2522 http://unicode.org/mail-arch/unicode-ml/y2007-m01/0297.html
2523
2524 On which base to draw a "standalone" diacritics
2525
2526 http://unicode.org/mail-arch/unicode-ml/y2007-m07/0075.html
2527
2528 Variation sequences
2529
2530 http://unicode.org/mail-arch/unicode-ml/y2004-m07/0246.html
2531
2532 =head2 Typesetting
2533
2534 Upside-down text in CSS (remove position?)
2535
2536 http://unicode.org/mail-arch/unicode-ml/y2012-m01/0037.html
2537
2538 Unicode to PostScript
2539
2540 http://unicode.org/mail-arch/unicode-ml/y2009-m06/0056.html
2541 http://www.linuxfromscratch.org/blfs/view/svn/pst/enscript.html
2542 http://unicode.org/mail-arch/unicode-ml/y2009-m06/0062.html
2543
2544 Spacing: English and French
2545
2546 http://unicode.org/mail-arch/unicode-ml/y2006-m09/0167.html
2547 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0103.html
2548 http://unicode.org/mail-arch/unicode-ml/y2007-m08/0138.html
2549
2550 Chicago Manual of Style
2551
2552 http://unicode.org/mail-arch/unicode-ml/y2006-m01/0127.html
2553
2554 Coloring parts of ligatures
2555 Implemenations:
2556
2557 http://unicode.org/mail-arch/unicode-ml/y2005-m06/0195.html
2558 http://unicode.org/mail-arch/unicode-ml/y2005-m06/0233.html
2559 http://unicode.org/mail-arch/unicode-ml/y2005-m06/0208.html
2560 GPOS
2561 http://unicode.org/mail-arch/unicode-ml/y2005-m06/0167.html
2562
2563 Chinese typesetting
2564
2565 http://idsgn.org/posts/the-end-of-movable-type-in-china/
2566
2567 @fonts and non-URL URIs
2568
2569 http://unicode.org/mail-arch/unicode-ml/y2010-m01/0156.html
2570
2571 =head2 Looking at the future
2572
2573 Why and how to introduce innovative characters
2574
2575 http://unicode.org/mail-arch/unicode-ml/y2012-m01/0045.html
2576
2577 Unicode knows the concept of a provisional property
2578
2579 http://unicode.org/mail-arch/unicode-ml/y2011-m11/0142.html
2580 http://unicode.org/reports/tr23/
2581 http://unicode.org/mail-arch/unicode-ml/y2011-m11/0161.html
2582 If you want to make analogies, however, the ISO ballots constitute
2583 the *provisional* publication for character code points and names.
2584 that needs to be available from day one for a character to be
2585 implementable at all (such as decomp mappings, bidi class,
2586 code point, name, etc.).
2587
2588 ZERO-WIDTH UNDEFINED DECOMPOSITION MARK
2589 - to define decomposition, prepend it
2590
2591 Exciting new letter forms for English
2592
2593 http://www.theonion.com/articles/alphabet-updated-with-15-exciting-new-replacement,2869/
2594
2595 Proposing new stuff, finding new stuff proposed
2596
2597 http://unicode.org/mail-arch/unicode-ml/y2008-m01/0238.html
2598 http://www.unicode.org/mail-arch/unicode-ml/y2013-m09/0056.html
2599
2600 A useful set of criteria for encoding symbols is found in
2601 Annex H of this document:
2602
2603 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3002.pdf
2604
2605 =head2 Unsorted
2606
2607 Summary views into CLDR
2608
2609 http://www.unicode.org/cldr/charts//by_type/patterns.characters.html
2610 http://www.unicode.org/cldr/charts//by_type/misc.exemplarCharacters.html
2611
2612 Pound
2613
2614 http://unicode.org/mail-arch/unicode-ml/y2012-m05/0242.html
2615
2616 Classification of Dings (bats etc)
2617
2618 std.dkuug.dk/jtc1/sc2/wg2/docs/n4115.pdf
2619
2620 Escape: 2be9 2b9b
2621 ARROW SHAFT - various
2622
2623 Locales
2624
2625 http://blog.kyero.com/2011/11/14/what-is-the-common-locale-data-repository/
2626 http://blog.kyero.com/2010/12/02/lost-in-translation-locales-not-languages/
2627 http://unicode.org/mail-arch/unicode-ml/y2006-m06/0203.html
2628
2629 General
2630
2631 http://ebixio.com/online_docs/UnicodeDemystified.pdf
2632
2633 Diacritics in fonts
2634
2635 http://unicode.org/mail-arch/unicode-ml/y2011-m05/0047.html
2636 http://www.user.uni-hannover.de/nhtcapri/combining-marks.html#greek
2637
2638 Licences (GPL etc) in TV sets
2639
2640 http://unicode.org/mail-arch/unicode-ml/y2009-m12/0092.html
2641
2642 Similar glyphs:
2643
2644 http://unicode.org/reports/tr39/data/confusables.txt
2645
2646 GeoLocation by IP
2647
2648 http://unicode.org/mail-arch/unicode-ml/y2009-m04/0197.html
2649
2650 Per language character repertoir:
2651
2652 http://unicode.org/mail-arch/unicode-ml/y2009-m04/0253.html
2653 http://unicode.org/mail-arch/unicode-ml/y2009-m04/0255.html
2654
2655 Dates/numbers in Unicode
2656
2657 http://unicode.org/mail-arch/unicode-ml/y2010-m02/0122.html
2658
2659 Normalization FAQ
2660
2661 http://www.macchiato.com/unicode/nfc-faq
2662
2663 Apostrophe
2664
2665 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0060.html
2666 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0063.html
2667 http://unicode.org/mail-arch/unicode-ml/y2008-m05/0066.html
2668 http://unicode.org/mail-arch/unicode-ml/y2007-m07/0251.html
2669 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0309.html
2670
2671 Apostroph as soft sign
2672
2673 http://unicode.org/mail-arch/unicode-ml/y2010-m08/0123.html
2674
2675 Questionner at start of Unicode proposal
2676
2677 http://unicode.org/mail-arch/unicode-ml/y2007-m05/0087.html
2678
2679 Rubi
2680
2681 http://en.wikipedia.org/wiki/Ruby_character#Unicode
2682
2683 Tamil/ISCII
2684
2685 http://unicode.org/faq/indic.html
2686 http://unicode.org/versions/Unicode6.1.0/ch09.pdf
2687 http://www.brainsphere.co.in/keyboard/tm.pdf
2688
2689 CGI and OpenType
2690
2691 http://unicode.org/mail-arch/unicode-ml/y2008-m02/0097.html
2692
2693 Numbers in scripts ;-)
2694
2695 http://unicode.org/mail-arch/unicode-ml/y2008-m02/0120.html
2696
2697 Indicating coverage of the font
2698
2699 http://unicode.org/mail-arch/unicode-ml/y2008-m02/0152.html
2700 http://unicode.org/mail-arch/unicode-ml/y2008-m02/0167.html
2701
2702 Accessing ligatures
2703
2704 http://unicode.org/mail-arch/unicode-ml/y2007-m11/0210.html
2705
2706 Folding characters
2707
2708 http://unicode.org/reports/tr30/tr30-4.html
2709
2710 Writing systems vs written languages
2711
2712 http://unicode.org/mail-arch/unicode-ml/y2005-m07/0198.html
2713 http://unicode.org/mail-arch/unicode-ml/y2005-m07/0241.html
2714
2715 MS Visual OpenType tables
2716
2717 http://www.microsoft.com/typography/VOLT.mspx
2718 http://www.microsoft.com/typography
2719
2720 "Same" character Oacute used for different "functions" in the same text
2721
2722 http://unicode.org/mail-arch/unicode-ml/y2004-m08/0019.html
2723 etc:
2724 http://unicode.org/mail-arch/unicode-ml/y2004-m07/0227.html
2725
2726 Diacritics
2727
2728 http://www.sil.org/~gaultney/ProbsOfDiacDesignLowRes.pdf
2729 http://en.wikipedia.org/wiki/Sylfaen_%28typeface%29
2730 http://tiro.com/Articles/sylfaen_article.pdf
2731
2732 Sign writing
2733
2734 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n4342.pdf
2735
2736 Writing digits in non-decimal
2737
2738 http://unicode.org/mail-arch/unicode-ml/y2011-m03/0050.html
2739 Which separator is less ambiguous? Breve ˘ ? ␣ ? Inverted ␣ ?
2740
2741 Use to identify a letter:
2742
2743 http://unicode.org/charts/collation/
2744
2745 Perl has problems with unpaired surrogates (whole thread)
2746
2747 http://unicode.org/mail-arch/unicode-ml/y2010-m11/0034.html
2748
2749 Complex fonts (e.g., Indic)
2750
2751 http://unicode.org/mail-arch/unicode-ml/y2010-m10/0049.html
2752
2753 Complex glyphs in Symbola (pre-6.01) font may crash older versions of Windows
2754
2755 http://unicode.org/mail-arch/unicode-ml/y2010-m10/0082.html
2756 http://unicode.org/mail-arch/unicode-ml/y2010-m10/0084.html
2757
2758 Window 7 SP1 improvements
2759
2760 http://babelstone.blogspot.de/2010/05/prototyping-tangut-imes-or-why-windows.html
2761
2762 Middle dot is ambiguous
2763
2764 http://unicode.org/mail-arch/unicode-ml/y2010-m09/0023.html
2765 http://unicode.org/mail-arch/unicode-ml/y2013-m03/0151.html
2766
2767 Superscript == modifiers
2768
2769 http://unicode.org/mail-arch/unicode-ml/y2010-m03/0133.html
2770
2771 Translation of Unicode names
2772
2773 http://unicode.org/mail-arch/unicode-ml/y2012-m12/0066.html
2774 http://unicode.org/mail-arch/unicode-ml/y2012-m12/0076.html
2775
2776 Transliteration on passports (see p.IV-48), UniDEcode
2777
2778 http://www.icao.int/publications/Documents/9303_p1_v1_cons_en.pdf
2779 http://unicode.org/mail-arch/unicode-ml/y2013-m11/0025.html
2780
2781 =head1 Keyboard input on Windows: interaction of applications and the kernel
2782
2783 =head2 Keyboard input on Windows, Part I: what is the kernel doing?
2784
2785 This is not documented. We try to provide a description which is
2786 both as simple as possible, and as complete as possible. (We ignore
2787 many important parts: the handling of hot keys [or C<C-A-Del>]), IME,
2788 handling of focus switch [C<Alt-Tab> etc], the syncronization of keystate
2789 between different queues, waking up the system, the keyboard filters,
2790 widening of virtual keycodes, and LED lights.)
2791
2792 We omit Step 0, when the hardware keyboard drivers (PS/2 or USB) deliver keydown/up(/repeat???) event for scan
2793 codes of corresponding keys. (This is a complicated topic, but well-documented.)
2794
2795 =over
2796
2797 =item 1
2798
2799 The scan codes are massaged (see “Low level scancode mapping” in L<"SEE ALSO">).
2800
2801 =item 2
2802
2803 The keyboard layout tables map the translated scancode to a virtual keycode.
2804 (This may also depend on the “modification column”; see L<"Far Eastern keyboards on Windows">.)
2805 The “internal” key state table is updated.
2806
2807 =item 3
2808
2809 Mythology: the modification keys (C<Shift>, C<Alt>, C<Ctrl> etc) are taken into account.
2810
2811 What actually happens: any key may act as a modification key. The keyboard layout tables
2812 map keycodes to 16-bit masks (or bitmaps). (The customary names for lower bits of the mask are C<KBDSHIFT>,
2813 C<KBDCTRL>, C<KBDALT>, C<KBDKANA>; two more bits are named C<KBDROYA> and C<KBDLOYA> — after
2814 OYAYUBI 親指, meaning THUMB; ten more
2815 bits are unnamed.) The keycodes of the currently pressed keys (from the “internal” table) are translated to bitmaps, and
2816 these bitmaps are ORed together. (For the purpose of translation to C<WM_CHAR>/etc [done
2817 in ToUnicode()/ToUnicodeEx()], the bit C<KBDKANA> may be set
2818 also when key C<VK_KANA> was pressed odd number of times; this is
2819 controlled by C<KANALOK> flag in a virtual key descriptor [of the key being currently processed]
2820 of the keyboard layout tables.)
2821
2822 The keyboard layout tables translate the ORed bitmaps to a number called “modification column”.
2823 (Thess two numbers are completely hidden from applications. The only glint the
2824 applications get is in the [useless, since there is no way to map it to anything “real”] result of
2825 L<VkKeyScanEx()|http://msdn.microsoft.com/en-us/library/windows/desktop/ms646332%28v=vs.85%29.aspx>.])
2826
2827 =item 4
2828
2829 Depending on the current “modification column”, the virtual keycode of the current key event
2830 may be massaged further. (See L<"Far Eastern keyboards on Windows">.) Numpad keycodes
2831 depend also on the state of C<NumLock> — provided the keyboard layout table marks them with
2832 C<KBDNUMPAD> flag. A few other scancodes may also produce different virtual keycodes in
2833 different situations (e.g., C<Break>).
2834
2835 When C<KLLF_ALTGR> flag is present, fake presses/releases of left C<Ctrl> are generated
2836 on presses(repeats)/releases of right C<Alt> (exception: the press is not generated if any
2837 Ctrl key is down; likewise for when left C<Ctrl> up when right C<Alt> is released). With
2838 keypad presses/releases in presence of C<VK_SHIFT> and C<NumLock>, fake releases/presses of C<VK_SHIFT>
2839 are generated.
2840
2841 =item 5
2842
2843 If needed, asynchronous key state for the current key's non-left-non-right flavor is updated.
2844 (The rest is dropped if the key is consumed by a C<WH_KEYBOARD_LL> hook.)
2845
2846 Asynchronous key state for the current key is updated. Numpad-by-number flags are updated.
2847 (The rest is dropped if the key is a hotkey.)
2848
2849 The message C<WM_(SYS)KEYDOWN/UP> is posted to the application. If C<VK_MENU> [usually
2850 called the C<Alt> key] is
2851 down, but C<VK_CONTROL> is not, the event is of C<SYS> flavor (this info is duplicated in
2852 lParam. Additionally, for C<VK_MENU> tapping, the UP event is also made C<SYS> — although
2853 at this moment C<VK_MENU> is not down!).
2854 (The C<KBDEXT> flag [of the scancode] is also delivered to the application.)
2855
2856 (When a C<WM_(SYS)KEYDOWN/UP> message is posted, the key state is updated. This key state
2857 may be used by TranslateMessage() as an argument to ToUnicode(), and is returned by GetKeyState() etc.)
2858
2859 B<The following steps are applicable only if the application uses “the standard message pump”
2860 with TranslateMessage()/DispatchMessage() or uses some equivalent code.>
2861
2862 =item 6
2863
2864 Before the application dispatches C<WM_(SYS)KEYDOWN/UP> to the message handler,
2865 TranslateMessage() calls L<ToUnicode()|The semantic of ToUnicode()> with C<wFlags = 0> (unless a popup menu
2866 is active; then C<wFlags = 1> — which disables character-by-number input via
2867 numeric KeyPad) and the buffer of 16 UTF-16 code units.
2868
2869 =item 7
2870
2871 The UTF-16 code units obtained from ToUnicode() are posted via PostMessage(). All the code units but
2872 the last one are marked by C<FAKE_KEYSTROKE> flag in C<lParam>. If the initial message
2873 was C<WM_SYSKEYDOWN>, the C<SYS> flavor is posted; if ToUnicode() returns a
2874 deadkey, the C<DEAD> flavor is posted.
2875
2876 (The bit C<ALTNUMPAD_BIT> is set/used only for the console handler — otherwise the character is already translated to Unicode. — It
2877 indicates that the character which was input-by-number
2878 should be interpreted “as in” OEM codepage — as opposed to ANSI-codepage/Unicode. This happens when non-hex input was started by
2879 non-C<0> digit.)
2880
2881 =back
2882
2883 =head2 Keyboard input on Windows, Part II: The semantic of ToUnicode()
2884
2885 L<The syntax of ToUnicode() is documented|http://msdn.microsoft.com/en-us/library/windows/desktop/ms646320%28v=vs.85%29.aspx>,
2886 the semantic is not. Here we fix this.
2887
2888 =over 4
2889
2890 =item 1
2891
2892 If the bit C<0x01> in C<wFlags> is not set, the key event is checked for contributing to
2893 character-by-number input via numeric KeyPad (and numpad-by-number flags are updated — unless
2894 the bit C<0x04> in C<wFlags> is set).
2895 If so, the character is
2896 delivered only when C<Alt> is released. (This the only case when KEYUP
2897 delivers a character.) Unless the bit 0x02 in C<wFlags> is set, the KEYUP
2898 events are not processed any more.
2899
2900 =item 2
2901
2902 The flag C<KLLF_LRM_RLM> is acted upon, and C<VK_PACKET> is processed.
2903
2904 =item 3
2905
2906 The keys which are currently down are mapped to the ORed bitmap (see above).
2907
2908 =item 4
2909
2910 If the key event does not contribute to input-by-number via numeric keypad,
2911 and C<KBDALT> is set, and no other bits except C<KBDSHIFT>, C<KBDKANA> are set:
2912 then the bit C<KBDALT> is removed from the ORed bitmaps. (We call this “C<KBDALT>
2913 stripping” below. B<Note:> this does not happen on “key up” events — which is very
2914 important in the context of “non-destructive C<ToUnicode[Ex]()> calls.)
2915
2916 =item 5
2917
2918 If C<CapLock> is active, C<KBDSHIFT> state is flipped in the following cases: either at most
2919 C<KBDSHIFT> is set in the bitmap, and C<CAPLOK> is set in the descriptor,
2920 or both C<KBDALT> and C<KBDCTRL> are set in the bitmap, and C<CAPLOKALTGR> is set in the
2921 descriptor.
2922
2923 Now the ORed bitmap is converted to the modification column (see above).
2924
2925 =item 6
2926
2927 The key descriptor for the current virtual keycode is consulted (the “row” of the table).
2928 If C<SGCAPS> flag is on, C<CapsLock> is active, and no other bits but C<KBDSHIFT> are set in the bitmap,
2929 the row is replaced by the next row.
2930
2931 =item 7
2932
2933 The entry at
2934 the row/column is extracted; if defined, it is either a string (zero or more UTF-16 code units), or a
2935 dead key ID (one UTF-16 unit). (I<Implementation>: the ID is taken from the next row of the table.)
2936
2937 (If the ORed bitmaps corresponds to a valid modification column, but the row does not
2938 define the behaviour at this column, and the bit C<KBDCTRL> is set, and no other bits but C<KBDSHIFT>, C<KBDKANA>
2939 are set, then an autogenerated character in the range 0x00..0x1f is emitted for virtual keycodes
2940 'A'..'Z' and widened virtual keycodes 0xFF61..0xFF91 [for latter, based on the low bits of translation-to-scancode]).
2941
2942 =item 8
2943
2944 The resulting units are fed to the finite state machine. When the state machine is in
2945 0-state, a fed character unit is passed through, and a fed deadkey ID sets the state
2946 of the state machine to this number. In non-0 state, the IDs behave the
2947 same as numerically equal character units; the behaviour is described by the keyboard layout
2948 tables. The state machine changes the state according to the input; it may also emit a character
2949 (= 1 code unit; then it is always reset to 0 state). When “unrecognized input” arrives, the state machine
2950 emits the ID I<and> the input, and resets to 0 state.
2951
2952 (On KEYUP event, the changes to the state of the finite-state-machine are ignored. This is only
2953 relevant if C<wFlags> has bit C<0x02> set.)
2954
2955 B<MS documents new behaviour after version ………:> (untested) if C<wFlags> has bit C<0x04> set, the initial state of the finite
2956 state machine is restored.
2957
2958 =item 9
2959
2960 After UTF-16 codepoints are passed through the state machine, its output is returned by ToUnicode().
2961 If the state machine is in non-0 state, the state ID becomes the output.
2962
2963 =back
2964
2965 B<NOTE:> MSKLC restricts the length of the string associated to the row/column cell to
2966 be at most 4 UTF-16 code units. There are 2 restrictions for keyboard layouts created with other tools:
2967 first, the maximal number of UTF-16 codepoints in all these strings is stored in a byte, hence there
2968 may be at most 255 UTF-16 codepoints. Second, the actual slot C<KBDTABLES.cbLgEntry> where the string is allocated
2969 contains two shorts, then the UTF-16 data; its length is also stored in a byte. This results in
2970 the maximal string length of 125 code units — if it is stored in one slot.
2971
2972 However, with creative allocations, one can use more than one slot for a string storage
2973 (theoretically, one may imagine specially crafted layout where this would break the
2974 layout; on practice, such situations should not arise — even if one stores long strings in
2975 I<many> slots good for 4-chars strings. This is limited by the type C<BYTE> used to specify
2976 the maximal length of an entry in a ligature table; so this length cannot be more than 255.
2977
2978 B<Implementation detail:> to use “more than one slot”, one should expoit the fact that in all
2979 4 CPU architectures supported by C<MSKLC>, the structures C<LIGATURE{n}> is little-endian and
2980 aligned on 2-byte boundary — so its first element can be safely extended from C<BYTE> to
2981 C<WORD>. — And then one can put a C<WCHAR> there! B<Keep in mind:> when OS matches a “ligature
2982 record” and a keypress, the padding byte is ignored. However, if such “overhanging records”
2983 are at the end, this can lead to problems very rarely only.
2984
2985 B<NOTE:> If the application uses the standard message pump
2986 with TranslateMessage()/DispatchMessage(), the caller of ToUnicode() is TranslateMessage().
2987 In this case, ToUnicode() is called with an output buffer consisting of 16 UTF-16 code units. For
2988 such applications, the strings associated to keypresses are truncated after 16 code units.
2989
2990 B<NOTE:> If the string is “long” (i.e., defined via LIGATURES), when it is fed through the
2991 finite state machine, the transitions to non-0 state do not generate deadkey IDs in the output
2992 string. (The LIGATURES may contain strings of one code unit! This may lead to non-obvious
2993 behaviour! If pressing such a key after a deadkey generates a chained deadkey, this
2994 would happen without delivering C<WM_DEADKEY> message.)
2995
2996 B<NOTE:> How the kernel recognizes which key sequences contribute to
2997 character-by-number input via numeric KeyPad? First, the starter keydown must happen
2998 when the ORed bitmaps contains C<KBDALT>, and no other bits except C<KBDSHIFT>
2999 and C<KBDKANA>. (E.g., one can press C<Alt>, then tap C<f 1 2 3>, release C<Alt>
3000 [with 1,2,3 on the numeric keypad].
3001 This would deliver C<Alt-f>, then C<1> would start character-by-number input
3002 provided C<Alt> and C<NumPad1> together have ORed bitmaps “in between” of C<KBDALT>
3003 and C<KBDALT|KBDSHIFT|KBDKANA>.)
3004
3005 After the starter keydown (NumPad: 0..9, DOT, PLUS) is recognized as such, all the keydowns
3006 should be followed by the corresponding keyup (keydowns-due-to-repeat are ignored);
3007 more precisely, between two KEYDOWN events, the KEYUP for the first of them must be present.
3008 (In other words, KEYDOWN/KEYUP events must come in the expected order, maybe with some intermixed “extra” KEYUP events.)
3009 In the decimal mode (numeric starter) only the keys with scancodes of NumPad 0..9 are allowed.
3010 In the hex mode (starter is NumPad's DOT or PLUS) also the keys with virtual codes
3011 '0'..'9' and 'A'..'F' are allowed. The sequence is terminated by releasing C<VK_MENU>
3012 (=C<Alt>) key. (See
3013 L<the historical reasons for such behaviour|https://retrocomputing.stackexchange.com/questions/25016/ibm-pc-alt-numpad-for-entering-character-codes-firmware-bios-or-os/25017#25017>.)
3014
3015 B<NOTE:> In most cases, the resulting number is reduced mod 256. The exceptions are: the starter key is C<KeyPadPLUS>,
3016 or the translate-to codepage is multibyte (then a number above 255 is interpreted as big-endian combination
3017 of bytes). In multibyte codepages, numbers 0x80..0xFF
3018 are considered in C<cp1252> codepage (unless the translate-to codepage is Japanese, and the number’s codepoint is Katakana).
3019
3020 B<NOTE:> If the starter key is C<KeyPad0> or C<KeyPadDOT>, the number is a codepoint in the default codepage of the keyboard layout;
3021 if it is another digit, it is in the OEM codepage (usually one with pseudo-graphic symbols; user-settable). (For example, typing
3022 with C<Alt> keys C<1 1> may give C<U+2642=♂> on C<Alt>-release, while typing keys C<0 1 1> gives a control character C<U+000B>.)
3023 Enabling hex modes (C<KeyPadPLUS> or C<KeyPadDOT>) requires extra tinkering; see L<"Hex input of unicode is not enabled">.
3024
3025 B<NOTE:> since keyboard layout normally map C<Alt> to the bitmap C<KBDALT>, and do not define
3026 a modification column for the ORed bitmap C<=KBDALT>, and C<KBDALT> is B<NOT> stripped for
3027 key events in input-by-number, these key events usually do not generate spurious C<WM_CHAR>s.
3028
3029 B<NOTE:> if the bit C<0x01> of C<wFlags> is intended to be set, then there is a way to query
3030 the kernel “what would happen if a particular key with a particular combination of modifiers
3031 were pressed now”. (Recall that a “usual” ToUnicode() call is “destructive”: it modifies the
3032 I<state> of the keyboard stored in the kernel. The information about whether one is in the
3033 middle of entering-by-number and/or whether one is in a middle of a deadkey sequence is
3034 erased or modified by such calls.) In general, there is no way preserve the state of
3035 entering-by-number; however, in presence of bit 0x01, this is of no concern, so a solution
3036 exists.
3037
3038 Using C<wFlags=0x01|0x02>, and setting the high bit of C<wScanCode> gives the same result as
3039 ToUnicode() with C<wFlags=0x01> and no high bit in C<wScanCode>. Moreover, this preserves the state of
3040 the deadkey-finite-state-machine. This way, one gets a “I<non-destructive>” flavor of ToUnicode().
3041
3042 =head2 Keyboard input on Windows, Part III: Customary “special” keybindings of typical keyboards
3043
3044 Typically, keyboards define a few keypresses which deliver “control” characters
3045 (for benefits of console applications). As shown above, even if the keyboard does not
3046 define C<Control-letter> combinations (but does define modification column for C<Ctrl>
3047 which is associated to C<KBDCTRL> — with maybe C<KBDSHIFT>, C<KBDKANA> intermixed), C<WM_CHAR>
3048 with C<^letter> I<will> be delivered to the application. Same with happen for combinations
3049 with modifiers which produce only C<KBDCTRL>, C<KBDSHIFT>, C<KBDKANA>.
3050
3051 Additionally, the typical keyboards also define the following bindings:
3052
3053 Ctrl-Space ——→ 0x20
3054 Esc, Ctrl-[ ——→ 0x1b
3055 Ctrl-] ——→ 0x1d
3056 Ctrl-\ ——→ 0x1c
3057 BackSpace ——→ ^H
3058 Ctrl-BackSpace ——→ 0x7f
3059 Ctrl-Break ——→ ^C
3060 Tab ——→ ^I
3061 Enter ——→ ^M
3062 Ctrl-Enter ——→ ^J
3063 Ctrl-2 ——→ 0x00 In console only; due to a bug: not checking for the match of “Shift being down”.
3064
3065 In addition to this, the standard US keyboard (and keyboards built by this Perl module) define
3066 the following bindings with C<Ctrl-Shift> modifiers:
3067
3068 @ ——→ 0x00
3069 ^ ——→ 0x1e
3070 _ ——→ 0x1f
3071
3072 =head2 Can an application on Windows accept keyboard events?
3073
3074 This may seem a silly question until one have seen zillions of various attempts tried by different
3075 applications to implement the support of this functionality. All of these attempts I
3076 have seen are extremely buggy.
3077
3078 B<Why?> The key problem is that any code supporting a customizable key bindings (in particular,
3079 the Windows’ basic framework of APIs for applications!) needs to distinguish which case it is:
3080
3081 =over 4
3082
3083 =item
3084
3085 either I<user intends> the given key chord to “be intercepted” to trigger “a certain action”
3086 (as in: “save this file”), or
3087
3088 =item
3089
3090 I<the intent> is to insert a character.
3091
3092 =back
3093
3094 Unfortunately, the way the kernel treats keyboard actions is not helpful in the task of
3095 distinguishing these two intents. (See
3096 L<"Keyboard input on Windows, Part I: what is the kernel doing?">.)
3097
3098 Given the vast pletora of different approaches the keyboard layouts use to make character
3099 input convenient, an application would not be able to find out “on itself” whether a key
3100 press (say, C<Alt-Win-s> delivering the character C<∑>) was intended to “trigger a certain
3101 bindable action”. So the only viable strategy should be:
3102
3103 =over 4
3104
3105 =item
3106
3107 Find out whether a keypress B<“really”> delivers a character.
3108
3109 =item
3110
3111 If so, insert the character (the “intended-for-insert” case).
3112
3113 =item
3114
3115 If not, try to match this keypress with the list of bindable actions.
3116
3117 =back
3118
3119 Unfortunately, L<until recently|https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-tounicodeex>, the documented
3120 Windows APIs did not include the way to inspect the “really”-part above. So different applications tried various hacks — failing
3121 in all but the most trivial cases.
3122
3123 B<The difficulty:> L<C<KBDALT> stripping|"Keyboard input on Windows, Part II: The semantic of ToUnicode()"> does not allow one to
3124 see whether the C<Alt>-modifier was used to “modify” the character
3125 delivered by the keyboard layout, or it was used to “trigger an C<Alt>-action. With C<Win>-modifier there is no stripping, but
3126 a similar problem still remains (since by default this modifier have no C<KBD>-bits attached). To add insult to injury, some
3127 C<Ctrl>-chords also deliver characters — but these are not intended for character input!
3128
3129 B<The core difficulty:> to implement the scheme above, we need to C<check first> which character is delivered by a keypress.
3130 However, the APIs to do this¹⁾ I<reset the stored state> of the keyboard layout (“the current prefix=dead key”). So after doing
3131 this, we I<can find> “whether a character is delivered” — but this stops our further attempts to investigate “the ‘really delivered’
3132 bit” discussed above.
3133
3134 ¹⁾ ToUnicodeEx() or TranslateMessage(). — The latter is just a shallow wrapper
3135 for sending a character message described by ToUnicodeEx().
3136
3137 =head2 The “easy parts of the logic”
3138
3139 This goes like this:
3140
3141 If C<ToUnicodeEx()> delivers a prefix=dead key, this is not an accelerator. So the correct behaviour is “do
3142 nothing” (“the destructive version” alread modified the internal state of the keyboard layout appropriately! If it was
3143 non-destructuve, “redo it destructively”).
3144
3145 So. assume we know that C<ToUnicodeEx()> delivers a character.
3146
3147 =over
3148
3149 =item
3150
3151 If there is no C<Win>, C<Alt>, C<Ctrl> modifiers pressed, then I<it is definitely> “intended-for-insert”.
3152
3153 =item
3154
3155 Same if this happens after “a prefix key”. (To know this, raise a flag after getting a C<WM_(SYS)DEADCHAR>, and lower after
3156 getting a C<WM_(SYS)CHAR> or
3157 L<a C<WM_(SYS)DEADCHAR> with C<string="\0">|"It is not documented how to make a with-prefix-key(s) combination produce 0-length string"> — or equivalents of these from C<ToUnicodeEx()>.)
3158
3159 =item
3160
3161 If C<Ctrl> is down, this character may still be “fake” — when the intent is not “insert this”. However, these cases are easy to
3162 detect: just mark all the C<WM_(SYS)CHAR> carrying characters in the range C<0x00..0x1f>, C<0x7f> as “non-insert”, and
3163 do the same with C<0x20> delivered when one of C<Ctrl> keys is down.
3164
3165 =item
3166
3167 However, given how the kernel treats C<Win>- and C<Alt>-modifiers (ignores C<Win> and possibly-strips C<KBDALT>), when the
3168 user combines a keypress with C<Win>¹⁾ (and — in basic cases — with C<Alt>), the delivered character remains the same. But such
3169 chords are definitely I<not intended-for-insert>!
3170
3171 ¹⁾ This assumes that keyboard layout is ignoring Win-modifier — as most of layouts do.
3172
3173 This B<forces one to inspect whether removing C<Alt> and/or C<Win> from the chord leaves the delivered character the same>. If
3174 so — this is not intended for insert! The following sections discuss two approaches: a hack, and a 100%-robust one.
3175
3176 =back
3177
3178 =head2 The ultra-simple approach
3179
3180 What we describe here is still a hack. — However it avoids using “only-recently-documented” non-destructive APIs of Windows, and
3181 works in overwhelming majority of tricky cases (meaning: the cases where most of other approaches tried in Windows’ applications
3182 fail). It was implemented in Emacs in mid-10s, and only one bug (quickly worked around) was reported.
3183
3184 B<The problem:> how to find out whether removing C<Win>- and C<Alt>-modifiers would deliver the same character as returned by the
3185 earlier call to C<ToUnicodeEx()>? For example, on one layout C<Win>-modifer “is not bound”, but C<]>-key delivers C<щ> (a quite
3186 common situation), on the other layout it delivers C<]>, but C<Win> “is bound”, and C<Win-]> delivers C<щ>. If we can see that
3187 a chord-with-C<Win> delivers C<щ>, then in the first case we should better call the action associated with C<Win-щ>, while in the
3188 second case we should insert C<щ>.
3189
3190 Here we assume that the call to C<ToUnicodeEx()> was destructive, so calling C<ToUnicodeEx()> again “is too late”.
3191 The hack is to call L<C<VkKeyScanW()>|https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-vkkeyscanw> on the
3192 delivered character. (In particular, the delivered I<string> should contain only one codepoint; so this would not work for
3193 characters above C<U+FFFF>, and multi-char strings — but in the latter case it is hard to imagine how this makes sense with an
3194 “extra” C<Alt>-modifier.)
3195
3196 This call returns “(one of) the way(s) to reach this character from the given keyboard layout” — which is a combination of the
3197 C<VK_>-code, and of the “needed modifier bitmap”. (Here it may be advisable to look in
3198 L<"A convenient assignment of C<KBD*> bitmaps to modifier keys">.) So now one can proceed like this:
3199
3200 =over 4
3201
3202 =item
3203
3204 Since there may be several ways to type this character, we may get “a mismatching combination”. If the mismatch is in the
3205 C<VK_>-key — tough luck: but see the corresponding comment in C<get_wm_chars()> in
3206 L<https://github.com/emacs-mirror/emacs/blob/master/src/w32fns.c#L3833>; it seems that in this case, it is a good heuristic to
3207 assume that this key chord is intended-for-insert iff the delivered character is non-ASCII!)
3208
3209 =item
3210
3211 So now we assume that what C<VkKeyScanW()> reported matches the C<VK_>-code of the pressed key. Then we can compare the reported
3212 C<KBD*> bitmap with the modifier keys which are down.
3213
3214 =back
3215
3216 Discuss first the common cases. Usually C<Win> does not generate C<KBD*> bits, and if it generates them, they should be
3217 C<KBDKANA> or above. C<CONCLUSION:> if the bitmap is below C<KBDKANA>, and C<Win> is down, then this character may be entered
3218 without pressing C<Win>, so this-chord-with-C<Win> is not intended for insert.
3219
3220 More generally, if the returned bitmap is C<KBDSHIFT|KBDALT|KBDCTRL=7> or below, then on any keyboard layout with even microscopic
3221 sanity, this means that the bitmaps on the pressed keys “match their names”, and we can find exactly which combination of keys
3222 I<is needed> to emit this character — and this is exactly what we need. So if more modifiers than strictly necessary are pressed
3223 down, we can “strip away the ‘needed’ modifiers”, and trigger the action associated with our character and the remaining modifiers.
3224
3225 (If both C<left> and C<right> versions of a certain modifier are down, one should better follow what Windows’ “accelerator
3226 framework” does: with both C<lCtrl> and C<rAlt> are down, it would prefer striping C<lCtrl> and C<rAlt>.)
3227
3228 Furthermore even if bitmap is 8 or more, if only one C<Ctrl> is down, and the bitmap has C<KBDCTRL> set, then the
3229 C<Ctrl>-modifier should be ignored; likewise for C<Alt>-logic. — And if after this, there is no non-ignored C<Alt>-, C<Ctrl>- or
3230 C<Win>-modifiers which are pressed, this chord is “intended-for-insert”; otherwise, the non-ignored modifiers “lead to a
3231 boundable event”. (Indeed, if the bitmap does not have C<KBDALT> set, and C<Alt> is pressed, then this character may be entered
3232 without pressing C<Alt>, so this-chord-with-C<Alt> is not intended for insert, and “has C<Alt> added”.)
3233
3234 (The latter logic is due to the common case of the bitmap associated to C<Ctrl> including the bit C<KBDCTRL>, and the bitmap
3235 associated to C<Alt> including the bit C<KBDALT>.)
3236
3237 The only unhandled cases are when the bitmap is above C<KBDSHIFT|KBDALT|KBDCTRL=7>, and either C<Win> is down, or there is a
3238 non-ignored C<Alt> or C<Ctrl>. This case needs “tricky heuristics” — but it seems that the logic used above for “the case of
3239 mismatched C<VK_>-codes” is still applicable: if the delivered char is ASCII, consider this as a bindable event, otherwise
3240 it is “intended for insert”.
3241
3242 B<Remark:> See the link above for how Emacs does it — it is copiously commented. (However, keep in mind that this code wants to be
3243 as compatible as possible with “the ideosyncratic ways of old versions of Emacs”.)
3244
3245 B<Note:> Obviously, the algorithm above would not work if a keypress comes after a prefix key. So one should inspect
3246 C<WM_[SYS]DEADKEY> messages — and it is safe to I<just assume that during a chord involving prefix keys, no bindable actions should
3247 be called>. (However,
3248 L<in very rare situations bugs in Windows may spoil the picture|"It is impossible to find whether the keyboard state is “after a prefix key”">.)
3249
3250 B<Caveat:> the API in question allows accessing the lower 8 bit of the modifiers-bitmap. Since this bitmap seems to be 16-bit,
3251 this approach may give some bogus results (but in very tricky cases only!) for the keyboard layouts which use these extra bits.
3252
3253 =head2 The bullet-proof method
3254
3255 B<Warning:> this is untested. It is recommended that
3256 L<"Can an application on Windows accept keyboard events? Part I: insert only"> (and the followup parts) be consulted too before
3257 implementing this. This should also be better enhanced by
3258 L<C<lAlt-lCtrl>-recognition|"Can an application on Windows accept keyboard events? Part IV: application-specific modifiers">.
3259
3260 Nowadays, when the
3261 L<non-destructive ways of querying keyboard|https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-tounicodeex>
3262 are finally documented, one can do this easily. Recall that we need to find out whether a character delivered by a chord may
3263 be entered with fewer modifier keys pressed — and I<we know which modifier keys we are interested in>! So
3264
3265 =over 4
3266
3267 =item
3268
3269 Call C<ToUnicodeEx()> non-destructively; store the resulting string (we may assume it is not empty — otherwise it it trivially
3270 not-intended-for-insert — unless this happens after a prefix=dead key).
3271
3272 =item
3273
3274 Running through the list of “known modifier keys”, if this key is pressed, reissue the C<ToUnicodeEx()> calls with the (temporarily)
3275 modified array where this key is not pressed. If the result is the same as before — this modifier key is “excessive”! Memorize
3276 this key, unset it permanently in the array, and rerun this stage.
3277
3278 =item
3279
3280 Sooner or later we reach this stage. We memorized a (maximal!) set of “excessive” modifiers. Restore them in the “is␣pressed”
3281 array, and make a final call to C<ToUnicodeEx()> — this time destructively. (Of course, it returns the result we already
3282 know — but the keyboard layout needs this to handle sequences of keypresses “as intended”.
3283
3284 =back
3285
3286 The rest is very simple: if the delivered character is a control character, or C<" ">-and-C<Ctrl>-is-down, it should be
3287 ignored, — or maybe interpreted by adding C<Ctrl> to “excessive modifiers” after un-C<Ctrl>ing this character. Finally, if there is
3288 no “excessive” modifiers, this chord is “intended-for-insert”. If there are “excessive” modifiers, then the
3289 delivered character should be “augmented by these excessive modifiers” and translated to a bindable event.
3290
3291 B<Special cases:> In addition to treating input-by-number on older Windows, I<there are a few special cases> in which the logic
3292 above gives suboptimal results. First, as explained in
3293 L<"Windows combines modifier bitmaps for C<lCtrl>, C<Alt> and C<rAlt> on C<AltGr>">, for best user’s experience, with the flag
3294 C<KLLF_ALTGR> the bitmap associated to C<rAlt> should contain all the bits of C<lCtrl>. WIth the recipe above,
3295 we try to check whether removing modifiers could produce the same
3296 result — but this assumes that I<the user can remove these modifiers!> While with C<KLLF_ALTGR>, the kernel “mocks” pressing the
3297 left C<Ctrl> keys when C<AltGr> is pressed — and I<the user can do nothing to control this>. If the bitmaps produced by C<lCtrl>
3298 and C<rAlt> are I<independent>, the recipe above works fine: it would correctly detect that from the pair of modifiers
3299 “faked” by pressing C<AltGr>, neither can be removed. Unfortunately, with the “overlap” recommended above, this algorithm would
3300 B<“wrongly”> find out that “removing C<lCtrl> does not change the result”! — So this case should be special-cased: avoid removing
3301 C<lCtrl> if C<rAlt> is down and
3302 L<it is not known that the flag C<KLLF_ALTGR> is absent|"Many applications need to know the state of hidden flag C<KLLF_ALTGR>">.
3303
3304 The other special case concerns the
3305 L<C<lAlt-lCtrl>-recognition|"Can an application on Windows accept keyboard events? Part IV: application-specific modifiers">. — We
3306 already mentioned it above. Finally, for “dense keybindings”, in which two chords C<lAlt-lCtrl> and C<AltGr> of modifiers
3307 behave differently, the application should better
3308 L<use the timing data on keypresses|https://metacpan.org/dist/UI-KeyboardLayout/source/examples/dumper-msg.c> to detect when the
3309 combinations of C<lCtrl> and C<rAlt> were not “faked”, but actually keyed in by the user. (See
3310 L<the example working implementation|https://search.cpan.org/~ilyaz/UI-KeyboardLayout/examples/robust_input/>.)
3311
3312 B<Note:> for the last stage of the recipe, it is advisable to “pass the obtained string/prefix-char to ourselves” via C<CHAR> and
3313 C<DEADCHAR>
3314 messages — as C<TranslateMessage()> does. This would allow external applications to interact with our application “in the usual
3315 way”: by sending suitable messages.
3316
3317 B<Reminder:> the
3318 L<non-destructive ToUnicode()|https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-tounicodeex> can be
3319 coded in two ways: first, on newer Windows, put C<wFlags=0x04>. On older Windows, put C<wFlags=0x01|0x02>, raise the high bit
3320 of C<lParam> “from key-down to key-up”, and process
3321 L<“input-by-number”|"Keyboard input on Windows, Part II: The semantic of ToUnicode()"> in your application. (Theoretically, one
3322 could use C<wFlags=0x02> — but I expect that processing key-up events for [hex]digits during input-by-number — they
3323 change the state — may be tricky. And why should one follow the I<very quirky> [see the preceding reference] logic of the kernel
3324 I<precisely>?) The second method may have an advantage (and related — still unresolved — challenges): since there is no C<KBDALT>
3325 stripping on the key-up events.
3326
3327 (Compare with L<the example working implementation|https://search.cpan.org/~ilyaz/UI-KeyboardLayout/examples/robust_input/>. It
3328 uses the flags C<0x01|0x02> only.)
3329
3330 B<Beware:> L<this comment on Stack Exchange|https://stackoverflow.com/questions/2604541/how-can-i-use-tounicode-without-breaking-dead-key-support/78173637#comment134382035_2605828>
3331 says about C<0x04> flag (untested):
3332
3333 That flag sadly doesn't affect the kernel's Alt-Numpad buffer.
3334
3335 =head2 Possible enhancements and caveats
3336
3337 The method above is so powerful that one may want to use it to enhance the user’s experience yet more. For
3338 example, suppose a Greek keyboard layout sends Latin characters after a prefix-key C<Shift-Space> (so C<Shift-Space σ> sends C<s>).
3339 How can a user trigger the C<Alt-S> binding of the application? “The obvious way” is to try C<Alt-Shift-Space σ>. This
3340 may obviously fail in two cases: the keyboard layout may “do something” on C<Alt-Shift-Space>; or: the application may
3341 have C<Alt-Shift-Space> bound to some action.
3342
3343 However, observe what happens when none of these cases is applicable. With the scheme above the keyboard-input handler of the
3344 application I<already knows> that C<Alt-Shift-Space> is “C<Alt> combined with the prefix key C<Shift-Space>”. In principle, I<if
3345 it can get the “feedback from the event-binding engine” that C<Alt-Shift-Space> is unbound>, it I<might> start processing this
3346 as an “C<Alt>-modified sequence of keypresses”. (For this, it would memorize that “C<Alt>-modifier should be applied to the
3347 eventual result”, and proceed until an “insert event” or a bindable-event is detected — possibly stripping the “excessive”
3348 C<Alt>-modifiers. Then the engine would apply “another excessive modifier” C<Alt> to the resulting “insert event”. — And what to
3349 do with bindable events — it is a judgement call…) B<Warning:> one may choose to also apply this approach for C<Ctrl>
3350 modifier — mutatis mutandis.
3351
3352 B<Warning:> (This concerns a completely fictional situation.) We did not discuss what to do if a text input event corresponds to
3353 “a multi-character sequence I<with “excess” modifiers>. — And this is a judgement call! For example, to bind C<Alt-Space> Emacs’
3354 APIs use a “symbolic name” C<space>, so from the point of view of these APIs this event is a combination of a modifier C<Alt> and
3355 this “symbol” C<space>. How to present to it the input event which has an “excessive modifier” C<Alt> and the “delivered string”
3356 being C<"space">?! One made-up solution is to present it using a “symbol name” C<S_space> — this should not cause any confusion
3357 with C<VK_>-codes. Another is to deliver C<Alt-s Alt-p Alt-a …>. (Or just make this user-configurable!)
3358
3359 B<Note:> One major shortcoming of different schemes of binding events is that they assume that “the language of” the keyboard
3360 matches the language of the UI of the application/session. Suppose that the application “works in English context”, but I switched
3361 to Greek keyboard layout to enter a Greek fragment. Suppose I want to trigger an event assigned to C<Alt-s> key chord. The user
3362 would definitely prefer this to be triggered by pressing C<Alt> and hitting the key marked as C<s>! However, what the application
3363 can see is the event C<Alt-σ> — although it may also deduce that it comes from C<VK_>-code C<S>, so it may be I<also> interpreted
3364 as C<Alt-s>. — And the application cannot I<guess my intent> — did I want to trigger the binding assigned to C<Alt-σ> or to
3365 C<Alt-s>?!
3366
3367 (It seems that to make the best of a bad situation, the input engine may need to pass to the binding engine I<a list of possible
3368 interpretations> of a key chord (as opposed to “just one”) — delegating the resolution to the binding engine. If the latter can
3369 see that only one of these is defined — then it is clear what to do!)
3370
3371 One way to put a workaround for this (on the level of the keyboard layout) is
3372 discussed in the note in L<"A convenient assignment of C<KBD*> bitmaps to modifier keys">.
3373
3374 =head2 Can an application on Windows accept keyboard events? Part I: insert only
3375
3376 B<Warning:> Nowadays this may be obsolete. I recommend inspecting L<"Can an application on Windows accept keyboard events?"> (and
3377 the following sections) first.
3378
3379 The logic described above makes the kernel deliver more or less “correct” C<WM_(SYS)CHAR> messages
3380 to the application. The only bindings which may be defined in the keyboard layout, but will not be
3381 seen as C<WM_(SYS)CHAR> are those in modification columns which involve C<KBDALT>, and do not
3382 involve any bits except C<KBDSHIFT> and C<KBDKANA>. (Due to
3383 L<the stripping of C<KBDALT>|"Keyboard input on Windows, Part II: The semantic of ToUnicode()"> described
3384 above, these modification columns are never accessed — I<well, they are, but
3385 L<only for input-by-number|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">>.)
3386
3387 Try to design an application with an entry field; the application should insert B<ALL> the
3388 characters ”delivered for insertion” by the keyboard layout and the kernel. The application
3389 should not do anything else for all the other keyboard events. First, ignore
3390 the C<KBDALT> stripping.
3391
3392 Then the only C<WM_(SYS)CHAR> which are NOT supposed to insert the contents to the editable UI fields are the
3393 L<Customary “special” keybindings> described above. They are easy to recognize and ignore: just
3394 ignore all the C<WM_(SYS)CHAR> carrying characters in the range C<0x00..0x1f>, C<0x7f>, and ignore C<0x20>
3395 delivered when one of C<Ctrl> keys is down. So the application which inserts all the I<other>
3396 C<WM_(SYS)CHAR>s will follow I<the intent> of the keyboard as close as possible.
3397
3398 Now return to consideration of C<KBDALT> stripping. If the application follows the policy above,
3399 pressing C<Alt-b> would enter C<b> — provided C<Alt> is mapped to C<KBDALT>, as done
3400 on standard keyboards. So the application should recognize which C<WM_CHAR> carrying C<b>
3401 are actually due to stripping of C<KBDALT>, and should not insert the delivered characters.
3402
3403 Here comes the major flaw of the Windows’ keyboard subsystem: the kernel translates
3404 SCANCODE —→ VK_CODE —→ ORED_BITMAP —→ MODIFICATION_COLUMN, then operates in terms of
3405 ORed bitmaps and modification columns. The application can access only the first two levels
3406 of this translation; one cannot query the kernel for any information about the last
3407 two numbers. (Except for the API L<VkKeyScanEx()|http://msdn.microsoft.com/en-us/library/windows/desktop/ms646332%28v=vs.85%29.aspx>,
3408 but it is unclear how this API may help: it translates “in wrong direction” and covers only BMP.)
3409 Therefore, there is no bullet-proof way to recognize when C<WM_(SYS)CHAR> arrived
3410 due to C<KBDALT> stripping.
3411
3412 B<NOTE:> of course, if only C<Shift/Alt/Ctrl> keys are associated to non-0 ORed bitmaps,
3413 and they are associated to the “expected” C<KBDSHIFT/KBDALT/KBDCTRL> bits, then the
3414 application would easily recognize this situation by checking whether C<Alt> is down,
3415 but C<Ctrl> is not. (Also observe that this is exactly the situation distinguishing
3416 C<WM_CHAR> from C<WM_SYSCHAR> — no surprises here!)
3417
3418 Assuming that the application uses this method, it would correctly recognize stripped
3419 events on the “primitive” keyboards. However, on a keyboard with an extra modifier
3420 key (call it C<Super>; assume its bitmap involves a non-SHIFT/ALT/CTRL/KANA bit),
3421 the C<Alt-Super-key> combination will not be stripped by the kernel, but the application
3422 would think that it was, and would not insert the character in C<WM_CHAR> message. A bug!
3423
3424 Moreover, if “supporing only the naive mapping” were a feasible
3425 restriction, there would be no reason for the kernel to go through the extra step of “the ORed bitmap”.
3426 Actually, to have a keyboard which is simultaneously backward compatible, easy for users, and
3427 covering a sufficiently wide range of possible characters, one B<must> use more or
3428 less convoluted implementations (as in L<"A convenient assignment of C<KBD*> bitmaps to modifier keys">).
3429
3430 B<CONCLUSION:> the fact that the kernel and the applications speak different
3431 incompatible languages makes even the primitive task discussed here impossible
3432 to code in a bullet-proof way. A heuristic workaround exists, but it will not
3433 work with all keyboards and all combinations of modifiers.
3434
3435 B<CAVEAT with the above assignment:> some applications (e.g., Emacs) manage to distinguish
3436 C<lCtrl+lAlt> combination of modifier keys from the combination C<lCtrl+rAlt> produced by
3437 a typical C<AltGr>; these applications are able to use C<lCtrl+lAlt>-modified
3438 keys as a bindable accelerator keys. We address this question in the L<Part IV|"Can an application on Windows accept keyboard events? Part IV: application-specific modifiers">.
3439
3440 =head2 Can an application on Windows accept keyboard events? Part II: special key events
3441
3442 B<Warning:> Nowadays this may be obsolete. I recommend inspecting L<"Can an application on Windows accept keyboard events?"> (and
3443 the following sections) first.
3444
3445 In the preceding section, we considered the most primitive application accepting
3446 the user inserting of characters, and nothing more. “Real applications” must
3447 support also keyboard actions different from “insertion”; so those KEYDOWN events
3448 which are not related to insertion may trigger some “special actions”. To model a full-featured
3449 keyboard input, consider the following specification:
3450
3451 As above, the application has an entry field, and should insert B<ALL> the
3452 characters ”delivered for insertion” by the keyboard layout and the kernel.
3453 For all the keyboard events I<not related to insertion of characters>, the application
3454 should write to the log file which of C<Ctrl/Alt/Shift> modifiers were down,
3455 and the virtual keycode of the KEYDOWN event. Again, at first, we ignore
3456 L<the C<KBDALT> stripping|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">.
3457
3458 At first, the problem looks simple: with the standard message pump, when C<WM_(SYS)KEYDOWN>
3459 message is processed, the corresponding C<WM_(SYS)(DEAD)CHAR> messages are already
3460 sent to the message queue. One can PeekMessage() for these messages; if present,
3461 and not “special”, they correspond to “insertion”, so nothing should be written to the log.
3462 Otherwise, one reports this C<WM_(SYS)KEYDOWN> to the log.
3463
3464 Unfortunately, this solution is wrong. Inspect again what the kernel is delivering
3465 during L<the input-by-number via numeric keyboard|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">:
3466 the KEYDOWN for decimal/hex digits
3467 B<is> a part of the “insertion”, but it does not generate any C<WM_(SYS)(DEAD)CHAR>.
3468 Essentially, the application may see C<Alt-F> pressed during the processing of
3469 C<Alt-NumPadPlus+F+1+2>, but even if C<Alt-F> is supposed to format the paragraph,
3470 this action should not be triggered (but C<U+0F12> should be eventually inserted).
3471
3472 B<CONCLUSION:> Input-by-number is getting in the way of using the standard message
3473 pump. C<SOLUTION>: one should write a clone of TranslateMessage() which delivers
3474 suitable C<WM_USER*> messages for KEYDOWN/KEYUP involved in Input-by-number. Doing
3475 this, one can also remove sillyness from the Windows’ handling of Input-by-number
3476 (such as taking C<mod 256> for numbers above 255).
3477
3478 B<POSSIBLE IMPLEMENTATION>: myTranslateMessage() should:
3479
3480 =over 4
3481
3482 =item *
3483
3484 when non handling L<input-by-number|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">,
3485 call ToUnicode(), but use C<wFlag=0x01|0x02>, so that ToUnicode() does not handle input-by-number.
3486
3487 =item *
3488
3489 Recognize input-by-number starters by the scancode/virtual-keycode, the presence of C<VK_MENU> down, and
3490 the fact that ToUnicode() produces nothing or C<'0'..'9','.',',','+'>.
3491
3492 =item *
3493
3494 After the starter, allow continuation by checking the scancode/virtual-keycode and the presence of C<VK_MENU> down.
3495 Do not call ToUnicode() for continuation keydown/up events.
3496
3497 =item *
3498
3499 After a chain of continuations followed by KEYUP for C<VK_MENU>, one should PostMessage() for C<WM_(UNI)CHAR> with
3500 accumulated input.
3501
3502 =back
3503
3504 Combining this with the heuristical recognition of stripped C<KBDALT>, one gets an architecture
3505 with a naive approximation to handling of C<Alt> (but still miles ahead of all the applications
3506 I saw!), and bullet-proof handling of other combinations of modifiers.
3507
3508 B<NOTE:> this implementation of MyTranslateMessage() loses one “feature” of the original one:
3509 that input-by-number is disabled in the presence of (popup) menu. However, since I never saw
3510 this “feature” in action (and never have heard of it described anywhere), this must be of
3511 negligible price.
3512
3513 B<NOTE:> I<ALL> the applications I checked do this logic wrong. Most of them check B<FIRST> for
3514 “whether the key event looks like those which should trigger special actions”, then perform
3515 these special actions (and ignore the character payload).
3516
3517 As shown above, the reasonable way is to do this in the opposite order, and check for
3518 special actions only I<AFTER> it is known that the key event does not carry a character payload.
3519 The impossibility of reversing the order of these checks is due to the same reason as one discussed
3520 above: the
3521 kernel and application speaking different languages.
3522
3523 Indeed, since the application knows nothing
3524 about ORed bitmaps, it has no way to distinguish that, for example, C<lCtrl-rCtrl-=> may be I<SUPPOSED> to be
3525 distinct from C<lCtrl-=> and C<rCtrl-=>, and while the last two do not carry the character
3526 payload, the first one does. Checking I<FIRST> for the absense of C<WM_(SYS)(DEAD)CHAR>
3527 delegates such a discrimination to the kernel, which has enough information about the
3528 intent of the keyboard layout. (Likewise, the keyboard may define the pair of C<DEADKEY>
3529 and C<Ctrl-A> to insert ᵃ. Then C<Ctrl-A> alone will not carry any character payload,
3530 its combination with a deadkey may.)
3531
3532 Why the applications are trying to grab the potential special-key messages as early
3533 as possible? I suspect that the developers are afraid that otherwise, a keyboard layout may
3534 “steal” important accelerators from the application. While this is technically possible,
3535 nowadays keyboard accelerators are rarely the I<only> way to access features of the applications;
3536 and among hundreds of keyboard layout I saw, all but 2 or 3 would not “steal” I<anything> from applications.
3537 (Or maybe the developers just have no clue that the correct solution is so simple?)
3538
3539 B<NOTE:> Among the applications I checked, the worst offender was Firefox (it improved a lot after I reported
3540 its problems; see below). It follows L<a particularly
3541 unfortunate advice by Mike Kaplan|http://blogs.msdn.com/b/michkap/archive/2005/01/19/355870.aspx>
3542 and tries to reconstruct the mentioned above row/columns table of the keyboard layout, then
3543 uses this (heuristically reconstructed) table as a substitute for the real thing. And
3544 due to the mismatch of languages spoken by kernel and applications, working via such an
3545 attempted reconstruction turns out to have very little relationship to the actually intended
3546 behaviour of the keyboard (the behaviour observed in less baroque applications). In particular, if
3547 keyboards uses different modification columns for C<lCtrl-lAlt> and C<AltGr>=C<rAlt>
3548 modifiers, pressing C<AltGr-key> inputs wrong characters in Firefox.
3549
3550 (After I reported Firefox bugs, the handling much improved. In v.55 I can observe one major problem — but
3551 on grandious scale: in some layouts defining C<OEM_8> JIS left-of-backspace
3552 “replacement-for-ISO-key”, Firefox locks completely when one switches to these keyboards.)
3553
3554 B<NOTE:> Among notable applications which fail spectacularly was Emacs (this changed
3555 dramatically when my patches were accepted). The developers
3556 forget that for a generation, it is already XXI century; so they L<use ToAscii() instead of
3557 ToUnicode()|http://fossies.org/linux/misc/emacs-24.3.tar.gz:a/emacs-24.3/src/w32fns.c>!
3558 (Even if ToUnicode() is available, its result is converted to the result of the
3559 corresponding ToAscii() code.)
3560
3561 In addition to 8-bitness, Emacs had also been suffering from check-for-specials-first syndrome…
3562
3563 =head2 Can an application on Windows accept keyboard events? Part III: better detection of C<KBDALT> stripping
3564
3565 B<Warning:> Nowadays this may be obsolete. I recommend inspecting L<"Can an application on Windows accept keyboard events?"> (and
3566 the following sections) first.
3567
3568 We explained above that (without non-destructive C<ToUnicode[Ex]()> calls) L<it is not possible to make a bullet-proof algorithm
3569 handling the case when C<KBDALT> might have been stripped by the kernel|"Can an application on Windows accept keyboard events? Part I: insert only">. The
3570 very naive heuristic algorithm described there will recognize the simplest
3571 cases, but will also have many false positives: for many combinations it will decide
3572 that C<KBDALT> was stripped while it was not. The result will be that
3573 when the kernel reports that the character C<X> is delivered, the
3574 application would interpret it as C<Alt-X>, so C<X> would not be inserted.
3575 It will not handle, for example,
3576 the C<lAlt-Menu-key> modifier combinations with L<the assignment of bitmap
3577 from that section|"A convenient assignment of C<KBD*> bitmaps to modifier keys">.
3578
3579 Indeed, with this assignment, the only combination of modifiers for which the kernel will strip C<KBDALT>
3580 is C<lAlt> (and C<lAlt+Win> if one does not assign any bits to C<Win>).
3581 So C<lAlt-Menu-key> is not stripped, hence the
3582 correct C<WM_*CHAR> is delivered by the kernel. However, since this combination is
3583 still visible to the application as having C<Alt>, and not having C<Ctrl>,
3584 it is delivered as the C<SYS> flavor.
3585
3586 So the net result is: one designed a nice assignment of bitmaps to the modifier
3587 keys. This assignment makes keypresses successfully navigate around the quirks
3588 of I<the kernel>’s calculations of the character to deliver. However, the naive
3589 algorithm used by I<the application> will force the application to ignore this
3590 correctly delivered character to insert.
3591
3592 A very robust workaround for this problem is introduced in the
3593 L<Part IV|"Can an application on Windows accept keyboard events? Part IV: application-specific modifiers">.
3594 What we discuss here is a simple heuristic to recognize the combinations involving
3595 C<Alt> and an “unexpected modifier”, so that these combinations become
3596 exceptions to the rule “C<SYS> flavor means ‘do not insert’”.
3597
3598 B<NAIVE SOLUTION:> when C<WM_SYS*CHAR> message arrives, inspect the virtual keycodes
3599 which are reported as pressed. Ignore the keycode for the current message.
3600 Ignore the keycodes for “usual modifiers” (C<Shift/Alt/Kana>) which are
3601 expected to keep stripping. Ignore the keycode for the keys which may be
3602 kept “stuck down” by the keyboards (see L<"Far Eastern keyboards on Windows">).
3603 If some keycode remains, then consider it as an “extra” modifier, and ignore
3604 the fact that the message was of C<SYS> flavor.
3605
3606 So all one must do is to define one user message (for input-by-number-in-progress),
3607 code two very simple routines, MyTranslateMessage() and HasExtraModifiersHeuristical(), and perform two
3608 PeekMessage() on KEYDOWN event, and one gets a powerful almost-robust
3609 algorithm for keyboard input on Windows. (Recall that all the applications
3610 I saw provide close-to-abysmal support of keyboard input on Windows.)
3611
3612 =head2 Can an application on Windows accept keyboard events? Part IV: application-specific modifiers
3613
3614 B<Warning:> Nowadays this may be obsolete. I recommend inspecting L<"Can an application on Windows accept keyboard events?"> (and
3615 the following sections) first.
3616
3617 Some application handle certain keys as “extra modifiers for the purpose of
3618 application-specific accelerator keypresses”. For example, Emacs may treat
3619 the C<ApplicationMenu> in this way (as a C<Super> modifier for its bindable-keys
3620 framework). Usually, C<ApplicationMenu> does not
3621 contribute anything into the ORed bitmap; hence, C<ApplicationMenu-letter>
3622 combination will deliver the same character as just C<letter> alone. When
3623 the application treats C<ApplicationMenu-letter> as an accelerator, it must
3624 ignore the character delivered by this combination.
3625
3626 Additionally, many keyboard layouts
3627 use the C<KLLF_ALTGR> flag (it makes the kernel to fake pressing/releasing the
3628 left C<Ctrl> key when the right C<Alt> is pressed/released) with “standard”
3629 assignments of the ORed bitmaps. On such keyboards, pressing right C<Alt> (i.e.,
3630 C<AltGr>) delivers the same characters as pressing any C<Ctrl> together with
3631 any C<Alt>. On the other hand, an application may distinguish left-C<Ctrl> combinined
3632 with left-C<Alt> from C<AltGr> pressed
3633 on such keyboards by inspecting which (virtual) keys are currently down. So the application
3634 may consider left-C<Ctrl> combinined with left-C<Alt>
3635 as “intended to be an accelerator”; then the application would ignore the characters delivered by
3636 such a keypress.
3637
3638 One can immediately see that such applications would inevitably enter into conflict
3639 with keyboards which B<define> these key combinations. For example, on a keyboard
3640 which defines an ORed bitmap for C<ApplicationMenu>, pressing C<ApplicationMenu-letter>
3641 I<should> deliver a different character than pressing C<letter>. However, the
3642 application does not know this, and just ignores the character delivered by
3643 C<ApplicationMenu-letter>.
3644
3645 A similar situation arises when the keyboard defines C<leftCtrl-leftAlt-letter> to
3646 deliver a different character than C<AltGr-letter>. Again, the character will be ignored
3647 by the application. Since the fact that such a “unusual” keyboard is active
3648 implies user's intent, such behaviour is a bug of the application.
3649
3650 B<CONCLUSION:> an application must interpret a keypress as “intended to be an accelerator”
3651 only if this keypress produces no character, or produces B<the same> character as
3652 the key without the “extra” modifier. (Correspondingly, if replacing C<leftAlt> by
3653 C<rightAlt> does not change the delivered character.)
3654
3655 B<IMPLEMENTATION:> to do this, the application must be able to query “what would happen
3656 if the user pressed different key combinations?”; such a query requires “non-destructive”
3657 calls of ToUnicode(). (These calls must be done I<before> the “actual”, destructive,
3658 call of ToUnicode() corresponding to the currently pressed down modifiers.)
3659
3660 Fortunately, with the framework described in the
3661 L<Part III|"Can an application on Windows accept keyboard events? Part III: better detection of C<KBDALT> stripping">,
3662 the call of ToUnicode() is performed with C<wFlags> being C<0x01|0x02>. As explained near the end of the section
3663 L<"Keyboard input on Windows, Part II: The semantic of ToUnicode()">, this call has a “non-destructive”
3664 flavor! Hence, for applications with such “enhanced” modifier keys, the logic of the
3665 L<Part III|"Can an application on Windows accept keyboard events? Part III: better detection of C<KBDALT> stripping">
3666 should be enhanced in the following ways:
3667
3668 =over 4
3669
3670 =item *
3671
3672 Make a non-destructive call of ToUnicode(). Store the result. If no insertable character
3673 (or deadkey) is delivered, ignore the rest.
3674
3675 =item *
3676
3677 If both left C<Ctrl> and left C<Alt> are down (AND right C<Ctrl> AND right C<Alt> are up!)
3678 replace left C<Alt> by the right C<Alt>, and
3679 make another non-destructive call of ToUnicode(). If the result is identical to the first one,
3680 mark C<leftCtrl+leftAlt> as “special modifiers present for accelerators”. (This assumes that
3681 L<the keyboard has C<KLLF_ALTGR> bit set|"Many applications need to know the state of hidden flag C<KLLF_ALTGR>">.)
3682
3683 Remove left C<Ctrl> and left C<Alt> from the collection of keys which are down (argument to ToUnicode()),
3684 and continue with the previous step.
3685 (This may be generalized to other combinations of left/right C<Alt>/C<Ctrl>.)
3686
3687 =item *
3688
3689 For every other “special modifier” virtual key which is down,
3690 make another non-destructive call of ToUnicode() with this virtual key up.
3691 If the result is identical to the first one, mark this “special modifier” as “present for accelerators”.
3692
3693 =item *
3694
3695 Finally, if nothing suitable for accelerators is found, make a “usual” call of ToUnicode()
3696 (so that on future keypresses the deadkey finite state-machine behaves as expected). Generate the
3697 corresponding messages.
3698
3699 =back
3700
3701 If no insertable character is delivered, or suitable “extra” accelerators are found, the
3702 process-the-accelerator logic should be triggered.
3703
3704 For example, if the character Ω is delivered, and a special modifier C<ApplicationMenu> is down
3705 and marked as suitable as accelerator, then Ω will be ignored. The accelerator for C<ApplicationMenu-Ω>
3706 should be triggered. (Processing this as C<ApplicationMenu-Shift-ω> may be also done. This may require an
3707 extra non-destructive call.)
3708
3709 An alternative logic is possible: if this Ω was generated by modifiers C<lCtrl-rAlt-Shift-ApplicationMenu>
3710 with the virtual key C<VK_W>, then the application may query what C<VK_W> generates standalone (for example,
3711 cyrillic ц), and trigger the accelerator for C<Ctrl-Alt-Shift-ApplicationMenu-ц>. (This assumes that
3712 C<lCtrl-rAlt-Shift> with C<VK_W> generates the same Ω!)
3713
3714 If no character is delivered, then this is a “trivial” situation, and the framework of accelerator keys
3715 should be called as if the complication considered here did not exist.
3716
3717 B<NOTE:> this logic handles the intended behaviour of C<Alt> key as well! So, with this implementation,
3718 the application would
3719
3720 =over 5
3721
3722 =item *
3723
3724 Handle L<C<Alt>-NUMPAD input-by-number|"Keyboard input on Windows, Part II: The semantic of ToUnicode()"> in an intuitive mostly
3725 compatible with Windows way
3726 (but not bug-for-bug compatible with the Windows' way);
3727
3728 =item *
3729
3730 Would recognize C<Alt> modifier which does not change the delivered character as such. (So it may be processed
3731 as the menu accessor.)
3732
3733 =item *
3734
3735 Would recognize B<all> the key combinations defined by the keyboard layout (and deliverable via ToUnicode());
3736
3737 =item *
3738
3739 Would recognize all the application-specific extra modifier keys which do not interfere with the
3740 key combinations defined by the keyboard layout.
3741
3742 =back
3743
3744 =head2 Far Eastern keyboards on Windows
3745
3746 The syntax of defining these keyboards is documented in F<kbd.h> of the toolkit.
3747 The semantic of the NLS table is undocumented. Here we fix this.
3748
3749 The function returning the NLS table should be exported with ordinal 2.
3750 The offsets of both tables in the module should be below 0x10000.
3751 The keyboard layout should define a function with ordinal 3 or 5 returning 0, or
3752 be loaded through such a function returning non-0; the signature is
3753
3754 BOOL ordinal5(HKL hkl, LPWSTR __OUT__ dllname , PCLIENTKEYBOARDTYPE type_if_remote_session, LPVOID dummy);
3755 BOOL ordinal3(LPWSTR __OUT__ dllname);
3756
3757 if return is non-0, keyboard is reloaded from C<dllname>.
3758
3759 In short, these layouts have an extra table which may define the following enhancements:
3760
3761 One 3-state (or 2-state) radio-button:
3762 on keys with VK codes DBE_ALPHANUMERIC/DBE_HIRAGANA/DBE_KATAKANA
3763 (the third state can be also toggled (?!) independently of the others).
3764 Three Toggling (like CAPSLOCK) button (pairs):
3765 toggling radio-button-like VK codes DBE_SBCSCHAR/DBE_DBCSCHAR, DBE_ROMAN/DBE_NOROMAN, DBE_CODEINPUT/DBE_NOCODEINPUT
3766 Make key produce different VK codes with different modifiers.
3767 Make a “reverse NUMPAD” translation.
3768 Manipulate a couple of bits of IME state.
3769 A few random hacks for key-deficient hardware layouts.
3770
3771 (Via assigning ORed bitmaps for modification bitmaps to radio-buttons, the radio-buttons and toggle-buttons above may affect the layout.
3772 Using this, it is easy to convert each toggling buttons to 2-state radiobuttons.
3773 The limitation is that the number of modification columns compatible with the
3774 extra table is at most 8.)
3775
3776 B<WARNING:> it turns out that the preceding paragraph is bogus. In fact, I<these specific FE-hacks operate on very different
3777 assumptions> than the rest of the Windows’ keyboard logic. In particular, the tables-of-length-8 are driven I<not by ORed-bitmaps
3778 assigned to the modification keys>, but by “physical modifier C<Shift>, C<Ctrl>, C<Alt> modification buttons. (In particular,
3779 even with C<KLLF_ALTGR>-flag, the key C<AltGr> is counted as C<Alt> and not C<Ctrl+Alt>.)
3780
3781 Every C<VK> may be associated to two tables of functions, the “normal” one, and the “alternative” one. For
3782 every modification column, each table
3783 assigns a filter id, and a parameter for the filter. (Recall that columns are associated
3784 to the ORed bitmaps by the table in the C<MODIFIERS> structure. One B<must> define all the entries
3785 in the table — or at least the entries reachable by the
3786 modifier keys. B<NOTE:> the limit on the number of states in the tables is 8; it is not clear what happens with the 
3787 states above this; some versions of Windows may buffer-overflow.)
3788
3789 The input/output for the filters consists of: the C<VK>, C<UP>/C<DOWN> flag, the flags associated to the scancode in C<< KBDTABLES->ausVK >>
3790 (may be added to upsteam), the
3791 parameter given in C<VK_F> structure (and an unused C<DWORD> read/write parameter). A filter may change these parameters,
3792 then pass the event forward, or it may ignore an event. Filters by ID:
3793
3794 KBDNLS_NULL Ignore key (should not be called; only for unreachable slots in the tables).
3795 KBDNLS_NOEVENT Ignore key.
3796 KBDNLS_SEND_BASE_VK Pass through VK unchanged.
3797 KBDNLS_SEND_PARAM_VK Replace VK by the number specified as the parameter.
3798 KBDNLS_KANAMODE Ignore UP; on DOWN, toggle (=generate UP-or-DOWN for) DBE_KATAKANA
3799
3800 These 3 generate UP for “other” key, then DOWN for the target (as needed!):
3801 KBDNLS_ALPHANUM Ignore UP; DBE_ALPHANUMERIC,DBE_HIRAGANA,DBE_KATAKANA → DBE_ALPHANUMERIC
3802 KBDNLS_HIRAGANA Ignore UP; DBE_ALPHANUMERIC,DBE_HIRAGANA,DBE_KATAKANA → DBE_HIRAGANA
3803 KBDNLS_KATAKANA Ignore UP; DBE_ALPHANUMERIC,DBE_HIRAGANA,DBE_KATAKANA → DBE_KATAKANA
3804
3805 KBDNLS_SBCSDBCS Ignore UP; Toggle DBE_SBCSCHAR / DBE_DBCSCHAR
3806 KBDNLS_ROMAN Ignore UP; Toggle DBE_ROMAN / DBE_NOROMAN
3807 KBDNLS_CODEINPUT Ignore UP; Toggle DBE_CODEINPUT / DBE_NOCODEINPUT
3808 KBDNLS_HELP_OR_END Pass-through if NUMPAD flag ON (in ausVK); send-or-toggle HELP/END (see below)
3809 KBDNLS_HOME_OR_CLEAR Pass-through if NUMPAD flag ON (in ausVK); send HOME/CLEAR (see below)
3810 KBDNLS_NUMPAD If !NUMLOCK | SHIFT, replace NUMPADn/DECIMAL by no-numpad flavors
3811 KBDNLS_KANAEVENT Replace VK by the number specified as the parameter. On DOWN, see below
3812 KBDNLS_CONV_OR_NONCONV See below
3813
3814 The startup values are C<ALPHANUMERIC>, C<SBCSCHAR>, C<NOROMAN>, C<NOCODEINPUT>.
3815
3816 Typical usages:
3817
3818 KBDNLS_KANAMODE (VK_KANA (Special case))
3819 KBDNLS_ALPHANUM (VK_DBE_ALPHANUMERIC)
3820 KBDNLS_HIRAGANA (VK_DBE_HIRAGANA)
3821 KBDNLS_KATAKANA (VK_DBE_KATAKANA)
3822 KBDNLS_SBCSDBCS (VK_DBE_SBCSCHAR/VK_DBE_DBCSCHAR)
3823 KBDNLS_ROMAN (VK_DBE_ROMAN/VK_DBE_NOROMAN)
3824 KBDNLS_CODEINPUT (VK_DBE_CODEINPUT/VK_DBE_NOCODEINPUT)
3825 KBDNLS_HELP_OR_END (VK_HELP or VK_END) [NEC PC-9800 Only]
3826 KBDNLS_HOME_OR_CLEAR (VK_HOME or VK_CLEAR) [NEC PC-9800 Only]
3827 KBDNLS_NUMPAD (VK_xxx for Numpad) [NEC PC-9800 Only; exactly the opposite to KBDNUMPAD — possbily predates it?]
3828 KBDNLS_KANAEVENT (VK_KANA) [Fujitsu FMV oyayubi Only]
3829 KBDNLS_CONV_OR_NONCONV (VK_CONVERT and VK_NONCONVERT) [Fujitsu FMV oyayubi Only]
3830
3831 Toggle (= 2-state) and 3-state radio-keys are switched by sending KEYUP for the currently
3832 “active” key, then KEYDOWN for the newly activated key. When switching 3-state, additional
3833 action happens depending on the new state:
3834
3835 DBE_ALPHANUMERIC If IME is off, and KANA toggle is on, switch IME on in the KATAKANA mode
3836 DBE_HIRAGANA If IME is off, and KANA toggle is off, switch IME off in the ALPHANUMERIC mode
3837 DBE_KATAKANA SAME AS HIRAGANA
3838
3839 Additionally, C<KEYDOWN> of C<KBDNLS_KANAEVENT> switches IME to
3840
3841 KANA toggle on: switch IME off in the ALPHANUMERIC mode
3842 KANA toggle off: switch IME on in the KATAKANA mode
3843
3844 and C<KBDNLS_CONV_OR_NONCONV> (on C<KEYUP> and C<KEYDOWN>) passes through, and does
3845
3846 KANA toggle on, IME off: switch IME off in the ALPHANUMERIC mode
3847 otherwise: Do nothing
3848
3849 (The semantic of IME being-in/switching-to OFF/ON mode is not clear (probably IME-specific).
3850 The switching happens by
3851 calling C<RequestDeviceChange(pDeviceInfo, GDIAF_IME_STATUS, TRUE)> for devices with a C<handle>
3852 and C<type == DEVICE_TYPE_KEYBOARD>, while putting the request at into global memory — unless
3853 C<IMECOMPAT_HYDRACLIENT> flag is set on the foreground keyboard.)
3854
3855 For C<KBDNLS_HOME_OR_CLEAR>, the registry is checked at statup. For C<KBDNLS_HELP_OR_END>, the registry is checked at statup, and:
3856
3857 KANA_AWARE: flips END/HELP if KANA toggle is ON (on input, “HELP” means not-an-END)
3858 otherwise: sends END/HELP depending on what registry says.
3859
3860 The checked values are C<helpkey>, C<KanaHelpKey>, C<clrkey> in the hive C<RTL_REGISTRY_WINDOWS_NT\WOW\keyboard>.
3861
3862 Which of two tables is chosen is controlled by the type (C<NULL>/C<NORMAL>/C<TOGGLE>) of the key's tables, and the (per key)
3863 history bit.
3864 The initial state of the bit is in C<NLSFEProcCurrent>
3865 (L<StuxNet hits here|http://www.eset.com/us/resources/white-papers/Stuxnet_Under_the_Microscope.pdf>!).
3866 The tables of type C<NULL> are ignored (the key descriptor passes all events
3867 through), the C<NORMAL> key uses only the first table. The C<TOGGLE> key uses the first table on KEYDOWN, and
3868 uses the first or the second table on KEYUP. The choice depends on modifiers present in the preceding KEYDOWN;
3869 the bitmap C<NLSFEProcSwitch> is indexed by the modification column of KEYDOWN event; the second table is
3870 used on the following KEYUP if the indexed bit is set. (The KEYREPEAT events are handled the same way as KEYUP.)
3871
3872 The typical usage of C<TOGGLE> keys is to make the KEYUP event match B<what KEYDOWN did> no matter what
3873 is the order of releasing the modifier keys and the main key.
3874 Having the history bit up “propagates” to KEYUP the information about which modifiers were active on KEYDOWN. This helps in ensuring
3875 consistency of some actions between the KEYDOWN event and the corresponding KEYUP event: remember that the state of modifiers
3876 on KEYUP is often different than the state on KEYDOWN: people can release modifiers in different orders:
3877
3878 press-Shift, press-Enter, release-Shift, release-Enter ---> Shift-Enter pressed, Enter released
3879 press-Shift, press-Enter, release-Enter, release-Shift ---> Shift-Enter pressed and released
3880
3881 If pressing C<Shift-Enter> acts as if it were the C<F38> key (and only so with C<Shift>!), to ensure consistency, one would need
3882 to make releasing C<Shift-Enter> B<and also> releasing C<Enter> to act as if it were the C<F38> key. So one can make pressing
3883 C<Shift-Enter> special (via the first table), sets the history bit on C<Shift-Enter>, and make I<the second table> map C<Enter>
3884 and C<Shift-Enter> to be special too (send C<F38>) I<if the history bit is set>.
3885
3886 B<Remark:> the standard key processing has its own filters too. C<AltGr> processing adds fake C<lCtrl> up/down events
3887 (provided the flag C<KLLF_ALTGR> is set);
3888 C<Shift-Cancels-CapsLock> processing ignores/fakes the C<KEYDOWN>/C<KEYUP> for C<VK_CAPITAL> (=C<CapsLock>)
3889 (provided the flag C<KLLF_SHIFTLOCK> is set); C<Shift-Multiply> becomes
3890 C<VK_SNAPSHOT> (same for C<Alt>); C<Ctrl-ScrollLck/Numlock> become C<VK_CANCEL>/C<VK_PAUSE>; C<Ctrl-Pause> may become C<VK_CANCEL>.
3891 OEM translations (NumPad→Cursor, except C<C-A-Del>; C<00> to double-press of C<0>) come first, then locale-specific (C<AltGr>,
3892 C<Shift-Cancels-CapsLock>), then those defined in the tables above.
3893
3894 B<Remark:> As opposed to these translations, C<KLLF_LRM_RLM> and C<Alt-NUMPADn> is actually handled inside the
3895 event loop, by ToUnicode().
3896
3897 B<Remark:> L<http://www.toppa.com/2007/english-windows-xp-with-a-japanese-keyboard/> (and references inside!)
3898 explains fine points of using Japanese keyboards. See also: L<http://www.coscom.co.jp/learnjapanese801/lesson08.html>.
3899
3900 =head2 Example of changing C<VK_>-codes depending on modifiers
3901
3902 The logic defined in the preceding section shows that with this:
3903
3904 {
3905 VK_SPACE, // Base Vk
3906 KBDNLS_TYPE_TOGGLE, // NLSFEProcType
3907 KBDNLS_INDEX_NORMAL, // The initial memory bit (.NLSFEProcCurrent)
3908 0x08, /* 00001000 */ // NLSFEProcSwitch (is “active” in positions marked with ☑ below)
3909 { // NLSFEProc
3910 {KBDNLS_SEND_BASE_VK,0}, // Base (These are “real” states of SHIFT etc, not “fancy”)
3911 {KBDNLS_SEND_BASE_VK,0}, // Shift
3912 {KBDNLS_SEND_BASE_VK,0}, // Control
3913 {KBDNLS_SEND_PARAM_VK,VK_PA1}, // Shift+Control ☑ (= “use the second table on release”)
3914 {KBDNLS_SEND_BASE_VK,0}, // Alt (AltGr is counted as Alt and not Ctrl+Alt — even with KLLF_ALTGR)
3915 {KBDNLS_SEND_BASE_VK,0}, // Shift+Alt
3916 {KBDNLS_SEND_BASE_VK,0}, // Control+Alt
3917 {KBDNLS_SEND_BASE_VK,0} // Shift+Control+Alt
3918 },
3919 { // NLSFEProcAlt
3920 {KBDNLS_SEND_PARAM_VK,VK_PA1}, // Base
3921 {KBDNLS_SEND_PARAM_VK,VK_PA1}, // Shift
3922 {KBDNLS_SEND_PARAM_VK,VK_PA1}, // Control
3923 {KBDNLS_SEND_PARAM_VK,VK_PA1}, // Shift+Control ☑
3924 {KBDNLS_SEND_BASE_VK,0}, // Alt AltGr ⇒ Alt
3925 {KBDNLS_SEND_BASE_VK,0}, // Shift+Alt
3926 {KBDNLS_SEND_BASE_VK,0}, // Control+Alt
3927 {KBDNLS_SEND_BASE_VK,0} // Shift+Control+Alt
3928 }
3929 },
3930
3931 as an element of the “C<VK>-to-function table”,
3932 C<Shift-Ctrl-Space> emits C<VK_PA1>; also, depending on the order of releasing the keys C<Space>, C<Shift> and
3933 C<Ctrl>, the modifiers at the moment of I<release of this combination> may be arbitrary subsets of C<Shift>+C<Ctrl>. The bitmap of
3934 C<0x08> says to use the second table if and only if the key produces C<VK_PA1> — so I<all these arbitrary subsets> correspond to
3935 “releasing C<VK_PA1>”.
3936
3937 B<Note:> observe that the last 4 entries of the second table may be triggered only if C<Alt> is “accidentally” pressed while
3938 C<Space> was down. While not very probable, it is still possible. — So probably it is better to fill I<all the positions> in
3939 the second table the same. (We do this in the example below.)
3940
3941 B<Warning:> since we I<are forced> to use C<VK_PA1> in the first row of the second table, this approach cannot “work 100%” if there
3942 are more than 2 C<VK_>-codes assigned to a key (essentially, this is due to having only one bit of memory). In FE keyboard layouts,
3943 “extra” C<VK_>-codes (third or more) appear only when these keys “are actually key-toggles” (for the user they look like
3944 C<CapsLock>, but without the kernel special-casing them by looking into the “toggle state”), so their keyrelease
3945 is “ignored anyway” — hence no confusion may arise. (“Physical keydown” events are alternately translated to “logical keyup” and
3946 “logical keydown” events.)
3947
3948 =head2 A full example of changing C<VK_>-codes depending on modifiers
3949
3950 Put the “C<VK>-to-function table” C<VkToFuncTable> (similar to one discussed in the preceding section) near the start of the first
3951 C file compiled into the layout DLL:
3952
3953 static ALLOC_SECTION_LDATA VK_F VkToFuncTable[] = {
3954 {
3955 VK_CAPITAL, // Base Vk
3956 KBDNLS_TYPE_TOGGLE, // NLSFEProcType
3957 KBDNLS_INDEX_NORMAL, // (The initial value of) the memory bit (.NLSFEProcCurrent)
3958 0x10, /* 00010000 */ // NLSFEProcSwitch (is “active” in positions marked with ☑ below)
3959 { // NLSFEProc
3960 {KBDNLS_SEND_BASE_VK,0}, // Base (These are “real” states of SHIFT etc, not “fancy”)
3961 {KBDNLS_SEND_BASE_VK,0}, // Shift
3962 {KBDNLS_SEND_BASE_VK,0}, // Control
3963 {KBDNLS_SEND_BASE_VK,0}, // Shift+Control
3964 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Alt ☑ (= “use the second table on release”) AltGr ⇒ Alt
3965 {KBDNLS_SEND_BASE_VK,0}, // Shift+Alt
3966 {KBDNLS_SEND_BASE_VK,0}, // Control+Alt
3967 {KBDNLS_SEND_BASE_VK,0} // Shift+Control+Alt
3968 },
3969 { // NLSFEProcAlt: if VK_OEM_AX-down was generated, generate VK_OEM_AX-up for all themod-combinations
3970 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Base
3971 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Shift
3972 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Control
3973 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Shift+Control
3974 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Alt ☑ ( AltGr ⇒ Alt )
3975 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Shift+Alt
3976 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Control+Alt
3977 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX} // Shift+Control+Alt
3978 }
3979 },
3980 };
3981
3982 static ALLOC_SECTION_LDATA KBDNLSTABLES KbdNlsTables = {
3983 0, // OEM ID (0 = Microsoft)
3984 0, // Information
3985 1, // Number of VK_F entry
3986 VkToFuncTable, // Pointer to VK_F array
3987 0, // Number of MouseVk entry
3988 NULL // Pointer to MouseVk array
3989 };
3990
3991 and “report it” in a certain C<extern> function exported with the ordinal C<2>. Two more functions returning 0 seem to be
3992 necessary; they should be exported with ordinals C<3> and C<5> (see the F<.def> file below):
3993
3994 PKBDNLSTABLES KbdNlsLayerDescriptor(VOID) { return &KbdNlsTables; }
3995
3996 BOOL KbdLayerRealDllFile(HKL hkl, WCHAR *realDllName, PCLIENTKEYBOARDTYPE pClientKbdType, LPVOID reserve)
3997 { return FALSE; } // FALSE means: no reload needed (However, the presence of these enables KbdNlsLayerDescriptor()
3998
3999 BOOL KbdLayerRealDllFileNT4(WCHAR *RealDllName) { return FALSE; }
4000
4001 Finally, the C<EXPORTS> part of F<.def> file (which should already contain C<KbdLayerDescriptor @1>) should be appended with
4002
4003 KbdNlsLayerDescriptor @2
4004 KbdLayerRealDllFileNT4 @3
4005 ; for NT4 Hydra backward comptility -- @4 should be left empty.
4006 KbdLayerRealDllFile @5
4007 ; KbdLayerMultiDescriptor @6 fully undocumented
4008
4009 This would make C<CapsLock> pressed when C<Alt>-modifier (and no other modifier) were down to behave as C<OEM_AX>. Moreover, since
4010 the second table is “fully loaded”, there going to be no “stuck” C<OEM_AX> key — so, in particular, one can use C<OEM_AX> as I<a new
4011 modifier key>!
4012
4013 For example, pressing C<Alt>, then C<CapsLock>, then releasing C<Alt> when keeping C<CapsLock> down allows combinging this fake-
4014 C<OEM_AX> key with other modifiers — then combine this accord with “real keypresses”.
4015
4016 B<Warning:> for less confusion, it is probably advisable to implement the C<VK_>-code-switch above I<whenever> C<Alt> is down — so
4017 that C<Alt> may be combined with other modifiers. Then the start of the table entry above should be changed to:
4018
4019 KBDNLS_INDEX_NORMAL, // (The initial value of) the memory bit (.NLSFEProcCurrent)
4020 0xF0, /* 11110000 */ // NLSFEProcSwitch (is “active” in positions marked with ☑ below)
4021 { // NLSFEProc
4022 {KBDNLS_SEND_BASE_VK,0}, // Base (These are “real” states of SHIFT etc, not “fancy”)
4023 {KBDNLS_SEND_BASE_VK,0}, // Shift
4024 {KBDNLS_SEND_BASE_VK,0}, // Control
4025 {KBDNLS_SEND_BASE_VK,0}, // Shift+Control
4026 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Alt ☑ (= “use the second table on release”) AltGr ⇒ Alt
4027 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Shift+Alt ☑ (= “use the second table on release”)
4028 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX}, // Control+Alt ☑ (= “use the second table on release”)
4029 {KBDNLS_SEND_PARAM_VK,VK_OEM_AX} // Shift+Control+Alt ☑ (= “use the second table on release”)
4030 },
4031
4032 =head2 Another redefinition to avoid problems with the C<KLLF_ALTGR> flag
4033
4034 As mentioned in L<"Windows combines modifier bitmaps for C<lCtrl>, C<Alt> and C<rAlt> on C<AltGr>">, while the C<KLLF_ALTGR> flag
4035 (in the keyboard definition) is useful for support of legacy applications, it does not allow the keyboard behave differently
4036 with C<rAlt> and with C<lCtrl-rAlt> modifiers.
4037
4038 However, with these definitions C<lCtrl> and C<rAlt> produce two different C<VK_codes> depending on whether C<Ctrl> and/or
4039 C<Alt> were pressed I<before> the corresponding keypresses:
4040
4041 {
4042 VK_LCONTROL, // Base Vk
4043 KBDNLS_TYPE_TOGGLE, // NLSFEProcType
4044 KBDNLS_INDEX_NORMAL, // (The initial value of) the memory bit (.NLSFEProcCurrent)
4045 0xC0, /* 11000000 */ // NLSFEProcSwitch (is “active” in positions marked with ☑ below)
4046 { // NLSFEProc
4047 {KBDNLS_SEND_BASE_VK,0}, // Base (These are “real” states of SHIFT etc, not “fancy”)
4048 {KBDNLS_SEND_BASE_VK,0}, // Shift
4049 {KBDNLS_SEND_BASE_VK,0}, // Control
4050 {KBDNLS_SEND_BASE_VK,0}, // Shift+Control
4051 {KBDNLS_SEND_BASE_VK,0}, // Alt (AltGr is counted as Alt and not Ctrl+Alt - even with KLLF_ALTGR)
4052 {KBDNLS_SEND_BASE_VK,0}, // Shift+Alt
4053 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Control+Alt ☑ (= “use the second table on release”)
4054 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3} // Shift+Control+Alt ☑ (= “use the second table on release”)
4055 },
4056 { // NLSFEProcAlt: if VK_OEM_PA3-down was generated, generate VK_OEM_PA3-up for all themod-combinations
4057 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Base
4058 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Shift
4059 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Control
4060 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Shift+Control
4061 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Alt (AltGr is counted as Alt and not Ctrl+Alt - even with KLLF_ALTGR)
4062 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Shift+Alt
4063 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3}, // Control+Alt ☑
4064 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA3} // Shift+Control+Alt ☑
4065 }
4066 },
4067 {
4068 VK_RMENU, // Base Vk
4069 KBDNLS_TYPE_TOGGLE, // NLSFEProcType
4070 KBDNLS_INDEX_NORMAL, // (The initial value of) the memory bit (.NLSFEProcCurrent)
4071 0xCC, /* 11001100 */ // NLSFEProcSwitch (is “active” in positions marked with ☑ below)
4072 { // NLSFEProc
4073 {KBDNLS_SEND_BASE_VK,0}, // Base (These are “real” states of SHIFT etc, not “fancy”)
4074 {KBDNLS_SEND_BASE_VK,0}, // Shift
4075 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Control ☑ (= “use the second table on release”)
4076 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Shift+Control ☑ (= “use the second table on release”)
4077 {KBDNLS_SEND_BASE_VK,0}, // Alt (AltGr is counted as Alt and not Ctrl+Alt - even with KLLF_ALTGR)
4078 {KBDNLS_SEND_BASE_VK,0}, // Shift+Alt
4079 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Control+Alt ☑ (= “use the second table on release”)
4080 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2} // Shift+Control+Alt ☑ (= “use the second table on release”)
4081 },
4082 { // NLSFEProcAlt: if VK_OEM_PA3-down was generated, generate VK_OEM_PA3-up for all themod-combinations
4083 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Base
4084 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Shift
4085 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Control ☑ (= “use the second table on release”)
4086 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Shift+Control ☑ (= “use the second table on release”)
4087 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Alt
4088 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Shift+Alt
4089 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2}, // Control+Alt ☑
4090 {KBDNLS_SEND_PARAM_VK,VK_OEM_PA2} // Shift+Control+Alt ☑
4091 }
4092 }
4093
4094 This way one can distinguish user pressing both C<lCtrl> and C<rAlt> even with C<KLLF_ALTGR> (the result depends on the order in
4095 which these two modifiers were pressed — though in practice this is not important). By assigning C<PA2> and C<PA3> suitable
4096 bitmaps, one can define how the keyboard behaves when both these modifiers are down. (However, this requires consuming 1 extra
4097 bit in the modifiers-bitmap. If it is indeed 16-bit as it seems, this should be OK even with the assignment from the next
4098 section.)
4099
4100 Later L<we inspect possibities opened by the assignments above|"Almost orthogonality — with C<lCtrl>-C<AltGr>-combinations">.
4101
4102 =head2 A convenient assignment of C<KBD*> bitmaps to modifier keys
4103
4104 In this section, we omit discussion of C<Shift> modifier; so every
4105 bitmap may be further combined with C<KBDSHIFT> to produce two different bindings.
4106 Assign ORed bitmaps to the modifier keys as follows:X<AssignBitmapsSmart>
4107
4108 lCtrl lAlt rAlt Menu rCtrl
4109 CTRL|LOYA ALT|KANA CTRL|ALT|LOYA|X1 CTRL|ALT|X2 CTRL|ALT|ROYA
4110
4111 with suitable backward-compatible mapping of ORed masks to modification columns.
4112 This assignment allows using C<KLLF_ALTGR> flag (faking presses of C<lCtrl> when
4113 C<rAlt> is pressed — this greatly increases compatibility of C<rAlt> with brain-damaged
4114 applications), it
4115 avoids L<stripping of C<KBDALT>|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">
4116 on C<lAlt> combined with other modifiers,
4117 makes C<CapsLock> L<work with all relevant combinations|"Workarounds for WINDOWS GOTCHAS for application developers (problems in kernel)">,
4118 while completely preserving all application-visible properties of keyboard events.
4119
4120 Note that ignoring the C<CTRL> and C<ALT> bits, all combinations of
4121 C<LOYA,KANA,X1,X2,ROYA> are possible, which gives at least 32 C<Shift>-pairs.
4122
4123 With C<KLLF_ALTGR> flag, C<rAlt> is “forced” into
4124 C<lCtrl+rAlt> (so these combinations are not distinguishable and produce the same
4125 bitmaps. — I<This is why> above we assigned C<CTRL|ALT|LOYA|X1> to C<right-Alt>).
4126 Then there are 24 possible bitmaps (without using
4127 C<Shift>) — and 3 of them are taken by C<lCtrl> C<rCtrl> and C<lAlt> — which should
4128 better not be used for character input. This leaves 21 possible C<Shift>-pairs.
4129
4130 (The L<B<izKeys> keyboard layouts|http://k.ilyaz.org> use them for the Base personality
4131 and its C<AltGr> variant, plus 3 companion personalities (=alphabets), plus 16 for
4132 L<different flavors|https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols>
4133 of Latin and Greek Unicode math symbols. — This misses 2 flavors of Sans-Serif+Bold Greek.
4134 See more details in L<"Notes on the finer details of assigning modifier-bitmap bits">.)
4135
4136 B<WARNING:> the OS attempts to autogenerate bindings (such as C<"\004"> for C<Control-D>)
4137 for C<Control>-alphabetical keys (based on their C<VK_>codes). However, this is done
4138 only if the current modifier bitmap is made of C<SHIFT> C<CTRL> and C<KANA> bits. So with
4139 assignments above, it is important to have dedicated columns in the C<LAYOUT> section
4140 for C<Control->keys. (But this is done anyway for keyboards generated with C<MSKLC>.)
4141
4142 B<WARNING:> without any other modifier (except C<Shift>)
4143 L<the stripping of C<KBDALT>|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">
4144 still happens with the assignment above. It results in the bitmap C<KBDKANA> (possibly combined
4145 with C<KBDSHIFT>). For normal functionality of the C<left_Alt>-keys, one should redirect
4146 these bitmaps to modification columns by I<stripping C<KBDKANA>> from these two bitmaps.
4147
4148 B<NOTE:> since C<KBDALT> stripping leaves a non-base bitmap, one can map to a column I<specific
4149 to C<Alt>-bindings>. In particular, even if a keyboard is non-Latin, one can still make C<Alt->keys
4150 activate English-language menu entries, or trigger Latin-bases accelerator in an application. (Compare
4151 with what is discussed in L<"Possible enhancements and caveats">.)
4152
4153 B<Remark:> the assignment to the left C<Alt> is more or less “fixed” (compare with
4154 L<Windows ignores C<lAlt> if its modifier bitmaps is not standard>). Likewise,
4155 the assignment to the C<rAlt=AltGr> is explained in
4156 L<"Windows combines modifier bitmaps for C<lCtrl>, C<Alt> and C<rAlt> on C<AltGr>">.
4157
4158 B<Caveat:> the latter assignment leads to possible complications (see B<Caveat> in L<"The bullet-proof method">). So the
4159 assignment above should only be “used when designing ‘what different modification columns should do’”. — However, in the actual
4160 C<MODIFIERS> section of the keyboard layout one should better remove the bits of C<lCtrl> from the bits in C<rAlt> (preferably
4161 leaving a comment about “the effective” bits! — this is what this module is doing).
4162
4163 This is continued in L<More (random) rambling on assignment of key combinations>.
4164
4165 =head2 Using C<Win>-key
4166
4167 The preceding section was written when I thought that the bitmap is limited
4168 to 8 bits. In fact, the bitmap turns out to be 16-bit, so one can enhance the
4169 discussion above assigning C<X3> bit to C<Win> key, making all the combinations
4170 with C<Win> fully distinct by their bitmap.
4171 (See L<"Workarounds for WINDOWS GOTCHAS for application developers (problems in kernel)">.)
4172
4173 B<NOTE:> since the OS uses the bitmap as an index in the array C<MODIFIERS.ModNumber>, the
4174 size of this array does not affect the speed of lookup. The only effect of using
4175 wider bitmaps is the size of the keyboard DLL: using 10 bits instead of 5 would
4176 only increase the size by 1K.
4177
4178 Since it seems that L<the OS does not eat combinations of C<Win> and C<AltGr>|https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec>,
4179 one may actually use these combinations to produce character input. (Although
4180 without thorough experiments it is not clear whether this is advisable… Better
4181 avoid C<Win> if feasible! L<This undocumented C<Ctrl-Win-Alt-Shift-L> shortcut|https://www.pcworld.com/article/2070843/behold-the-dumbest-windows-shortcut-of-them-all.html>
4182 may also get in the way! One can still hope that there is a way to affect this by a judicious use of the remapping of C<LWIN> and
4183 C<RWIN> keys as in L<"A full example of changing C<VK_>-codes depending on modifiers">. Although interpretation of C<AltGr> “as
4184 of pure C<Alt>” — see the referenced section and its preceding section — gets in the way of “naive approaches”: with them the
4185 shortcuts including C<Win>+C<Alt> — “Game pad”, “Voice typing” and “App‘s actions” — must be entered “in exactly this order” — as
4186 opposed to C<Alt>+C<Win>…)
4187
4188 If one assignes character input to combinations including C<Win+rAlt>, this
4189 adds 8 more C<Shift>-pairs to 21 discussed above. For example, one could add
4190 2 missing math flavors of Greek, add 3 more for C<AltGr>-variants of companion
4191 personalities, B<as well as free> the C<lCtrl-lAlt> from character
4192 bindings — freeing it for application accelerators.
4193
4194 (However, it is not clear whether these bindings can be made “orthogonal enough”
4195 to redeem the trouble! For example, it is desired for C<AltGr> to “behave the
4196 same” on the base personality and on its 3 companions, as well as generate
4197 SanSerif/Bold/Italic variants of Latin/Greek by adding 3 modifiers. Is it even
4198 possible?! See below…)
4199
4200 =head2 Almost orthogonality — with C<Win>-key
4201
4202 To answer the last question at least partially, consider the following way of binding:
4203
4204 | ∅ M C MC A AM AC AMC
4205 —————————————————————————————————————————————————
4206 ∅ | Lat Grk — Scr Latᴬ Grkᴬ BbB Frk
4207 C | — Lˢˢ 〃 〃 〃 〃
4208 A | — Scrᴮ Lᴮ Grᴮ Mono Frkᴮ
4209 CA | — Lᴮˢˢ Grᴮˢˢ 〃 〃 〃 〃
4210 W | — ¿? — ¿? Lᴵ Grᴵ Lᴵˢˢ
4211 CW | — ¿? — ¿? 〃 〃 〃 〃
4212 WA | — ¿? Cyrᴬ Hbrᴬ Lᵗᵉⁿ Grᵗᵉⁿ
4213 CWA | Cyr Hbr Lᴮⁱ Grᴮᴵ 〃 〃 〃 〃
4214
4215 with
4216
4217 =over 4
4218
4219 =item
4220
4221 Columns are combinations of “keys on the right of Spacebar: C<AltGr>, C<Menu>, C<rCtrl>” (shortened to one letter).
4222
4223 =item
4224
4225 Rows are cominations of keys “on the left of Spacebar: C<lCtrl> C<Win> C<lAlt>”.
4226
4227 =item
4228
4229 Dashes “C<—>” mean “this position should not be bound — to free it to application accelerators”;
4230
4231 =item
4232
4233 Ditto marks “〃” mean “same as above it” — the limitation due to C<KLLF_ALTGR>.
4234
4235 =item
4236
4237 C<Lat>/C<Grk>/C<Cyr>/C<Hbr> mean 4 personalities (these particular names are just for illustrative purposes), C<L> and C<Gr> mean
4238 two possible scripts of math alphabet letters. The superscripts mean:
4239 C<ᴬ>: C<AltGr>-flavor, C<ᴮ>: Bold, C<ᴵ>: Italic, C<ˢˢ>: SansSerif, C<ᵗᵉⁿ>: “Tensor” = C<ᴮᴵˢˢ>.
4240
4241 (Although the name C<Gr> is arbitrary, I<on “Math-font” flavors> this B<indeed means “Greek”>. So maybe it is better to call it
4242 I<Oriental> 😃.)
4243
4244 =item
4245
4246 C<Bbb>/C<Mono>/C<Scr>/C<Frk> mean flavors of “fancy” math characters: C<Blackboard-Bold> 𝔸𝕒𝔹𝕓, C<Monospaced> 𝙰𝚊𝙱𝚋, C<Script> 𝒜𝒶ℬ𝒷,
4247 C<Frakture> 𝔄𝔞𝔅𝔟 (the last two may be boldified).
4248
4249 =item
4250
4251 “C<¿?>” marks “questionable positions”, where the system-accelerator-based-on-VK_-code can trigger???
4252
4253 =back
4254
4255 With this, one can have
4256
4257 =over 4
4258
4259 =item
4260
4261 Convenient access to C<L>/C<Gr> personalities (including C<AltGr>-versions) and “fancy math” (with C<lAlt> meaning “(un)Bold” — same
4262 as below).
4263
4264 =item
4265
4266 Non-convenient (but easy-to-memorize: C<left-CWA>) access to C<Cyr>/C<Hbr>-personalities (including C<AltGr>-versions) and
4267 “acceptable” way to reach “Tensor Math-fonts”.
4268
4269 =item
4270
4271 Access to “Math-font” flavors is non-orthogonal, “but almost”: starting from C<AltGr>-C<L>-personality, the orthogonal accessors are
4272 “the usual C<Gr>-switch”, C<lAlt> for “Bold”, C<Win> for “Italic”, and C<rCtrl> for “SansSerif”.
4273
4274 =item
4275
4276 But not all flavors can be accessed by combining these orthogonal accessors. — One may need to replace C<AltGr> by C<lCtrl>.
4277 (This works only with C<rCtrl>-active.)
4278
4279 =item
4280
4281 The final inconvenience is with “Bold-Italic Math fonts”: they are accessed by the preceding rule “as if it had ‘SansSerif’ added”.
4282
4283 =back
4284
4285 (As the 3rd/4th personalities go, one can duplicate them — at least non-C<AltGr> versions — to easier to access (but “non-orthogonal”)
4286 free slots at the top-left of the table. And if one can live with another modifier key replacing C<AltGr> as the accessor to its
4287 second layer, one can even add a 5th personality into the unused space of the table above.)
4288
4289 B<Summary>: This way of access trades the convenience of access to the 3rd/4th personalities (of
4290 L<C<izKeys>-type access|http://k.ilyaz.org/#advMods>) for simple access to C<AltGr>-layer of the 2nd personality, a
4291 kind-of-orthogonality of “Math-fonts”, and for freeing C<lCtrl-lAlt> for accelerators. (Just in case, recall again: here I<we do
4292 not even try> to make “Math-fonts” easily-accessible! This is just an illustration that even with Windows’ ideosyncrasies, I<a
4293 logical> way of access can be “almost at reach”. — To make things convenient, there should be a way of “latching” the modifier
4294 keys for a short time — for example, I<until B<all> the modifier keys are released>.)
4295
4296 B<Note>: the special role of Bold Italic Sans Serif math font is that though standards deny particular binds between fonts-in-math
4297 and semantic (like ISO 80000-2 (3): “There are no strict rules for the use of letter fonts…”), many of them suggest denoting tensors
4298 in this font. (For example, ISO 80000-2 (17.19) = L<ISO 31-11 (13.14)|https://law.resource.org/pub/in/bis/S07/is.1890.11.1995.pdf#page=28>,
4299 or L<IEC 60050 (102-03-39)|https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-39>.)
4300
4301 B<Enhancement>: since there are a few unused slots in the table above, one may want to allow “short continuous” input of
4302 Super/subscripts, phonetic symbols etc. by filling these slots.
4303
4304 =head2 Almost orthogonality — with C<lCtrl>-C<AltGr>-combinations
4305
4306 Recall that nowadays it seems that by making the C<VK_>-code of C<lCtrl> and of C<AltGr> dependant on modifiers,
4307 L<it is possible to support combinations of C<lCtrl>-C<AltGr>|"Another redefinition to avoid problems with the C<KLLF_ALTGR> flag">
4308 (and other modifiers) almost without user-visible glitches. Therefore, it makes sense to inspect what kind of orthogonality is
4309 achievable when such combinations become accessible for binding.
4310
4311 In the table above, C<〃>s disappear. The best result I could arrive at is:
4312
4313 ↓L R→| ∅ M C MC A AM AC AMC Heuristics
4314 —————————————————————————————————————————————————
4315 ∅ | Lat Grk — Scr Latᴬ Grkᴬ BbB Frk Base (Two personalities + Weird-Math)
4316 A | — ¿? Scrᴮ Lᵗᵉⁿ Grᵗᵉⁿ Mono Frkᴮ ±Heavy
4317 C | — Cyr Hbr Lᴵˢˢ Lᴮˢˢ Cyrᴬ Hbrᴬ Grᴮˢˢ Two more personalities (and — scattered — Sans Serif)
4318 CA | — Lˢˢ Lᴵ Grᴵ Lᴮ Grᴮ Lᴮⁱ Grᴮᴵ Orthogonal math: (and Lˢˢ)
4319
4320
4321 As before, C<Lat>/C<Grk>/C<Cyr>/C<Hbr> mean 4 personalities (these particular names are just for illustrative purposes), C<L> and
4322 C<Gr> mean two possible scripts of math alphabet letters. The superscripts mean:
4323 C<ᴬ>: C<AltGr>-flavor, C<ᴮ>: Bold, C<ᴵ>: Italic, C<ˢˢ>: SansSerif, C<ᵗᵉⁿ>: “Tensor” = C<ᴮᴵˢˢ>. This time, C<¿?> stands for the
4324 position where not I<very> sophisticated applications may interpret as “being C<Alt>-letters”. (This is the only “usable” position
4325 for which C<Alt> is down, but C<Ctrl> is not).
4326
4327 ??? One should also inspect what happens with modifiers-changed lCtrl.
4328 If AltGr was pressed first, this does not matter — so at least there is a workaround — except for the left ½ of bottom row.
4329 (And there pressing lCtrl before lAlt is a workaround.) What happens without workarounds???
4330
4331 Complete orthogonality is not possible; however:
4332
4333 =over 4
4334
4335 =item
4336
4337 For personalities, C<AltGr> behaves “as expected”. (And in the “orthogonal math” it means “Bold”.)
4338
4339 =item
4340
4341 The “C<lAlt>” row is the “Heavy” variant of the first row. (Only to get “tensor”, one needs another C<Alt> too…)
4342
4343 =item
4344
4345 “Two more” personalities are obtained “by adding C<lCtrl> and/or C<rCtrl>”. — This is not “fully orthogonal”.
4346
4347 =item
4348
4349 In the “orthogonal math” mode, C<AltGr> means “Bold”, C<rCtrl> means “Italic”, and C<Menu> means “Greek”.
4350
4351 =item
4352
4353 Non-”tensor” variants of Sans Serif math is obtained by removing C<lAlt> (and possibly removing Greek/Italic) from the “orthogonal”
4354 variants (without Sans Serif). (The only exception is C<Lˢˢ> — for which one “skips removing C<lAlt>” as well ☺.)
4355
4356 =back
4357
4358 B<Enhancement:> two unused slots (empty, and the “questionable C<¿?> one”) may be used as in the preceding section.
4359
4360 =head2 Notes on the finer details of assigning modifier-bitmap bits
4361
4362 B<NOTE:> Without using the C<Win> key, only 21 useful C<Shift>-pairs remain (with the
4363 assignment above and using C<KLLF_ALTGR> flag).
4364 (This is what C<versions ≥0.63> of L<B<izKeys> keyboard layout|http://k.ilyaz.org/iz> is
4365 using; out of 24 combinations with distinct bitmaps, C<lAlt>, C<lCtrl> and C<rCtrl> should be
4366 excluded.) B<Trivia:> While this may look as a complete overkill, recall that characters
4367 outside BMP can be inserted on Windows I<only> via one keypress, possibly with many
4368 modifiers. (This restriction relates only to the “classical” flavor of Windows keyboard layouts.)
4369 Unicode L<defines 18 additional Latin/Greek alphabets for mathematical
4370 discourse|http://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols>. If a keyboard
4371 layout would want to support these letters, this would quickly exhaust the possible combinations
4372 of modifiers. (For 2-script layout, one could live with Latin/AltGr-Latin/Greek + 18 mathematical
4373 alphabets. But for layouts supporting more scripts, it lookes like using C<Win> key is not
4374 avoidable.) B<WARNING:> the price for using 21 C<Shift>-pairs (as opposed to ≤20) is that the
4375 modifiers C<lCtrl-lAlt> are forced to be used for character input. This is in no way the best
4376 practice, since many applications using keyboard-accelerators get confusing results in such a
4377 situation.
4378
4379 (B<HOWTO:> In principle, such applications could inspect the timing data on keypresses to
4380 distinguish C<KLLF_ALTGR>-auto-generated C<lCtrl> presses — when C<rAlt> is pressed the timecodes 
4381 on C<lCtrl> and C<rAlt> are guarantied to be the same — from I<actual> keypresses of
4382 C<lCtrl> and C<rAlt> made by user — and interpret these as accelerators. With such inspection,
4383 one could use C<lCtrl-lAlt> and C<rAlt> for character input, and use C<lCtrl-rAlt->presses
4384 to control the application.)
4385
4386 B<NOTE:> Applications may call ToUnicode() with I<impossible combinations> of modifiers:
4387 for example, they may "put" C<Ctrl> down, but do not specify whether it is C<rCtrl> or
4388 C<lCtrl>. Likewise for C<Alt>.
4389
4390 To support that, one would need to define a mask for standalone C<VK_CONTROL> and C<VK_MENU>
4391 (i.e., C<Ctrl> and C<Alt>). Since these modifiers are present when the real “left-right-handed”
4392 keys are down, the masks should be “contained” in the masks of handed keys. B<Example:> one
4393 can make the pseudo-key C<Ctrl> to generate bit C<CTRL>, and the pseudo-key C<Alt> to generate
4394 the bit C<ALT>. Then for any combination of modifiers with unhanded C<Ctrl> and/or C<Alt>,
4395 either the corresponding combination of bits is supported by the layout (and then the
4396 application will access the corresponding modification column — which is probably not
4397 the “expected” column corresponding to some handed flavor), or the combination is not
4398 yet defined. In the latter case, one may actually decide I<how> to resolve this: one can
4399 map this combination of modifiers to an arbitatrary modification column!
4400
4401 In particular, one can map such combination of modifiers to a certain choice of handedness
4402 of C<Ctrl> and C<Alt>. (An example of such a problematic application was L<Firefox|"Firefox misinterprets keypresses">;
4403 look for “I<impossible modifier>”.)
4404
4405 B<NOTE:> Some applications may do a "reverse lookup" using
4406 L<C<VkKeyScanW()>|https://msdn.microsoft.com/en-us/library/windows/desktop/ms646329%28v=vs.85%29.aspx>
4407 (this is B<the only> API which exposes the modifier masks). Most of these calls would not
4408 know anything about "higher bits", only S/C/A would be covered. In particular,
4409 it makes sense to add "fake" entries mapping combinations of bits 0x01/0x02/0x04 to the
4410 "corresponding" modification columns.
4411
4412 For example, C<rAlt> above would produce modifier mask C<CTRL|ALT|LOYA|X1>;
4413 this mask would access a certain column in the table of bindings; make the
4414 mask C<CTRL|ALT> access the same column. Then an application making a lookup
4415 for a certain character via C<VkKeyScanW()> would see C<CTRL|ALT>. Since this is
4416 the mask which is I<usually> produced by pressing C<rAlt>, the application
4417 would think (correctly! — but only thanks to this fake entry) that this character
4418 may be produced with C<rAlt> modifier.
4419
4420 B<NOTE:> A keypress may be combined with “modifier keys” (like C<Shift>, C<right-Control> etc.) in up
4421 to 125 ways. B<REMARK:> Why not a power of 2? The maximal number of “modification columns” supported by Windows is 126: a
4422 larger number would make the size of C<VK_TO_WCHARS...> (which includes 2 extra bytes)
4423 to overflow the maximal number
4424 255 storable in the field C<VK_TO_WCHAR_TABLE.cbSize> of type C<BYTE> = C<unsigned char>.
4425
4426 Given that the column 15 is ignored, this reduces the number of strings associated to
4427 a keypress (with different “modifiers”) to 125.
4428
4429 =head2 Issues with support of European(ISO)/Brazilian(ABNT2)/Japanese(JIS) physical keyboards
4430
4431 How can one keyboard layout (done in software!) retain functionality when used with different physical keyboards?
4432
4433 Three keyboards above have L<extra keys|https://www.win.tue.nl/~aeb/linux/kbd/scancodes-8.html> (see also
4434 L<https://kbdlayout.info/kbdibm02/scancodes> — changing
4435 “Arrangement” if needed, as well as L<https://bsakatu.net/doc/virtual-key-of-windows/> — and the references there),
4436 with their positions on the “main island” of the keyboard and scancodes
4437 (as well as intended translations to C<VK_>codes) as in:
4438
4439 Left Right Top-Right
4440 ————————————————————————————————————————————————————————————————
4441 European(ISO) 56→OEM_102 --- ---
4442 Brazilian(ABNT2) 56→OEM_102 73→ABNT_C1 ---
4443 Japanese(JIS) --- 73→OEM_102 7D→OEM_8
4444
4445 (These keys are positioned right-of-C<left_Shift>, left-of-C<right_Shift>, left-of-C<Backspace>. Inspect
4446 L<these images|https://kbdlayout.info/kbdibm02/scancodes>; one can change the shown physical keyboard by changing C<Arrangement>,
4447 and change the labels on the keys — below-right of the image. — Also try changing the layout — in the URL — to C<kbdbr>.)
4448
4449 Recall that a scancode is a signal from hardware (+drivers), while the C<VK_>code is calculated based on the scancode.
4450 B<CONCLUSION:> these assignments are incompatible in one keyboard layout (due to conflicts of ABNT2/JIS with the translation of the
4451 scancode 0x73).
4452
4453 On the other hand, European and Brazilian physical keyboards are compatible. If one keeps these assignments C<56→OEM_102>,
4454 C<73→ABNT_C1>, then the right extra-key on JIS (marked as C<\> C<_>, between C</?> and right C<Shift>) behaves as the right extra
4455 key on the Brazilian keyboard. (This is already good!)
4456
4457 However, “doing only this” makes the functionality assigned to C<OEM_102> unavailable on the Japanese physical keyboard. However,
4458 it has one more extra key (to the left of L<Backspace>). — So if one uses its intended translation to C<VK_OEM_8>, but B<duplicates>
4459 the functionality of C<VK_OEM_102> to C<VK_OEM_8>, then this key I<replaces> “the ISO key”! (Nowadays they are even marked the
4460 same: C<\> C<|> — but historically it was C<¥> C<¦> on JIS.)
4461
4462 This boils down to:
4463
4464 =over 4
4465
4466 =item
4467
4468 Assign C<56→OEM_102>, C<73→ABNT_C1>, C<7D→OEM_8> and
4469
4470 =item
4471
4472 duplicate “the layout of” C<OEM_102> to C<OEM_8>.
4473
4474 =item
4475
4476 This results in the “extra right key” on ABNT2 and JIS keyboards behaving the same (C<ABNT_C1>), and
4477
4478 =item
4479
4480 the “extra left key” on ISO/ABNT2 keyboards behaving the same as “extra top-right key” on JIS keyboards. (While this is
4481 inconvenient, the position of C<OEM_102> varies anyway on many physical keyboards!)
4482
4483 =back
4484
4485 (The only other shortcoming of this scheme is that applications special-casing the C<VK_>code C<OEM_102> — are there such?! — would
4486 not act on “the top-right extra-key” as intended. — But anyway, this happens even without using the scheme above! B<TODO:> Can one
4487 work around by making an assignment C<e056→OEM_102> and remapping scancode C<56> to C<e056> as in "Low level scancode mapping"
4488 below?)
4489
4490 B<MORE ISSUES:> On ABNT2 physical keyboard there is one more extra key C<7E→ABNT_C2> (between C<Gray-+> and C<Gray-Enter> on the
4491 “numeric island”). In the Brazilean layout it generates “the opposite” of the C<DECIMAL> numeric-island key (C<.> vs. C<,>). So
4492 if C<DECIMAL> generates C<.>, it makes sense to duplicate the bindings of the key C<COMMA> to the key C<ABNT_C2>.
4493
4494 Likewise, on JIS physical keyboard the C<Space> key is very narrow — since its space is taken by C<CONVERT> and C<NOCONVERT> keys.
4495 When one runs non-Japanese keyboard layouts on such a keyboard, “one can restore the justice” and duplicate the bindings of the
4496 C<SPACE> key to the C<CONVERT> and C<NONCONVERT> keys.
4497
4498 B<NOTE:> it is a judgement call how to implement the mirroring done above. One could also, for example, map the scan codes
4499 0x79 and 0x7B (usually translated to C<CONVERT> and C<NONCONVERT> keys) to C<VK_SPACE>. (However, this may make rebinding of
4500 these keys in customizable applications harder.)
4501
4502 B<WARNING:> some versions of Firefox may lock when switching to certain keyboards (see
4503 L<"Can an application on Windows accept keyboard events? Part II: special key events">).
4504 With v.55 such a lock would not occur when one
4505 removes the binding for C<OEM_8> from this keyboard. Caveat emptor!
4506
4507 B<NOTE:> for yet more exotic keys search for C<exotic virtual> in L<"SEE ALSO">.
4508
4509 =head1 WINDOWS GOTCHAS
4510
4511 First of all, keyboard layouts on Windows are controlled by DLLs; the only function
4512 of these DLLs is to export a table of "actions" to perform. This table is passed
4513 to the kernel, and that's it - whatever is not supported by the format of this table
4514 cannot be implemented by native layouts. (The DLL performs no "actions" when
4515 actual keyboard events arrive.)
4516
4517 Essentially, the logic is like that: there are primary "keypresses", and
4518 chained "keypresses" ("prefix keys" [= deadkeys] and keys pressed after them).
4519 Primary keypresses are distinguished by which physical key on keyboard is
4520 pressed, and which of "modifier keys" are also pressed at this moment (as well
4521 as the state of "latched keys" - usually C<CapsLock> only, but may be also C<Kana>). This combination
4522 determines which Unicode character is generated by the keypress, and whether
4523 this character starts a "chained sequence".
4524
4525 On the other hand, the behaviour of chained keys is governed I<ONLY> by Unicode
4526 characters they generate: if there are several physical keypresses generating
4527 the same Unicode characters, these keypresses are completely interchangeable
4528 inside a chained sequence. (The only restriction is that the first keypress
4529 should be marked as "prefix key"; for example, there may be two keys producing
4530 B<-> so that one is producing a "real dash sign", and another is producing a
4531 "prefix" B<->.)
4532
4533 The table allows: to map C<ScanCode>s to C<VK_key>s; to associate a C<VK_key> to several
4534 (numbered) choices of characters to output, and mark some of these choices as prefixes
4535 (deadkeys). (These "base" choices may contain up to 4 16-bit characters (with 32-bit
4536 characters mapped to 2 16-bit surrogates); but only those with 1 16-bit character may
4537 be marked as deadkeys.) For each prefix character (not a prefix key!) one can
4538 associate a table mapping input 16-bit "base characters" to output 16-bit characters,
4539 and mark some of the output choices as prefix characters.
4540
4541 The numbered choices above are determined by the state of "modifier keys" (such as
4542 C<Shift>, C<Alt>, C<Control>), but not directly. First of all, C<VK_keys> may be
4543 associated to a certain combination of 6 "modifier bits" (called "logical" C<Shift>,
4544 C<Alt>, C<Control>, C<Kana>, C<User1> and C<User2>, but the logical bits are not
4545 required to coincide with names of modifier keys). (Example: one can bind C<Right Control>
4546 to activate C<Shift> and C<Kana> bits.) The 64 possible combinations of modifier bits
4547 are mapped to the numbered choices above.
4548
4549 Additionally, one can define two "separate
4550 numbered choices" in presence of CapsLock (but the only allowed modifier bit is C<Shift>).
4551 The another way to determine what C<CapsLock> is doing: one can mark that it
4552 flips the "logical C<Shift>" bit (separately on no-modifiers state, C<Control-Alt>-only state,
4553 and C<Kana>-only state [?!] - here "only" allow for the C<Shift> bit to be C<ON>).
4554
4555 C<AltGr> key is considered equivalent to C<Control-Alt> combination (of those
4556 are present, or always???), and one cannot bind C<Alt> and C<Alt-Shift> combinations.
4557 Additionally, binding bare C<Control> modifier on alphabetical keys (and
4558 C<SPACE>, C<[>, C<]>, C<\>) may confuse some applications.
4559
4560 B<NOTE:> there is some additional stuff allowed to be done (but only in presence
4561 of Far_East_Support installed???). FE-keyboards can define some sticky state (so
4562 may define some other "latching" keys in addition to C<CapsLock>). However,
4563 I did not find a clear documentation yet (C<keyboard106> in the DDK toolkit???).
4564
4565 There is a tool to create/compile the required DLL: F<kbdutool.exe> of I<MicroSoft
4566 Keyboard Layout Creator> (with a graphic frontend F<MSKLC.exe>). The tool does
4567 not support customization of modifier bits, and has numerous bugs concerning binding keys which
4568 usually do not generate characters. The graphic frontend does not support
4569 chained prefix keys, adds another batch of bugs, and has arbitrarily limitations:
4570 refuses to work if the compiled version of keyboard is already installed;
4571 refuses to work if C<SPACE> is redefined in useful ways.
4572
4573 B<WORKFLOW:> uninstall the keyboard, comment the definition of C<SPACE>,
4574 load in F<MSKLC> and create an install package. Then uncomment the
4575 definition of C<SPACE>, and compile 4 architecture versions using F<kbdutool>,
4576 moving the DLLs into suitable directories of the install package. Install
4577 the keyboard. (For another — and very robust — way to work, see
4578 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
4579
4580 For development cycle, one does not need to rebuild the install package
4581 while recompiling.
4582
4583 The following sections classify GOTCHAS into 3 categories:
4584
4585 L<"WINDOWS GOTCHAS for keyboard users">
4586
4587 L<"WINDOWS GOTCHAS for keyboard developers using MSKLC">
4588
4589 L<"WINDOWS GOTCHAS for keyboard developers (problems in kernel)">
4590
4591 =head1 WINDOWS GOTCHAS for keyboard users
4592
4593 =head2 MSKLC keyboards not working on Windows 8 without reboot
4594
4595 The layout is shown as active, but "preview" is grayed out,
4596 and is not shown on the Win-Space list. See also:
4597
4598 http://www.errordetails.com/125726/activate-custom-keyboard-layout-created-with-msklc-windows
4599
4600 The workaround is to reboot. Compare with
4601
4602 http://blogs.msdn.com/b/michkap/archive/2012/03/12/10281199.aspx
4603
4604 =head2 Default keyboard of an application
4605
4606 Apparently, there is no way to choose a default keyboard for a certain
4607 language. The configuration UI allows moving keyboards up and down in
4608 the list, but, apparently, this order is not related to which keyboard
4609 is selected when an application starts. (This may be fixed on Windows 8?)
4610
4611 =head2 Hex input of unicode is not enabled
4612
4613 One needs to explicitly tinker with the registry (see F<examples/enable-hex-unicode-entry.reg>)
4614 and then I<reboot> to enable this.
4615
4616 =head2 Standard fonts have some chars exchanged
4617
4618 At least in Consolas and Lucida Sans Unicode φ and ϕ are exchanged.
4619 Compare with Courier and Times. (This may be due to the L<difference between
4620 Unicode's pre-v3.0 choice of representative glyphs|http://en.wikipedia.org/wiki/Phi#Computing>,
4621 or the L<difference
4622 between French/English Apla=Didot/Porson's approaches|http://www.greekfontsociety.gr/pages/en_typefaces19th.html>.)
4623
4624 =head2 The console font configuration
4625
4626 According to L<MicroSoft|http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q247815>, it is controlled by Registry hive
4627
4628 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
4629
4630 The key C<0> usually gives C<Lucida Console>, and the key C<00>
4631 gives C<Consolas>. Adding random numbers does not work; however,
4632 if one adds one more zero (at least when adding to a sequence of zeros),
4633 one can add more fonts.
4634 You need to export this hive (e.g., use
4635
4636 reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" console-ttf.reg
4637
4638 ), save a copy (so you can always restore if the love goes sour)
4639 then edit the resulting file.
4640
4641 So if the maximal key with 0s is C<00>, add one extra row with an extra 0
4642 at end, and the family name of your font. The "family name" is what the Font
4643 list in C<Control Panel> shows for I<font families> (a "stacked" icon is shown);
4644 for individual fonts the weight (Regular, Book, Bold etc) is appended. So I add a line
4645
4646 "000"="DejaVu Sans Mono"
4647
4648 the result is (omitting Far Eastern fonts)
4649
4650 Windows Registry Editor Version 5.00
4651
4652 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont]
4653 "949"="..."
4654 "0"="Lucida Console"
4655 "950"="..."
4656 "932"="..."
4657 "936"="..."
4658 "00"="Consolas"
4659 "000"="DejaVu Sans Mono"
4660
4661 The full file is in F<examples/console-fonts00-added.reg>. After importing this
4662 file via F<reg> (or give it as parameter to F<regedit>; both require administrative priviledges)
4663 the font is immediately available in menu. (However, it does not work in "existing"
4664 console windows, only in newly created windows.)
4665
4666 B<(Do not use the example file directly. First inspect the hive exported on your system,
4667 and find the number of 0s to use. Then add a new line with correct number of
4668 zeros - as a value, one can use the string above. This will I<preserve> the defaults
4669 of your setup.> Keep in mind that
4670 selection-by-fontfamily is buggy: if you have more than one version of the font
4671 in different weight, it is a Russian Rullette which one of them will be taken
4672 (at least for DejaVu, which uses C<Book> as the default weight). First install
4673 the "normal" flavor of the font, then do as above (so the system has no way of picking
4674 the wrong flavor!), and only after this install the remaining
4675 flavors.
4676
4677 B<NOTE:> keep in mind that I distribute a good-for-console L<“merge” of two
4678 fonts|http://ilyaz.org/software/fonts/>: C<DejaVu + Unifont Smooth>; C<DejaVu> brings
4679 in nicely shaped nicely-scalable
4680 glyphs, and C<Unifont Smooth> brings a scalable font with complete coverage of BMP (as of 2015, of Unicode C<v7.0>).
4681 (We omit Han/Hangul since it does not fit in a narrow box of a console font.
4682 (As of 2015, it does not include U+30fb since apparently, this breaks display of
4683 "undefined" character in PUA in Windows' console.)
4684
4685 B<CAVEAT:> the string to put into C<Console\TrueTypeFont> is the I<Family Name> of the font.
4686 The family name is what is shown in the C<Fonts> list of the C<Control Panel> — but only
4687 for families with more than one font; otherwise the “metric name” of the font is appended.
4688
4689 On Windows, it is tricky to find the family name using the default Windows' tools, without
4690 inspecting the font in a font editor. One workaround is to select the font in C<Character Map>
4691 application, then inspect C<HKEY_CURRENT_USER\Software\Microsoft\CharMap\Font> via:
4692
4693 reg export HKCU\Software\Microsoft\CharMap character-map-font.reg
4694
4695 Note: the mentioned above MicroSoft KB article lists the wrong way to find the family name.
4696 What is visible in the C<Properties> dialogue of the font, and in C<CurrentVersion\Fonts> is the
4697 I<Full Font Name>. Fortunately, quite often the full name and the family name coincide —
4698 this is what happened with C<DejaVu>. To find the "Full name" of the font, one can look into the hive
4699
4700 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
4701 reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" fonts.reg
4702
4703 For example, after installing C<DejaVuSansMono.ttf>, I see
4704 C<DejaVu Sans Mono (TrueType)> as a key in this hive.
4705
4706 B<One more remark:> for desktop icons coming from the “Public” user (“shared”
4707 icons) which start a console application, the default font is not directly editable.
4708 To reset it, one must:
4709
4710 =over
4711
4712 =item *
4713
4714 copy the F<.lnk> icon file to “your” desktop directory;
4715
4716 =item *
4717
4718 start the application using the “new” icon;
4719
4720 =item *
4721
4722 change the font via “Properties” of the window's menu;
4723
4724 =item *
4725
4726 as administrator, copy the F<.lnk> file back to the F<Public/Desktop>
4727 directory (usually in something like F<C:/Users>). Manually refresh
4728 the desktop. Verify that the “old” icon works as expected.
4729 (Now you can remove the “new” icon created on the first step.)
4730
4731 =back
4732
4733 =head2 There is no way to show Unicode contents on Windows
4734
4735 Until Firefox C<v13>, one could use FireFox to show arbitrary
4736 Unicode text (limited only by which fonts are installed on your
4737 system). If you upgraded to a newer version, there is no (AFAIK)
4738 Windows program (for general public consumption) which would visualize
4739 Unicode text. The applications are limited either (in the worst case) by
4740 the characters supported by the currently selected font, or (in the best
4741 case) they can show additionally characters, but only those considered by the
4742 system as "important enough" (coming from a few of default fonts?).
4743
4744 There is a workaround for this major problem in FireFox (present at least
4745 up to C<v20>). The problem is caused
4746 by L<this “improvement”|https://bugzilla.mozilla.org/show_bug.cgi?id=705594>
4747 which blatantly saves a few seconds of load time for a tiny minority of
4748 users, the price being an unability to show Unicode I<for everybody>
4749 (compare with comments L<33|https://bugzilla.mozilla.org/show_bug.cgi?id=705594#c33>
4750 and L<75|https://bugzilla.mozilla.org/show_bug.cgi?id=705594#c75> on the bug report above).
4751
4752 It is not documented, but this action is controlled by C<about:config>
4753 setting C<gfx.font_rendering.fallback.always_use_cmaps>. To enable Unicode,
4754 make this setting into C<true> (if you have it in the list as C<false>, double-clicking it would
4755 do this — do search to determine this; otherwise you need to create a new
4756 C<Binary> entry).
4757
4758 There is an alternative/additional way to enable extra fonts; it makes
4759 sense if you know a few character-rich fonts present on your system. The (undocumented)
4760 settings C<font.name-list.*.x-unicode> (apparently) control fallback fonts for situations
4761 when a suitable font cannot be found via more specific settings. For example, when
4762 you installed (free) L<Deja vu|http://dejavu-fonts.org/>,
4763 L<junicode|http://junicode.sourceforge.net/>, L<Symbola|http://users.teilar.gr/~g1951d/> fonts on your system, you may set (these
4764 variables are not present by default; you need to create new C<String> variables):
4765
4766 font.name-list.sans-serif.x-unicode DejaVu Sans,Symbola,DejaVu Serif,DejaVu Sans Mono,Junicode,Unifont Smooth
4767 font.name-list.serif.x-unicode DejaVu Serif,Symbola,Junicode,DejaVu Sans,Symbola,DejaVu Sans Mono,Unifont Smooth
4768 font.name-list.cursive.x-unicode Junicode,Symbola,DejaVu Sans,DejaVu Serif,DejaVu Sans Mono,Unifont Smooth
4769 font.name-list.monospace.x-unicode DejaVu Sans Mono,DejaVu Sans,Symbola,DejaVu Serif,Junicode,Unifont Smooth
4770
4771 And maybe also L<Fantasy|http://shallowsky.com/blog/tech/web/firefox-cursive-fantasy.html>
4772
4773 font.name-list.fantasy.x-unicode Symbola,DejaVu Serif,Junicode,DejaVu Sans Mono,DejaVu Sans,Unifont Smooth
4774
4775 (Above, we use the L<C<Unifont Smooth>||http://ilyaz.org/software/fonts/>
4776 as the font of last resort. Although the glyphs are very coarse, in this role
4777 it is very useful since it contains all the Unicode C<v9.0> characters in BMP (as well as many out of BMP).
4778
4779 B<Note:> L<the standard distribution|http://unifoundry.com/unifont.html> of C<Unifont>
4780 contains “fake” glyphs for characters not supported by the font. Such a design error is unexcusable for a TrueType font; this gets
4781 in the way when an application tries to find the best way to show a character. Using
4782 (non-C<Mono> variant of) my “C<Smooth>” re-build not only fixes this (and some others) problems,
4783 but also makes the font nicely scalable — the original works well only in the size 16px.
4784
4785 B<Note:> on Windows, install the hinted version of Symbola (from the ZIP file); unhinted versions does not work well in GDI
4786 applications (apparently, GDI does not auto-hints).
4787
4788 If you set both: the C<font.*> variables with rich enough fonts,
4789 B<and> C<gfx.font_rendering.fallback.always_use_cmaps>,
4790 then you may have the best of both worlds: the situation when a character cannot
4791 be shown via C<font.*> settings will be extremely rare, so the possiblity of delay
4792 due to C<gfx.font_rendering.fallback.always_use_cmaps> is irrelevant.
4793
4794 =head2 Firefox misinterprets keypresses
4795
4796 Most of these are fixed (at least as of v.55) except ones marked with [B<*>] below:
4797
4798 =over 4
4799
4800 =item *
4801
4802 [B<*>] Firefox locks completely when one tries to switch to certain keyboards. See
4803 details near the end of L<"Can an application on Windows accept keyboard events? Part II: special key events">.
4804
4805 =item *
4806
4807 Multiple prefix keys are not supported.
4808
4809 =item *
4810
4811 C<AltGr-0> and C<Shift-AltGr-0> are recognized as a character-generating
4812 keypress (good!), but the character they produce bears little relationship
4813 to what keyboard produces. (In our examples, the character may be available
4814 only via multiple prefix keys!)
4815
4816 =item *
4817
4818 After a prefix key, C<Control-(Shift-)letter> is not recognized as a
4819 character-generating key.
4820
4821 =item *
4822
4823 [B<*>] C<Kana-Enter> is not recognized as a character-generating key.
4824
4825 =item *
4826
4827 [B<*>] C<Alt-+-HEXDIGITS> is not recognized as a character-generating key sequence (recall
4828 that C<Alt> should be pressed all the time, and other keys C<+ HEXDIGITS> should be
4829 pressed+released sequentially). (Nowadays digits work, but hex letter do not.)
4830
4831 =item *
4832
4833 When keyboard has an “extra” modifier key in addition to C<Shift/Alt/Ctrl> (an
4834 analogue of C<Kana> key), combining it with C<Ctrl> or with C<Alt> is interpreted
4835 by Firefox as if only C<Ctrl> or C<Alt> were pressed.
4836
4837 =item *
4838
4839 When keyboard generates different characters on C<AltGr> than on C<Control-Alt>
4840 (possible with assigning extra modifier bits to C<AltGr>), FireFox interprets any
4841 C<AltGr-Key> as if it were C<Control-Alt-Key>.
4842
4843 C<Exception:> when C<AltGr-Fkey> produces a character, this character is understood
4844 correctly by FF. Same for C<AltGr-arrowKey> (but again, while this works on numeric
4845 keypad, it is still buggy if C<NumLock> is on, or if the key is C<Numpad-Enter>.)
4846
4847 =item *
4848
4849 [B<*>] The keyboard may have C<rCtrl> which produces the same characters as C<lCtrl>, but
4850 which behaves differently when combined with other keys. FireFox ignores these
4851 differences.
4852
4853 This is combinable with other remarks above: e.g., C<lCtrl-Kana> is interpreted
4854 by FireFox as C<lCtrl>; same with C<lAlt>.
4855
4856 =item *
4857
4858 In addition to this, Firefox replaces C<rCtrl> and C<lCtrl> modifiers by
4859 an I<impossible modifier>: Firefox pretends that I<only> C<unhandedCtrl> is down. (Here
4860 C<unhandedCtrl> is a fake key C<VK_CONTROL> which Window pretends is down when either one
4861 of C<rCtrl> or C<lCtrl> is down.) Since the situation when C<unhandedCtrl>
4862 is down, but neither C<rCtrl> nor C<lCtrl> are down is not possible, this
4863 may access parts of the keyboard layout not visible to other applications.
4864 (Same for C<lAlt> and C<rAlt>.)
4865
4866 The net effect is that key combinations involving C<Ctrl> or C<Alt> keys
4867 may behave wrong in Firefox. For example, with version C<0.63> of
4868 L<izKeys keyboard layout|http://k.ilyaz.org/iz>, C<Ctrl> and C<Alt>
4869 are ignored on character-producing keys.
4870
4871 =item *
4872
4873 [B<*>] If C<lCtrl-lAlt-comma> produces C< — > (this is C<U+200A U+2014 U+200A>), and
4874 C<AltGr-comma> produces the “cedilla deadkey”, then pressing C<AltGr-comma c>
4875 acts as both: first C<U+200A U+2014 U+200A> are inserted, then C<ç>.
4876
4877 =item *
4878
4879 A subtle variation of the previous failure mode: If C<lCtrl-lAlt-`> produces
4880 deadkey X, and C<AltGr-`> produces the deadkey Y, then combining C<AltGr-`>
4881 with C<a> gives the expected Y*a combination. However, if combining with
4882 something more complicated (C<Control-Alt-a> or C<Kana-f>), with what
4883 deadkey Y is not combinable, B<THEN> the bugs strike:
4884
4885 =over 4
4886
4887 =item 1
4888
4889 in the first case the deadkey behaves as X: it produces a pair of characters
4890 C<Xα>; here C<Control-Alt-a> produces C<α>. (Keep in mind that inserting two
4891 characters is the expected behaviour outside of Firefox, but Firefox usually
4892 “eats” an undefined deadkey combination; and note that it is X, not the
4893 expected Y!).
4894
4895 =item 2
4896
4897 [B<*>] in the second case it produces only the character C<ф> generated by C<Kana-f>. Here
4898 the behaviour is neither as outside Firefox (where it would produce C<Yф>) nor as
4899 usual in Firefox (where it would eat the undefined sequence).
4900
4901 =back
4902
4903 =back
4904
4905 Of these problems, C<Chrome> has only C<Control-(Shift-)letter> one, but a very cursory inspection shows
4906 other problems: C<Kana-arrows> are not recognized as character-generating keys. (And IE9 just
4907 crashes in most of these situations…)
4908
4909 =head2 C<AltGr>-keypresses triggering some actions
4910
4911 For example, newer versions of windows have graphics driver reacting on C<Ctrl-Alt-Arrow>s by
4912 rotating the screen. Usually, when you know which application is stealing your keypresses, one
4913 can find a way to disable or reconfigure this action.
4914
4915 For screen rotation: Right-Click on desktop, “Graphics Options”, “Hot Keys”, disable. The way to
4916 reconfigure this is to use “Graphics Properties” instead of “Graphics Options” (but this may depend
4917 on your graphics subsystem).
4918
4919 =head2 C<AltGr>-keypresses going nowhere
4920
4921 Some C<AltGr>-keypresses do not result in the corresponding letter on
4922 keyboard being inserted. It looks like they are stolen by some system-wide
4923 hotkeys. See:
4924
4925 http://www.kbdedit.com/manual/ex13_replacing_altgr_with_kana.html
4926
4927 If these keypresses would perform some action, one might be able to deduce
4928 how to disable the hotkeys. So the real problem comes when the keypress
4929 is silently dropped.
4930
4931 I found out one scenario how this might happen, and how to fix this particular
4932 situation. (Unfortunately, it did not fix what I see, when C<AltGr-s> [but not
4933 C<AltGr-S>] is stolen.) Installing a shortcut, one can associate a hotkey to
4934 the shortcut. Unfortunately, the UI allows (and encourages!) hotkeys of the
4935 form C<Control-Alt-letter> (which are equivalent to C<AltGr-letter>) - instead
4936 of safe combinations like C<Control-Alt-F4> or
4937 C<Alt-Shift-letter> (which — by convention — are ignored by keyboard drivers, and do not generate
4938 characters). If/when an application linked to by this shortcut is
4939 gone, the hotkey remains, but now it does nothing (no warning or dialogue comes).
4940
4941 If the shortcut is installed in one of "standard places", one can find it.
4942 Save this to F<K:\findhotkey.vbs> (replace F<K:> by the suitable drive letter
4943 here and below)
4944
4945 on error resume next
4946 set WshShell = WScript.CreateObject("WScript.Shell")
4947 Dim A
4948 Dim Ag
4949 Set Ag=Wscript.Arguments
4950 If Ag.Count > 0 then
4951 For x = 0 to Ag.Count -1
4952 A = A & Ag(x)
4953 Next
4954 End If
4955 Set FSO = CreateObject("Scripting.FileSystemObject")
4956 f=FSO.GetFile(A)
4957 set lnk = WshShell.CreateShortcut(A)
4958 If lnk.hotkey <> "" then
4959 msgbox A & vbcrlf & lnk.hotkey
4960 End If
4961
4962 Save this to F<K:\findhotkey.cmd>
4963
4964 set findhotkey=k:\findhotkey
4965 for /r %%A in (*.lnk) do %findhotkey%.vbs "%%A"
4966 for /r %%A in (*.pif) do %findhotkey%.vbs "%%A"
4967 for /r %%A in (*.url) do %findhotkey%.vbs "%%A"
4968 cd /d %UserProfile%\desktop
4969 for /r %%A in (*.lnk) do %findhotkey%.vbs "%%A"
4970 for /r %%A in (*.pif) do %findhotkey%.vbs "%%A"
4971 for /r %%A in (*.url) do %findhotkey%.vbs "%%A"
4972 cd /d %AllUsersProfile%\desktop
4973 for /r %%A in (*.lnk) do %findhotkey%.vbs "%%A"
4974 for /r %%A in (*.pif) do %findhotkey%.vbs "%%A"
4975 for /r %%A in (*.url) do %findhotkey%.vbs "%%A"
4976 cd /d %UserProfile%\Start Menu
4977 for /r %%A in (*.lnk) do %findhotkey%.vbs "%%A"
4978 for /r %%A in (*.pif) do %findhotkey%.vbs "%%A"
4979 for /r %%A in (*.url) do %findhotkey%.vbs "%%A"
4980 cd /d %AllUsersProfile%\Start Menu
4981 for /r %%A in (*.lnk) do %findhotkey%.vbs "%%A"
4982 for /r %%A in (*.pif) do %findhotkey%.vbs "%%A"
4983 for /r %%A in (*.url) do %findhotkey%.vbs "%%A"
4984 cd /d %APPDATA%
4985 for /r %%A in (*.lnk) do %findhotkey%.vbs "%%A"
4986 for /r %%A in (*.pif) do %findhotkey%.vbs "%%A"
4987 for /r %%A in (*.url) do %findhotkey%.vbs "%%A"
4988 cd /d %HOMEDRIVE%%HOMEPATH%
4989 for /r %%A in (*.lnk) do %findhotkey%.vbs "%%A"
4990 for /r %%A in (*.pif) do %findhotkey%.vbs "%%A"
4991 for /r %%A in (*.url) do %findhotkey%.vbs "%%A"
4992
4993 (In most situations, only the section after the last C<cd /d> is important;
4994 in my configuration all the "interesting" stuff is in C<%APPDATA%>. Running
4995 this should find all shortcuts which define hot keys.
4996
4997 Run the cmd file. Repeat in the "All users"/"Public" directory. It should
4998 show a dialogue for every shortcut with a hotkey it finds. (But, as I said,
4999 it did not fix I<my> problem: C<AltGr-s> works in F<MSKLC> test window,
5000 and nowhere else I tried...)
5001
5002 =head2 C<Control-Shift>-keypresses starting bloatware applications
5003
5004 (Seen on IdeaPad.) Some pre-installed programs may steal C<Control-Shift>-keypresses;
5005 it may be hard to understand what is the name of the application even when
5006 the stealing results in user-visible changes.
5007
5008 One way to deal with it is to start C<Task Manager> in C<Processes> (or
5009 C<Details>) panel, and click on CPU column until one gets decreasing-order
5010 of CPU percentage. Then one can try to detect which process is becoming
5011 active by watching top rows when the action happens (or when one manages to
5012 get back to the desktop from the full-screen bloatware); one may need to
5013 repeat triggering this action several times in a row. After you know
5014 the name of executable, you can google to find out how to disable it, and/or
5015 whether it is safe to kill this process.
5016
5017 B<Example:> On IdeaPad, it was F<TouchZone.exe> (safe to kill). It was stealing
5018 C<Control-Shift-R> and C<Control-Shift-T>.
5019
5020 B<Example:> On MSI, a similar stealer was F<MGSysCtrl.exe> (some claim it is used to show on-screen
5021 animation when special laptop keys are pressed; if you do not need them, it is safe
5022 to kill). It was stealing C<Control-Alt-s>. (But to find I<this> one, I needed to
5023 kill all suspicious apps one by one…)
5024
5025 =head1 WINDOWS GOTCHAS for keyboard developers using MSKLC
5026
5027 F<MSKLC> has a convenient interactive tool F<MSKLC.exe> and a command-line
5028 program F<kbdutool.exe>. However, the latter program has many shortcomings;
5029 they are listed in the sections below.
5030
5031 The way to fix this is described in
5032 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.
5033
5034 =head2 Several similar F<MSKLC> created keyboards may confuse the system
5035
5036 Apparently, the system may get majorly confused when the C<description>
5037 of the project gets changed without changing the DLL (=project) name.
5038
5039 (Tested only with Win7 and the name in the DESCRIPTIONS section
5040 coinciding with the name on the KBD line - both in F<*.klc> file.)
5041
5042 The symptoms: I know how one can get 4 different lists of keyboards:
5043
5044 =over 4
5045
5046 =item 1
5047
5048 Click on the keyboard icon in the C<Language Bar> - usually shown
5049 on the toolbar; positioned to the right of the language code EN/RU
5050 etc (keyboard icon is not shown if only one keyboard is associated
5051 to the current language).
5052
5053 =item 2
5054
5055 Go to the C<Input Language> settings (e.g., right-click on the
5056 Language bar, Settings, General.
5057
5058 =item 3
5059
5060 on this C<General> page, press C<Add> button, go to the language
5061 in question.
5062
5063 =item 4
5064
5065 Check the F<.klc> files for recently installed Input Languages.
5066
5067 =item 5
5068
5069 In MS Keyboard Layout Creator, go to C<File/Load Existing Keyboard>
5070 list.
5071
5072 =back
5073
5074 It looks like the first 4 get in sync if one deletes all related keyboards,
5075 then installs the necessary subset. I do not know how to fix 5 - MSKLC
5076 continues to show the old name for this project.
5077
5078 Another symptom: Current language indicator (like C<EN>) on the language
5079 bar disappears. (Reboot time?)
5080
5081 Is it related to C<***\Local Settings\MuiCache\***> hive???
5082
5083 Possible workaround: manually remove the entry in C<HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layouts>
5084 (the last 4 digits match the codepage in the F<.klc> file).
5085
5086 =head2 Too long description (or funny characters in description?)
5087
5088 If the name in the C<DESCRIPTIONS> section is too long, the name shown in
5089 the list C<2> above may be empty.
5090
5091 (Checked only on Win7 and when the name in the DESCRIPTIONS section
5092 coincides with the name on the C<KBD> line - both in F<*.klc> file.
5093 Length=63 works fine, Length=64 triggers the bug.)
5094
5095 (Fixed by shortening the name [but see
5096 L<"Several similar F<MSKLC> created keyboards may confuse the system">
5097 above!], so maybe it was
5098 not the length but some particular character (C<+>?) which was confusing
5099 the system. (I saw a report on F<MSKLC> bug when description had apostroph
5100 character C<'>.)
5101
5102 =head2 F<MSKLC> ruins names of dead key when reading a F<.klc>
5103
5104 When reading a F<.klc> file, MS Keyboard Layout Creator may ruin the names
5105 of dead keys. Symptom: open the dialogue for a dead key mapping
5106 (click the key, check that C<Dead key view> has checkmark, click on the
5107 C<...> button near the C<Dead key?> checkbox); then the name (the first
5108 entry field) contains some junk. (Looks like a long ASCII string
5109
5110 U+0030 U+0030 U+0061 U+0039
5111
5112 .)
5113
5114 B<Workaround:> if all one needs is to compile a F<.klc>, one can run
5115 F<KBDUTOOL> directly.
5116
5117 B<Workaround:> correct ALL these names manually in MSKLC. If the names are
5118 the Unicode name for the dead character, just click the C<Default> button
5119 near the entry field. Do this for ALL the dead keys in all the registers
5120 (including C<SPACE>!). If C<CapsLock> is not made "semantically meaningful",
5121 there are 6 views of the keyboard (C<PLAIN, Ctrl, Ctrl+Shift, Shift,
5122 AltGr, AltGr+Shift>) - check them all for grayed out keys (=deadkeys).
5123
5124 Check for success: C<File/"Save Source File As>, use a temporary name.
5125 Inspect near the end of the generated F<.klc> file. If OK, you can
5126 go to the Project/Build menu. (Likewise, this way lets you find which
5127 deadkey's names need to be fixed.)
5128
5129 !!! This is time-consuming !!! Make sure that I<other> things are OK
5130 before you do this (by C<Project/Validate>, C<Project/Test>).
5131
5132 BTW: It might be that this is cosmetic only. I do not know any bad
5133 effect - but I did not try to use any tool with visual feedback on
5134 the currently active sub-layout of keyboard.
5135
5136 =head2 Double bug in F<KBDUTOOL> with dead characters above 0x0fff
5137
5138 This line in F<.klc> file is treated correctly by F<MSKLC>'s builtin keyboard tester:
5139
5140 39 SPACE 0 0020 00a0@ 0020 2009@ 200a@ // ,  , ,  ,   // SPACE, NO-BREAK SPACE, SPACE, THIN SPACE, HAIR SPACE
5141
5142 However, via F<kbdutool> it produces the following two bugs:
5143
5144 static ALLOC_SECTION_LDATA MODIFIERS CharModifiers = {
5145 &aVkToBits[0],
5146 7,
5147 {
5148 // Modification# // Keys Pressed
5149 // ============= // =============
5150 0, //
5151 1, // Shift
5152 2, // Control
5153 SHFT_INVALID, // Shift + Control
5154 SHFT_INVALID, // Menu
5155 SHFT_INVALID, // Shift + Menu
5156 3, // Control + Menu
5157 4 // Shift + Control + Menu
5158 }
5159 };
5160 .....................................
5161 {VK_SPACE ,0 ,' ' ,WCH_DEAD ,' ' ,WCH_LGTR ,WCH_LGTR },
5162 {0xff ,0 ,WCH_NONE ,0x00a0 ,WCH_NONE ,WCH_NONE ,WCH_NONE },
5163 .....................................
5164 static ALLOC_SECTION_LDATA LIGATURE2 aLigature[] = {
5165 {VK_SPACE ,6 ,0x2009 ,0x2009 },
5166 {VK_SPACE ,7 ,0x200a ,0x200a },
5167
5168 Essentially, C<2009@ 200a@> produce C<LIGATURES> (= multiple 16-bit chars)
5169 instead of deadkeys. Moreover, these ligatures are put on non-existing
5170 "modifications" 6, 7 (the maximal modification defined is 4; so the code uses
5171 the C<Shift + Control + Menu> flags instead of "modification number" in
5172 the ligatures table.
5173
5174 =head2 F<MSKLC> keyboards handle C<Ctrl-Shift-letter>, C<Ctrl-@ (x00)> , C<Ctrl-^ (x1e)> and C<Ctrl-_ (x1f)> differently than US keyboard
5175
5176 The US keyboard produces (as the
5177 “string value”) the corresponding Control-letter when
5178 C<Ctrl-Shift-letter> is pressed. (In console applications,
5179 C<\x00> is not visible.) F<MSKLC> does not reproduces this
5180 behaviour. This may break an application if
5181 it was not specifically tested with “complicated” keyboards.
5182
5183 The only way to fix this from the “naive” keyboard
5184 layout DLL (i.e., the kind that F<MSKLC> generates) which I found is to
5185 explicitly include C<Ctrl-Shift> as a handled combination, and return
5186 C<Ctrl-letter> on such keypresses. (This is enabled in the generated
5187 keyboards generated by this module - not customizable in v0.12.)
5188
5189 =head2 "There was a problem loading the file" from F<MSKLC>
5190
5191 Make line endings in F<.klc> DOSish.
5192
5193 =head2 C<AltGr-keys> do not work
5194
5195 Make line endings in F<.klc> DOSish (when given as input to F<kbdutool> -
5196 it gives no error messages, and deadkeys work [?!]).
5197
5198 =head2 Error 2011 (ooo-us, line 33): There are not enough columns in the layout list.
5199
5200 The maximal line end of F<kbdutool> is exceeded (a line or two ahead). Try remoing
5201 inline comments. If helps, change he workflow to cut off long lines (250 bytes is OK).
5202
5203 =head2 C<Error 2012 (ooo-us-shorten.klc, line 115):>
5204
5205 <ScanCode e065 - too many scancodes here to parse.>
5206
5207 from F<MSKLC>. This means that the internal table of virtual keys
5208 mapped to non-C<e0> (sic!) scancodes is overloaded.
5209
5210 Time to switch to direct generation of F<.c> file? (See
5211 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5212 Or you need to
5213 triage the “added” virtual keys, and decide which are less important
5214 so you can delete them from the F<.klc> file.
5215
5216 =head2 Only the first 8 with-modifiers columns are processed by F<kbdutool>
5217
5218 Time to switch to direct generation of F<.c> file? (See
5219 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5220
5221 =head2 Only the first digit of the which-modifier-column is output by F<kbdutool> in C<LIGATURES>
5222
5223 Time to switch to direct generation of F<.c> file? (See
5224 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5225
5226 =head2 F<kbdutool> produces C<KEYNAME_DEAD> section with meaningless entries for prefix keys C<0x08>, C<0x0A>, C<0x0D>
5227
5228 These entries do not stop keyboard from working. They look like C<L"'\b'" L"Name is here…">...
5229
5230 Time to switch to direct generation of F<.c> file? (See
5231 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5232
5233 =head2 It is not clear how to compile F<.C> files emitted by F<kbdutool.exe>
5234
5235 This distribution includes a script F<examples/compile_link_kbd.cmd> which can do this. It is
5236 inspired by
5237
5238 http://stackoverflow.com/questions/3360746/how-can-i-compile-programmer-dvorak
5239 http://levicki.net/articles/tips/2006/09/29/HOWTO_Build_keyboard_layouts_for_Windows_x64.php
5240
5241 It allows us to build using the cycle
5242
5243 =over 4
5244
5245 =item *
5246
5247 Build skeleton F<.klc> file.
5248
5249 =item *
5250
5251 Convert to B<C> using F<kbdutool.c>.
5252
5253 =item *
5254
5255 Patch against bugs in F<kbdutool.c>.
5256
5257 =item *
5258
5259 Patch in features not supported by F<kbdutool.c>.
5260
5261 =item *
5262
5263 Compile and link DLLs.
5264
5265 =back
5266
5267 (This assumes that the installer was already built by F<MSKLC> using a
5268 “simplified-to-nothing” F<.klc> file which does not trigger the F<MSKLC> bugs).
5269
5270 (See also L<http://accentuez.mon.nom.free.fr/Clavier-Galeron_fichiers/cr%E9ation_clavier.zip>.)
5271
5272 =head2 F<kbdutool> cannot ignore column=15 of the keybinding definition table
5273
5274 (Compare with L<"Windows ignores column=15 of the keybinding definition table">.)
5275
5276 F<kbdutool> requires that all the columns are associated to a modifier-bitmap.
5277 But column=15 should not be associated to any.
5278
5279 The workaround is to associate it to the bitmap which should not be bound to any
5280 column (like C<4=KBDALT>). In the output C<.C> file, one would have 15 instead
5281 of C<SHFT_INVALID> for the bitmap 4, but C<SHFT_INVALID> is defined to be 15 anyway…
5282
5283 =head2 F<kbdutool> ignores bits above 0x20 in the modification columns descriptor
5284
5285 Time to switch to direct generation of F<.C> files? (See
5286 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5287
5288 =head2 F<kbdutool> cannot assign more than one bitmask to a modification column
5289
5290 Time to switch to direct generation of F<.C> files? (See
5291 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5292
5293 (Quite often, one combination of modifiers should produce the same characters as
5294 another one. The format of keyboard layout tables allows them to share a
5295 modification column. The format of F<.klc> files does not allow sharing.)
5296
5297 =head2 F<kbdutool> cannot reasonably handle C<NUMPADn> keys and C<DECIMAL>
5298
5299 F<kbdutool> requires that every C<VK_>-code is assigned a scancode. The keys above
5300 are not assigned scancodes (on non-exotic keyboards), but are instead
5301 translated from C<Insert>/C<End>/etc. as needed by the kernel.
5302
5303 (Unchecked) workaround: use fake scancodes (for example, C<0xe0e*> are not used
5304 by known physical keyboards, so redefining the actions of these scancodes should not
5305 cause conflicts.
5306
5307 =head2 F<kbdutool> forgets to emit C<aVkToWch3>/6/8
5308
5309 If the F<.klc> file has many modification columns, the emitted aVkToWcharTable
5310 contains only C<aVkToWch1>/2.
5311
5312 =head2 F<kbdutool> confuses LIGATURES on unusual keys
5313
5314 For example, C<VK_SUBTRACT> may be replaced by C<VK_F2> in the LIGATURES table.
5315
5316 Time to switch to direct generation of F<.C> files? (See
5317 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5318
5319 =head2 F<kbdutool> places C<KbdTables> at end of the generated F<.c> file
5320
5321 The offset of this structure should be no more than 0x10000. Thus keyboards
5322 with large tables of prefixed keys may fail to load. This may be related to
5323 the bug L<"If data in C<KEYNAME_DEAD> takes too much space, keyboard is mis-installed, and “Language Bar” goes crazy">.
5324
5325 Time to switch to direct generation of F<.C> files? (See
5326 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5327
5328 =head2 F<kbdutool> finicky with NumPad keys
5329
5330 B<Background:> on non-exotic keyboards C<NUMPAD>n and C<DECIMAL> are not assigned scancodes, but are translated from
5331 C<Insert>/C<End>/etc. C<VK_>-codes as needed by the kernel. On the other hand, F<kbdutool> I<requires B<a specific>> scancode
5332 assigned to each line in the C<LAYOUT> section. In particular, one needs to be inventive with assigning characters to these NumPad
5333 C<VK_>-codes.
5334
5335 What happens is that F<kbdutool> handles “fake” scancodes (such as C<0xE0E3>) assigned to C<NUMPAD>n reasonably well (meaning: it is
5336 I<the other bugs> described above which are going to be triggered 😦 — but one of these bugs is that F<kbdutool> does not update
5337 C<E0>-map — which is good for “fake” codes!). However, C<DECIMAL> B<must be assigned> to the scancode C<0x53>. (This is
5338 handled automatically for F<.klc> files produced by this module.)
5339
5340 =head2 F<kbdutool> may assign scancodes wrongly
5341
5342 While F<kbdutool> allows assigning a C<VK_>-code to a scancode (one can use an “ultra-short line” like
5343
5344 e05d KANA
5345
5346 in the C<LAYOUT> section to make “the Menu key” into C<VK_KANA>), such scancodes are not included into “the special table for
5347 C<e0>-bindings” of the generated C file.
5348
5349 To add insult to injury, the entry for C<e05d> may actually I<be omitted> from this table (at least when one moves C<APPS> binding
5350 to a different scancode).
5351
5352 Time to switch to direct generation of F<.C> files? (See
5353 L<"WORKAROUND: a summary of the productive “alternative” workflow with F<.klc>">.)
5354
5355 =head2 Error "the required resource DATABASE is missing" from F<setup.exe>
5356
5357 The localized C<DESCRIPTION> in F<.klc> file contains a character outside of
5358 the repertoir of the codepage in question. Removing offending characters, or
5359 removing the C<DESCRIPTION> altogether should fix this. (But either way, the name of
5360 layout in the C<Settings> of the Language Bar may become empty.) Having a
5361 different localized description has a side effect that the name of the layout
5362 shown in the Language Bar popups is localized.
5363
5364 (The localized description is what put into the C<resource=1000> of the
5365 DLL file; it is this resource which is mentioned in the registry. (There
5366 will be no such resource when the localized C<DESCRIPTION> is missing.)
5367
5368 (The failure of F<setup.exe> is not reproducible after a reboot!)
5369
5370 Apparently, this has nothing to do with the length, so the (older) conjectures
5371 below are wrong (although the F<.RC> file generated by MSKLC has the [non-localized] name
5372 truncated after 40 chars in the field C<FileDescription> — but not in other fields):
5373
5374 It looks like there is a buffer overflow in MSKLC, and sometimes the generated
5375 F<setup.exe> in the install package would just exit with this error. The
5376 apparent reason is the length of the C<DESCRIPTION>-like fields.
5377
5378 Workaround: it looks like the C<DESCRIPTION> field is not used in F<setup.exe>.
5379 So generate an “extra dummied” F<.klc> file I<too> (with shortened descriptions),
5380 make an install package from it, and mix the F<setup.exe> from the “extra
5381 dummied” variant with the rest of the install package from a
5382 “less dummied” F<.klc> file.
5383
5384 The alternative is to get rid of F<setup.exe> completely, and ask users
5385 to run the appropriate F<.msi> file from the install package by hand
5386 (choosing basing on 32-bit vs 64-bit architecture).
5387
5388 =head2 Error when linking: a missing F<oldnames.lib>
5389
5390 It seems that the supplied F<.lib> files of MSKLC are defective. However, this is
5391 OK as far as the linked F<.obj> files are self-sufficient (as they should be).
5392
5393 On the other hand, if there is a missing symbol, then the F<.lib> files are attempted
5394 to be read — and the resulting errors are “emitted first”; this “hides” the error about
5395 a missing symbol:
5396
5397 \Microsoft-Keyboard_Layout_Creator\lib\amd64\MSVCRT.lib : warning LNK4003: invalid library format; library ignored
5398 LINK : fatal error LNK1104: cannot open file 'OLDNAMES.lib'
5399
5400 To get the name of the missing symbols, one should either substitute these
5401 libraries by legal (but possibly empty) ones, (as via
5402
5403 https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977
5404
5405 or use the C</verbose> option on the linker to get more detailed output:
5406
5407 https://stackoverflow.com/questions/5249431/linker-trouble-how-to-determine-where-a-defaultlib-is-coming-from/31146961#31146961
5408
5409 (Another conjectural reason: a conflict between an extern declaration and a static definition of a symbol.)
5410
5411 =head2 The generated table of C<KEYNAME>s is wrong for C<F>-keys
5412
5413 The numeric part is C<VK_>-codes, while it should be the scancodes. Similarly, in the
5414 “extended” section appear mysterious keys C<< <00> >>, C<Help> (in positions C<X54>, C<X56>)
5415 which do not seem to be present anywhere.
5416
5417 =head1 WORKAROUND summary of the productive “alternative” workflow with F<.klc>
5418
5419 =head2 Summary of the productive workflow with F<.klc>:
5420
5421 (Some of the steps below may be omitted depending on how complicated
5422 your F<.klc> layout is; for practical implementation, see
5423 L<the example of F<.klc> creation|https://search.cpan.org/~ilyaz/UI-KeyboardLayout/examples/build-iz.pl>
5424 and L<the example of F<.klc> to F<.dll>
5425 processing|https://search.cpan.org/~ilyaz/UI-KeyboardLayout/examples/build_here.cmd>):
5426
5427 =over 4
5428
5429 =item
5430
5431 Make an “extra dummied” F<.klc> (short descriptions, short dummy C<SHIFTSTATE>,
5432 C<LAYOUT>, C<DEADKEY>, C<KEYNAME_DEAD> sections, no C<LIGATURE> section). Run
5433 it through GUI MSKLC (C<Alt-P Enter>, then C<Alt-P B Enter Enter>, C<Alt-F4>).
5434 Store the generated F<setup.exe>, rename the directory.
5435
5436 Can be made by giving optional arguments C<'dummy', 'dummyname'> to fill_win_template();
5437 see L<"SYNOPSIS">.
5438
5439 =item
5440
5441 Make a “less dummied” F<.klc> file (as above, but with the correct “description” on
5442 the C<KBD> line). (Can be made by giving optional argument C<'dummy'> to fill_win_template();
5443 see L<"SYNOPSIS">.) Do as above, and mix in the F<setup.exe> from the previous step.
5444
5445 This makes a correct “installation framework”. — But it has I<very wrong> F<.dll>
5446 files!
5447
5448 There is no need to repeat these steps with newer versions of F<.klc> files — unless
5449 the C<KBD> line changes.
5450
5451 =item
5452
5453 Convert to C with
5454
5455 perl -wC31 %ex%/klc2c.pl FILENAME.klc >C_NAME.c
5456
5457 Here C<C_NAME> is the name from C<KBD> line of F<.klc> file. (This would
5458 overwrite the F<.c> file created on preceding step. This would also create
5459 one extra C file, and a header file — as well as a F<.rc> file and F<.def> 
5460 file — but it would not overwrite these files if present.)
5461
5462 (This assumes that C<%ex% expands to the name of F<./examples> subdirectory
5463 in the distribution of <UI::KeyboardLayout>).
5464
5465 =item
5466
5467 Compile the resulting B<C> files. For example, one can use
5468
5469 %ex%\compile_link_kbd.cmd --with-extra-c C_NAME_extra C_NAME
5470
5471 Here C<C_NAME> is as above. This assumes that the directory named as C<C_NAME>
5472 contains the distribution files (F<.exe> and F<.msi>) created on the first
5473 two steps.
5474
5475 =back
5476
5477 However, one should remember that the script F<klc2c.pl> is still (as of 2024)
5478 pretty new; its limitations are listed at the start of the file.
5479 (However, I expect it to handle everything-not-extremely-tricky now.)
5480
5481 This workflow (except the second part) is used by the example script
5482 L<F<examples/build_here.cmd>|https://search.cpan.org/~ilyaz/UI-KeyboardLayout/examples/build_here.cmd>.
5483 It is a part of the pathway used for generation of L<I<izKeys> layouts|http://k.ilyaz.org>. This script
5484 assumes that the “fake” distributions (or the distributions of older versions)
5485 are in subdirectories F<iz-la-4s> etc. of the current directory, and that the
5486 F<.klc> files are in the parent directory (C<%src> above); moreover, it assumes
5487 that C<%Keyboard_Layout_Creator%> is set so that
5488
5489 %Keyboard_Layout_Creator%\bin\i386\kbdutool.exe
5490
5491 exists — although now it uses only the C compiler from this distribution).
5492
5493 =head1 Workarounds for WINDOWS GOTCHAS for application developers (problems in kernel)
5494
5495 The “old-style” keyboard layouts in Windows are just tables loaded into memory. The
5496 kernel consults these tables when processing keypresses. One cannot create a
5497 functionality except those hard-coded into the logic of processing these tables.
5498
5499 However, there is much more flexibility in these tables than what is “typically believed”.
5500 In particular:
5501
5502 =over 4
5503
5504 =item
5505
5506 The interaction of modifier keys and C<CapsLock> is less restrictive than one may think! Recall that the modifier keys
5507 “act” via the associated bitmap, and that C<CAPSLOK-> and C<SGCAPS-> switches trigger only if this bitmap is 0 or C<SHIFT>.
5508 Likewise, C<CAPSLOKALTGR>-switch trigger only if this bitmap has both C<ALT> and C<CTRL> bits are set. This may seem to be a strong
5509 restriction: what to do if only one of C<ALT> and C<CTRL> bits is set?!
5510
5511 However, the latter situation I<may be completely avoided>): see L<"A convenient assignment of C<KBD*> bitmaps to modifier keys">.
5512
5513 B<NOTE:> all keys are affected by C<KANALOK> logic (which mocks turning up C<KANA> bit if C<VK_KANA> key is “logically down” — it
5514 may be processed as “radiobutton” if it has C<KBDKANA> bit assigned). This allows C<VK_KANA> to
5515 have effect on some keys (those with KANALOK), and no effect on tother keys (those without). (Of course, this effect could be
5516 achieved also by duplicating entries in the columns with C<KBDKANA>!)
5517
5518 =item
5519
5520 The prefix keys (“deadkeys”) cannot produce more than one C<UTF-16> codepoint. However,
5521 this does not mean that they cannot “affect” keys producing multi-codepoint strings. (The
5522 only limitation for these strings is that one cannot be a prefix of another.)
5523
5524 =item
5525
5526 A keypress may be combined with “modifier keys” (like C<Shift>, C<right-Control> etc.) in up
5527 to 125 ways.
5528 See L<"Notes on the finer details of assigning modifier-bitmap bits">.
5529
5530 =item
5531
5532 A keypress (with particular modifier keys) may produce
5533 L<a string with up to 125 (with “tricks” up to 255) characters|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">.
5534
5535 See L<"More (random) rambling on assignment of key combinations"> for more details.
5536
5537 =item
5538
5539 The mapping from “a combination of modifier keys” to a column in the translation table goes
5540 by C<OR>ing certain bitmaps assigned to the modifier keys. The width of these bitmaps is 16,
5541 so one can support a huge “orthogonal set” to distinguish all useful combinations of typical
5542 modifiers (2 each of C<Shift>, C<Control>, C<Alt>, C<Windows>, as well as C<Kana>, C<Menu-key>
5543 and maybe even C<CapsLock>).
5544
5545 (The actual limit is in the count 125 of possible usable columns — as well as some obscure bugs which
5546 may be triggered in the installer if the C<.dll> is too large.)
5547
5548 =item
5549
5550 If one uses C<SGCAPS> flag for a partiular key — to have customizable bindings (this affects
5551 the case when only C<Shift> and C<CapsLock> are active), one can still assign deadkeys to such
5552 key (with certain modifiers).
5553
5554 The only limitation is that the each of the C<Shift-> and no-C<Shift-> position cannot produce
5555 deadkeys B<both> “with” and “without” C<CapsLock>. In presence of other modifiers there is no
5556 restriction!
5557
5558 (Moreover, by (creatively) combining C<SGCAPS> with C<CAPLOK> even with this limitation one can
5559 cover all the cases of up to two deadkeys on 4 possible combinations of C<Shift> and C<CapsLock>.
5560 However, one may need to duplicate the corresponding C<DEADKEY> section with another prefix key.)
5561
5562 (In fact, “ultra-creatively” duplicating with the ”new” deadkey “coded” as C<WCH_DEAD=0xF001>
5563 (so in the section C<DEADKEY F001>) one can also support one key with up to 3 deadkeys out
5564 of 4 possible combinations of C<Shift> and C<CapsLock>.)
5565
5566 =back
5567
5568 =head1 WINDOWS GOTCHAS for application developers (problems in kernel)
5569
5570 =head2 Many applications need to know the state of hidden flag C<KLLF_ALTGR>
5571
5572 To decide what to do with a keypress, an application may need to know
5573 whether C<KLLF_ALTGR> is enabled in the keyboard (in other words, if
5574 C<left-Control> is faked when C<right-Alt> is pressed). For example, when
5575 the kernel processes accelerators, it would not trigger C<Ctrl-Alt-A>
5576 if C<A> was pressed with C<right-Alt> in the presence of this flag — even
5577 though C<left-Ctrl> I<IS> visible as being pressed (one needs to press
5578 C<left-Alt + right-Control>).
5579
5580 An application with configurable bindings may need to emulate this action
5581 of TranslateMessage(). One of the ways to do this may be to do (when
5582 C<left-Control> and C<right-Alt> are down)
5583
5584 =over 4
5585
5586 =item *
5587
5588 Set a global flag disabling processing of C<WM_(SYS)COMMAND> in the application;
5589
5590 =item *
5591
5592 Call TranslateAccelerator() with an improbable virtual key (C<VK_OEM_AX> or
5593 some such — or, better, the “unassigned C<VK_>-code C<0xe8>) and a suitable ad hoc translation table;
5594
5595 =item *
5596
5597 Check whether accelerator was recognized (if so, C<KLLF_ALTGR> is not enabled).
5598
5599 =back
5600
5601 Possible problems with this approach: the “improbable key” should better not
5602 trigger some system accelerator (this is why one should not use “ordinary”
5603 keys). In fact, one should better subclasses the target window to catch the
5604 accelerator (if the system decides to deliver it — as happens without C<KLLF_ALTGR>).
5605 (Compare with L<the example working implementation|https://search.cpan.org/~ilyaz/UI-KeyboardLayout/examples/robust_input/>.)
5606
5607 B<Obsolete:> Additionally, some system accelerators react on Windows key as a
5608 modifier; so acceleration table may specify this as a certain flag. This
5609 would imply that the algorithm above may not work when C<Windows> key is
5610 down. (Testing with the implementation above shows that this concern is irrelevant.)
5611
5612 (Or maybe these C<Win-key> bindings are not accelerators, and are
5613 processed in a different part of keyboard input events. — Then there is
5614 little to worry about.)
5615
5616 =head2 It is impossible to find whether the keyboard state is “after a prefix key”
5617
5618 The effect of a keypress depends on whether a “prefix key” (= “deadkey”) was pressed before it. For example, on many layouts typing
5619 4 keys C<Compose ( a )> produces C<ⓐ≡U+24d0> (here C<Compose> stands for a certain layout-specific “prefix”). Here the effect of
5620 typing C<(> is very different — one may call it C<(-after-Compose> — than when C<(> is typed “standalone” — in “the base state” of
5621 the keyboard. (So the example shows a chain of three prefix keys, C<Compose> and C<(-after-Compose> and
5622 C<a-after-(-after-Compose> — and the final C<)> “produces a real character”. A convenient way to think of it is that “a prefix
5623 key” is just “a switch to a particular state in a Finite State Machine. “The result” of a keypress depends on the state!)
5624
5625 An application may want to know whether the keyboard is “in the base state or not” (for example,
5626 L<to decide whether a keypress should “insert”, or “trigger a bindable action”.|"The ultra-simple approach">).
5627 In the best world, the application would do it by checking whether the last non-0 result of C<ToUnicode[Ex]()> was
5628 negative — indicating “a prefix key” (but
5629 L<one needs to special-case the returned state being 0|"It is not documented how to make a with-prefix-key(s) combination produce 0-length string">).
5630 However, while this works fine for the first prefix key, for a chain of prefix keys this is not bullet-proof: two bugs get in the
5631 way.
5632
5633 First, for all the “prefix key” keypresses in a chain of prefix keys (as in the example above) C<ToUnicodeEx()> correctly returns
5634 C<-1> to indicate that it is still not in the base state. However, “the returned new state” is returned correctly only after the
5635 first keypress in a chord — in the remaining cases the returned state is just unitialized junk. B<CONCLUSION:> one cannot
5636 check this state for being 0 — as it is needed for the robust algorithm above.
5637
5638 Second, when “the base action of a keypress” is to produce “several C<UTF-16> codepoints”, pressing this key after a prefix key
5639 “behaves as expected”. For example, if C<AltGr-a> produces the string C<(a>, then C<Compose AltGr-a )> would still produce
5640 C<ⓐ≡U+24d0>. However, C<ToUnicode[Ex]()> does not return C<-1> after C<Compose AltGr-a> — although this combination produces
5641 a non-0 state in the finite state machine. (The returned value is “0-characters produced”, so the application would conclude that
5642 the state did not change — which would be wrong
5643 L<if the resulting state is 0|"It is not documented how to make a with-prefix-key(s) combination produce 0-length string">.)
5644
5645 =head1 WINDOWS GOTCHAS for keyboard developers (problems in kernel)
5646
5647 =head2 It is hard to understand what a keyboard really does
5648
5649 To inspect the output of the keyboard in the console mode (may be 8-bit,
5650 depending on how Perl is compiled), one can run
5651
5652 perl -MWin32::Console -wle 0 || cpan install Win32::Console
5653 perl -we "sub mode2s($){my $in = shift; my @o; $in & (1<<$_) and push @o, (qw(rAlt lAlt rCtrl lCtrl Shft NumL ScrL CapL Enh ? ??))[$_] for 0..10; qq(@o)} use Win32::Console; my $c = Win32::Console->new( STD_INPUT_HANDLE); my @k = qw(T down rep vkey vscan ch ctrl); for (1..20) {my @in = $c->Input; print qq($k[$_]=), ($in[$_] < 0 ? $in[$_] + 256 : $in[$_]), q(; ) for 0..$#in; print(@in ? mode2s $in[-1] : q(empty)); print qq(\n)}"
5654
5655 This installs Win32::Console module (if needed; included with ActiveState Perl)
5656 then reports 20 following console events (press and keep C<Alt> key
5657 to exit by generating a “harmless” chain of events). B<Limitations:> the reported
5658 input character is not processed (via ToUnicode(); hence chained keys and
5659 multiple chars per key are reported only as low-level), and is reported as
5660 a signed 8-bit integer (so the report for above-8bit characters is
5661 completely meaningless).
5662
5663 T=1; down=1; rep=1; vkey=65; vscan=30; ch=240; ctrl=9; rAlt lCtrl
5664 T=1; down=0; rep=1; vkey=65; vscan=30; ch=240; ctrl=9; rAlt lCtrl
5665
5666 This reports single (T=1) events for keypress/keyrelease (down=1/0) of
5667 C<AltGr-a>. One can see that C<AltGr> generates C<rAlt lCtrl> modifiers
5668 (this is just a transcription of C<ctrl=9>,
5669 that C<a> is on virtual key 65 (this is C<VK_A>) with virtual scancode
5670 30, and that the generated character (it was C<æ>) is C<240>.
5671
5672 The character is approximated to the current codepage. For example, this is
5673 C<Kana-b> entering C<β = U+03b2> in codepage C<cp1252>:
5674
5675 T=1; down=1; rep=1; vkey=66; vscan=48; ch=223; ctrl=0;
5676 T=1; down=0; rep=1; vkey=66; vscan=48; ch=223; ctrl=0;
5677
5678 Note that C<223 = 0xDF>, and C<U+00DF = ß>. So I<beta> is substituted by
5679 I<eszet>.
5680
5681 There is also a script F<examples/raw_keys_via_api.pl> in this distribution
5682 which does a little
5683 bit more than this. One can also give this script the argument C<U> (or C<Un>,
5684 where C<n> is the 0-based number among the listed keyboard layouts) to report
5685 ToUnicode() results, or argument C<cooked> to report what is produced by reading raw
5686 charactes (as opposed to events) from the console.
5687
5688 =head2 It is not documented how to make a with-prefix-key(s) combination produce 0-length string
5689
5690 Use C<0000@> (in F<.klc>), or DEADKEY 0 in a F<.c> file. Explanation: what a prefix key
5691 is doing is making the kernel remember a word (the state of the finite state machine), and not
5692 producing any output character. Having no prefix key corresponds to the state being 0.
5693
5694 Hence making prefix_key=0 is the same as switching the finite state machine to the initial
5695 state, and not producing any character — and this exactly what is requested in the question.
5696 (However, one should keep in mind that this may break certain heuristics applications can make — L<due
5697 to a bug in C<ToUnicode[Ex]()>|"It is impossible to find whether the keyboard state is “after a prefix key”">.
5698
5699 =head2 If data in C<KEYNAME_DEAD> takes too much space, keyboard is mis-installed, and “Language Bar” goes crazy
5700
5701 See a more correct diagnosis in next subsection.
5702
5703 =head2 If DLL is too large, keyboard is mis-installed, and “Language Bar” goes crazy
5704
5705 Synopsis: Installation reports success, the keyboard appears in the list in the Language Bar's "Settings".
5706 But the keyboard is not listed in the menu of the Language Bar itself. (This is not fixed
5707 by a reboot.)
5708
5709 Deinstalling (by F<MSKLC>'s installer) in such a case removes one (apparently, the last) of the listed keyboards for the language;
5710 at least it is removed from the menu of the Language Bar itself. However, the list in the “Settings”
5711 does not change! One can't restore the (wrongly) removed (unrelated!) layout by manipulating the latter list.
5712 (I did not try to check what will happen if only one keyboard for the language is available — is it removed
5713 for good?) I<This> condition is fixed by a reboot: the “missing” “unrelated” layout jumps to existence.
5714
5715 I did not find a way to restore the deleted keyboard layout (without a reboot). Experimenting with these is kinda painful:
5716 with each failure,
5717 I add one extra keyboard to the list in the “Settings”; - so the list is growing and growing! [Better
5718 add useless-to-you keyboards, since until the reboot you will never be able to install them again.]
5719
5720 This condition was first diagnozed in update from v0.61 to v0.63 of B<izKeys> layouts. Between
5721 these versions, there was
5722 a very small increment of the size of DLLs: one modification column was added, and two deadkeys were added. This triggered
5723 the problem described above. As experiments
5724 had shown,
5725 removing a bunch of dead keys descriptions (to decrease the size of DLL) fixed this (I do not know a situation where these
5726 descriptions play any role). So it looks like
5727 this defect was due to I<ONLY> increasing the size of the DLL… Maybe it is due to the total
5728 size of certain segments in the DLL.
5729
5730 See the L<DLL which does not install|http://k.ilyaz.org/windows/newer/not-installable-and-fix/iz-ru-la.zip> and
5731 the L<smaller DLL which installs|http://k.ilyaz.org/windows/newer/not-installable-and-fix/was-not-installing-fixed.zip>.
5732 For details and SRC see the L<README file|http://k.ilyaz.org/windows/newer/not-installable-and-fix/README>. (Apparently,
5733 for 64bit DLL, 264,704B is too large, but 249,856B is OK. With other builds, I observed: 258,560B is OK, but 264,192B too big.)
5734
5735 (This may be related to the bug L<"F<kbdutool> places C<KbdTables> at end of the generated F<.c> file">. However, now we
5736 organize compilation so that the relevant code is in the beginning of the DLL, but this does not help with this bug.)
5737
5738 Workarounds: this module allows decreasing number of entries in the name table via C<WindowsEmitDeadkeyDescrREX> configuration
5739 variable.
5740
5741 =head2 Windows ignores column=15 of the keybinding definition table
5742
5743 Note that 15 is C<SHFT_INVALID>; this column number is used to indicate that
5744 this particular combination of modifiers does not produce keys. In particular,
5745 the this column number should not be used in the layout.
5746
5747 Workaround: put junk into this column, and use different columns for useful modifier
5748 combinations. The mapping from modifiers to columns should not be necessarily 1-to-1.
5749 (But see L<"F<kbdutool> cannot ignore column=15 of the keybinding definition table">.)
5750
5751 =head2 Windows combines modifier bitmaps for C<lCtrl>, C<Alt> and C<rAlt> on C<AltGr>
5752
5753 Usually — for compatibility with legacy applications — a keyboard layout is marked with the C<KLLF_ALTGR> flag; then C<AltGr> is
5754 special in this keyboard layout, and pressing it mocks pressing of 2 keys:
5755 C<lCtrl>, then C<rAlt> — with the same timestamp (likewise for releasing). (However, this does not happen if one of C<Ctrl> keys is
5756 already down; but — otherwise — happens for “keyrepeat events” too.) This means that the modifier bitmap bound to this
5757 key I<is effectively> a bit-OR of bitmaps for C<lCtrl> and C<rAlt> (as usual, one should also combine the “unhanded” variants
5758 C<VK_CONTROL> and C<VK_MENU>). Essentially, this prohibits assigning “interesting bitmaps” to C<lCtrl>.
5759
5760 To add insult to injury, I<due to the exceptions described above> this does not I<happen always>. For example, whether
5761 C<lCtrl> “is faked” when pressing the chord C<rCtrl-rAlt> depends on the order in which this chord is pressed (if C<rCtrl> is
5762 pressed first, then C<lCtrl> is not faked) — hence the bitmap produced for this chord may have two different values.
5763
5764 B<Aside:> Likewise, pressing
5765 C<any-Ctrl>, then C<rAlt>, I<then releasing> C<Ctrl> “makes the pressed C<rAlt> ‘expose its I<real bitmap>’. However, this happens
5766 for very short time only, since “keyrepeat” events for C<rAlt> re-emulate pressing C<lCtrl>. But this momentous situation is
5767 degraded yet more if some other modifiers — say C<Shift> — is pressed after C<rAlt>; then it is C<Shift> which is going to be
5768 “keyrepeated”, hence pressing C<Ctrl-rAlt-Shift> (in this order) then releasing C<Ctrl> will “expose the ‘native’ bitmap of C<rAlt>
5769 for a long time.
5770
5771 Since this changes how C<rAlt> combines with keys, it may be very confusing situation for users.
5772
5773 The (very limited — and nowadays potentially dangerous — see B<Possible complications> in L<"The bullet-proof method">) workaround
5774 is to ensure that the bits in the modification bitmap one puts on C<AltGr> contain
5775 all the bits assigned to the above VK codes. This completely avoids the complication above.
5776
5777 (With applications using “ad hoc algorithms”, this would not change anything;
5778 and since this makes the assignments less confusing for human inspection, B<historically> we recommended to use it.
5779 Unfortunately, using such “joined bitmap” in the C<MODIFIERS> section leads to problems: the “bullet-proof” algorithm should 
5780 take into account this situation. Given an improvement in user’s experience vs. a minor complication in the algorithm, one
5781 should probably prefer the later.)
5782
5783 B<Enhancement:> a workaround for the impossibility to combine C<lCtrl> with C<rAlt> is possible (although only partially tested):
5784 see L<Another redefinition to avoid problems with the C<KLLF_ALTGR> flag>.
5785
5786 (Compare with L<"A convenient assignment of KBD* bitmaps to modifier keys">. — But see B<Caveat> in this section!)
5787
5788 =head2 Windows ignores C<lAlt> if its modifier bitmaps is not standard
5789
5790 Adding C<KBDROYA> to C<lAlt> disables console sending non-modified char on keydown.
5791 Together with the previous problem, this looks like essentially prohibiting
5792 putting interesting bitmaps on the left modifier keys.
5793
5794 The gist of this is: for I<the kernel> to handle C<Alt-Numpad> input correctly (without these keypresses I<inserting> [hex] digits)
5795 the C<Alt>-keys should not produce any character without C<KBDALT> stripping. On the other hand, for I<the applications> to treat
5796 C<Alt>-keypresses correctly, they should better produce “the base characters” I<after> C<KBDALT> stripping.
5797
5798 C<Workaround:> one may still add C<KBDKANA> on C<lAlt>. It looks like the combination
5799 C<KBDALT|KBDKANA> is compatible with Windows' handling of C<Alt> (both in console,
5800 and for accessing/highlighting the menu entries). (However, since only C<KBDALT>
5801 is going to be stripped for handling of C<lAlt-key>, the modification column for
5802 C<KBDKANA> should duplicate the modification column for no-C<KBD>-flags. Same with
5803 C<KBDSHIFT> added. — Moreover, one can still enhance this: see the “NOTE” after going through the next link.)
5804
5805 (Compare with L<"A convenient assignment of KBD* bitmaps to modifier keys">.)
5806
5807 =head2 When C<AltGr> produces C<ROYA>, problems in Notepad
5808
5809 Going to the Save As dialogue in Notepad loses "speciality of AltGr" (it highlights Menu);
5810 one need to switch layouts via LAlt+LShift to restore.
5811
5812 I do not know any workaround (except combining C<AltGr> with at most C<KANA>).
5813
5814 =head2 Console applications cannot detect when a keypress may be interpreted as a “command”
5815
5816 The typical logic of an (advanced) application is that it interprets certain keypresses
5817 (combinations of keys with modifiers) as “commands”. To do this in presence of user-switchable
5818 keyboards, when it is not known in compile time which key sequences generate characters,
5819 the application must be able to find at runtime which keypresses are characters-generating,
5820 and which are not. The latter keypresses are candidates to be checked whether they should trigger commands
5821 of the application.
5822
5823 For final keypresses of a character-generating key-sequence, an application gets a notification
5824 from the ReadConsoleInput() API call that this keypress generates a character. However, for the
5825 keypresses of the sequence which are non the last one (“dead” keys), there is no such notification.
5826
5827 Therefore, there is no way to avoid dead keys triggering actions in an application. What is the
5828 difference with non-console applications? First of all, they get such a notification (with the
5829 standard TranslateMessage()/DispatchMessage() sequence of API calls, on WM_KEYDOWN, one can
5830 PeekMessage() for WM_SYSDEADCHAR/WM_DEADCHAR and/or WM_SYSCHAR/WM_CHAR). Second, the windowed
5831 application may call ToUnicode(Ex)() to calculate this information itself.
5832
5833 Well, why a console application cannot use the second method? First, the active keyboard layout
5834 of a console application is the default one. When user switches the keyboard layout of the console,
5835 the application gets no notification of this, and its keyboard layout does not change. This makes
5836 ToUnicode() useless. Moreover, due to
5837 security architecture, the console application cannot query the ID of the thread serving the message
5838 loop of the console, so cannot query GetKeyboardLayout() of this thread. Hence ToUnicodeEx() is
5839 useless too.
5840
5841 (There may be a lousy workaround: run ToUnicodeEx() on B<all> the installed keyboard layouts, and
5842 check which of them are excluded by comparing with results of ReadConsoleInput(). Interpret
5843 contradictions as user changing the keyboard layout. Of course, on several keypresses following
5844 a change of keyboard layout one may get unexpected results. And if two similar
5845 keyboards are installed, one may also never get definite answer on which of them is currently active.)
5846
5847 (To handle this workaround, one must have a way to call ToUnicode() in a way which does not change
5848 the internal state of the keyboard driver. Observe:
5849
5850 =over 4
5851
5852 =item *
5853
5854 Such a way is not documented.
5855
5856 =item *
5857
5858 Watch the character reported by ReadConsoleInput() on the C<KEYUP> event for deadkeys. This is
5859 the character which a deadkey would produce if it is pressed twice (and is 0 if pressing it twice
5860 results in a deadkey again). The only explanation for this I can fathom is that the console's
5861 message queue thread calls such a non-disturbing-state version of ToUnicode().
5862
5863 Why it should be “non-disturbing”? Otherwise it would reset the state “this deadkey was pressed”,
5864 and the following keypress would be interpreted as not preceded by a deadkey. And this is not
5865 what happens. (If one does it with usual ToUnicode() call, DOWN reports a deadkey, but UP reports
5866 “ignored”; to see this, run F<examples/raw_keys_via_api.pl> with arguments C<Un 1>
5867 with a keyboard which produces ç on C<AltGr-, c>. Here C<n> is the number of the keyboard in the list
5868 of available keyboards reported by C<examples/raw_keys_via_api.pl U 1>).
5869
5870 Well, when one I<knows> that some API calls are possible, it is just a SMP to find it out
5871 (see F<examples/raw_keys_via_api.pl>). It turns out that given argument C<wFlags=0x02> achieves
5872 the behaviour of a console during KeyUp event. (As a side benefit, it also avoids another
5873 glitch in Windows' keyboard processing: it reports the character value in presence of C<Alt>
5874 modifier — recall that ToUnicodeEx() ignores C<Alt> unless C<Ctrl> is present too. Well, I
5875 checked this so far only on KeyUp event, where console producess mysterious results.)
5876
5877 =item *
5878
5879 However, even without using undocumented flags, it is not hard to construct such a non-disturbing version of ToUnicode(). The only
5880 ingredient needed is a way to reset the state to “no deadkeys pressed” one. Then just store
5881 keypresses/releases from the time the last such state was found, call ToUnicode(), reset state,
5882 and call ToUnicode() again for all the stored keypresses/releases; then update the stored state
5883 appropriately.
5884
5885 =item *
5886
5887 But I strongly doubt that console's message loop does anything so advanced. My bet would be that
5888 it uses a non-documented call or non-documented flags. (Especially since the approach above does
5889 not handle C<Alt> the same way as the console does.)
5890
5891 =back
5892
5893 =head2 In console, which combinations of keypresses may deliver characters?
5894
5895 In addition to the problem outlined in the preceding section, a console application should
5896 better support L<input of character-by-numeric-code|"Keyboard input on Windows, Part II: The semantic of ToUnicode()">, and of
5897 copy-and-pasted strings. Actually,
5898 the second situation, although undocumented, is well-engineered, so let us document these two
5899 here. (These two should better be documented together, since pasting may fake input by
5900 repeated character-by-numeric-code.)
5901
5902 Pasting happens character-by-character (more precise, by UTF-16 codepoints), but C<ReadConsoleInput()>
5903 would group them together:
5904
5905 =over 4
5906
5907 =item *
5908
5909 When pasting a character present in a keyboard layout with at most C<Shift> modifier,
5910 a fully correct emulation of a sequence C<Shift-Press Key-Press Key-Release Shift-Release>
5911 is produced (without C<Shift> if it is not needed). The character (as usual) is delivered
5912 on both C<Key-Press/Release> events.
5913
5914 =item *
5915
5916 When pasting a character present in a keyboard layout, but needing I<extra> modifiers (not
5917 only C<Shift>), a partial emulation of a certain key tap is produced:
5918 C<rAlt-Press Key-Press Key-Release rAlt-Release>. The character (as usual) is delivered
5919 on both C<Key-Press/Release> events.
5920
5921 Quirks: first, if C<Shift> is needed, its press/release are not emulated, but the flags on
5922 the C<Key-Press/Release> events indicate presence of a C<Shift>. Second (by this, the
5923 pasting may be distinguished from “real” keypress), C<lCtrl> press/release are not emulated,
5924 but it is indicated as "present" in flags of all 4 events.
5925
5926 =item *
5927
5928 When pasting control-characters (available via the C<Ctrl(-Shift)>-maps of the layout),
5929 the press/release of C<Ctrl> is not emulated (but the flags indicate C<lCtrl> downs); however,
5930 if C<Shift> is needed, its press/release is emulated (and flags for I<these> events do not
5931 have C<lCtrl> is down).
5932
5933 Pasting C<CR LF> delivers only U+000D (CR) — the typical maps have it on C<Enter> and C<^M>,
5934 and C<Enter> is delivered.
5935
5936 =item *
5937
5938 Otherwise, an emulation of C<lAlt-6-3> is sent, with the C<lAlt-Release> delivering a character:
5939 C<rAlt-Press Key-Press Key-Release Key’-Press Key’-Release lAlt-Release>. The C<Key Key’>
5940 are very unusual combinations of scancode/vkey for C<6> and C<3> on the numeric keyboard:
5941 they are delivered as if C<NumLock> (or C<Shift>) is down, but the flags indicate that
5942 these modifiers are "not present".
5943
5944 The “honest” C<lAlt-6-3> delivers U+003f, which is "C<?>" (as above, it is delivered on release
5945 of C<lAlt>).
5946
5947 =item *
5948
5949 In general, L<entering characters-by-numeric-code|"Keyboard input on Windows, Part II: The semantic of ToUnicode()"> (entering the
5950 decimal — or “KP+” then hex — while
5951 C<Alt> is down) produces the resulting character when C<Alt> is released. Processing this may create
5952 a significant problem for applications which interpret C<Alt-keypad> as “commands” (e.g., if
5953 they interpret C<Alt-Left> as “word-left”).
5954
5955 There may several work-arounds. First, usually hex input is much more important than decimal,
5956 and usually, C<Alt-KP_Add> is not bound to commands. Then the application may ignore characters
5957 delivered on C<Alt-Release> B<unless> the C<Alt-Press> was immediately followed by the press/release
5958 of C<KP_Add>; additionally, it should disable the interpret-as-commands logic while C<Alt> is down,
5959 and its press was followed by press/release of C<KP_Add>.
5960
5961 Second, it is not crucial to deliver Unicode characters numbered in single-digits. So one may
5962 require that commands are triggered by C<Alt-Numpad> only when pressed one-by-one (releasing
5963 C<Alt> between them), and consider multi-digit presses as input-by-number only.
5964
5965 Finally, Windows aborts entering character-by-numeric-code if any unexpected key press interferes.
5966 For example, C<Alt-6-3> is “C<?>”, but pressing-releasing C<Shift> after pressing down C<Alt>
5967 would not deliver anything. If an application follows the same logic (in reverse!) when recognizing
5968 keypressing resulting in “commands”, the users would have at least a “technical ability” to enter
5969 both commands, I<AND> enter characters-by-numeric-code.
5970
5971 =back
5972
5973 This is tested I<ONLY> in the situation when a layout has C<KLLF_ALTGR> present, and all the
5974 "with-extra-modifiers" characters are on bitmap entries with C<RMENU> bit marked. This is
5975 a situation with discussed in the section L<"A convenient assignment of C<KBD*> bitmaps to modifier keys">.
5976
5977 It is plausible that only C<SHIFT>, C<CTRL> and C<ALT> bits in a bitmap returned by C<VkKeyScan()> are
5978 acted upon (with C<Ctrl> flag added based on C<KLLF_ALTGR>). Some popular keyboard layouts
5979 use C<KANA> bit on the C<rAlt> key; under this assumption, the characters available via C<rAlt> key
5980 would be delivered with at most C<Shift> modifier.
5981
5982 All the emulated events do not have C<NumLock> indicated as "present" in their flags.
5983
5984 =head2 Behaviour of C<Alt-Modifiers-Key> vs C<Modifiers-Key>
5985
5986 When both combinations produce characters (say, X and Y), it is not clear
5987 how an application shouild decide whether it got C<Alt-Y> event (for menu
5988 entry starting with Y), or an C<X> event.
5989
5990 A partial workaround (if the semantic of the layout fits into the limited number
5991 of bits in the ORed mask): make all the keys which may be combined with
5992 C<Alt> to have the C<KBDCTRL> bit in the mask set; add some extra bit
5993 to C<Ctrl> keys to be able to distinguish them. Then at least the
5994 kernel will produce the correct character on the ToUnicode() call (hence
5995 in TranslateMessage()). [A potential that an application may be confused
5996 is still large.]
5997
5998 =head2 Customization of what C<CapsLock> is doing is very limited
5999
6000 (See the description of the semantic of C<CapsLock> in L<"Keyboard input on Windows, Part II: The semantic of ToUnicode()">.)
6001
6002 A partial workaround (if the semantic of the layout fits into the limited number
6003 of bits in the ORed mask): make all the modifier combinations (except for the
6004 base layer) to have C<KBDCTRL> and C<KBDALT> bits set; add some extra bits to
6005 C<Ctrl> keys and C<Alt> keys (apparently, only C<KBDKANA> will work with C<Alt>)
6006 to be able to distinguish them. Then the C<CAPLOKALTGR> flag will affect all
6007 these combinations too.
6008
6009 =head2 C<lCtrl-rCtrl> combination: multiple problems
6010
6011 First of all, sometimes C<Shift> is ignored when used with this combination.
6012 (Fixed by reboot. When this happens, C<Shift> does not work also with combinations
6013 with C<lAlt> and/or C<Menu>). On the
6014 other hand, C<CapsLock> works as intended. (I even got an impression that
6015 sometimes C<Shift> works when C<CapsLock> is active; cannot reproduce this,
6016 though.)
6017
6018 I suspect this is related to the binding (usually not active) of C<Shift-Ctrl> to switch between
6019 keyboards of a language. It may have suddently jumped to existence (without my interaction).
6020 Simultaneously, this option disappeared from the UI to change keyboard options
6021 (L<Language Bar/Settings/Advanced Key Settings> in Windows 7). It might be that
6022 press/release of C<Shift> is filtered out in presence of C<lCtrl-rCtrl>? (Looks
6023 like this for C<rightShift> now...)
6024
6025 (I also saw what looks like C<Menu> key being stuck in some rare situations — fixed
6026 by pressing it again. Do not know how to reproduce this. It is interesting to
6027 note that one of the bits in the mask of the C<Menu> key is 0x80, and there is
6028 a define for this bit in F<kbd.h> named C<KBDGRPSELTAP> — but it is undocumented,
6029 and, judging by names, one might think that C<KBDGRPSELTAP> would work in pair with the flag
6030 C<GRPSELTAP> of C<VK_TO_WCHARSn→Attributes>. [But in fact it is a remnant of never-included-in-the-kernel
6031 attempt to support ISO keyboard concepts.])
6032
6033 B<NOTES:> Apparently, key up/down for many combinations of C<lCtrl+rCtrl+char> are
6034 not delivered to applications.
6035 Key up/down for C<`/5/6/-/=/Z/X/C/V/M/,/./Enter/rShift> are not delivered here when used with C<lCtrl+rCtrl> modifiers
6036 (at least in a console). Adding C<Shift/lAlt/Menu> does not change this. Same for C<F1/F2/F8/F9>
6037 and C<Enter/Insert/Delete/Home/PgUp> (but not for keypad ones!).
6038
6039 Moreover, when used with C<KeyPad→> or C<KeyPad*>, this behaves as if both these
6040 keys were pressed. Same with the pair C<KeyPad-> and C<Keypad+> (is it hardware-dependent???).
6041
6042 (Time to time C<lCtrl+rCtrl+NUMPADchar> do not work — neither with nor without C<NumLock>.)
6043
6044 No workarounds are known. Although I could reproduce this on 3 physically different
6045 keyboards, this is, most probably, a design defect of hardware keyboards. Compare with
6046 L<the explanation of problems in diode-less keyboard designs|http://www.dribin.org/dave/keyboard/one_html/> and
6047 L<experiments with 2 Shift keys|http://forums.macrumors.com/threads/hold-down-both-shift-keys-and-type-the-alphabet.230655/>.
6048 Another related tidbit: apparently, L<some hardware keyboard may change the internal layout
6049 after pressing some modifier keys|http://ccm.net/forum/affich-24692-keyboard-mess-up-after-shift-key-held-too-lon?page=2>
6050
6051 =head2 C<lAlt-rAlt> combination: many keys are not delivered to applications
6052
6053 Apparently, key up/down for many combinations of C<lAlt+rAlt+char> are
6054 not delivered to applications.
6055 For example, C<Numpad3> and C<Numpad7> — neither with nor without C<NumLock>; same
6056 for C<G/H/'/B/N/slash> (at least in a console). Adding C<Shift/lAlt/Menu>
6057 does not change this. Same for C<F4/F5/F6>.
6058
6059 No workarounds are known (except that C<Numpad3> and C<Numpad7> (without C<NumLock>)
6060 may be replaced by C<Home> and C<PgDown>).
6061
6062 B<NOTE:> in the bottom row of the keyboard, all the keys (except C<lShift>) are
6063 either in the list above, or in the list for C<lCtrl+rCtrl> modifiers. See also the
6064 references in the discussion of the previous problem (with C<lCtrl+rCtrl>).
6065
6066 =head2 Too long C<DESCRIPTION> of the layout is not shown in Language Bar Settings
6067
6068 (the description is shown in the Language Bar itself). The examples are (behave the same)
6069
6070 Greek-QWERTY (Pltn) Grn=⇑␣=^ˡⒶˡ-=Lat; Ripe=Ⓐʳ␣=Mnu-=Rus(Phon); Ripe²=Mnu-^ʳ-=Hbr; k.ilyaz.org
6071 US-Intl Grn=⇑␣=^ˡⒶˡ-=Grk; Ripe=Ⓐʳ␣=Mnu-=Rus(Phon); Ripe²=Mnu-^ʳ-=Hbr; k.ilyaz.org
6072
6073 (Or maybe it is the semicolons in the names???). If this happens, one can still assign
6074 distinctive icons to the layout, and distinguish them via going to C<Properties>.
6075
6076 =head1 UNICODE TABLE GOTCHAS
6077
6078 The position of Unicode consortium is, apparently, that the “name” of
6079 a Unicode character is “just an identifier”. In other words, its
6080 (primary) function is to identify a character uniquely: different
6081 characters should have different names, and that's it. Any other function
6082 is secondary, and “if it works, fine”; if it does not work, tough luck.
6083 If the name does not match how people use the character (and with the
6084 giant pool of defined characters, this has happened a few times), this is not
6085 a reason to abandon the name.
6086
6087 This position makes the practice of maintaining backward compatibility
6088 easy. There is L<documentation of obvious errors in the naming|http://unicode.org/notes/tn27/>.
6089
6090 However, this module tries to extract a certain amount of I<orthogonality>
6091 from the giant heap of characters defined in Unicode; the principal concept
6092 is “a mogrifier”. Most mogrifiers are defined by programmatic inspection of names
6093 of characters and relations between names of different characters. (In other
6094 words, we base such mogrifiers on names, not glyphs.) Here we
6095 sketch the irregularities uncovered during this process.
6096
6097 APL symbols with C<UP TACK> and C<DOWN TACK> look reverted w.r.t. other
6098 C<UP TACK> and C<DOWN TACK> symbols.
6099
6100 C<LESS-THAN>, C<FULL MOON>, C<GREATER-THAN>, C<EQUALS> C<GREEK RHO>, C<MALE>
6101 are defined with C<SYMBOL> or C<SIGN> at end, but (may) drop it when combined
6102 with modifiers via C<WITH>. Likewise for C<SUBSET OF>, C<SUPERSET OF>,
6103 C<CONTAINS AS MEMBER>, C<PARALLEL TO>, C<EQUIVALENT TO>, C<IDENTICAL TO>.
6104
6105 Sometimes opposite happens, and C<SIGN> appears out of blue sky; compare:
6106
6107 2A18 INTEGRAL WITH TIMES SIGN
6108 2A19 INTEGRAL WITH INTERSECTION
6109
6110 C<ENG> I<is> a combination of C<n> with C<HOOK>, but it is not marked as such
6111 in its name.
6112
6113 Sometimes a name of diacritic (after C<WITH>) acquires an C<ACCENT> at end
6114 (see C<U+0476>).
6115
6116 Oftentimes the part to the left of C<WITH> is not resolvable: sometimes it
6117 is underspecified (e.g, just C<TRIANGLE>), sometimes it is overspecified
6118 (e.g., in C<LEFT VERTICAL BAR WITH QUILL>), sometime it should be understood
6119 as a glyph-of-written-word (e.g, in C<END WITH LEFTWARDS ARROW ABOVE>). Sometimes it just
6120 does not exist (e.g., C<LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE> -
6121 there is C<LATIN LETTER INVERTED GLOTTAL STOP>, but not the reversed variant).
6122 Sometimes it is a defined synonym (C<VERTICAL BAR>).
6123
6124 Sometimes it has something appended (C<N-ARY UNION OPERATOR WITH DOT>).
6125
6126 Sometimes C<WITH> is just a clarification (C<RIGHTWARDS HARPOON WITH BARB DOWNWARDS>).
6127
6128 1 AND
6129 1 ANTENNA
6130 1 ARABIC MATHEMATICAL OPERATOR HAH
6131 1 ARABIC MATHEMATICAL OPERATOR MEEM
6132 1 ARABIC ROUNDED HIGH STOP
6133 1 ARABIC SMALL HIGH LIGATURE ALEF
6134 1 ARABIC SMALL HIGH LIGATURE QAF
6135 1 ARABIC SMALL HIGH LIGATURE SAD
6136 1 BACK
6137 1 BLACK SUN
6138 1 BRIDE
6139 1 BROKEN CIRCLE
6140 1 CIRCLED HORIZONTAL BAR
6141 1 CIRCLED MULTIPLICATION SIGN
6142 1 CLOSED INTERSECTION
6143 1 CLOSED LOCK
6144 1 COMBINING LEFTWARDS HARPOON
6145 1 COMBINING RIGHTWARDS HARPOON
6146 1 CONGRUENT
6147 1 COUPLE
6148 1 DIAMOND SHAPE
6149 1 END
6150 1 EQUIVALENT
6151 1 FISH CAKE
6152 1 FROWNING FACE
6153 1 GLOBE
6154 1 GRINNING CAT FACE
6155 1 HEAVY OVAL
6156 1 HELMET
6157 1 HORIZONTAL MALE
6158 1 IDENTICAL
6159 1 INFINITY NEGATED
6160 1 INTEGRAL AVERAGE
6161 1 INTERSECTION BESIDE AND JOINED
6162 1 KISSING CAT FACE
6163 1 LATIN CAPITAL LETTER REVERSED C
6164 1 LATIN CAPITAL LETTER SMALL Q
6165 1 LATIN LETTER REVERSED GLOTTAL STOP
6166 1 LATIN LETTER TWO
6167 1 LATIN SMALL CAPITAL LETTER I
6168 1 LATIN SMALL CAPITAL LETTER U
6169 1 LATIN SMALL LETTER LAMBDA
6170 1 LATIN SMALL LETTER REVERSED R
6171 1 LATIN SMALL LETTER TC DIGRAPH
6172 1 LATIN SMALL LETTER TH
6173 1 LEFT VERTICAL BAR
6174 1 LOWER RIGHT CORNER
6175 1 MEASURED RIGHT ANGLE
6176 1 MONEY
6177 1 MUSICAL SYMBOL
6178 1 NIGHT
6179 1 NOTCHED LEFT SEMICIRCLE
6180 1 ON
6181 1 OR
6182 1 PAGE
6183 1 RIGHT ANGLE VARIANT
6184 1 RIGHT DOUBLE ARROW
6185 1 RIGHT VERTICAL BAR
6186 1 RUNNING SHIRT
6187 1 SEMIDIRECT PRODUCT
6188 1 SIX POINTED STAR
6189 1 SMALL VEE
6190 1 SOON
6191 1 SQUARED UP
6192 1 SUMMATION
6193 1 SUPERSET BESIDE AND JOINED BY DASH
6194 1 TOP
6195 1 TOP ARC CLOCKWISE ARROW
6196 1 TRIPLE VERTICAL BAR
6197 1 UNION BESIDE AND JOINED
6198 1 UPPER LEFT CORNER
6199 1 VERTICAL BAR
6200 1 VERTICAL MALE
6201 1 WHITE SUN
6202 2 CLOSED MAILBOX
6203 2 CLOSED UNION
6204 2 DENTISTRY SYMBOL LIGHT VERTICAL
6205 2 DOWN-POINTING TRIANGLE
6206 2 HEART
6207 2 LEFT ARROW
6208 2 LINE INTEGRATION
6209 2 N-ARY UNION OPERATOR
6210 2 OPEN MAILBOX
6211 2 PARALLEL
6212 2 RIGHT ARROW
6213 2 SMALL CONTAINS
6214 2 SMILING CAT FACE
6215 2 TIMES
6216 2 TRIPLE HORIZONTAL BAR
6217 2 UP-POINTING TRIANGLE
6218 2 VERTICAL KANA REPEAT
6219 3 CHART
6220 3 CONTAINS
6221 3 TRIANGLE
6222 4 BANKNOTE
6223 4 DIAMOND
6224 4 PERSON
6225 5 LEFTWARDS TWO-HEADED ARROW
6226 5 RIGHTWARDS TWO-HEADED ARROW
6227 8 DOWNWARDS HARPOON
6228 8 UPWARDS HARPOON
6229 9 SMILING FACE
6230 11 CIRCLE
6231 11 FACE
6232 11 LEFTWARDS HARPOON
6233 11 RIGHTWARDS HARPOON
6234 15 SQUARE
6235
6236 perl -wlane "next unless /^Unresolved: <(.*?)>/; $s{$1}++; END{print qq($s{$_}\t$_) for keys %s}" oxx-us2 | sort -n > oxx-us2-sorted-kw
6237
6238 C<SQUARE WITH> specify fill - not combining. C<FACE> is not combining, same for C<HARPOON>s.
6239
6240 Only C<CIRCLE WITH HORIZONTAL BAR> is combining. Triangle is combining only with underbar and dot above.
6241
6242 C<TRIANGLE> means C<WHITE UP-POINTING TRIANGLE>. C<DIAMOND> - C<WHITE DIAMOND> (so do many others.)
6243 C<TIMES> means C<MULTIPLICATION SIGN>; but C<CIRCLED MULTIPLICATION SIGN> means C<CIRCLED TIMES> - go figure!
6244 C<CIRCLED HORIZONTAL BAR WITH NOTCH> is not a decomposition (it is "something circled").
6245
6246 Another way of compositing is C<OVER> (but not C<UNDER>!) and C<FROM BAR>. See also C<ABOVE>, C<BELOW>
6247 - but only C<BELOW LONG DASH>. Avoid C<WITH/AND> after these.
6248
6249 C<TWO HEADED> should replace C<TWO-HEADED>. C<LEFT ARROW> means C<LEFTWARDS ARROW>, same for C<RIGHT>.
6250 C<DIAMOND SHAPE> means C<DIAMOND> - actually just a bug - http://www.reddit.com/r/programming/comments/fv8ao/unicode_600_standard_published/?
6251 C<LINE INTEGRATION> means C<CONTOUR INTEGRAL>. C<INTEGRAL AVERAGE> means C<INTEGRAL>.
6252 C<SUMMATION> means C<N-ARY SUMMATION>. C<INFINITY NEGATED> means C<INFINITY>.
6253
6254 C<HEART> means C<WHITE HEART SUIT>. C<TRIPLE HORIZONTAL BAR> looks genuinely missing...
6255
6256 C<SEMIDIRECT PRODUCT> means one of two, left or right???
6257
6258 This better be convertible by rounding/sharpening mogrifiers, but see
6259 C<BUT NOT/WITH NOT/OR NOT/AND SINGLE LINE NOT/ABOVE SINGLE LINE NOT/ABOVE NOT>
6260
6261 2268 LESS-THAN BUT NOT EQUAL TO; 1.1
6262 2269 GREATER-THAN BUT NOT EQUAL TO; 1.1
6263 228A SUBSET OF WITH NOT EQUAL TO; 1.1
6264 228B SUPERSET OF WITH NOT EQUAL TO; 1.1
6265 @ Relations
6266 22E4 SQUARE IMAGE OF OR NOT EQUAL TO; 1.1
6267 22E5 SQUARE ORIGINAL OF OR NOT EQUAL TO; 1.1
6268 @@ 2A00 Supplemental Mathematical Operators 2AFF
6269 @ Relational operators
6270 2A87 LESS-THAN AND SINGLE-LINE NOT EQUAL TO; 3.2
6271 x (less-than but not equal to - 2268)
6272 2A88 GREATER-THAN AND SINGLE-LINE NOT EQUAL TO; 3.2
6273 x (greater-than but not equal to - 2269)
6274 2AB1 PRECEDES ABOVE SINGLE-LINE NOT EQUAL TO; 3.2
6275 2AB2 SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO; 3.2
6276 2AB5 PRECEDES ABOVE NOT EQUAL TO; 3.2
6277 2AB6 SUCCEEDS ABOVE NOT EQUAL TO; 3.2
6278 @ Subset and superset relations
6279 2ACB SUBSET OF ABOVE NOT EQUAL TO; 3.2
6280 2ACC SUPERSET OF ABOVE NOT EQUAL TO; 3.2
6281
6282 Looking into v6.1 reference PDFs, 2268,2269,2ab5,2ab6,2acb,2acc have two horizontal bars,
6283 228A,228B,22e4,22e5,2a87,2a88,2ab1,2ab2 have one horizontal bar, Hence C<BUT NOT EQUAL TO> and C<ABOVE NOT EQUAL TO>
6284 are equivalent; so are C<WITH NOT EQUAL TO>, C<OR NOT EQUAL TO>, C<AND SINGLE-LINE NOT EQUAL TO>
6285 and C<ABOVE SINGLE-LINE NOT EQUAL TO>. (Square variants come only with one horizontal line?)
6286
6287
6288 Set C<$ENV{UI_KEYBOARDLAYOUT_UNRESOLVED}> to enable warnings. Then do
6289
6290 perl -wlane "next unless /^Unresolved: <(.*?)>/; $s{$1}++; END{print qq($s{$_}\t$_) for keys %s}" oxx | sort -n > oxx-sorted-kw
6291
6292 =head1 More (random) rambling on assignment of key combinations
6293
6294 (Here we continue the discussion in L<"A convenient assignment of KBD* bitmaps to modifier keys">. This stems from an obsolete
6295 assumption that it makes sense to assign to L<Win> key the modifier flags C<CTRL|X1>:
6296
6297 lCtrl Win lAlt rAlt Menu rCtrl
6298 CTRL|LOYA CTRL|X1 ALT|KANA CTRL|ALT|LOYA|X1 CTRL|ALT|X2 CTRL|ALT|ROYA
6299
6300 Nowadays I would use C<CTRL|X3> instead.)
6301
6302 B<NOTES:> All the combinations involving at most one of C<lCtrl>, C<Win> or
6303 C<rAlt> give distinct ORed masks. This completely preserving all
6304 application-visible properties of keyboard events [except those with C<lCtrl-Win-lAlt->
6305 modifiers; this combination is equivalent to C<lAlt-rAlt->].
6306 The only combination of C<LOYA,KANA,X1,X2,ROYA> which may appear with
6307 different C<CTRL,ALT> bits is C<LOYA|X1>; hence there are 33 possible combinations
6308 of C<CTRL,ALT,LOYA,KANA,X1,X2,ROYA>.
6309
6310
6311 Indeed, C<CTRL> is determined by C<LOYA|X1|X2|ROYA>.
6312 If one of C<KANA,X2,ROYA> is present, then C<ALT> is set; so assume C<KANA,X2,ROYA> are not present.
6313 But then, if C<ALT> B<may be> set, then both C<LOYA|X1> B<must> be present; which gives the
6314 only duplication.
6315
6316 Leaving out 5 combinations of C<lCtrl>, C<Win>, C<lAlt> [8, minus the empty one, and
6317 C<lCtrl+lAlt>, which is avoided by most application due to its similarity to C<AltGr=rAlt>,
6318 and C<lCtrl+Win+lAlt> which is undistinguishable by the mask from C<lAlt+rAlt>]
6319 to have bindable keypresses in applications, and having C<rCtrl> as equivalent to
6320 C<lCtrl>, this gives 27 C<Shift>-pairs which may produce characters.
6321
6322 B<NOTE:> C<lCtrl+Win+lAlt> being undistinguishable by the mask from C<lAlt+rAlt>
6323 is not a big deal, since there is no standard keyboard shortcuts involving C<Ctrl+Win+Alt>.
6324
6325 B<NOTE:> Combinations of C<lCtrl> with C<rCtrl> L<cause several problems|"C<lCtrl-rCtrl> combination: multiple problems">;
6326 likewise for L<combinations of C<lAlt> with C<rAlt> |"C<lAlt-rAlt> combination: many keys are not delivered to applications">.
6327 B<Summary:> These seem to be combinations of keyboard’s hardware problems with (rare, unreproducible)
6328 software-being-stuck-in-unexpected-state problems (should not one try to switch between keyboard layout then?!).
6329
6330 =head1 SEE ALSO
6331
6332 The keyboard(s) generated with this module: L<UI::KeyboardLayout::izKeys>, L<http://k.ilyaz.org/>
6333
6334 On diacritics:
6335
6336 http://www.phon.ucl.ac.uk/home/wells/dia/diacritics-revised.htm#two
6337 http://en.wikipedia.org/wiki/Tonos#Unicode
6338 http://en.wikipedia.org/wiki/Early_Cyrillic_alphabet#Numerals.2C_diacritics_and_punctuation
6339 http://en.wikipedia.org/wiki/Vietnamese_alphabet#Tone_marks
6340 http://diacritics.typo.cz/
6341
6342 http://en.wikipedia.org/wiki/User:TEB728/temp (Chars of languages)
6343 http://www.evertype.com/alphabets/index.html
6344
6345 Accents in different Languages:
6346 http://fonty.pl/porady,12,inne_diakrytyki.htm#07
6347 http://en.wikipedia.org/wiki/Latin-derived_alphabet
6348
6349 On typography marks
6350
6351 http://wiki.neo-layout.org/wiki/Striche
6352 http://www.matthias-kammerer.de/SonsTypo3.htm
6353 http://en.wikipedia.org/wiki/Soft_hyphen
6354 http://en.wikipedia.org/wiki/Dash
6355 http://en.wikipedia.org/wiki/Ditto_mark
6356
6357 On keyboard layouts:
6358
6359 http://en.wikipedia.org/wiki/Keyboard_layout
6360 http://en.wikipedia.org/wiki/Keyboard_layout#US-International
6361 http://en.wikipedia.org/wiki/ISO/IEC_9995
6362 http://www.pentzlin.com/info2-9995-3-V3.pdf (used almost nowhere - only half of keys in Canadian multilanguage match)
6363 http://en.wikipedia.org/wiki/QWERTY#Canadian_Multilingual_Standard
6364 http://en.wikipedia.org/wiki/Unicode_input
6365 Discussion of layout changes and position of €:
6366 https://www.libreoffice.org/bugzilla/show_bug.cgi?id=5981
6367
6368 History of QUERTY
6369 http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/publications/PreQWERTY.html
6370 http://kanji.zinbun.kyoto-u.ac.jp/db-machine/~yasuoka/QWERTY/
6371
6372 http://msdn.microsoft.com/en-us/goglobal/bb964651
6373 http://eurkey.steffen.bruentjen.eu/layout.html
6374 http://ru.wikipedia.org/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Birman%27s_keyboard_layout.svg
6375 http://bepo.fr/wiki/Accueil
6376 http://www.unibuc.ro/e/prof/paliga_v_s/soft-reso/ (Academic for Mac)
6377 http://cgit.freedesktop.org/xkeyboard-config/tree/symbols/ru
6378 http://cgit.freedesktop.org/xkeyboard-config/tree/symbols/keypad
6379 http://www.evertype.com/celtscript/type-keys.html (Old Irish mechanical typewriters)
6380 http://eklhad.net/linux/app/halfqwerty.xkb (One-handed layout)
6381 http://www.doink.ch/an-x11-keyboard-layout-for-scholars-of-old-germanic/ (and references there)
6382 http://www.neo-layout.org/
6383 https://commons.wikimedia.org/wiki/File:Neo2_keyboard_layout.svg
6384 Images in (download of)
6385 http://www.mzuther.de/en/contents/osd-neo2
6386 Neo2 sources:
6387 http://wiki.neo-layout.org/browser/windows/kbdneo2/Quelldateien
6388 Shift keys at center, nice graphic:
6389 http://www.tinkerwithabandon.com/twa/keyboarding.html
6390 Physical keyboard:
6391 http://www.konyin.com/?page=product.Multilingual%20Keyboard%20for%20UNITED%20STATES
6392 Polytonic Greek
6393 http://www.polytoniko.org/keyb.php?newlang=en
6394 Portable keyboard layout
6395 http://www.autohotkey.com/forum/viewtopic.php?t=28447
6396 One-handed
6397 http://www.autohotkey.com/forum/topic1326.html
6398 Typing on numeric keypad
6399 http://goron.de/~johns/one-hand/#documentation
6400 On screen keyboard indicator
6401 http://www.autohotkey.com/docs/scripts/KeyboardOnScreen.htm
6402 Keyboards of ЕС-1840/1/5
6403 http://aic-crimea.narod.ru/Study/Shen/PC/1/5-4-1.htm
6404 (http://www.aic-crimea.narod.ru/Study/Shen/PC/main.htm) Руководство пользователя ПЭВМ
6405 http://fdd5-25.net/fddforum/index.php?PHPSESSID=201bd45ab972f1ab4b440dcb6c7ca18f&topic=489.30
6406 Phonetic Hebrew layout(s) (1st has many duplicates, 2nd overweighted)
6407 http://bc.tech.coop/Hebrew-ZC.html
6408 http://help.keymanweb.com/keyboards/keyboard_galaxiehebrewkm6.php
6409 Greek (Galaxy) with a convenient mapping (except for Ψ) and BibleScript
6410 http://www.tavultesoft.com/keyboarddownloads/%7B4D179548-1215-4167-8EF7-7F42B9B0C2A6%7D/manual.pdf
6411 With 2-letter input of Unicode names:
6412 http://www.jlg-utilities.com
6413 Medievist's
6414 http://www.personal.leeds.ac.uk/~ecl6tam/
6415 Yandex visual keyboards
6416 http://habrahabr.ru/company/yandex/blog/108255/
6417 Implementation in FireFox
6418 http://mxr.mozilla.org/mozilla-central/source/widget/windows/KeyboardLayout.cpp#1085
6419 Implementation in Emacs 24.3 (ToUnicode() in fns)
6420 http://fossies.org/linux/misc/emacs-24.3.tar.gz:a/emacs-24.3/src/w32inevt.c
6421 http://fossies.org/linux/misc/emacs-24.3.tar.gz:a/emacs-24.3/src/w32fns.c
6422 http://fossies.org/linux/misc/emacs-24.3.tar.gz:a/emacs-24.3/src/w32term.c
6423 Naive implementations:
6424 http://social.msdn.microsoft.com/forums/en-US/windowssdk/thread/07afec87-68c1-4a56-bf46-a38a9c2232e9/
6425 Quality of a keyboard
6426 http://www.tavultesoft.com/keymandev/quality/whitepaper1.1.pdf
6427
6428 Manipulating keyboards on Windows and X11
6429
6430 http://symbolcodes.tlt.psu.edu/keyboards/winkeyvista.html (using links there: up to Win7)
6431 http://windows.microsoft.com/en-us/windows-8/change-keyboard-layout
6432 http://www.howtoforge.com/changing-language-and-keyboard-layout-on-various-linux-distributions
6433
6434 MSKLC parser
6435
6436 http://pastebin.com/UXc1ub4V
6437
6438 By author of MSKLC Michael S. Kaplan (do not forget to follow links)
6439
6440 Input on Windows:
6441 http://seit.unsw.adfa.edu.au/staff/sites/hrp/personal/Sanskrit-External/Unicode-KbdsonWindows.pdf
6442
6443 http://blogs.msdn.com/b/michkap/archive/2006/03/26/560595.aspx
6444 http://blogs.msdn.com/b/michkap/archive/2006/04/22/581107.aspx
6445 Chaining dead keys:
6446 http://blogs.msdn.com/b/michkap/archive/2011/04/16/10154700.aspx
6447 Mapping VK to VSC etc:
6448 http://blogs.msdn.com/b/michkap/archive/2006/08/29/729476.aspx
6449 [Link] Remapping CapsLock to mean Backspace in a keyboard layout
6450 (if repeat, every second Press counts ;-)
6451 http://colemak.com/forum/viewtopic.php?id=870
6452 Scancodes from kbd.h get in the way
6453 http://blogs.msdn.com/b/michkap/archive/2006/08/30/726087.aspx
6454 What happens if you start with .klc with other VK_ mappings:
6455 http://blogs.msdn.com/b/michkap/archive/2010/11/03/10085336.aspx
6456 Keyboards with Ctrl-Shift states:
6457 http://blogs.msdn.com/b/michkap/archive/2010/10/08/10073124.aspx
6458 On assigning Ctrl-values
6459 http://blogs.msdn.com/b/michkap/archive/2008/11/04/9037027.aspx
6460 On hotkeys for switching layouts:
6461 http://blogs.msdn.com/b/michkap/archive/2008/07/16/8736898.aspx
6462 Text services
6463 http://blogs.msdn.com/b/michkap/archive/2008/06/30/8669123.aspx
6464 Low-level access in MSKLC
6465 http://levicki.net/articles/tips/2006/09/29/HOWTO_Build_keyboard_layouts_for_Windows_x64.php
6466 http://blogs.msdn.com/b/michkap/archive/2011/04/09/10151666.aspx
6467 On font linking
6468 http://blogs.msdn.com/b/michkap/archive/2006/01/22/515864.aspx
6469 Unicode in console
6470 http://blogs.msdn.com/michkap/archive/2005/12/15/504092.aspx
6471 Adding formerly "invisible" keys to the keyboard
6472 http://blogs.msdn.com/b/michkap/archive/2006/09/26/771554.aspx
6473 Redefining NumKeypad keys
6474 http://blogs.msdn.com/b/michkap/archive/2007/07/04/3690200.aspx
6475 BUT!!!
6476 http://blogs.msdn.com/b/michkap/archive/2010/04/05/9988581.aspx
6477 And backspace/return/etc
6478 http://blogs.msdn.com/b/michkap/archive/2008/10/27/9018025.aspx
6479 kbdutool.exe, run with the /S ==> .c files
6480 Doing one's own WM_DEADKEY processing'
6481 http://blogs.msdn.com/b/michkap/archive/2006/09/10/748775.aspx
6482 Dead keys do not work on SG-Caps
6483 http://blogs.msdn.com/b/michkap/archive/2008/02/09/7564967.aspx
6484 Dynamic keycaps keyboard
6485 http://blogs.msdn.com/b/michkap/archive/2005/07/20/441227.aspx
6486 Backslash/yen/won confusion
6487 http://blogs.msdn.com/b/michkap/archive/2005/09/17/469941.aspx
6488 Unicode output to console
6489 http://blogs.msdn.com/b/michkap/archive/2010/10/07/10072032.aspx
6490 Install/Load/Activate an input method/layout
6491 http://blogs.msdn.com/b/michkap/archive/2007/12/01/6631463.aspx
6492 http://blogs.msdn.com/b/michkap/archive/2008/05/23/8537281.aspx
6493 Reset to a TT font from an application:
6494 http://blogs.msdn.com/b/michkap/archive/2011/09/22/10215125.aspx
6495 How to (not) treat C-A-Q
6496 http://blogs.msdn.com/b/michkap/archive/2012/04/26/10297903.aspx
6497 Treating Brazilian ABNT c1 c2 keys
6498 http://blogs.msdn.com/b/michkap/archive/2006/10/07/799605.aspx
6499 And JIS ¥|-key
6500 (compare with http://www.scs.stanford.edu/11wi-cs140/pintos/specs/kbd/scancodes-7.html
6501 http://hp.vector.co.jp/authors/VA003720/lpproj/others/kbdjpn.htm )
6502 http://blogs.msdn.com/b/michkap/archive/2006/09/26/771554.aspx
6503 Suggest a topic:
6504 http://blogs.msdn.com/b/michkap/archive/2007/07/29/4120528.aspx#7119166
6505
6506 Installable Keyboard Layouts - Apple Developer (“.keylayout” files; modifiers not editable; cache may create problems;
6507 to enable deadkeys in X11, one may need extra work)
6508
6509 http://developer.apple.com/technotes/tn2002/tn2056.html
6510 http://wordherd.com/keyboards/
6511 http://stackoverflow.com/questions/999681/how-to-remap-context-menu-key-in-mac-os-x
6512 http://apple.stackexchange.com/questions/21691/ukelele-generated-custom-keyboard-layouts-not-working-in-lion
6513 http://wiki.openoffice.org/wiki/X11Keymaps
6514 http://www.tenshu.net/2012/11/using-caps-lock-as-new-modifier-key-in.html
6515 http://raw.github.com/lreddie/ukelele-steps/master/USExtended.keylayout
6516 http://scripts.sil.org/cms/scripts/page.php?item_id=keylayoutmaker
6517
6518 ANSI/ISO/ABNT/JIS/Russian Apple’s keyboards
6519
6520 https://discussions.apple.com/thread/1508293
6521 http://www.dtp-transit.jp/apple/mac/post_1137.html
6522 http://www.dtp-transit.jp/images/apple-keyboards-US-JIS.jpg
6523 http://m10lmac.blogspot.co.il/2007/02/fixing-brazilian-keyboard-layout.html
6524 http://www2d.biglobe.ne.jp/~msyk/keyboard/layout/mac-jiskbd.html
6525 http://commons.wikimedia.org/wiki/File:KB_Russian_Apple_Macintosh.svg
6526
6527 JIS variations (OADG109 vs A)
6528
6529 http://ja.wikipedia.org/wiki/JIS%E3%82%AD%E3%83%BC%E3%83%9C%E3%83%BC%E3%83%89
6530
6531 Different ways to access chars on Mac (1ˢᵗ suggests adding a Discover via plists via Keycaps≠Strings)
6532
6533 http://apple.stackexchange.com/questions/49565/how-can-i-expand-the-number-of-special-characters-i-can-type-using-my-keyboard
6534 http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/eventoverview/TextDefaultsBindings/TextDefaultsBindings.html#//apple_ref/doc/uid/20000468-CJBDEADF
6535 http://www.hcs.harvard.edu/~jrus/Site/System%20Bindings.html Default keybindings
6536 http://www.hcs.harvard.edu/~jrus/Site/Cocoa%20Text%20System.html
6537 http://hints.macworld.com/article.php?story=2005051118320432 Mystery keys on Mac
6538 http://www.snark.de/index.cgi/0007 Patching ADB drivers
6539 http://www.snark.de/mac/usbkbpatch/index_en.html Patching USB drivers (gives LCtrl vs RCtrl etc???)
6540 http://www.lorax.com/FreeStuff/TextExtras.html (has no docs???)
6541 http://stevelosh.com/blog/2012/10/a-modern-space-cadet/ Combining different approaches
6542 http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ (simplified version of ↖)
6543 http://david.rothlis.net/keyboards/microsoft_natural_osx/ Num Lock is claimed as not working
6544
6545 Compose on Mac requires hacks:
6546
6547 http://apple.stackexchange.com/questions/31487/add-compose-key-to-os-x
6548
6549 Convert Apple to MSKLC
6550
6551 http://typophile.com/node/90606
6552
6553 Keyboards on Mac:
6554
6555 http://homepage.mac.com/thgewecke/mlingos9.html
6556 http://web.archive.org/web/20080717203026/http://homepage.mac.com/thgewecke/mlingos9.html
6557
6558 Tool to produce:
6559
6560 http://wordherd.com/keyboards/
6561 http://developer.apple.com/library/mac/#technotes/tn2056/_index.html
6562
6563 VK_OEM_8 Kana modifier - Using instead of AltGr
6564
6565 http://www.kbdedit.com/manual/ex13_replacing_altgr_with_kana.html
6566
6567 Limitations of using KANA toggle
6568
6569 http://www.kbdedit.com/manual/ex12_trilang_ser_cyr_lat_gre.html
6570
6571 KANALOK documented:
6572
6573 http://www.kbdedit.com/manual/high_level_kanalok.html
6574
6575 (Essentially, when C<KBDKANA> modifier-flag is assigned on C<VK_KANA> — as opposed on, e.g., C<VK_OEM_8> — the “is-pressed” state of
6576 C<VK_KANA> is toggled on each keypress, but the C<KBDKANA> bit is not (?) set in the “current keyboard state”. Instead, keys with
6577 C<KANALOK> flag react on “calculated KBDKANA” which is found by the “pressed state” of VK_KANA.)
6578
6579 FE (Far Eastern) keyboard source code example (NEC AT is 106 with SPECIAL MULTIVK flags changed on some scancodes, OEM_7/8 producing 0x1e 0x1f, and no OEM_102):
6580
6581 http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/ntos/w32/ntuser/kbd/fe_kbds/jpn/ibm02/kbdibm02.c__.htm
6582 http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/ntos/w32/ntuser/kbd/fe_kbds/jpn/kbdnecat/kbdnecat.c__.htm
6583 http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/ntos/w32/ntuser/kbd/fe_kbds/jpn/106/kbd106.c__.htm
6584
6585 Investigation on relation between VK_ asignments, KBDEXT, KBDNUMPAD etc:
6586 http://code.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/kbddvp.c
6587
6588 PowerShell vs ISE (and how to find them [On Win7: WinKey Accessories]
6589 http://blogs.msdn.com/b/powershell/archive/2009/04/17/differences-between-the-ise-and-powershell-console.aspx
6590 http://blogs.msdn.com/b/michkap/archive/2013/01/23/10387424.aspx
6591 http://blogs.msdn.com/b/michkap/archive/2013/02/15/10393862.aspx
6592 http://blogs.msdn.com/b/michkap/archive/2013/02/19/10395086.aspx
6593 http://blogs.msdn.com/b/michkap/archive/2013/02/20/10395416.aspx
6594
6595 Google for "Get modification number for Shift key" for code to query the kbd DLL directly ("keylogger")
6596 http://web.archive.org/web/20120106074849/http://debtnews.net/index.php/article/debtor/2008-09-08/1088.html
6597 http://code.google.com/p/keymagic/source/browse/KeyMagicDll/kbdext.cpp?name=0419d8d626&r=d85498403fd59bca9efc04b4e5bb4406d39439a0
6598
6599 How to read Unicode in an ANSI Window:
6600 http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/d455e846-d18b-4086-98de-822658bcebf0/
6601 http://blog.tavultesoft.com/2011/06/accepting-unicode-input-in-your-windows-application.html
6602
6603 HTML consolidated entity names and discussion, MES charsets:
6604
6605 http://www.w3.org/TR/xml-entity-names
6606 http://www.w3.org/2003/entities/2007/w3centities-f.ent
6607 http://www.cl.cam.ac.uk/~mgk25/ucs/mes-2-rationale.html
6608 http://web.archive.org/web/20000815100817/http://www.egt.ie/standards/iso10646/pdf/cwa13873.pdf
6609
6610 Ctrl2cap
6611
6612 http://technet.microsoft.com/en-us/sysinternals/bb897578
6613
6614 Low level scancode mapping
6615
6616 http://www.annoyances.org/exec/forum/winxp/r1017256194
6617 http://web.archive.org/web/20030211001441/http://www.microsoft.com/hwdev/tech/input/w2kscan-map.asp
6618 http://msdn.microsoft.com/en-us/windows/hardware/gg463447
6619 http://www.annoyances.org/exec/forum/winxp/1034644655
6620 ???
6621 http://netj.org/2004/07/windows_keymap
6622 the free remapkey.exe utility that's in Microsoft NT / 2000 resource kit.
6623
6624 perl -wlne "BEGIN{$t = {T => q(), qw( X e0 Y e1 )}} print qq( $t->{$1}$2\t$3) if /^#define\s+([TXY])([0-9a-f]{2})\s+(?:_EQ|_NE)\((?:(?:\s*\w+\s*,){3})?\s*([^\W_]\w*)\s*(?:(?:,\s*\w+\s*){2})?\)\s*(?:\/\/.*)?$/i" kbd.h >ll2
6625 then select stuff up to the first e1 key (but DECIMAL is not there T53 is DELETE??? take from MSKLC help/using/advanced/scancodes)
6626
6627 CapsLock as on typewriter:
6628
6629 http://web.archive.org/web/20120717083202/http://www.annoyances.org/exec/forum/winxp/1071197341
6630
6631 Scancodes visible on the low level:
6632
6633 http://openbsd.7691.n7.nabble.com/Patch-Support-F13-F24-on-PC-122-terminal-keyboard-td224992.html
6634 http://www.seasip.info/Misc/1227T.html
6635
6636 Scancodes visible on Windows (with USB)
6637
6638 http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf
6639
6640 Detailed description of production of scancodes (see after C<===>), including C<0x80xx> codes (and C<0xe2> Logitech prefix):
6641
6642 http://www.fysh.org/~zefram/keyboard/xt_scancodes.txt
6643
6644 Ultra-exotic virtual keys
6645
6646 See
6647
6648 https://learn.microsoft.com/en-us/previous-versions/aa931968(v=msdn.10)
6649
6650 (note that C<OEM_ATTN OEM_COPY OEM_CUSEL OEM_ENLW> do not seem to have any scancodes assigned anywhere…).
6651
6652 See also L<this discussion|https://stackoverflow.com/questions/11740958/js-what-keyboard-keys-are-specified-for-key-codes-in-intervals-146-185-193-218>.
6653 and L<these lists and references|https://bsakatu.net/doc/virtual-key-of-windows/>.
6654
6655 (L<One of (industrial) keyboards with C<OEM_FJ_000>-key|https://geekhack.org/index.php?topic=60355.0> is a part of
6656 L<a huge family|https://telcontar.net/KBK/Fujitsu/series>.
6657
6658 The less exotic “largish” keyboards are discussed in
6659 L<"Issues with support of European(ISO)/Brazilian(ABNT2)/Japanese(JIS) physical keyboards">.
6660
6661 X11 XKB docs:
6662
6663 https://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html
6664
6665 ftp://www.x.org/pub/xorg/X11R7.5/doc/input/XKB-Enhancing.html (what is caps:shift* ???)
6666 https://wiki.gentoo.org/wiki/Keyboard_layout_switching
6667 http://webkeys.platonix.co.il/about/use_xkb/#caps-key-types
6668
6669 https://apt-browse.org/browse/debian/wheezy/main/all/xkb-data/2.5.1-3/file/usr/share/X11/xkb/symbols/keypad
6670 http://misc.openbsd.narkive.com/UK2Xlptl/shift-backspace-in-x
6671 NoSymbol (do not change; do not make array longer; if alphabetic, may be extended to width 2)
6672 vs VoidSymbol (undefine; may actually extend the array. Undocumented in xkbproto??? )
6673 compare with http://kotoistus.tksoft.com/linux/void_no_symbol-en.html
6674
6675 overlay1=<KO7> overlay2=<KO7> How to switch to overlay: see compat/keypad
6676 RadioGroup ???
6677
6678 Problems on X11:
6679
6680 http://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html (definition of XKB protocol)
6681 http://www.x.org/releases/current/doc/kbproto/xkbproto.html
6682
6683 http://web.archive.org/web/20050306001520/http://pascal.tsu.ru/en/xkb/
6684
6685 Some features are removed in libxkbcommon, which is used by many toolkits now:
6686 https://xkbcommon.org/doc/current/md_doc_compat.html
6687 But XKB is implemented in the server???
6688
6689 http://wiki.linuxquestions.org/wiki/Configuring_keyboards (current???)
6690 http://wiki.linuxquestions.org/wiki/Accented_Characters (current???)
6691 http://wiki.linuxquestions.org/wiki/Altering_or_Creating_Keyboard_Maps (current???)
6692 https://help.ubuntu.com/community/ComposeKey (documents almost 1/2 of the needed stuff)
6693 http://www.gentoo.org/doc/en/utf-8.xml (2005++ ???)
6694 http://en.gentoo-wiki.com/wiki/X.Org/Input_drivers (2009++ HAS: How to make CapsLock change layouts)
6695 http://www.freebsd.org/cgi/man.cgi?query=setxkbmap&sektion=1&manpath=X11R7.4
6696 http://people.uleth.ca/~daniel.odonnell/Blog/custom-keyboard-in-linuxx11
6697 http://shtrom.ssji.net/skb/xorg-ligatures.html (of 2008???)
6698 http://tldp.org/HOWTO/Danish-HOWTO-2.html (of 2005???)
6699 http://www.tux.org/~balsa/linux/deadkeys/index.html (of 1999???)
6700 http://www.x.org/releases/X11R7.6/doc/libX11/Compose/en_US.UTF-8.html
6701 http://cgit.freedesktop.org/xorg/proto/xproto/plain/keysymdef.h
6702
6703 EIGHT_LEVEL FOUR_LEVEL_ALPHABETIC FOUR_LEVEL_SEMIALPHABETIC PC_SYSRQ : see
6704 http://cafbit.com/resource/mackeyboard/mackeyboard.xkb
6705
6706 ./xkb in /etc/X11 /usr/local/X11 /usr/share/local/X11 /usr/share/X11
6707 (maybe it is more productive to try
6708 ls -d /*/*/xkb /*/*/*/xkb
6709 ?)
6710 but what dead_diaeresis means is defined here:
6711 Apparently, may be in /usr/X11R6/lib/X11/locale/en_US.UTF-8/Compose /usr/share/X11/locale/en_US.UTF-8/Compose
6712 http://wiki.maemo.org/Remapping_keyboard
6713 http://www.x.org/releases/current/doc/man/man8/mkcomposecache.8.xhtml
6714
6715 B<Note:> have XIM input method in GTK disables Control-Shift-u way of entering HEX unicode.
6716
6717 How to contribute:
6718 http://www.freedesktop.org/wiki/Software/XKeyboardConfig/Rules
6719
6720 B<Note:> the problems with handling deadkeys via .Compose are that: .Compose is handled by
6721 applications, while keymaps by server (since they may be on different machines, things can
6722 easily get out of sync); .Compose knows nothing about the current "Keyboard group" or of
6723 the state of CapsLock etc (therefore emulating "group switch" via composing is impossible).
6724
6725 JS code to add "insert these chars": google for editpage_specialchars_cyrilic, or
6726
6727 http://en.wikipedia.org/wiki/User:TEB728/monobook.jsx
6728
6729 Latin paleography
6730
6731 http://en.wikipedia.org/wiki/Latin_alphabet
6732 http://tlt.its.psu.edu/suggestions/international/bylanguage/oenglish.html
6733 http://guindo.pntic.mec.es/~jmag0042/LATIN_PALEOGRAPHY.pdf
6734 http://www.evertype.com/standards/wynnyogh/ezhyogh.html
6735 http://www.wordorigins.org/downloads/OELetters.doc
6736 http://www.menota.uio.no/menota-entities.txt
6737 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n2957.pdf (Uncomplete???)
6738 http://skaldic.arts.usyd.edu.au/db.php?table=mufi_char&if=mufi (No prioritization...)
6739
6740 Summary tables for Cyrillic
6741
6742 http://ru.wikipedia.org/wiki/%D0%9A%D0%B8%D1%80%D0%B8%D0%BB%D0%BB%D0%B8%D1%86%D0%B0#.D0.A1.D0.BE.D0.B2.D1.80.D0.B5.D0.BC.D0.B5.D0.BD.D0.BD.D1.8B.D0.B5_.D0.BA.D0.B8.D1.80.D0.B8.D0.BB.D0.BB.D0.B8.D1.87.D0.B5.D1.81.D0.BA.D0.B8.D0.B5_.D0.B0.D0.BB.D1.84.D0.B0.D0.B2.D0.B8.D1.82.D1.8B_.D1.81.D0.BB.D0.B0.D0.B2.D1.8F.D0.BD.D1.81.D0.BA.D0.B8.D1.85_.D1.8F.D0.B7.D1.8B.D0.BA.D0.BE.D0.B2
6743 http://ru.wikipedia.org/wiki/%D0%9F%D0%BE%D0%B7%D0%B8%D1%86%D0%B8%D0%B8_%D0%B1%D1%83%D0%BA%D0%B2_%D0%BA%D0%B8%D1%80%D0%B8%D0%BB%D0%BB%D0%B8%D1%86%D1%8B_%D0%B2_%D0%B0%D0%BB%D1%84%D0%B0%D0%B2%D0%B8%D1%82%D0%B0%D1%85
6744 http://en.wikipedia.org/wiki/List_of_Cyrillic_letters - per language tables
6745 http://en.wikipedia.org/wiki/Cyrillic_alphabets#Summary_table
6746 http://en.wiktionary.org/wiki/Appendix:Cyrillic_script
6747
6748 Extra chars (see also the ordering table on page 8)
6749 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3194.pdf
6750
6751 Typesetting Old and Modern Church Slavonic
6752 http://www.sanu.ac.rs/Cirilica/Prilozi/Skup.pdf
6753 http://irmologion.ru/ucsenc/ucslay8.html
6754 http://irmologion.ru/csscript/csscript.html
6755 http://cslav.org/success.htm
6756 http://irmologion.ru/developer/fontdev.html#allocating
6757
6758 Non-dialogue of Slavists and Unicode experts
6759 http://www.sanu.ac.rs/Cirilica/Prilozi/Standard.pdf
6760 http://kodeks.uni-bamberg.de/slavling/downloads/2008-07-26_white-paper.pdf
6761
6762 Newer: (+ combining ф)
6763 http://tug.org/pipermail/xetex/2012-May/023007.html
6764 http://www.unicode.org/alloc/Pipeline.html As below, plus N-left-hook, ДЗЖ ДЧ, L-descender, modifier-Ь/Ъ
6765 http://www.synaxis.info/azbuka/ponomar/charset/charset_1.htm
6766 http://www.synaxis.info/azbuka/ponomar/charset/charset_2.htm
6767 http://www.synaxis.info/azbuka/ponomar/roadmap/roadmap.html
6768 http://www.ponomar.net/cu_support.html
6769 http://www.ponomar.net/files/out.pdf
6770 http://www.ponomar.net/files/variants.pdf (5 VS for Mark's chapter, 2 VS for t, 1 VS for the rest)
6771
6772 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3772.pdf typikon (+[semi]circled), ε-form
6773 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3971.pdf inverted ε-typikon
6774 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3974.pdf two variants of o/O
6775 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3998.pdf Mark's chapter
6776 http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3563.pdf Reversed tse
6777
6778 IPA
6779
6780 http://upload.wikimedia.org/wikipedia/commons/f/f5/IPA_chart_2005_png.svg
6781 http://en.wikipedia.org/wiki/Obsolete_and_nonstandard_symbols_in_the_International_Phonetic_Alphabet
6782 http://en.wikipedia.org/wiki/Case_variants_of_IPA_letters
6783 Table with Unicode points marked:
6784 http://www.staff.uni-marburg.de/~luedersb/IPA_CHART2005-UNICODE.pdf
6785 (except for "Lateral flap" and "Epiglottal" column/row.
6786 (Extended) IPA explained by consortium:
6787 http://unicode.org/charts/PDF/U0250.pdf
6788 IPA keyboard
6789 http://www.rejc2.co.uk/ipakeyboard/
6790
6791 http://en.wikipedia.org/wiki/International_Phonetic_Alphabet_chart_for_English_dialects#cite_ref-r_11-0
6792
6793
6794 Is this discussing KBDNLS_TYPE_TOGGLE on VK_KANA???
6795
6796 http://mychro.mydns.jp/~mychro/mt/2010/05/vk-f.html
6797
6798 Windows: fonts substitution/fallback/replacement
6799
6800 http://msdn.microsoft.com/en-us/goglobal/bb688134
6801
6802 Problems on Windows:
6803
6804 http://en.wikipedia.org/wiki/Help:Special_characters#Alt_keycodes_for_Windows_computers
6805 http://en.wikipedia.org/wiki/Template_talk:Unicode#Plane_One_fonts
6806
6807 Console font: Lucida Console 14 is viewable, but has practically no Unicode support.
6808 Consolas (good at 16) has much better Unicode support (sometimes better sometimes worse than DejaVue)
6809 Dejavue is good at 14 (equal to a GUI font size 9 on 15in 1300px screen; 16px unifont is native at 12 here)
6810 http://cristianadam.blogspot.com/2009/11/windows-console-and-true-type-fonts.html
6811
6812 Apparently, Windows picks up the flavor (Bold/Italic/Etc) of DejaVue at random; see
6813 http://jpsoft.com/forums/threads/strange-results-with-cp-1252.1129/
6814 - he got it in bold. I''m getting it in italic... Workaround: uninstall
6815 all flavors but one (the BOOK flavor), THEN enable it for the console... Then reinstall
6816 (preferably newer versions).
6817
6818 Display (how WikiPedia does it):
6819
6820 http://en.wikipedia.org/wiki/Help:Special_characters#Displaying_special_characters
6821 http://en.wikipedia.org/wiki/Template:Unicode
6822 http://en.wikipedia.org/wiki/Template:Unichar
6823 http://en.wikipedia.org/wiki/User:Ruud_Koot/Unicode_typefaces
6824 In CSS: .IPA, .Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; }
6825 http://web.archive.org/web/20060913000000/http://en.wikipedia.org/wiki/Template:Unicode_fonts
6826
6827 Inspect which font is used by Firefox:
6828
6829 https://addons.mozilla.org/en-US/firefox/addon/fontinfo/
6830
6831 Windows shortcuts:
6832
6833 http://windows.microsoft.com/en-US/windows7/Keyboard-shortcuts
6834 http://www.redgage.com/blogs/pankajugale/all-keyboard-shortcuts--very-useful.html
6835 https://skydrive.live.com/?cid=2ee8d462a8f365a0&id=2EE8D462A8F365A0%21141
6836 http://windows.microsoft.com/en-us/windows-8/new-keyboard-shortcuts
6837
6838 On meaning of Unicode math codepoints
6839
6840 https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
6841 http://milde.users.sourceforge.net/LUCR/Math/unimathsymbols.pdf
6842 http://milde.users.sourceforge.net/LUCR/Math/data/unimathsymbols.txt
6843 http://www.ams.org/STIX/bnb/stix-tbl.ascii-2006-10-20
6844 http://www.ams.org/STIX/bnb/stix-tbl.layout-2006-05-15
6845 http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/unicode-math/unimath-symbols.pdf
6846 http://mirrors.ibiblio.org/CTAN//biblio/biber/documentation/utf8-macro-map.html
6847 http://tex.stackexchange.com/questions/14/how-to-look-up-a-symbol-or-identify-a-math-symbol-or-character
6848 http://unicode.org/Public/math/revision-09/MathClass-9.txt
6849 http://www.w3.org/TR/MathML/
6850 http://www.w3.org/TR/xml-entity-names/
6851 http://www.w3.org/TR/xml-entity-names/bycodes.html
6852
6853 Transliteration (via iconv [it is locale-dependent], example rules for Greek)
6854
6855 http://sourceware.org/bugzilla/show_bug.cgi?id=12031
6856
6857 Monospaced fonts with combining marks (!)
6858
6859 https://bugs.freedesktop.org/show_bug.cgi?id=18614
6860 https://bugs.freedesktop.org/show_bug.cgi?id=26941
6861
6862 Indic ISCII - any hope with it? (This is not representable...:)
6863
6864 http://unicode.org/mail-arch/unicode-ml/y2012-m09/0053.html
6865
6866 (Percieved) problems of Unicode (2001)
6867
6868 http://www.ibm.com/developerworks/library/u-secret.html
6869
6870 On a need to have input methods for unicode
6871
6872 http://unicode.org/mail-arch/unicode-ml/y2012-m07/0226.html
6873
6874 On info on Unicode chars
6875
6876 http://unicode.org/mail-arch/unicode-ml/y2012-m07/0415.html
6877
6878 Zapf dingbats encoding, and other fine points of AdobeGL:
6879
6880 ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/zdingbat.txt
6881 http://web.archive.org/web/20001015040951/http://partners.adobe.com/asn/developer/typeforum/unicodegn.html
6882
6883 Yet another (IMO, silly) way to handle '; fight: ' vs ` ´
6884
6885 http://www.cl.cam.ac.uk/~mgk25/ucs/apostrophe.html
6886
6887 Surrogate characters on IE
6888
6889 HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\Scripts\42
6890 http://winvnkey.sourceforge.net/webhelp/surrogate_fonts.htm
6891 http://msdn.microsoft.com/en-us/library/aa918682.aspx Script IDs
6892
6893 Quoting tchrist:
6894 I<You can snag C<unichars>, C<uniprops>, and C<uninames> from L<http://training.perl.com> if you like.>
6895
6896 Tom's unicode scripts
6897
6898 https://search.cpan.org/~bdfoy/Unicode-Tussle-1.03/lib/Unicode/Tussle.pm
6899
6900 =head2 F<.XCompose>: on docs and examples
6901
6902 Syntax of C<.XCompose> is (partially) documented in
6903
6904 http://www.x.org/archive/current/doc/man/man5/Compose.5.xhtml
6905 http://cgit.freedesktop.org/xorg/lib/libX11/tree/man/Compose.man
6906
6907 # Modifiers are not documented
6908 # (Shift, Alt, Lock, Ctrl with aliases Meta, Caps [Alt/Meta binds Mod1];
6909 # ! means that not mentioned supported modifiers must be off;
6910 # None means that all recognizerd modifiers are off.)
6911
6912 Semantic (e.g., which of keybindings has a preference) is not documented.
6913 Experiments (see below) show that a longer binding wins; if same
6914 length, one which is loaded later wins (as far as they match exactly, both
6915 the keys, and the set of required modifiers and their states).
6916 Note that a given keypress may match several I<essentially different> lists of
6917 modifier; one defined earlier wins.
6918
6919 For example, in
6920
6921 ~Ctrl Shift <a> : "a1"
6922 Shift ~Ctrl <a> <b> : "ab1"
6923 ~Meta Shift <b> : "b1"
6924 ~Ctrl ~Meta Shift <b> <a> : "ba1"
6925 Shift ~Meta <b> : "b2"
6926 Shift ~Meta ~Lock <b> : "b3"
6927
6928 there is no way to trigger the output C<"a1"> (since the next row captures
6929 essentially the same keypress into a longer binding). The only binding which
6930 is explicitly overwritten is one for C<"b1">. Hence pressing
6931 C<Shift-b> would trigger the binding C<"b2">, and there is no way to trigger
6932 the bindings for C<"b3"> and C<"ba1">.
6933
6934 # (the source of imLcPrs.c shows that the expansion of the
6935 # shorter sequence is stored too - but the presence of
6936 # ->succession means that the code to process the resulting
6937 # tree ignores the expansion).
6938
6939 The interaction of C<.Compose> with
6940 L<mandatory processing|http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Transforming_the_KeySym_Associated_with_a_Key_Event>
6941 of passed-through C<Control> and C<Lock> modifiers is not documented.
6942
6943 Before the syntax was documented: For the best approximation,
6944 read the parser's code, e.g., google for
6945
6946 inurl:compose.c XCompose
6947 site:cgit.freedesktop.org "XCompose"
6948 site:cgit.freedesktop.org "XCompose" filetype:c
6949 _XimParseStringFile
6950
6951 http://cgit.freedesktop.org/xorg/lib/libX11/tree/modules/im/ximcp/imLcIm.c
6952 http://cgit.freedesktop.org/xorg/lib/libX11/tree/modules/im/ximcp/imLcPrs.c
6953 http://uim.googlecode.com/svn-history/r6111/trunk/gtk/compose.c
6954 http://uim.googlecode.com/svn/tags/uim-1.5.2/gtk/compose.c
6955
6956 The actual use of the compiled compose table:
6957
6958 http://cgit.freedesktop.org/xorg/lib/libX11/tree/modules/im/ximcp/imLcFlt.c
6959
6960 Apparently, the first node (= defined last) in the tree which
6961 matches keysym and modifiers is chosen. So to override C<< <Foo> <Bar> >>,
6962 looks like (checked to work!) C<< ~Ctrl <Foo> >> may be used...
6963 On the other hand, defining both C<< <Foo> <Bar> <Baz> >> and (later) C<< <Foo> ~Ctrl <Bar> >>,
6964 one would expect that C<< <Foo> <Ctrl-Bar> <Baz> >> should still trigger the
6965 expansion of C<< <Foo> <Bar> <Baz> >> — but it does not... See also:
6966
6967 http://cgit.freedesktop.org/xorg/lib/libX11/tree/modules/im/ximcp/imLcLkup.c
6968
6969 The file F<.XCompose> is processed by X11 I<clients> on startup. The changes
6970 to this file should be seen immediately by all newly started clients
6971 (but GTK or QT applications may need extra config - see below)
6972 unless the directory F<~/.compose-cache> is present and has a cache
6973 file compatible with binary architecture (then until cache
6974 expires - one day after creation - changes are not seen). The
6975 name F<.XCompose> may be overriden by environment variable C<XCOMPOSEFILE>.
6976
6977 To get (better?) examples, google for C<"multi_key" partial alpha "DOUBLE-STRUCK">.
6978
6979 # include these first, so they may be overriden later
6980 include "%H/my-Compose/.XCompose-kragen"
6981 include "%H/my-Compose/.XCompose-ootync"
6982 include "%H/my-Compose/.XCompose-pSub"
6983
6984 Check success: kragen: C<\ space> --> ␣; ootync: C<o F> --> ℉; pSub: C<0 0> --> ∞ ...
6985
6986 Older versions of X11 do not understand %L %S. - but understand %H
6987
6988 E.g. Debian Squeeze 6.0.6; according to
6989
6990 http://packages.debian.org/search?keywords=x11-common
6991
6992 it has C<v 1:7.5+8+squeeze1>).
6993
6994 include "/etc/X11/locale/en_US.UTF-8/Compose"
6995 include "/usr/share/X11/locale/en_US.UTF-8/Compose"
6996
6997 Import default rules from the system Compose file:
6998 usually as above (but supported only on newer systems):
6999
7000 include "%L"
7001
7002 detect the success of the lines above: get C<#> by doing C<Compose + +> ...
7003
7004 The next file to include have been generated by
7005
7006 perl -wlne 'next if /#\s+CIRCLED/; print if />\s+<.*>\s+<.*>\s+<.*/' /usr/share/X11/locale/en_US.UTF-8/Compose
7007 ### Std tables contain quadruple prefix for GREEK VOWELS and CIRCLED stuff
7008 ### only. But there is a lot of triple prefix...
7009 perl -wne 'next if /#\s+CIRCLED/; $s{$1}++ or print qq( $1) if />\s+<.*>\s+<.*>\s+<.*"(.*)"/' /usr/share/X11/locale/en_US.UTF-8/Compose
7010 ## – — ☭ ª º Ǖ ǖ Ǘ ǘ Ǚ ǚ Ǜ ǜ Ǟ ǟ Ǡ ǡ Ǭ ǭ Ǻ ǻ Ǿ ǿ Ȫ ȫ Ȭ ȭ Ȱ ȱ ʰ ʱ ʲ ʳ ʴ ʵ ʶ ʷ ʸ ˠ ˡ ˢ ˣ ˤ ΐ ΰ Ḉ ḉ Ḕ ḕ Ḗ ḗ Ḝ ḝ Ḯ ḯ Ḹ ḹ Ṍ ṍ Ṏ ṏ Ṑ ṑ Ṓ ṓ Ṝ ṝ Ṥ ṥ Ṧ ṧ Ṩ ṩ Ṹ ṹ Ṻ ṻ Ấ ấ Ầ ầ Ẩ ẩ Ẫ ẫ Ậ ậ Ắ ắ Ằ ằ Ẳ ẳ Ẵ ẵ Ặ ặ Ế ế Ề ề Ể ể Ễ ễ Ệ ệ Ố ố Ồ ồ Ổ ổ Ỗ ỗ Ộ ộ Ớ ớ Ờ ờ Ở ở Ỡ ỡ Ợ ợ Ứ ứ Ừ ừ Ử ử Ữ ữ Ự ự ἂ ἃ ἄ ἅ ἆ ἇ Ἂ Ἃ Ἄ Ἅ Ἆ Ἇ ἒ ἓ ἔ ἕ Ἒ Ἓ Ἔ Ἕ ἢ ἣ ἤ ἥ ἦ ἧ Ἢ Ἣ Ἤ Ἥ Ἦ Ἧ ἲ ἳ ἴ ἵ ἶ ἷ Ἲ Ἳ Ἴ Ἵ Ἶ Ἷ ὂ ὃ ὄ ὅ Ὂ Ὃ Ὄ Ὅ ὒ ὓ ὔ ὕ ὖ ὗ Ὓ Ὕ Ὗ ὢ ὣ ὤ ὥ ὦ ὧ Ὢ Ὣ Ὤ Ὥ Ὦ Ὧ ᾀ ᾁ ᾂ ᾃ ᾄ ᾅ ᾆ ᾇ ᾈ ᾉ ᾊ ᾋ ᾌ ᾍ ᾎ ᾏ ᾐ ᾑ ᾒ ᾓ ᾔ ᾕ ᾖ ᾗ ᾘ ᾙ ᾚ ᾛ ᾜ ᾝ ᾞ ᾟ ᾠ ᾡ ᾢ ᾣ ᾤ ᾥ ᾦ ᾧ ᾨ ᾩ ᾪ ᾫ ᾬ ᾭ ᾮ ᾯ ᾲ ᾴ ᾷ ῂ ῄ ῇ ῒ ῗ ῢ ῧ ῲ ῴ ῷ ⁱ ⁿ ℠ ™ שּׁ שּׂ а̏ А̏ е̏ Е̏ и̏ И̏ о̏ О̏ у̏ У̏ р̏ Р̏ 🙌
7011
7012 The following exerpt from NEO compose tables may be good if you use
7013 keyboards which do not generate dead keys, but may generate Cyrillic keys;
7014 in other situations, edit filtering/naming on the following download
7015 command and on the C<include> line below. (For my taste, most bindings are
7016 useless since they contain keysymbols which may be generated with NEO, but
7017 not with less intimidating keylayouts.)
7018
7019 (Filtering may be important, since having a large file may
7020 significantly slow down client's startup (without F<~/.compose-cache>???).)
7021
7022 # perl -wle 'foreach (qw(base cyrillic greek lang math)) {my @i=@ARGV; $i[-1] .= qq($_.module?format=txt); system @i}' wget -O - http://wiki.neo-layout.org/browser/Compose/src/ | perl -wlne 'print unless /<(U[\dA-F]{4,6}>|dead_|Greek_)/' > .XCompose-neo-no-Udigits-no-dead-no-Greek
7023 include "%H/.XCompose-neo-no-Udigits-no-dead-no-Greek"
7024 # detect the success of the line above: get ♫ by doing Compose Compose (but this binding is overwritten later!)
7025
7026 ###################################### Neo's Math contains junk at line 312
7027
7028 Print with something like (loading in a web browser after this):
7029
7030 perl -l examples/filter-XCompose ~/.XCompose-neo-no-Udigits-no-dead-no-Greek > ! o-neo
7031 env LC_ALL=C sort -f o-neo | column -x -c 130 > ! /tmp/oo-neo-x
7032
7033 =head2 “Systematic” parts of rules in a few F<.XCompose>
7034
7035 ================== .XCompose b=bepo o=ootync k=kragen p=pSub s=std
7036 b Double-Struck b
7037 o circled ops b
7038 O big circled ops b
7039 r rotated b 8ACETUv ∞
7040
7041 - sub p
7042 = double arrows po
7043 g greek po
7044 m math p |=Double-Struck rest haphasard...
7045 O circles p Oo
7046 S stars p Ss
7047 ^ sup p added: i -
7048 | daggers p
7049
7050 Double mathop ok +*&|%8CNPQRZ AE
7051
7052 # thick-black arrows o
7053 -,Num- arrows o
7054 N/N fractions o
7055 hH pointing hands o
7056 O circled ops o
7057 o degree o
7058 rR roman nums o
7059 \ UP upper modifiers o
7060 \ DN lower modifiers o
7061 { set theoretic o
7062 | arrows |-->flavors o
7063 UP / roots o
7064 LFT DN 6-quotes, bold delim o
7065 RT DN 9-quotes, bold delim o
7066 UP,DN super,sub o
7067
7068 DOUBLE-separated-by-& op k ( )
7069 in-() circled k xx for tensor
7070 in-[] boxed, dice, play-cards k
7071 BKSP after revert k
7072 < after revert k
7073 ` after small-caps k
7074 ' after hook k
7075 , after hook below k
7076 h after phonetic k
7077
7078 # musical k
7079 %0 ROMAN k %_0 for two-digit
7080 % roman k %_ for two-digit
7081 * stars k
7082 *. var-greek k
7083 * greek k
7084 ++, 3 triple k
7085 + double k
7086 , quotes k
7087 !, / negate k
7088 6,9 6,9-quotes k
7089 N N fractions k
7090 = double-arrows, RET k
7091 CMP x2 long names k
7092 f hand, pencils k
7093 \ combining??? k
7094 ^ super, up modifier k
7095 _ low modifiers k
7096 |B, |W chess, checkers, B&W k
7097 | double-struck k
7098 ARROWS ARROWS k
7099
7100 ! dot below s
7101 " diaeresis s
7102 ' acute s
7103 trail < left delimiter s
7104 trail > right delimiter s
7105 trail \ slanted variant s
7106 ( ... ) circled s
7107 ( greek aspirations s
7108 ) greek aspirations s
7109 + horn s
7110 , cedilla s
7111 . dot above s
7112 - hor. bar s
7113 / diag, vert hor. bar s
7114 ; ogonek s
7115 = double hor.bar, ₤₦€¥≠ s
7116 trail = double hor.bar s
7117 ? hook above s
7118 b breve s
7119 c check above s
7120 iota iota below s
7121 trail 0338 negated s
7122 o ring above s
7123 U breve s
7124 SOME HEBREW
7125 ^ circumflex s
7126 ^ _ superscript s
7127 ^ undbr superscript s
7128 _ bar s
7129 _ subscript s
7130 underbr subscript s
7131 ` grave s
7132 ~ greek dieresis s
7133 ~ tilde s
7134 overbar bar s
7135 ´ acute s ´ is not '
7136 ¸ cedilla s ¸ is cedilla
7137
7138 =head1 LIMITATIONS
7139
7140 For the keyboards with non-US mapping of hardware keys to "the etched
7141 symbols", one should use the C<VK> section to describe the mapping of the
7142 C<VK_>-codes to scancodes. (Recall that on German physical keyboards the Y/Z keycaps
7143 are swapped: Z is etched between T and U, and Y is to the left of X. French
7144 keyboards swap A and Q as well as W and Z. Moreover, French or Russian physical
7145 keyboards have more alphabetical keys than 26.)
7146
7147 While the architecture of assembling a keyboard of small easy-to-describe
7148 pieces is (IMO) elegant and very powerful, and is proven to be useful, it
7149 still looks like a collection of independent hacks. Many of these hacks
7150 look quite similar; it would be great to find a way to unify them, so
7151 reduce the repertoir of operations for assembly.
7152
7153 The current documentation of the module’s functionality is not fully complete.
7154
7155 The implementation of the module is crumbling under its weight. Its
7156 evolution was by bloating (even when some design features were simplified).
7157 Since initially I had very little clue to which level of abstraction and
7158 flexibility the keyboard description would evolve, bloating accumulated
7159 to incredible amounts.
7160
7161 =head1 COPYRIGHT
7162
7163 Copyright (c) 2011-2024 Ilya Zakharevich <ilyaz@cpan.org>
7164
7165 This library is free software; you can redistribute it and/or modify
7166 it under the same terms as Perl itself, either Perl version 5.8.0 or,
7167 at your option, any later version of Perl 5 you may have available.
7168
7169 The distributed examples may have their own copyrights.
7170
7171 =head1 TODO
7172
7173 The content of this section is most probably completely obsolete. The newer list is in the
7174 L<dedicated TODO file|https://metacpan.org/dist/UI-KeyboardLayout/source/TODO>. We mark obvious GOTCHAS which are NOTFIX by OK.
7175
7176 “UniPolyK-MultiSymple”
7177
7178 “designated Primary- and Secondary- switch keys” (as Shift-Space and AltGr-Space now).
7179
7180 OK: C<Soft hyphen> as a deadkey may be not a good idea: following it by a special key
7181 (such as C<Shift-Tab>, or C<Control-Enter>) may insert the deadkey character???
7182 Hence the character should be highly visible... (Now the key is invisible,
7183 so this is irrelevant for characters from the main layer...)
7184
7185 Currently linked layers must have exactly the same number of keys in VK-tables.
7186
7187 VK tables for TAB, BACK were BS. Same (remains) for the rest of unusual keys... (See TAB-was.)
7188 But UTOOL cannot handle them anyway... (We do not generate them now…)
7189
7190 Define an extra element in VK keys: linkable. Should be sorted first in the kbd map,
7191 and there should be the same number in linked lists. Non-linkable keys should not
7192 be linked together by deadkey access...
7193
7194 OK: Interaction of FromToFlipShift with SelectRX not intuitive. This works: Diacritic[<sub>](SelectRX[[0-9]](FlipShift(Face(Latin))))
7195
7196 OK: FlipShift is not reliable without an explicit argument (when used with multiple-personalities??? Since accesses a possibly scant
7197 non-Full face???)
7198
7199 DefinedTo cannot be put on Cyrillic 3a9 (yo to superscript disappears - due to duplication???).
7200
7201 ... so we do it differently now, but: LinkLayer was not aggressively resolving all the occurences of a character on a layer
7202 before we started to combine it with Diacritic_if_undef... - and Cyrillic 3a9 is not helped...
7203
7204 via_parent() is broken - cannot replace for Diacritic_if_undef.
7205
7206 Currently, we map ephigraphic letters to capital letters - is it intuitive???
7207
7208 DeadKey_Map200A= FlipLayers
7209 #DeadKey_Map200A_0= Id(Russian-AltGr)
7210 #DeadKey_Map200A_1= Id(Russian)
7211 performs differently from the commented variant: it adds links to auto-filled keys...
7212
7213 Why ¨ on THIN SPACE inserts OGONEK after making ¨ multifaceted???
7214
7215 When splitting a name on OVER/BELOW/ABOVE, we need both sides as modifiers???
7216
7217 OK: Ỳ currently unreachable via AltGr (appears only in Latin-8 Celtic, is not on Wikipedia)
7218
7219 We decompose reversed-smallcaps in one step - probably better add yet another two-steps variant...
7220
7221 We do not do canonical-merging of diacritics; so one needs to specify VARIA in addition to GRAVE ACCENT.
7222
7223 OK: Inspector tool for NamesList.txt:
7224
7225 grep " WITH .* " ! | grep -E -v "(ACUTE|GRAVE|ABOVE|BELOW|TILDE|DIAERESIS|DOT|HOOK|LEG|MACRON|BREVE|CARON|STROKE|TAIL|TONOS|BAR|DOTS|ACCENT|HALF RING|VARIA|OXIA|PERISPOMENI|YPOGEGRAMMENI|PROSGEGRAMMENI|OVERLAY|(TIP|BARB|CORNER) ([A-Z]+WARDS|UP|DOWN|RIGHT|LEFT))$" | grep -E -v "((ISOLATED|MEDIAL|FINAL|INITIAL) FORM|SIGN|SYMBOL)$" |less
7226 grep " WITH " ! | grep -E -v "(ACUTE|GRAVE|ABOVE|BELOW|TILDE|DIAERESIS|CIRCUMFLEX|CEDILLA|OGONEK|DOT|HOOK|LEG|MACRON|BREVE|CARON|STROKE|TAIL|TONOS|BAR|CURL|BELT|HORN|DOTS|LOOP|ACCENT|RING|TICK|HALF RING|COMMA|FLOURISH|TITLO|UPTURN|DESCENDER|VRACHY|QUILL|BASE|ARC|CHECK|STRIKETHROUGH|NOTCH|CIRCLE|VARIA|OXIA|PSILI|DASIA|DIALYTIKA|PERISPOMENI|YPOGEGRAMMENI|PROSGEGRAMMENI|OVERLAY|(TIP|BARB|CORNER) ([A-Z]+WARDS|UP|DOWN|RIGHT|LEFT))$" | grep -E -v "((ISOLATED|MEDIAL|FINAL|INITIAL) FORM|SIGN|SYMBOL)$" |less
7227
7228 AltGrMap should be made CapsLock aware (impossible: smart capslock works only on the first layer, so
7229 the dead char must be on the first layer). [May work for Shift-Space - but it has a bag of problems...]
7230
7231 Alas, CapsLock'ing a composition cannot be made stepwise. Hence one must calculate it directly.
7232 (Oups, Windows CapsLock is not configurable on AltGr-layer. One may need to convert
7233 it to VK_KANA???)
7234
7235 WarnConflicts[exceptions] and NoConflicts translation map parsing rules.
7236
7237 Need a way to map to a different face, not a different layer.
7238
7239 Vietnamese: to put second accent over ă, ơ (o/horn), put them “over the C<AltGr> forms æ/œ”; - including
7240 another ˘ which would "cancel the implied one", so will get o-horn itself. - Except
7241 for acute accent which should replaced by ¨, and hook must be replaced by ˆ. (Over æ/œ
7242 there is only macron ǣ and acute ǽ over æ — although there are turned-œ with bar and stroke ꭁ and ꭂ.)
7243
7244 (Vietnamese input in described in L<F<Changes>|https://metacpan.org/dist/UI-KeyboardLayout/source/Changes#L635>; see the part for
7245 C<v0.09>.)
7246
7247 Or: for the purpose of taking a second accent, AltGr-A behaves as Ă (or Â?), AltGr-O
7248 behaves as Ô (or O-horn Ơ?). Then Å and O/ behave as the other one... And ˚ puts the
7249 dot *below*, macron puts a hook. Exception: ¨ acts as ´ on the unaltered AE.
7250
7251 While Å takes acute accent, one can always input it via putting ˚ on Á.
7252
7253 If Ê is on the keyboard (and macron puts a hook), then the only problem is how to enter
7254 a hook alone (double circumflex is not precombined), dot below (???), and accents on u-horn ư.
7255
7256 Mogrification rules for double accents: AE Å OE O/ Ù mogrify into hatted/horned versions; macron
7257 mogrifies into a hook; second hat modifies a hat into a horn. The only problem: one won't be
7258 able to enter double grave on U - use the OTHER combination of ¨ and `... And how to enter
7259 dot below on non-accented aue? Put ¨ on umlaut? What about Ë?
7260
7261 To allow . or , on VK_DECIMAL: maybe make CapsLock-dependent?
7262
7263 http://blogs.msdn.com/b/michkap/archive/2006/09/13/752377.aspx
7264
7265 How to write this diacritic recipe: insert hacheck on AltGr-variant, but only if
7266 the breve on the base layer variant does not insert hacheck (so inserts breve)???
7267
7268 Sorting diacritics by usefulness: we want to apply one of accents from the
7269 given list to a given key (with l layers of 2 shift states). For each accent,
7270 we have 2l possible variants for composition; assign to 2 variants differing
7271 by Shift the minimum penalty of the two. For each layer we get several possible
7272 combinations of different priority; and for each layer, we have a certain number
7273 of slots open. We can redistribute combinations from the primary layer to
7274 secondary one, but not between secondary layers.
7275
7276 Work with slots one-by-one (so that the assignent is "monotinic" when the number
7277 of slots increases). Let m be the number of layers where slots are present.
7278 Take highest priority combinations; if the number of "extra" combinations
7279 in the primary layer is at least m, distribute the first m of them to
7280 secondary layers. If n<m of them are present, fill k layers which
7281 have no their own combinations first, then other n-k layers. More precisely,
7282 if n<=k, use the first n of "free" layers; if n>k, fill all free layers, then
7283 the last n-k of non-free layers.
7284
7285 Repeat as needed (on each step, at most one slot in each layer appears).
7286
7287 But we do not need to separate case-differing keys! How to fix?
7288
7289 All done, but this works only on the current face! To fix, need to pass
7290 to the translator all the face-characters present on the given key simultaneously.
7291
7292 ===== Accent-key TAB accesses extra bindinges (including NUM->numbered one)
7293 (may be problematic with some applications???
7294 -- so duplicate it on + and @ if they is not occupied
7295 -- there is nothing related to AT in Unicode)
7296
7297 Diacritics_0218_0b56_0c34= May create such a thing...
7298 (0b56_0c34 invisible to the user).
7299
7300 Hmm - how to combine penaltized keys with reversion? It looks like
7301 the higher priority bindings would occupy the hottest slots in both
7302 direct and reverse bindings...
7303
7304 Maybe additional forms Diacrtitics2S_* and Diacrtitics2E_* which fight
7305 for symbols of the same penalty from start and from end (with S winning
7306 on stuff exactly in the middle...). (The E-form would also strip the last |-group.)
7307
7308 ' Shift-Space (from US face) should access the second level of Russian face.
7309 To avoid infinite cycles, face-switch keys to non-private faces should be
7310 marked in each face...
7311
7312 "Acute makes sharper" is applicable to () too to get <>-parens... But now they are on Green — maybe can replace???
7313
7314 Another ways of combining: "OR EQUAL TO", "OR EQUIVALENT TO", "APL FUNCTIONAL
7315 SYMBOL QUAD", "APL FUNCTIONAL SYMBOL *** UNDERBAR", "APL FUNCTIONAL SYMBOL *** DIAERESIS".
7316
7317 When recognizing symbols for GREEK, treat LUNATE (as NOP). Try adding HEBREW LETTER at start as well...
7318
7319 Compare with: 8 basic accents: http://en.wikipedia.org/wiki/African_reference_alphabet (English 78)
7320
7321 When a diacritic on a base letter expands to several variants, use them all
7322 (with penalty according to the flags).
7323
7324 Problem: acute on acute makes double acute modifier...
7325
7326
7327 ╼†━†╾†╺†╸†╶†─†╴†╌†┄†┈† †╍†┅†┉†
7328 ╼━╾╺╸╶─╴╌┄┈ ╍┅┉
7329 ╻
7330 ┃
7331 ╹
7332 ╷
7333 │
7334 ╵
7335
7336 ╽
7337 ╿
7338 ╎┆┊╏┇┋
7339
7340
7341
7342 =head2 Implementation details: C<FullFace(FNAME)>
7343
7344 Since the C<FullFace(FNAME)> accessor may have different effects at different moment of
7345 a face C<FNAME> synthesis, here is the order in which C<FullFace(FNAME)> changes (we also
7346 mention how to access the results from these steps from Perl code):
7347
7348 ini_layers: essentially, contains what is given in the key “layers” of the face recipe
7349 Later, a version of these layers with exportable keys marked is created as ini_layers_prefix.
7350 ini_filled_layers: adds extra (fake) keys containing control characters and created via-VK-keys
7351 (For these extended layers, the previous version can be inspected via ini_copy1.)
7352 (created when exportable keys are handled.)
7353
7354 The next modification is done not by modifying the list of names of layers
7355 associated to the face, but by editing the corresponding layers in place.
7356 (The unmodified version of layer, one containing the exportable keys, is
7357 accessible via C<ini_copy>.) On this step one adds the missing characters
7358 from the face specified in the C<LinkFace> key.
7359
7360 =cut
7361
7362 # '
7363 1 my (%Globals, $DEBUG);
7364
7365 0 ▶sub set__value ($$$) {
Subroutine set__value: not called CC=2 SCAR=17.9
Pod undocumented
7366 0 my($class, $key) = (shift, shift);
7367 0 ▶ (ref $class ? $class->{$key} : $Globals{$key}) = shift;
Branch: 1 branch
BranchTrueFalseTotal
ref $class ? : 0 0 0
7368 }
7369 0 ▶sub get__value ($$) {
Subroutine get__value: not called CC=3 SCAR=24.8
Pod undocumented
7370 0 my($class, $key) = (shift, shift);
7371 0 ▶ if (ref $class and defined(my $v = $class->{$key})) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $class and defined(my $v = $class->{$key})) { } 0 0 0
Condition0%0/3
ref $class and defined(my $v = $class->{$key})
!ll&&!rl&&r
000
MC/DC0%0/2
ref $class and defined(my $v = $class->{$key})
ref $class defined(my $v = $class->{$key})
Truth table0%0/3
A and B
A= ref $classB= defined(my $v = $class->{$key})
ABresult
0X0
100
111
7372 0 $v;
7373 } else {
7374 0 $Globals{$key};
7375 }
7376 }
7377 0 ▶sub set_NamesList ($$;$) {
Subroutine set_NamesList: not called CC=1 SCAR=6.9
Pod undocumented
7378 0 my $class = shift;
7379 0 set__value($class, 'NamesList', shift);
7380 0 set__value($class, 'AgeList', shift);
7381 }
7382 0 ▶sub get_NamesList ($) { get__value(shift, 'NamesList') }
Subroutine get_NamesList: not called CC=1 SCAR=6.9
Pod undocumented
7383 0 ▶sub get_AgeList ($) { get__value(shift, 'AgeList') }
Subroutine get_AgeList: not called CC=1 SCAR=6.9
Pod undocumented
7384
7385 0 ▶sub new ($;$) {
Subroutine new: not called CC=4 SCAR=30.0
Pod undocumented
7386 0 my $class = shift;
7387 0 ▶ die "too many arguments to UI::KeyboardLayout->new" if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 0 0
7388 0 ▶ my $data = @_ ? {%{shift()}} : {};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
7389 0 ▶ bless $data, (ref $class or $class);
Condition0%0/3
ref $class || $class
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table0%0/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
7390 }
7391
7392 0 ▶sub put_deep($$$$@) {
Subroutine put_deep: not called CC=3 SCAR=24.8
Pod undocumented
7393 0 my($self, $hash, $v, $k) = (shift, shift, shift, shift);
7394 0 ▶ return $self->put_deep($hash->{$k} ||= {}, $v, @_) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
Condition0%0/2
$hash->{$k} ||= {}
l!l
00
MC/DC0%0/1
$hash->{$k} ||= {}
$hash->{$k}
Truth table0%0/2
A
A= $hash->{$k}
Aresult
11
00
7395 0 $hash->{$k} = $v;
7396 }
7397
7398 # Sections [foo/bar] [visual -> foo/bar]; directives foo=bar or @foo=bar,baz
7399 # actually: parses configfile string, not file
7400 0 ▶sub parse_configfile ($$) { # Trailing whitespace is ignored, whitespace about "=" is not
Subroutine parse_configfile: not called CC=1 SCAR=6.9
Pod undocumented
7401 0 my ($self, $s) = (shift, shift);
7402 0 $self->parse_add_configstring($s, {});
7403 }
7404
7405 0 ▶sub parse_add_configstring ($$$) { # Trailing whitespace is ignored, whitespace about "=" is not
Subroutine parse_add_configstring: not called CC=16 SCAR=56.1
Pod undocumented
7406 0 my ($self, $s, $vv, @KEYS) = (shift, shift, shift);
7407 0 $s =~ s/[^\S\n]+$//gm;
7408 0 $s =~ s/^\x{FEFF}//; # BOM are not stripped by Perl from UTF-8 files with -C31
7409 0 (my $pre, my %f) = split m(^\[((?:visual\s*->\s*)?[\w/]*)\]\s*$ \n?)mx, $s; # //x is needed to avoid $\
7410 0 ▶ warn "Part before the first section in configfile ignored: `$pre'" if length $pre;
Branch: 1 branch
BranchTrueFalseTotal
if length $pre 0 0 0
7411 0 for my $k (sort keys %f) {
7412 # warn "Section `$k'";
7413 0 my($v, $V, @V) = $f{$k};
7414 0 ▶ if ($k =~ s{^visual\s*->\s*}{[unparsed]/}) { # Make sure that prefixes do not allow visual line to be confused with a config
Branch: 1 branch
BranchTrueFalseTotal
if ($k =~ s[^visual\s*->\s*][[unparsed]/]) 0 0 0
7415 0 $v =~ s[(^(?!#|[/\@+]?\w+=).*)]//ms; # find non-comment non-assignment
7416 0 @V = "unparsed_data=$1";
7417 }
7418 # warn "xxx: @V";
7419 0 push @KEYS, $k;
7420 0 my @k = split m(/), $k;
7421 0 ▶ @k = () if "@k" eq ''; # root
Branch: 1 branch
BranchTrueFalseTotal
if join($", @k) eq "" 0 0 0
7422 0 for my $l ((grep !/^#/, split(/\n/, $v)), @V) {
7423 0 ▶ die "unrecognized config file line: `$l' in `$s'"
Branch: 1 branch
BranchTrueFalseTotal
unless () = $l =~ m[^((?:(\@)|(/)|\+)?)(\w+)=(.*)]s 0 0 0
7424 unless my($arr, $at, $slash, $kk, $vvv) = ($l =~ m[^((?:(\@)|(/)|\+)?)(\w+)=(.*)]s);
7425 0 ▶ my $spl = $at ? qr/,/ : ( $slash ? qr[/] : qr[(?!)] );
Branch: 2 branches
BranchTrueFalseTotal
$at ? : 0 0 0
$slash ? : 0 0 0
7426 0 ▶ $vvv = [ length $vvv ? (split $spl, $vvv, -1) : $vvv ] if $arr; # create empty element if $vvv is empty
Branch: 2 branches
BranchTrueFalseTotal
if $arr 0 0 0
length $vvv ? : 0 0 0
7427 0 my $slot = $self->get_deep($vv, @k);
7428 0 ▶ if ($slot and exists $slot->{$kk}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($slot and exists $slot->{$kk}) 0 0 0
Condition0%0/3
$slot and exists $slot->{$kk}
!ll&&!rl&&r
000
MC/DC0%0/2
$slot and exists $slot->{$kk}
$slot exists $slot->{$kk}
Truth table0%0/3
A and B
A= $slotB= exists $slot->{$kk}
ABresult
0X0
100
111
7429 0 ▶ if ($arr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arr) { } 0 0 0
7430 0 ▶ if (ref($slot->{$kk} || 0) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($slot->{$kk} || 0) eq 'ARRAY') { } 0 0 0
Condition0%0/2
$slot->{$kk} || 0
l!l
00
MC/DC0%0/1
$slot->{$kk} || 0
$slot->{$kk}
Truth table0%0/2
A
A= $slot->{$kk}
Aresult
11
00
7431 0 $vvv = [@{$slot->{$kk}}, @$vvv];
7432 } else {
7433 0 warn "Redefinition of non-array entry `$kk' in `$k' by array one, old value ignored"
7434 }
7435 } else {
7436 0 warn "Redefinition of entry `$kk' in `$k', old value ignored"
7437 }
7438 }
7439 # warn "Putting to the root->@k->`$kk'";
7440 0 $self->put_deep($vv, $vvv, @k, $kk);
7441 }
7442 }
7443 0 $vv->{'[keys]'} = \@KEYS;
7444 # warn "config parsed";
7445 0 $vv
7446 }
7447
7448 0 ▶sub merge_configstrings ($$@) { # Trailing whitespace is ignored, whitespace about "=" is not
Subroutine merge_configstrings: not called CC=2 SCAR=17.9
Pod undocumented
7449 0 my ($self, $overwrite) = (shift, shift);
7450 0 for my $s (@_) {
7451 0 my $data = {};
7452 0 $self->parse_add_configstring($s, $data); # consolidate arrays into $data
7453 0 $self->merge_hash($data, $self, $overwrite);
7454 }
7455 $self
7456 0 }
7457
7458 0 ▶sub merge_confighash ($$@) { # Trailing whitespace is ignored, whitespace about "=" is not
Subroutine merge_confighash: not called CC=2 SCAR=17.9
Pod undocumented
7459 0 my ($self, $overwrite) = (shift, shift);
7460 0 for my $data (@_) {
7461 0 $self->merge_hash($data, $self, $overwrite);
7462 }
7463 $self
7464 0 }
7465
7466 0 ▶sub merge_hash ($$$$) {
Subroutine merge_hash: not called CC=8 SCAR=42.8
Pod undocumented
7467 0 my ($self, $from, $to, $overwrite) = (shift, shift, shift, shift);
7468 0 for my $k (keys %$from) {
7469 0 ▶ my $old = (exists $to->{k} ? ref($to->{k}) : '-');
Branch: 1 branch
BranchTrueFalseTotal
exists $to->{'k'} ? : 0 0 0
7470 0 ▶ if ($old eq 'HASH') {
Branch: 3 branches
BranchTrueFalseTotal
if ($old eq 'HASH') { } 0 0 0
elsif ($old ne '-' and not $overwrite) { } 0 0 0
elsif (ref $from->{$k} eq 'HASH') { } 0 0 0
7471 0 ▶ die "Merging non-HASH subentry into a HASH" unless 'HASH' eq ref($from->{$k});
Branch: 1 branch
BranchTrueFalseTotal
unless "HASH" eq ref $from->{$k} 0 0 0
7472 0 $self->merge_hash($from->{$k}, $to->{$k}, $overwrite);
7473 ▶ } elsif ($old ne '-' and not $overwrite) { # Do nothing
Condition0%0/3
$old ne "-" and not $overwrite
!ll&&!rl&&r
000
MC/DC0%0/2
$old ne "-" and not $overwrite
$old ne "-" not $overwrite
Truth table0%0/3
A and not(B)
A= $old ne "-"B= not $overwrite
ABresult
0X0
100
111
7474 } elsif (ref $from->{$k} eq 'HASH') {
7475 0 die "Merging HASH subentry into a non-HASH";
7476 } else {
7477 0 $to->{$k} = $from->{$k};
7478 }
7479 }
7480 $self
7481 0 }
7482
7483
7484 0 ▶sub process_key_chunk ($$$$$) {
Subroutine process_key_chunk: not called CC=18 SCAR=58.3
Pod undocumented
7485 0 my $self = shift;
7486 0 my $name = shift;
7487 0 my $skip_first = shift;
7488 0 (my $k = shift) =~ s/\p{Blank}(?=\p{NonspacingMark})//g; # Allow combining marks to be on top of SPACE
7489 0 my $sep2 = shift;
7490 0 $k = $self->stringHEX2string($k);
7491 0 my @k = split //, $k;
7492 0 ▶ if (defined $sep2 and 3 <= @k and $k =~ /$sep2/) { # Allow separation by $sep2, but only if too long
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sep2 and 3 <= @k and $k =~ /$sep2/) 0 0 0
Condition0%0/6
defined $sep2 and 3 <= @k and $k =~ /$sep2/
!ll&&!rl&&r
000
defined $sep2 and 3 <= @k
!ll&&!rl&&r
000
MC/DC0%0/3
defined $sep2 and 3 <= @k and $k =~ /$sep2/
defined $sep2 3 <= @k $k =~ /$sep2/
Truth table0%0/4
A and B and C
A= defined $sep2B= 3 <= @kC= $k =~ /$sep2/
ABCresult
0XX0
10X0
1100
1111
7493 0 @k = split /$sep2/, $k;
7494 0 ▶ shift @k if not length $k[0] and @k == 2;
Branch: 1 branch
BranchTrueFalseTotal
if not length $k[0] and @k == 2 0 0 0
Condition0%0/3
not length $k[0] and @k == 2
!ll&&!rl&&r
000
MC/DC0%0/2
not length $k[0] and @k == 2
not length $k[0] @k == 2
Truth table0%0/3
not(A) and B
A= not length $k[0]B= @k == 2
ABresult
0X0
100
111
7495 0 ▶ warn "Zero length expansion in the key slot <$k>\n" if not @k or grep !length, @k;
Branch: 1 branch
BranchTrueFalseTotal
if not @k or grep((!length($_)), @k) 0 0 0
Condition0%0/3
not @k or grep((!length($_)), @k)
l!l&&r!l&&!r
000
MC/DC0%0/2
not @k or grep((!length($_)), @k)
not @k grep((!length($_)), @k)
Truth table0%0/3
not(A) or B
A= not @kB= grep((!length($_)), @k)
ABresult
1X1
011
000
7496 }
7497 0 ▶ undef $k[0] if ($k[0] || '') eq "\0" and $skip_first;
Branch: 1 branch
BranchTrueFalseTotal
if ($k[0] || "") eq "\0" and $skip_first 0 0 0
Condition0%0/5
($k[0] || "") eq "\0" and $skip_first
!ll&&!rl&&r
000
$k[0] || ''
l!l
00
MC/DC0%0/2
($k[0] || "") eq "\0" and $skip_first
$k[0] $skip_first
Truth table0%0/3
A and B
A= $k[0]B= $skip_first
ABresult
0X0
100
111
7498 0 ▶ push @k, ucfirst $k[0] if @k == 1 and defined $k[0] and 1==length $k[0] and $k[0] ne ucfirst $k[0];
Branch: 1 branch
BranchTrueFalseTotal
if @k == 1 and defined $k[0] and 1 == length $k[0] and $k[0] ne &UI::KeyboardLayout::ucfirst($k[0]) 0 0 0
Condition0%0/9
@k == 1 and defined $k[0] and 1 == length $k[0] and $k[0] ne &UI::KeyboardLayout::ucfirst($k[0])
!ll&&!rl&&r
000
@k == 1 and defined $k[0] and 1 == length $k[0]
!ll&&!rl&&r
000
@k == 1 and defined $k[0]
!ll&&!rl&&r
000
MC/DC0%0/4
@k == 1 and defined $k[0] and 1 == length $k[0] and $k[0] ne &UI::KeyboardLayout::ucfirst($k[0])
@k == 1 defined $k[0] 1 == length $k[0] $k[0] ne &UI::KeyboardLayout::ucfirst($k[0])
Truth table0%0/5
A and B and C and D
A= @k == 1B= defined $k[0]C= 1 == length $k[0]D= $k[0] ne &UI::KeyboardLayout::ucfirst($k[0])
ABCDresult
0XXX0
10XX0
110X0
11100
11111
7499 0 ▶ $name = "VisLr=$name" if $name;
Branch: 1 branch
BranchTrueFalseTotal
if $name 0 0 0
7500 # warn "Multi-char key in <<@k>>" if grep $_ && 1<length, @k;
7501 0 ▶ warn "More that 2 Shift-states in <<@k>>" if @k > 2;
Branch: 1 branch
BranchTrueFalseTotal
if @k > 2 0 0 0
7502 #warn "Sep2 in $name, $skip_first, <$k> ==> <@k>\n" if defined $sep2 and $k =~ /$sep2/;
7503 0 ▶ map {defined() ? [$_, undef, undef, $name] : $_} @k;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
7504 # @k
7505 } # -> list of chars
7506
7507 0 ▶sub process_key ($$$$$$;$) { # $sep may appear only in a beginning of the first key chunk
Subroutine process_key: not called CC=7 SCAR=40.3
Pod undocumented
7508 0 my ($self, $k, $limit, $sep, $ln, $l_off, $sep2, @tr) = (shift, shift, shift, shift, shift, shift, shift);
7509 0 my @k = split m((?!^)\Q$sep), $k;
7510 0 ▶ die "Key descriptor `$k' separated by `$sep' has too many parts: expected $limit, got ", scalar @k
Branch: 1 branch
BranchTrueFalseTotal
if @k > $limit 0 0 0
7511 if @k > $limit;
7512 0 ▶ defined $k[$_] and $k[$_] =~ s/^--(?=.)/\0/ and $tr[$_]++ for 0..$#k;
Branch: 1 branch
BranchTrueFalseTotal
defined $k[$_] and $k[$_] =~ s/^--(?=.)/\000/ and ++$tr[$_] 0 0 0
Condition0%0/3
defined $k[$_] and $k[$_] =~ s/^--(?=.)/\000/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $k[$_] and $k[$_] =~ s/^--(?=.)/\000/
defined $k[$_] $k[$_] =~ s/^--(?=.)/\000/
Truth table0%0/3
A and B
A= defined $k[$_]B= $k[$_] =~ s/^--(?=.)/\000/
ABresult
0X0
100
111
7513 0 ▶ $k[0] = '' if $k[0] eq '--'; # Allow a filler (multi)-chunk
Branch: 1 branch
BranchTrueFalseTotal
if $k[0] eq "--" 0 0 0
7514 0 ▶ map [$self->process_key_chunk( $ln->[$l_off+$_], $tr[$_], (defined($k[$_]) ? $k[$_] : ''), $sep2)], 0..$#k;
Branch: 1 branch
BranchTrueFalseTotal
defined $k[$_] ? : 0 0 0
7515 } # -> list of arrays of chars
7516
7517 0 ▶sub decode_kbd_layers ($@) {
Subroutine decode_kbd_layers: not called CC=27 SCAR=66.3
Pod undocumented
7518 0 my ($self, $lineN, $row, $line_in_row, $cur_layer, @out, $N, $l0) = (shift, 0, -1);
7519 0 my %needed = qw(unparsed_data x visual_rowcount 2 visual_per_row_counts [2;2] visual_prefixes * prefix_repeat 3 in_key_separator / layer_names ???);
7520 0 my %extra = (qw(keyline_offsets 1 in_key_separator2), undef);
7521 0 my $opt;
7522 0 for my $k (keys %needed, keys %extra) {
7523 0 ▶ my ($from) = grep exists $_->{$k}, @_, (ref $self ? $self : ());
Branch: 1 branch
BranchTrueFalseTotal
ref $self ? : 0 0 0
7524 0 ▶ die "option `$k' not specified" unless $from or exists $extra{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless $from or exists $extra{$k} 0 0 0
Condition0%0/3
$from or exists $extra{$k}
l!l&&r!l&&!r
000
MC/DC0%0/2
$from or exists $extra{$k}
$from exists $extra{$k}
Truth table0%0/3
A or B
A= $fromB= exists $extra{$k}
ABresult
1X1
011
000
7525 0 $opt->{$k} = $from->{$k};
7526 }
7527 die "option `visual_rowcount' differs from length of `visual_per_row_counts': $opt->{visual_rowcount} vs. ",
7528 0 ▶ scalar @{$opt->{visual_per_row_counts}} unless $opt->{visual_rowcount} == @{$opt->{visual_per_row_counts}};
Branch: 1 branch
BranchTrueFalseTotal
unless $opt->{"visual_rowcount"} == @{$opt->{"visual_per_row_counts"};} 0 0 0
7529 0 my @lines = grep !/^#/, split /\s*\n/, $opt->{unparsed_data};
7530 0 my ($C, $lc, $pref) = map $opt->{$_}, qw(visual_rowcount visual_per_row_counts visual_prefixes);
7531 0 ▶ die "Number of uncommented rows (" . scalar @lines . ") in a visual template not divisible by the rowcount $C: `$opt->{unparsed_data}'"
Branch: 1 branch
BranchTrueFalseTotal
if @lines % $C 0 0 0
7532 if @lines % $C;
7533 0 ▶ $pref = [map {$_ eq ' ' ? qr/\s/ : qr/\Q$_/ } split(//, $pref), (' ') x $C];
Branch: 1 branch
BranchTrueFalseTotal
$_ eq ' ' ? : 0 0 0
7534 # my $line_in_row = [];
7535 0 my @counts;
7536 my $sep2;
7537 0 ▶ $sep2 = qr/$opt->{in_key_separator2}/ if defined $opt->{in_key_separator2};
Branch: 1 branch
BranchTrueFalseTotal
if defined $opt->{"in_key_separator2"} 0 0 0
7538 0 ▶ while (@lines) {
Branch: 1 branch
BranchTrueFalseTotal
if (@lines) 0 0 0
7539 # push @out, $line_in_row = [] unless $C % $c;
7540 0 ▶ $row++, $line_in_row = $cur_layer = 0 unless $lineN % $C;
Branch: 1 branch
BranchTrueFalseTotal
unless $lineN % $C 0 0 0
7541 0 $lineN++;
7542 0 my $l1 = shift @lines;
7543 0 my $PREF = qr/(?:$pref->[$line_in_row]){$opt->{prefix_repeat}}/;
7544 0 ▶ $PREF = '\s' if $pref->[$line_in_row] eq qr/\s/;
Branch: 1 branch
BranchTrueFalseTotal
if $pref->[$line_in_row] eq qr/\s/ 0 0 0
7545 0 ▶ $l1 =~ s/\s*\x{202c}$// if $l1 =~ s/^[\x{202d}\x{202e}]//; # remove PDF if removed LRO, RLO
Branch: 1 branch
BranchTrueFalseTotal
if $l1 =~ s/^[\x{202d}\x{202e}]// 0 0 0
7546 0 ▶ die "line $lineN in visual layers has unexpected prefix:\n\tPREF=/$PREF/\n\tLINE=`$l1'" unless $l1 =~ s/^$PREF\s*(?<=\s)//;
Branch: 1 branch
BranchTrueFalseTotal
unless $l1 =~ s/^$PREF\s*(?<=\s)// 0 0 0
7547 0 my @k1 = split /\s+(?!\p{NonspacingMark})/, $l1;
7548 0 ▶ $l0 = $l1, $N = @k1 if $line_in_row == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $line_in_row == 0 0 0 0
7549 # warn "Got keys: ", scalar @k1;
7550 0 ▶ die sprintf "number of keys in lines differ: %s vs %s in:\n\t`%s'\n\t`%s'\n\t<%s>",
Branch: 1 branch
BranchTrueFalseTotal
unless @k1 == $N 0 0 0
7551 scalar @k1, $N, $l0, $l1, join(">\t<", @k1) unless @k1 == $N; # One can always fill by --
7552 0 for my $key (@k1) {
7553 0 my @kk = $self->process_key($key, $lc->[$line_in_row], $opt->{in_key_separator}, $opt->{layer_names}, $cur_layer, $sep2);
7554 0 ▶ push @{$out[$cur_layer + $_]}, $kk[$_] || [] # (defined $kk[$_] ? [$kk[$_],undef,undef,$opt->{layer_names}[$cur_layer + $_]] : [])
Condition0%0/2
$kk[$_] || []
l!l
00
MC/DC0%0/1
$kk[$_] || []
$kk[$_]
Truth table0%0/2
A
A= $kk[$_]
Aresult
11
00
7555 0 for 0..($lc->[$line_in_row]-1);
7556 }
7557 0 $cur_layer += $lc->[$line_in_row++];
7558 0 ▶ push @counts, scalar @k1 if 1 == $lineN % $C;
Branch: 1 branch
BranchTrueFalseTotal
if 1 == $lineN % $C 0 0 0
7559 }
7560 # warn "layer[0] = ", join ', ', map "@$_", @{$out[0]};
7561 0 die "Got ", scalar @out, " layers, but ", scalar @{$opt->{layer_names}}, " layer names"
7562 0 ▶ unless @out == @{$opt->{layer_names}};
Branch: 1 branch
BranchTrueFalseTotal
unless @out == @{$opt->{"layer_names"};} 0 0 0
7563 0 my(%seen, %out);
7564 0 ▶ $seen{$_}++ and die "Duplicate layer name `$_'" for @{$opt->{layer_names}};
Branch: 1 branch
BranchTrueFalseTotal
$seen{$_}++ and die "Duplicate layer name `${_}'" 0 0 0
7565 0 @out{ @{$opt->{layer_names}} } = @out;
7566 0 for my $i ( 0 .. ($#{ $opt->{layer_names} } - 1) ) {
7567 0 my($base,$shift) = ($out[$i], $out[$i+1]);
7568 0 ▶ $out{$opt->{layer_names}[$i] . '²'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # ²: Layer, and the next “as shifted”
Condition0%0/2
$out{$opt->{"layer_names"}[$i] . "\262"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
l!l
00
MC/DC0%0/1
$out{$opt->{"layer_names"}[$i] . "\262"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
$out{$opt->{"layer_names"}[$i] . "\262"}
Truth table0%0/2
A
A= $out{$opt->{"layer_names"}[$i] . "\262"}
Aresult
11
00
7569 0 ▶ next if $i > $#{ $opt->{layer_names} } - 3;
Branch: 1 branch
BranchTrueFalseTotal
if $i > $#{$$opt{"layer_names"};} - 3 0 0 0
7570 0 ($base,$shift) = ($out[$i+2], $out[$i+3]);
7571 0 ▶ $out{$opt->{layer_names}[$i] . '²⁺'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # ²⁺: two next layers (likewise)
Condition0%0/2
$out{$opt->{"layer_names"}[$i] . "\262\x{207a}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
l!l
00
MC/DC0%0/1
$out{$opt->{"layer_names"}[$i] . "\262\x{207a}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
$out{$opt->{"layer_names"}[$i] . "\262\x{207a}"}
Truth table0%0/2
A
A= $out{$opt->{"layer_names"}[$i] . "\262\x{207a}"}
Aresult
11
00
7572 ### warn "Created ² etc appended-names for layer $opt->{layer_names}[$i]";
7573 }
7574 0 my $ii = 0;
7575 0 if (0) { # Cannot do this: the subdivision into rows is not preserved by the parser! ???
7576 for my $pre_row ( 0 .. @{ $opt->{rect_horizontal_counts} } - 2) {
7577 my $C = $opt->{rect_horizontal_counts}[$pre_row];
7578 for my $iii ( 0 .. $C - 1) {
7579 my $I = $ii + $iii;
7580 my $i = $I + $C;
7581 next if $i > $#{ $opt->{layer_names} }; # Next row may be shorter
7582 my($base,$shift) = ($out[$i], $out[$i+1]);
7583 $out{$opt->{layer_names}[$I] . '₁'} ||= [ map [$base->[$_][0]], 0..$#$base ]; # In the next row listing layer-names
7584 next if $i > $#{ $opt->{layer_names} } - 1;
7585 $out{$opt->{layer_names}[$I] . '₂'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # As ² but in the next row
7586 next if $i > $#{ $opt->{layer_names} } - 3;
7587 ($base,$shift) = ($out[$i+2], $out[$i+3]);
7588 $out{$opt->{layer_names}[$I] . '₂₊'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # As ²⁺ but in the next row
7589 }
7590 $ii += $C;
7591 }}
7592 0 \%out, \@counts, $opt->{keyline_offsets};
7593 }
7594
7595 0 ▶sub decode_rect_layers ($@) {
Subroutine decode_rect_layers: not called CC=40 SCAR=74.0
Pod undocumented
7596 0 my ($self, $cnt, %extra, $opt, @out) = (shift, 0, qw(empty N/A));
7597 0 my %needed = qw(unparsed_data x rect_rows_cols [4;4] rect_horizontal_counts [2;2] layer_names ??? COLgap 0 ROWgap 0);
7598 0 for my $k (keys %needed, keys %extra) {
7599 0 ▶ my ($from) = grep exists $_->{$k}, @_, (ref $self ? $self : ());
Branch: 1 branch
BranchTrueFalseTotal
ref $self ? : 0 0 0
7600 0 ▶ die "option `$k' not specified" unless $from or exists $extra{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless $from or exists $extra{$k} 0 0 0
Condition0%0/3
$from or exists $extra{$k}
l!l&&r!l&&!r
000
MC/DC0%0/2
$from or exists $extra{$k}
$from exists $extra{$k}
Truth table0%0/3
A or B
A= $fromB= exists $extra{$k}
ABresult
1X1
011
000
7601 0 $opt->{$k} = $from->{$k};
7602 }
7603 0 $cnt += $_ for @{ $opt->{rect_horizontal_counts} };
7604 die "total of option `rect_horizontal_counts' differs from count of `layer_names': $cnt vs. ",
7605 0 ▶ scalar @{$opt->{layer_names}} unless $cnt == @{$opt->{layer_names}};
Branch: 1 branch
BranchTrueFalseTotal
unless $cnt == @{$opt->{"layer_names"};} 0 0 0
7606 0 $cnt = @{ $opt->{rect_horizontal_counts} };
7607 0 (my $D = $opt->{unparsed_data}) =~ s/^(#.*\n)+//;
7608 0 $D =~ s/^(#.*(\n|\z))+\z//m;
7609 0 my @lines = split /\s*\n/, $D;
7610 0 my ($C, $lc, $pref, $c0, $r0) = map $opt->{$_}, qw(visual_rowcount visual_per_row_counts visual_prefixes COLgap ROWgap);
7611 die "Number of uncommented rows (" . scalar @lines . ") in a visual rect template not matching rows(rect_rows_cols) x cnt(rect_horizontal_counts) = $opt->{rect_rows_cols}[0] x $cnt: `$opt->{unparsed_data}'"
7612 0 ▶ if @lines != $cnt * $opt->{rect_rows_cols}[0] + ($cnt-1)*$r0;
Branch: 1 branch
BranchTrueFalseTotal
if @lines != $cnt * $opt->{"rect_rows_cols"}[0] + ($cnt - 1) * $r0 0 0 0
7613 0 my $c = 0;
7614 0 ▶ while (@lines) {
Branch: 1 branch
BranchTrueFalseTotal
if (@lines) 0 0 0
7615 0 die "Too many rect vertically: expect only ", scalar @{ $opt->{rect_horizontal_counts} }, " in `" . join("\n",'',@lines,'') . "'"
7616 0 ▶ if $c >= @{ $opt->{rect_horizontal_counts} };
Branch: 1 branch
BranchTrueFalseTotal
if $c >= @{$opt->{"rect_horizontal_counts"};} 0 0 0
7617 0 my @L = splice @lines, 0, $opt->{rect_rows_cols}[0];
7618 0 my ($cR, $L) = 0;
7619 0 ▶ while (++$cR <= $r0) { # Inter-row gap
Branch: 1 branch
BranchTrueFalseTotal
if (++$cR <= $r0) 0 0 0
7620 0 ▶ last unless @lines;
Branch: 1 branch
BranchTrueFalseTotal
unless @lines 0 0 0
7621 0 ▶ ($L = shift @lines) =~ /^#/ or die "Line expected to be inter-row comment line No. $cR: <<<$L>>>"
Branch: 1 branch
BranchTrueFalseTotal
($L = shift @lines) =~ /^#/ or die "Line expected to be inter-row comment line No. ${cR}: <<<$L>>>" 0 0 0
7622 }
7623 0 my $l = length $L[0];
7624 0 ▶ $l == length or die "Lengths of lines encoding rect do not match: expect $l, got `" . join("\n",'',@L,'') . "'" for @L[1..$#L];
Branch: 1 branch
BranchTrueFalseTotal
$l == length $_ or die "Lengths of lines encoding rect do not match: expect $l, got `" . join("\n", "", @L, "") . q['] 0 0 0
7625 $l == $opt->{rect_rows_cols}[1] * $opt->{rect_horizontal_counts}[$c] + ($opt->{rect_horizontal_counts}[$c] - 1)*$c0
7626 or die "Wrong line length in rect: expect $opt->{rect_rows_cols}[1] * $opt->{rect_horizontal_counts}[$c] gaps=$c0, got $l in `"
7627 0 ▶ . join("\n",'',@L,'') . "'" for @L[1..$#L];
Branch: 1 branch
BranchTrueFalseTotal
$l == $opt->{"rect_rows_cols"}[1] * $opt->{"rect_horizontal_counts"}[$c] + ($opt->{"rect_horizontal_counts"}[$c] - 1) * $c0 or die qq[Wrong line length in rect: expect $opt->{"rect_rows_cols"}[1] * $opt->{"rect_horizontal_counts"}[$c] gaps=$c0, got $l in `] . join("\n", "", @L, "") . q['] 0 0 0
7628 0 ▶ while (length $L[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $L[0]) 0 0 0
7629 0 my @c;
7630 0 push @c, split //, substr $_, 0, $opt->{rect_rows_cols}[1], '' for @L;
7631 0 ▶ $_ eq $opt->{empty} and $_ = undef for @c;
Branch: 1 branch
BranchTrueFalseTotal
$_ eq $opt->{"empty"} and $_ = undef 0 0 0
7632 0 push @out, [map [$_], @c];
7633 0 ▶ next unless $c0 and length $L[0]; # Inter-col gap
Branch: 1 branch
BranchTrueFalseTotal
unless $c0 and length $L[0] 0 0 0
Condition0%0/3
$c0 and length $L[0]
!ll&&!rl&&r
000
MC/DC0%0/2
$c0 and length $L[0]
$c0 length $L[0]
Truth table0%0/3
A and B
A= $c0B= length $L[0]
ABresult
0X0
100
111
7634 0 for my $i (0..$#L) {
7635 0 ▶ next unless (my $gap = substr $L[$i], 0, $c0, '') =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless (my $gap = substr($L[$i], 0, $c0, "")) =~ /\S/ 0 0 0
7636 0 die "Inter-column gap not whitespace: line No. $i (0-based), gap No. $#out: <<<$gap>>>"
7637 }
7638 }
7639 0 $c++;
7640 }
7641 0 die "Too few vertical rect: got $c, expect ", scalar @{ $opt->{rect_horizontal_counts} }, " in `" . join("\n",'',@lines,'') . "'"
7642 0 ▶ if $c != @{ $opt->{rect_horizontal_counts} };
Branch: 1 branch
BranchTrueFalseTotal
if $c != @{$opt->{"rect_horizontal_counts"};} 0 0 0
7643 0 my(%seen, %out);
7644 0 ▶ $seen{$_}++ and die "Duplicate layer name `$_'" for @{$opt->{layer_names}};
Branch: 1 branch
BranchTrueFalseTotal
$seen{$_}++ and die "Duplicate layer name `${_}'" 0 0 0
7645 0 @out{ @{$opt->{layer_names}} } = @out;
7646 0 for my $i ( 0 .. ($#{ $opt->{layer_names} } - 1) ) {
7647 0 my($base,$shift) = ($out[$i], $out[$i+1]);
7648 0 ▶ $out{$opt->{layer_names}[$i] . '²'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # ²: Layer, and the next “as shifted”
Condition0%0/2
$out{$opt->{"layer_names"}[$i] . "\262"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
l!l
00
MC/DC0%0/1
$out{$opt->{"layer_names"}[$i] . "\262"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
$out{$opt->{"layer_names"}[$i] . "\262"}
Truth table0%0/2
A
A= $out{$opt->{"layer_names"}[$i] . "\262"}
Aresult
11
00
7649 0 ▶ next if $i > $#{ $opt->{layer_names} } - 3;
Branch: 1 branch
BranchTrueFalseTotal
if $i > $#{$$opt{"layer_names"};} - 3 0 0 0
7650 0 ($base,$shift) = ($out[$i+2], $out[$i+3]);
7651 0 ▶ $out{$opt->{layer_names}[$i] . '²⁺'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # ²⁺: two next layers (likewise)
Condition0%0/2
$out{$opt->{"layer_names"}[$i] . "\262\x{207a}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
l!l
00
MC/DC0%0/1
$out{$opt->{"layer_names"}[$i] . "\262\x{207a}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
$out{$opt->{"layer_names"}[$i] . "\262\x{207a}"}
Truth table0%0/2
A
A= $out{$opt->{"layer_names"}[$i] . "\262\x{207a}"}
Aresult
11
00
7652 ### warn "Created ² etc appended-names for rect layer $opt->{layer_names}[$i]";
7653 }
7654 0 my $ii = 0;
7655 0 for my $pre_row ( 0 .. @{ $opt->{rect_horizontal_counts} } - 2) {
7656 0 my $C = $opt->{rect_horizontal_counts}[$pre_row];
7657 0 for my $iii ( 0 .. $C - 1) {
7658 0 my $I = $ii + $iii;
7659 0 my $i = $I + $C;
7660 0 ▶ next if $i > $#{ $opt->{layer_names} }; # Next row may be shorter
Branch: 1 branch
BranchTrueFalseTotal
if $i > $#{$$opt{"layer_names"};} 0 0 0
7661 0 my($base,$shift) = ($out[$i], $out[$i+1]);
7662 0 ▶ $out{$opt->{layer_names}[$I] . '₁'} ||= [ map [$base->[$_][0]], 0..$#$base ]; # In the next row listing layer-names
Condition0%0/2
$out{$opt->{"layer_names"}[$I] . "\x{2081}"} ||= [map([$base->[$_][0]], 0 .. $base->$#*)]
l!l
00
MC/DC0%0/1
$out{$opt->{"layer_names"}[$I] . "\x{2081}"} ||= [map([$base->[$_][0]], 0 .. $base->$#*)]
$out{$opt->{"layer_names"}[$I] . "\x{2081}"}
Truth table0%0/2
A
A= $out{$opt->{"layer_names"}[$I] . "\x{2081}"}
Aresult
11
00
7663 0 ▶ next if $i > $#{ $opt->{layer_names} } - 1;
Branch: 1 branch
BranchTrueFalseTotal
if $i > $#{$$opt{"layer_names"};} - 1 0 0 0
7664 0 ▶ $out{$opt->{layer_names}[$I] . '₂'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # As ² but in the next row
Condition0%0/2
$out{$opt->{"layer_names"}[$I] . "\x{2082}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
l!l
00
MC/DC0%0/1
$out{$opt->{"layer_names"}[$I] . "\x{2082}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
$out{$opt->{"layer_names"}[$I] . "\x{2082}"}
Truth table0%0/2
A
A= $out{$opt->{"layer_names"}[$I] . "\x{2082}"}
Aresult
11
00
7665 0 ▶ next if $i > $#{ $opt->{layer_names} } - 3;
Branch: 1 branch
BranchTrueFalseTotal
if $i > $#{$$opt{"layer_names"};} - 3 0 0 0
7666 0 ($base,$shift) = ($out[$i+2], $out[$i+3]);
7667 0 ▶ $out{$opt->{layer_names}[$I] . '₂₊'} ||= [ map [$base->[$_][0], $shift->[$_][0]], 0..$#$base ]; # As ²⁺ but in the next row
Condition0%0/2
$out{$opt->{"layer_names"}[$I] . "\x{2082}\x{208a}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
l!l
00
MC/DC0%0/1
$out{$opt->{"layer_names"}[$I] . "\x{2082}\x{208a}"} ||= [map([$base->[$_][0], $shift->[$_][0]], 0 .. $base->$#*)]
$out{$opt->{"layer_names"}[$I] . "\x{2082}\x{208a}"}
Truth table0%0/2
A
A= $out{$opt->{"layer_names"}[$I] . "\x{2082}\x{208a}"}
Aresult
11
00
7668 }
7669 0 $ii += $C;
7670 }
7671 0 \%out, [($opt->{rect_rows_cols}[1]) x $opt->{rect_rows_cols}[0]];
7672 }
7673
7674 0 ▶sub get_deep ($$@) {
Subroutine get_deep: not called CC=3 SCAR=24.8
Pod undocumented
7675 0 my($self, $h) = (shift, shift);
7676 0 ▶ return $h unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
7677 0 my $k = shift @_;
7678 0 ▶ return unless exists $h->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $h->{$k} 0 0 0
7679 0 $self->get_deep($h->{$k}, @_);
7680 }
7681
7682 0 ▶sub get_deep_via_parents ($$$@) { # quadratic algorithm
Subroutine get_deep_via_parents: not called CC=9 SCAR=45.0
Pod undocumented
7683 0 my($self, $h, $idx, $IDX) = (shift, shift, shift);
7684 #warn "Deep: `@_'";
7685 0 ▶ ((defined $h) ? return $h : return) unless @_;
Branch: 2 branches
BranchTrueFalseTotal
unless @_ 0 0 0
defined $h ? : 0 0 0
7686 0 my $k = pop @_;
7687 {
7688 #warn "Deep::: `@_'";
7689 0 my $H = $self->get_deep($h, @_);
7690 (@_ or return), $IDX++, # Start extraction from array
7691 0 ▶ pop, redo unless exists $H->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $H->{$k} 0 0 0
Condition0%0/2
@_ or return
l!l
00
MC/DC0%0/1
@_ or return
@_
Truth table0%0/2
A
A= @_
Aresult
11
00
7692 0 my $v = $H->{$k};
7693 #warn "Deep -> `$v'";
7694 0 ▶ return $v unless ref($v || 1) and $IDX and defined $idx;
Branch: 1 branch
BranchTrueFalseTotal
unless ref($v || 1) and $IDX and defined $idx 0 0 0
Condition0%0/8
ref($v || 1) and $IDX and defined $idx
!ll&&!rl&&r
000
ref($v || 1) and $IDX
!ll&&!rl&&r
000
$v || 1
l!l
00
MC/DC0%0/3
ref($v || 1) and $IDX and defined $idx
$v $IDX defined $idx
Truth table0%0/4
A and B and C
A= $vB= $IDXC= defined $idx
ABCresult
0XX0
10X0
1100
1111
7695 0 return $v->[$idx];
7696 }
7697 0 return;
7698 }
7699
7700 0 ▶sub fill_kbd_layers ($$) { # We do not do deep processing here...
Subroutine fill_kbd_layers: not called CC=13 SCAR=52.0
Pod undocumented
7701 0 my($self, $h, %o, %c, %O) = (shift, shift);
7702 0 my @K = grep m(^\[unparsed]/(KBD|RECT)\b), @{$h->{'[keys]'}};
7703 # my $H = $h->{'[unparsed]'};
7704 0 for my $k (@K) {
7705 0 my (@parts, @h) = split m(/), $k;
7706 0 ▶ ref $self and push @h, $self->get_deep($self, @parts[1..$_]) || {} for 0..$#parts;
Branch: 1 branch
BranchTrueFalseTotal
ref $self and push @h, $self->get_deep($self, @parts[1 .. $_]) || {} 0 0 0
Condition0%0/2
$self->get_deep($self, @parts[1 .. $_]) || {}
l!l
00
MC/DC0%0/1
$self->get_deep($self, @parts[1 .. $_]) || {}
$self->get_deep($self, @parts[1 .. $_])
Truth table0%0/2
A
A= $self->get_deep($self, @parts[1 .. $_])
Aresult
11
00
7707 0 ▶ push @h, $self->get_deep($h, @parts[1..$_]) || {} for 0..$#parts; # Drop [unparsed]/ prefix...
Condition0%0/2
$self->get_deep($h, @parts[1 .. $_]) || {}
l!l
00
MC/DC0%0/1
$self->get_deep($h, @parts[1 .. $_]) || {}
$self->get_deep($h, @parts[1 .. $_])
Truth table0%0/2
A
A= $self->get_deep($h, @parts[1 .. $_])
Aresult
11
00
7708 0 ▶ push @h, $self->get_deep($h, @parts[0..$_]) || {} for -1..$#parts;
Condition0%0/2
$self->get_deep($h, @parts[0 .. $_]) || {}
l!l
00
MC/DC0%0/1
$self->get_deep($h, @parts[0 .. $_]) || {}
$self->get_deep($h, @parts[0 .. $_])
Truth table0%0/2
A
A= $self->get_deep($h, @parts[0 .. $_])
Aresult
11
00
7709 0 ▶ my ($in, $counts, $offsets) = ($k =~ m(^\[unparsed]/KBD\b) ? $self->decode_kbd_layers( reverse @h )
Branch: 1 branch
BranchTrueFalseTotal
$k =~ m(^\[unparsed]/KBD\b) ? : 0 0 0
7710 : $self->decode_rect_layers( reverse @h ) );
7711 0 ▶ exists $o{$_} and die "Visual spec `$k' overwrites exiting layer `$k'" for keys %$in;
Branch: 1 branch
BranchTrueFalseTotal
exists $o{$_} and die "Visual spec `${k}' overwrites exiting layer `${k}'" 0 0 0
7712 0 my $cnt = (@o{keys %$in} = values %$in);
7713 0 @c{keys %$in} = ($counts) x $cnt;
7714 0 ▶ @O{keys %$in} = ($offsets) x $cnt if $offsets;
Branch: 1 branch
BranchTrueFalseTotal
if $offsets 0 0 0
7715 }
7716 0 \%o, \%c, \%O
7717 }
7718
7719 0 ▶sub key2hex ($$;$) {
Subroutine key2hex: not called CC=3 SCAR=24.8
Pod undocumented
7720 0 my ($self, $k, $ignore) = (shift, shift, shift);
7721 0 ▶ return -1 if $ignore and not defined $k;
Branch: 1 branch
BranchTrueFalseTotal
if $ignore and not defined $k 0 0 0
Condition0%0/3
$ignore and not defined $k
!ll&&!rl&&r
000
MC/DC0%0/2
$ignore and not defined $k
$ignore not defined $k
Truth table0%0/3
A and not(B)
A= $ignoreB= not defined $k
ABresult
0X0
100
111
7722 0 return sprintf '%04x', ord $k; # if ord $k <= 0xFFFF;
7723 # sprintf '%06x', ord $k;
7724 }
7725
7726 0 ▶sub keyORarray2hex ($$;$) {
Subroutine keyORarray2hex: not called CC=5 SCAR=34.0
Pod undocumented
7727 0 my ($self, $k, $ignore) = (shift, shift, shift);
7728 0 ▶ return -1 if $ignore and not defined $k;
Branch: 1 branch
BranchTrueFalseTotal
if $ignore and not defined $k 0 0 0
Condition0%0/3
$ignore and not defined $k
!ll&&!rl&&r
000
MC/DC0%0/2
$ignore and not defined $k
$ignore not defined $k
Truth table0%0/3
A and not(B)
A= $ignoreB= not defined $k
ABresult
0X0
100
111
7729 0 ▶ $k = $k->[0] if $k and ref $k;
Branch: 1 branch
BranchTrueFalseTotal
if $k and ref $k 0 0 0
Condition0%0/3
$k and ref $k
!ll&&!rl&&r
000
MC/DC0%0/2
$k and ref $k
$k ref $k
Truth table0%0/3
A and B
A= $kB= ref $k
ABresult
0X0
100
111
7730 0 $self->key2hex($k, $ignore);
7731 }
7732
7733 0 ▶sub keys2hex ($$;$) {
Subroutine keys2hex: not called CC=3 SCAR=24.8
Pod undocumented
7734 0 my ($self, $k, $ignore) = (shift, shift, shift);
7735 0 ▶ return -1 if $ignore and not defined $k;
Branch: 1 branch
BranchTrueFalseTotal
if $ignore and not defined $k 0 0 0
Condition0%0/3
$ignore and not defined $k
!ll&&!rl&&r
000
MC/DC0%0/2
$ignore and not defined $k
$ignore not defined $k
Truth table0%0/3
A and not(B)
A= $ignoreB= not defined $k
ABresult
0X0
100
111
7736 0 return join '.', map {sprintf '%04x', ord} split //, $k; # if ord $k <= 0xFFFF;
7737 # sprintf '%06x', ord $k;
7738 }
7739
7740 0 ▶sub coverage_hex_sub($$$) { # Unfinished!!! XXXX UNUSED
Subroutine coverage_hex_sub: not called CC=2 SCAR=17.9
Pod undocumented
7741 0 my ($self, $layer, $to) = (shift, shift, shift);
7742 ++$to->{ $self->key2hex($_->[0], 'undef_ok') }, ++$to->{ $self->key2hex($_->[1], 'undef_ok') }
7743 0 for @{$self->{layers}{$layer}};
7744 }
7745
7746 # my %MANUAL_MAP = qw( 0020 0020 00a0 00a0 2007 2007 ); # We insert entry for SPACE manually
7747 # my %MANUAL_MAP_ch = map chr hex, %MANUAL_MAP;
7748
7749 0 ▶sub coverage_hex($$) {
Subroutine coverage_hex: not called CC=4 SCAR=30.0
Pod undocumented
7750 0 my ($self, $face) = (shift, shift);
7751 0 my $layers = $self->{faces}{$face}{layers};
7752 0 ▶ my $to = ($self->{faces}{$face}{'[coverage_hex]'} ||= {}); # or die "Panic!"; # Synthetic faces may not have this...
Condition0%0/2
$self->{"faces"}{$face}{"[coverage_hex]"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"faces"}{$face}{"[coverage_hex]"} ||= {}
$self->{"faces"}{$face}{"[coverage_hex]"}
Truth table0%0/2
A
A= $self->{"faces"}{$face}{"[coverage_hex]"}
Aresult
11
00
7753 0 my @Layers = map $self->{layers}{$_}, @$layers;
7754 0 for my $sub (@Layers) {
7755 0 ++$to->{ $self->keyORarray2hex($_, 'undef_ok') } for map +(@$_[0,1]), @$sub;
7756 }
7757 }
7758
7759 0 ▶sub deep_copy($$) {
Subroutine deep_copy: not called CC=4 SCAR=30.0
Pod undocumented
7760 0 my ($self, $o) = (shift, shift);
7761 0 ▶ return $o unless ref $o;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $o 0 0 0
7762 0 ▶ return [map $self->deep_copy($_), @$o] if "$o" =~ /^ARRAY\(/; # We should not have overloaded elements
Branch: 1 branch
BranchTrueFalseTotal
if "$o" =~ /^ARRAY\(/ 0 0 0
7763 0 ▶ return {map $self->deep_copy($_), %$o} if "$o" =~ /^HASH\(/;
Branch: 1 branch
BranchTrueFalseTotal
if "$o" =~ /^HASH\(/ 0 0 0
7764 }
7765 0 ▶sub DEEP_COPY($@) {
Subroutine DEEP_COPY: not called CC=1 SCAR=6.9
Pod undocumented
7766 0 my ($self) = (shift);
7767 0 map $self->deep_copy($_), @_;
7768 }
7769
7770 0 ▶sub deep_undef_by_hash($$@) {
Subroutine deep_undef_by_hash: not called CC=6 SCAR=37.4
Pod undocumented
7771 0 my ($self, $h) = (shift, shift);
7772 0 for (@_) {
7773 0 ▶ next unless defined;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_ 0 0 0
7774 0 ▶ if (ref $_) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_) { } 0 0 0
elsif ($h->{$_}) { } 0 0 0
7775 0 ▶ die "a reference not an ARRAY in deep_undef_by_hash()" unless 'ARRAY' eq ref $_;
Branch: 1 branch
BranchTrueFalseTotal
unless "ARRAY" eq ref $_ 0 0 0
7776 0 $self->deep_undef_by_hash($h, @$_);
7777 } elsif ($h->{$_}) {
7778 0 undef $_
7779 }
7780 }
7781 }
7782
7783 # Make symbols from the first half-face ($h1) to be accessible in the second face ($H1/$H2)
7784 0 ▶sub pre_link_layers ($$$;$$) { # Un-obscure non-alphanum bindings from the first face; assign in the direction $hh ---> $HH
Subroutine pre_link_layers: not called CC=47 SCAR=77.2
Pod undocumented
7785 0 my ($self, $hh, $HH, $skipfix, $skipwarn) = (shift, shift, shift, shift, shift); # [Main, AltGr-Main,...], [Secondary, AltGr-Secondary,...]
7786 0 my ($hn,$Hn, %seen_deobsc) = map $self->{faces}{$_}{layers}, $hh, $HH;
7787 #warn "Link $hh --> $HH;\t(@$hn) -> (@$Hn)" if "$hh $HH" =~ /00a9/i;
7788 0 ▶ die "Can't link sets of layers `$hh' `$HH' of different sizes: ", scalar @$hn, " != ", scalar @$Hn if @$hn != @$Hn;
Branch: 1 branch
BranchTrueFalseTotal
if @$hn != @$Hn 0 0 0
7789
7790 0 my $already_linked = $self->{faces}{$hh}{'[linked]'}{$HH}++;
7791 0 $self->{faces}{$HH}{'[linked]'}{$hh}++;
7792 0 for my $L (@$Hn) {
7793 0 ▶ next if $skipfix;
Branch: 1 branch
BranchTrueFalseTotal
if $skipfix 0 0 0
7794 die "Layer `$L' of face `$HH' is being relinked via `$HH' -> `$hh'???"
7795 0 ▶ if $self->{layers}{'[ini_copy]'}{$L};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"layers"}{"[ini_copy]"}{$L} 0 0 0
7796 #warn "ini_copy: `$L'";
7797 0 $self->{layers}{'[ini_copy]'}{$L} = $self->deep_copy($self->{layers}{$L});
7798 }
7799 0 for my $K (0..$#{$self->{layers}{$hn->[0]}}) { # key number
7800 #warn "One key data, FROM: K=$K, layer=<", join( '> <', map $self->{layers}{$_}[$K], @$Hn), '>' if "$hh $HH" =~ /00a9/i;
7801 0 my @h = map $self->{layers}{$_}[$K], @$hn; # arrays of [lowercase,uppercase]
7802 #warn "One key data, TO: K=$K, layer=<", join( '> <', map $self->{layers}{$_}[$K], @$Hn), '>' if "$hh $HH" =~ /00a9/i;
7803 0 my @H = map $self->{layers}{$_}[$K], @$Hn;
7804 0 ▶ my @p = map [map {$_ and ref and $_->[2]} @$_], @h; # Prefix
Condition0%0/6
$_ && ref $_ && $_->[2]
!ll&&!rl&&r
000
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/3
$_ && ref $_ && $_->[2]
$_ ref $_ $_->[2]
Truth table0%0/4
A and B && C
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
10X0
1100
1111
7805 0 ▶ my @c = map [map {($_ and ref) ? $_->[0] : $_} @$_], @h; # deep copy, remove extra info
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
7806 0 ▶ my @C = map [map {($_ and ref) ? $_->[0] : $_} @$_], @H;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
7807 # Find which of keys on $H[0] obscure symbol keys from $h[0]
7808 0 ▶ my @symb0 = grep {$p[0][$_] or ($c[0][$_] || '') =~ /[\W_]/} 0, 1; # not(wordchar but not _): prefix/symbols on $h[0]
Condition0%0/5
$p[0][$_] || ($c[0][$_] || '') =~ /[\W_]/
l!l&&r!l&&!r
000
$c[0][$_] || ''
l!l
00
MC/DC0%0/2
$p[0][$_] || ($c[0][$_] || '') =~ /[\W_]/
$p[0][$_] $c[0][$_]
Truth table0%0/3
A || B
A= $p[0][$_]B= $c[0][$_]
ABresult
1X1
011
000
7809 defined $H[0][$_] or not defined $C[0][$_] or $skipwarn
7810 or warn "Symbol char `$c[0][$_]' not copied to the second face while the slot is empty"
7811 0 ▶ for @symb0;
Branch: 1 branch
BranchTrueFalseTotal
defined $H[0][$_] or not defined $C[0][$_] or $skipwarn or warn "Symbol char `$c[0][$_]' not copied to the second face while the slot is empty" 0 0 0
Condition0%0/6
defined $H[0][$_] or not defined $C[0][$_] or $skipwarn
l!l&&r!l&&!r
000
defined $H[0][$_] or not defined $C[0][$_]
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $H[0][$_] or not defined $C[0][$_] or $skipwarn
defined $H[0][$_] not defined $C[0][$_] $skipwarn
Truth table0%0/4
A or not(B) or C
A= defined $H[0][$_]B= not defined $C[0][$_]C= $skipwarn
ABCresult
1XX1
01X1
0011
0000
7812 0 ▶ my @obsc = grep { defined $C[0][$_] and $c[0][$_] ne $C[0][$_]} @symb0; # undefined positions will be copied later
Condition0%0/3
defined $C[0][$_] && $c[0][$_] ne $C[0][$_]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $C[0][$_] && $c[0][$_] ne $C[0][$_]
defined $C[0][$_] $c[0][$_] ne $C[0][$_]
Truth table0%0/3
A && B
A= defined $C[0][$_]B= $c[0][$_] ne $C[0][$_]
ABresult
0X0
100
111
7813 #warn "K=$K,\tobs=@obsc;\tsymb0=@symb0";
7814 # If @obsc == 1, put on non-shifted location; may overwrite only ?-binding if it exists
7815 #return unless @obsc;
7816 0 my %map;
7817 0 my @free_first = ((grep {not defined $C[1][$_]} 0, 1), grep defined $C[1][$_], 0, 1);
7818 0 ▶ @free_first = (1,0) if 1 == ($obsc[0] || 0) and $free_first[0] = 0 and not defined $C[1][1]; # un-Shift ONLY if needed
Branch: 1 branch
BranchTrueFalseTotal
if 1 == ($obsc[0] || 0) and $free_first[0] = 0 and not defined $C[1][1] 0 0 0
Condition0%0/7
1 == ($obsc[0] || 0) and $free_first[0] = 0 and not defined $C[1][1]
!ll&&!rl&&r
000
1 == ($obsc[0] || 0) and $free_first[0] = 0
!ll
00
$obsc[0] || 0
l!l
00
MC/DC0%0/2
1 == ($obsc[0] || 0) and $free_first[0] = 0 and not defined $C[1][1]
1 == ($obsc[0] || 0) not defined $C[1][1]
MC/DC0%0/1
$obsc[0] || 0
$obsc[0]
Truth table0%0/3
A and not(B)
A= 1 == ($obsc[0] || 0)B= not defined $C[1][1]
ABresult
0X0
100
111
Truth table0%0/2
A
A= $obsc[0]
Aresult
11
00
7819 0 ▶ @map{@obsc} = @free_first[0 .. $#obsc] unless $skipfix;
Branch: 1 branch
BranchTrueFalseTotal
unless $skipfix 0 0 0
7820 # %map = map +($_, $free_first[$map{$_}]), keys %map;
7821 0 for my $k (sort keys %map) {
7822 0 ▶ if ($skipfix) {
Branch: 2 branches
BranchTrueFalseTotal
if ($skipfix) { } 0 0 0
elsif (defined $C[1][$map{$k}] and $p[0][$k]) { } 0 0 0
7823 0 ▶ my $s = $k ? ' (shifted)' : '';
Branch: 1 branch
BranchTrueFalseTotal
$k ? : 0 0 0
7824 warn "Key `$C[0][$k]'$s in layer $Hn->[0] does not match symbol $c[0][$k] in layer $hn->[0], and skipfix is requested...\n"
7825 0 ▶ unless ref($skipwarn || '') ? $skipwarn->{$c[0][$k]} : $skipwarn;
Branch: 2 branches
BranchTrueFalseTotal
unless ref($skipwarn || "") ? $$skipwarn{$c[0][$k]} : $skipwarn 0 0 0
ref($skipwarn || '') ? : 0 0 0
Condition0%0/2
$skipwarn || ''
l!l
00
MC/DC0%0/1
$skipwarn || ''
$skipwarn
Truth table0%0/2
A
A= $skipwarn
Aresult
11
00
7826 ▶ } elsif (defined $C[1][$map{$k}] and $p[0][$k]) {
Condition0%0/3
defined $C[1][$map{$k}] and $p[0][$k]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $C[1][$map{$k}] and $p[0][$k]
defined $C[1][$map{$k}] $p[0][$k]
Truth table0%0/3
A and B
A= defined $C[1][$map{$k}]B= $p[0][$k]
ABresult
0X0
100
111
7827 0 warn "Prefix `$c[0][$k]' in layer $hn->[0] obscured on a key with `$C[1][$map{$k}]' in layer=1: $Hn->[0]"
7828 } else {
7829 0 ▶ if (defined $C[1][$map{$k}]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $C[1][$map{$k}]) 0 0 0
7830 0 ▶ next if $seen_deobsc{$c[0][$k]}; # See ъЪ + palochkas obscuring \| on the secondary \|-key in RussianPhonetic
Branch: 1 branch
BranchTrueFalseTotal
if $seen_deobsc{$c[0][$k]} 0 0 0
7831 # So far, the only "obscuring" with useful de-obscuring is when the obscuring symbol is a letter
7832 0 ▶ die "existing secondary AltGr-binding `$C[1][$map{$k}]' blocks de-obscuring `$c[0][$k]';\n symbols to de-obscure are at positions [@symb0] in [@{$c[0]}]"
Branch: 1 branch
BranchTrueFalseTotal
unless ($C[0][$k] || ".") =~ /[\W\d_]/ 0 0 0
Condition0%0/2
$C[0][$k] || '.'
l!l
00
MC/DC0%0/1
$C[0][$k] || '.'
$C[0][$k]
Truth table0%0/2
A
A= $C[0][$k]
Aresult
11
00
7833 unless ($C[0][$k] || '.') =~ /[\W\d_]/;
7834 next
7835 0 }
7836 0 $H[1][$map{$k}] = $h[0][$k]; # !!!! Modify in place
7837 0 $seen_deobsc{$c[0][$k]}++;
7838 }
7839 }
7840 # Inherit keys from $h
7841 0 ▶ for my $L (0..($skipfix? -1 : $#H)) {
Branch: 1 branch
BranchTrueFalseTotal
$skipfix ? : 0 0 0
7842 0 for my $shift (0,1) {
7843 0 ▶ next if defined $H[$L][$shift];
Branch: 1 branch
BranchTrueFalseTotal
if defined $H[$L][$shift] 0 0 0
7844 0 $H[$L][$shift] = $h[$L][$shift];
7845 }
7846 }
7847 0 ▶ next if $already_linked;
Branch: 1 branch
BranchTrueFalseTotal
if $already_linked 0 0 0
7848 0 for my $i (0..@$hn) { # layer type
7849 0 for my $j (0,1) { # case
7850 #??? ++$seen_hex[$_]{ key2hex(($_ ? $key2 : $key1)->[$i][$j], 'undef') } for 0,1;
7851 0 ▶ push @{$self->{faces}{$hh}{need_extra_keys_to_access}{$HH}}, $H[$i][$j] if defined $C[$i][$j] and not defined $h[$i][$j];
Branch: 1 branch
BranchTrueFalseTotal
if defined $C[$i][$j] and not defined $h[$i][$j] 0 0 0
Condition0%0/3
defined $C[$i][$j] and not defined $h[$i][$j]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $C[$i][$j] and not defined $h[$i][$j]
defined $C[$i][$j] not defined $h[$i][$j]
Truth table0%0/3
A and not(B)
A= defined $C[$i][$j]B= not defined $h[$i][$j]
ABresult
0X0
100
111
7852 0 ▶ push @{$self->{faces}{$HH}{need_extra_keys_to_access}{$hh}}, $h[$i][$j] if defined $c[$i][$j] and not defined $H[$i][$j];
Branch: 1 branch
BranchTrueFalseTotal
if defined $c[$i][$j] and not defined $H[$i][$j] 0 0 0
Condition0%0/3
defined $c[$i][$j] and not defined $H[$i][$j]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $c[$i][$j] and not defined $H[$i][$j]
defined $c[$i][$j] not defined $H[$i][$j]
Truth table0%0/3
A and not(B)
A= defined $c[$i][$j]B= not defined $H[$i][$j]
ABresult
0X0
100
111
7853
7854 }
7855 }
7856 }
7857 }
7858
7859 # Make symbols from the first half-face ($h1) to be accessible in the second face ($H1/$H2)
7860 0 ▶sub link_layers ($$$;$$) { # Un-obscure non-alphanum bindings from the first keyboard
Subroutine link_layers: not called CC=11 SCAR=48.8
Pod undocumented
7861 0 my ($self, $hh, $HH, $skipfix, $skipwarn) = (shift, shift, shift, shift, shift); # [Main, AltGr-Main,...], [Secondary, AltGr-Secondary,...]
7862 0 $self->pre_link_layers ($hh, $HH, $skipfix, $skipwarn);
7863 #warn "Linking with FIX: $hh, $HH" unless $skipfix;
7864 # We expect that $hh is base-face, and $HH is a satellite.
7865 0 $self->face_make_backlinks($HH, $self->{faces}{$HH}{'[char2key_prefer_first]'}, $self->{faces}{$HH}{'[char2key_prefer_last]'}, $skipfix, 'skipwarn');
7866 # To insert Flip_AltGr_Key into a face, we need to know where it is on the base face, and put it into the corresponding
7867 # slot of the satellite face. After face_make_backlinks(), we can find it in the base face.
7868 # Moreover, we must do it BEFORE calling faces_link_via_backlinks().
7869 0 ▶ if (defined (my $flip = $self->{faces}{$hh}{'[Flip_AltGr_Key]'})) {{
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $flip = $self->{"faces"}{$hh}{"[Flip_AltGr_Key]"})) 0 0 0
7870 0 ▶ defined ( my $flipped = $self->{faces}{$HH}{'[invAltGr_Accessor]'} ) or last;
Branch: 1 branch
BranchTrueFalseTotal
defined(my $flipped = $self->{"faces"}{$HH}{"[invAltGr_Accessor]"}) or last 0 0 0
7871 # warn "adding AltGr-inv for $hh, accessor=", $self->key2hex($flipped);
7872 0 $flip = $self->charhex2key($flip);
7873 # warn "face_back on $hh: ", join ' ', keys %{$self->{face_back}{$hh} || {}};
7874 0 ▶ if (my $where = $self->{face_back}{$hh}{$flip}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $where = $self->{'face_back'}{$hh}{$flip}) { } 0 0 0
7875 0 my($l, $k, $shift) = @{ $where->[0] };
7876 # warn "Hex face_back l=$l, k=$k, shift-$shift on $hh";
7877 0 my($L, $expl, $dead) = ($self->{faces}{$HH}{layers}, '???');
7878 0 $L = $self->{layers}{$L->[$l]};
7879 0 my $C = my $c = $L->[$k][$shift];
7880 0 ▶ $c = $c->[0], $dead = $C->[2], $expl = $C->[3] || '???' if $c and ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if $c and ref $c 0 0 0
Condition0%0/5
$c and ref $c
!ll&&!rl&&r
000
$C->[3] || '???'
l!l
00
MC/DC0%0/2
$c and ref $c
$c ref $c
MC/DC0%0/1
$C->[3] || '???'
$C->[3]
Truth table0%0/3
A and B
A= $cB= ref $c
ABresult
0X0
100
111
Truth table0%0/2
A
A= $C->[3]
Aresult
11
00
7881 0 ▶ my $DEAD = $dead || '';
Condition0%0/2
$dead || ''
l!l
00
MC/DC0%0/1
$dead || ''
$dead
Truth table0%0/2
A
A= $dead
Aresult
11
00
7882 0 ▶ warn "adding Flip_AltGr => <<$flipped>> to $hh\'s satellite $HH: overwriting already present <<<$c>>> (via $expl), dead=$DEAD"
Branch: 1 branch
BranchTrueFalseTotal
if defined $c and $c ne $flipped || !$dead 0 0 0
Condition0%0/6
defined $c and $c ne $flipped || !$dead
!ll&&!rl&&r
000
$c ne $flipped or not $dead
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $c and $c ne $flipped || !$dead
defined $c $c ne $flipped not $dead
Truth table0%0/4
A and B or not(C)
A= defined $cB= $c ne $flippedC= not $dead
ABCresult
0XX0
1000
11X1
1011
7883 if defined $c and ($c ne $flipped or not $dead);
7884 0 $L->[$k][$shift] = [$flipped, undef, 1, 'Prefix for AltGr inversion'];
7885 0 delete $self->{faces}{$hh}{'Face_link_map'}{$HH}; # Reuse old copy
7886 # warn "Added to $HH; k=$k\[$l, $shift]";
7887 } else {
7888 0 warn "failed: adding AltGr-inv for $hh, flip=$flip, accessor=", $self->key2hex($flipped);
7889 }
7890 }}
7891 0 $self->face_make_backlinks($hh, $self->{faces}{$hh}{'[char2key_prefer_first]'}, $self->{faces}{$hh}{'[char2key_prefer_last]'}, 'skip');
7892 0 $self->faces_link_via_backlinks($hh, $HH);
7893 # $self->faces_link_via_backlinks($HH, $hh);
7894 }
7895
7896 0 ▶sub face_make_backlinks($$$$;$$) { # It is crucial to proceed layers in
Subroutine face_make_backlinks: not called CC=25 SCAR=64.8
Pod undocumented
7897 # parallel: otherwise the semantic of char2key_prefer_first suffers
7898 0 ▶ my ($self, $F, $prefer_first, $prefer_last, $skipfix, $skipwarn) = (shift, shift, shift || {}, shift || {}, shift, shift);
Condition0%0/4
shift() || {}
l!l
00
shift() || {}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
7899 #warn "Making backlinks for `$F'";
7900 0 my $LL = $self->{faces}{$F}{layers};
7901 0 ▶ if ($self->{face_back}{$F}) { # reuse old copy
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"face_back"}{$F}) 0 0 0
7902 0 ▶ return if $skipfix; # reuse old copy
Branch: 1 branch
BranchTrueFalseTotal
if $skipfix 0 0 0
7903 0 die "An obsolete copy of `$F' is cashed";
7904 }
7905 0 ▶ my $seen = ($self->{face_back}{$F} ||= {}); # maps char to array of possitions it appears in, each [key, shift]
Condition0%0/2
$self->{"face_back"}{$F} ||= {}
l!l
00
MC/DC0%0/1
$self->{"face_back"}{$F} ||= {}
$self->{"face_back"}{$F}
Truth table0%0/2
A
A= $self->{"face_back"}{$F}
Aresult
11
00
7906 # Since prefer_first should better operate in terms of keys, not layers; so the loop in $k should be the external one
7907 0 my $last = $#{ $self->{layers}{$LL->[0]} };
7908 0 my %warn;
7909 0 for my $k (0..$last) {
7910 0 for my $Lc (0..$#$LL) {
7911 0 my $L = $LL->[$Lc];
7912 # $self->layer_make_backlinks($_, $prefer_first) for @$L;
7913 0 my $a = $self->{layers}{$L};
7914 0 ▶ unless ($#$a == $last) { # Detect typos if we can (i.e., if no overflow into special ranges)
Branch: 1 branch
BranchTrueFalseTotal
unless ($a->$#* == $last) 0 0 0
7915 0 my $fst = 1e100; # infinity
7916 0 ▶ $fst > $_->[0] and $fst = $_->[0] for values %start_SEC;
Branch: 1 branch
BranchTrueFalseTotal
$fst > $_->[0] and $fst = $_->[0] 0 0 0
7917 0 ▶ die "Layer `$L' has lastchar $#$a, expected $last" unless $last >= $fst or $#$a >= $fst;
Branch: 1 branch
BranchTrueFalseTotal
unless $last >= $fst or $a->$#* >= $fst 0 0 0
Condition0%0/3
$last >= $fst or $a->$#* >= $fst
l!l&&r!l&&!r
000
MC/DC0%0/2
$last >= $fst or $a->$#* >= $fst
$last >= $fst $a->$#* >= $fst
Truth table0%0/3
A or B
A= $last >= $fstB= $a->$#* >= $fst
ABresult
1X1
011
000
7918 }
7919 ##########
7920 0 for my $shift (0..$#{$a->[$k]}) {
7921 0 ▶ next unless defined (my $c = $a->[$k][$shift]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $c = $a->[$k][$shift]) 0 0 0
7922 0 ▶ $c = $c->[0] if 'ARRAY' eq ref $c; # Treat prefix keys as usual chars
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $c 0 0 0
7923 0 ▶ if ($prefer_first->{$c}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prefer_first->{$c}) { } 0 0 0
7924 #warn "Layer `$L' char `$c': prefer first";
7925 0 ▶ @{ $seen->{$c} } = reverse @{ $seen->{$c} } if $seen->{$c} and $prefer_last->{$c}; # prefer 2nd of 3 (2nd from the end)
Branch: 1 branch
BranchTrueFalseTotal
if $seen->{$c} and $prefer_last->{$c} 0 0 0
Condition0%0/3
$seen->{$c} and $prefer_last->{$c}
!ll&&!rl&&r
000
MC/DC0%0/2
$seen->{$c} and $prefer_last->{$c}
$seen->{$c} $prefer_last->{$c}
Truth table0%0/3
A and B
A= $seen->{$c}B= $prefer_last->{$c}
ABresult
0X0
100
111
7926 0 push @{ $seen->{$c} }, [$Lc, $k, $shift];
7927 } else {
7928 0 ▶ $warn{$c}++ if @{ $seen->{$c} || [] } and not $prefer_last->{$c} and $c ne ' '; # XXXX Special-case ' ' ????
Branch: 1 branch
BranchTrueFalseTotal
if @{$seen->{$c} or [];} and not $prefer_last->{$c} and $c ne " " 0 0 0
Condition0%0/8
@{$seen->{$c} or [];} and not $prefer_last->{$c} and $c ne " "
!ll&&!rl&&r
000
@{$seen->{$c} or [];} and not $prefer_last->{$c}
!ll&&!rl&&r
000
$seen->{$c} || []
l!l
00
MC/DC0%0/3
@{$seen->{$c} or [];} and not $prefer_last->{$c} and $c ne " "
@{$seen->{$c} or [];} not $prefer_last->{$c} $c ne " "
MC/DC0%0/1
$seen->{$c} || []
$seen->{$c}
Truth table0%0/4
A and not(B) and C
A= @{$seen->{$c} or [];}B= not $prefer_last->{$c}C= $c ne " "
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/2
A
A= $seen->{$c}
Aresult
11
00
7929 0 unshift @{ $seen->{$c} }, [$Lc, $k, $shift];
7930 }
7931 }
7932 }
7933 }
7934 0 ▶ warn "The following chars appear several times in face `$F', but are not clarified\n\t (by `char2key_prefer_first', `char2key_prefer_last'):\n\t<",
Branch: 1 branch
BranchTrueFalseTotal
if %warn and not $skipwarn 0 0 0
Condition0%0/3
%warn and not $skipwarn
!ll&&!rl&&r
000
MC/DC0%0/2
%warn and not $skipwarn
%warn not $skipwarn
Truth table0%0/3
A and not(B)
A= %warnB= not $skipwarn
ABresult
0X0
100
111
7935 join('> <', sort keys %warn), '>' if %warn and not $skipwarn;
7936 }
7937
7938 0 ▶sub flip_layer_N ($$$) { # Increases layer number if number of layers is >2 (good for order Plain/AltGr/S-Ctrl)
Subroutine flip_layer_N: not called CC=2 SCAR=17.9
Pod undocumented
7939 0 my ($self, $N, $max) = (shift, shift, shift);
7940 0 ▶ return 0 if $N == $max;
Branch: 1 branch
BranchTrueFalseTotal
if $N == $max 0 0 0
7941 0 $N + 1
7942 }
7943
7944 0 ▶sub faces_link_via_backlinks($$$;$) { # It is crucial to proceed layers in
Subroutine faces_link_via_backlinks: not called CC=8 SCAR=42.8
Pod undocumented
7945 # parallel: otherwise the semantic of char2key_prefer_first suffers
7946 0 my ($self, $F1, $F2, $no_inic) = (shift, shift, shift, shift);
7947 0 ▶ return if $self->{faces}{$F1}{'Face_link_map'}{$F2}; # Reuse old copy
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"faces"}{$F1}{"Face_link_map"}{$F2} 0 0 0
7948 #warn "Making links for `$F1' -> `$F2'";
7949 0 ▶ my $seen = $self->{face_back}{$F1} or die "Panic: no backlinks on $F1!"; # maps char to array of positions it appears in, each [layer, key, shift]
Branch: 1 branch
BranchTrueFalseTotal
my $seen = $self->{"face_back"}{$F1} or die "Panic: no backlinks on $F1!" 0 0 0
7950 0 my $LL = $self->{faces}{$F2}{layers};
7951 #!$no_inic and $self->{layers}{'[ini_copy1]'}{$_} and warn "ini_copy1 of `$_' exists" for @$LL;
7952 #!$no_inic and $self->{layers}{'[ini_copy]'}{$_} and warn "ini_copy of `$_' exists" for @$LL;
7953 0 ▶ my @LL = map $self->{layers}{'[ini_copy1]'}{$_} || $self->{layers}{'[ini_copy]'}{$_} || $self->{layers}{$_}, @$LL;
Condition0%0/6
$self->{'layers'}{'[ini_copy1]'}{$_} || $self->{'layers'}{'[ini_copy]'}{$_} || $self->{'layers'}{$_}
l!l&&r!l&&!r
000
$self->{"layers"}{"[ini_copy1]"}{$_} or $self->{"layers"}{"[ini_copy]"}{$_}
l!l&&r!l&&!r
000
MC/DC0%0/3
$self->{'layers'}{'[ini_copy1]'}{$_} || $self->{'layers'}{'[ini_copy]'}{$_} || $self->{'layers'}{$_}
$self->{"layers"}{"[ini_copy1]"}{$_} $self->{"layers"}{"[ini_copy]"}{$_} $self->{'layers'}{$_}
Truth table0%0/4
A or B || C
A= $self->{"layers"}{"[ini_copy1]"}{$_}B= $self->{"layers"}{"[ini_copy]"}{$_}C= $self->{'layers'}{$_}
ABCresult
1XX1
01X1
0011
0000
7954 0 ▶ @LL = map $self->{layers}{$_}, @$LL if $no_inic;
Branch: 1 branch
BranchTrueFalseTotal
if $no_inic 0 0 0
7955 0 my($maxL, %r, %altR) = $#LL;
7956 # XXXX Must use $self->{layers}{'[ini_copy]'}{$L} for the target
7957 0 for my $c (sort keys %$seen) {
7958 0 my $arr = $seen->{$c};
7959 0 ▶ warn "Empty back-mapping array for `$c' in face `$F1'" unless @$arr;
Branch: 1 branch
BranchTrueFalseTotal
unless @$arr 0 0 0
7960 # if (@$arr > 1) {
7961 # }
7962 my ($to) = grep defined, (map {
7963 #warn "Check `$c': <@$_> ==> <", (defined $LL[$_->[0]][$_->[1]][$_->[2]] ? $LL[$_->[0]][$_->[1]][$_->[2]] : 'undef'), '>';
7964 0 $LL[$_->[0]][$_->[1]][$_->[2]]
7965 } @$arr);
7966 0 my ($To) = grep defined, (map { $LL[$self->flip_layer_N($_->[0], $maxL)][$_->[1]][$_->[2]] } @$arr);
7967 0 $r{$c} = $to; # Keep prefix keys as array refs
7968 0 $altR{$c} = $To; # Ditto
7969 }
7970 0 $self->{faces}{$F1}{'Face_link_map'}{$F2} = \%r;
7971 0 $self->{faces}{$F1}{'Face_link_map_INV'}{$F2} = \%altR;
7972 }
7973
7974 0 ▶sub charhex2key ($$) {
Subroutine charhex2key: not called CC=2 SCAR=17.9
Pod undocumented
7975 0 my ($self, $c) = (shift, shift);
7976 0 ▶ return chr hex $c if $c =~ /^[0-9a-f]{4,}$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $c =~ /^[0-9a-f]{4,}$/i 0 0 0
7977 0 $c
7978 }
7979
7980 0 ▶sub __manyHEX($$) { # for internal use only
Subroutine __manyHEX: not called CC=1 SCAR=6.9
7981 0 my ($self, $s) = (shift, shift);
7982 0 $s =~ s/\.?(\b[0-9a-f]{4,}\b)\.?/ chr hex $1 /ieg;
7983 0 $s
7984 }
7985
7986 0 ▶sub stringHEX2string ($$) { # One may surround HEX by ".", but only if needed. If not needed, "." is preserved...
Subroutine stringHEX2string: not called CC=1 SCAR=6.9
Pod undocumented
7987 0 my ($self, $s) = (shift, shift);
7988 0 $s =~ s/(?:\b\.)?((?:\b[0-9a-f]{4,}\b(?:\.\b)?)+)/ $self->__manyHEX("$1") /ieg;
7989 0 $s
7990 }
7991
7992 0 ▶sub layer_recipe ($$) {
Subroutine layer_recipe: not called CC=2 SCAR=17.9
Pod undocumented
7993 0 my ($self, $l) = (shift, shift);
7994 0 ▶ return unless exists $self->{layer_recipes}{$l};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"layer_recipes"}{$l} 0 0 0
7995 0 $self->recipe2str($self->{layer_recipes}{$l})
7996 }
7997
7998 0 ▶sub __dbg_latin_CtrlD ($) {
Subroutine __dbg_latin_CtrlD: not called CC=5 SCAR=34.0
7999 0 my $self = shift;
8000 0 my $Ln = $self->{faces}{Latin}{layers}[0];
8001 0 my $L = $self->{layers}{$Ln};
8002 0 my $Kn = $start_SEC{ARROWS}[0] + 14; # 14: RETURN 15: ADD
8003 0 my $K = $L->[$Kn][0]; # Unshifted
8004 0 ▶ $K = $K->[0] if ref $K;
Branch: 1 branch
BranchTrueFalseTotal
if ref $K 0 0 0
8005 0 ▶ die "Got \\x0d (=$K)" if $K and ($K eq "\x09" or $K eq '000d');
Branch: 1 branch
BranchTrueFalseTotal
if $K and $K eq "\t" || $K eq "000d" 0 0 0
Condition0%0/6
$K and $K eq "\t" || $K eq "000d"
!ll&&!rl&&r
000
$K eq "\t" or $K eq "000d"
l!l&&r!l&&!r
000
MC/DC0%0/3
$K and $K eq "\t" || $K eq "000d"
$K $K eq "\t" $K eq "000d"
Truth table0%0/4
A and B or C
A= $KB= $K eq "\t"C= $K eq "000d"
ABCresult
0XX0
1000
11X1
1011
8006 }
8007
8008 0 ▶sub revive_layer ($$$$) { # What is the difference with make_translated_layers()??? Supporting the fundamental layers???
Subroutine revive_layer: not called CC=4 SCAR=30.0
Pod undocumented
8009 0 my($self, $f, $ln, $l) = (shift, shift, shift, shift);
8010 0 ▶ next if $self->{layers}{$l}; # Else, auto-vivify
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"layers"}{$l} 0 0 0
8011 0 my $ll = $l;
8012 #warn "Creating layer `$l' for face `$f'...";
8013 0 my @r = $self->layer_recipe($l);
8014 0 ▶ $ll = $r[0] if @r;
Branch: 1 branch
BranchTrueFalseTotal
if @r 0 0 0
8015 0 warn "Massaging: Using layout_recipe `$ll' for layer '$l'\n" if debug_face_layout_recipes and exists $self->{layer_recipes}{$l};
8016 0 warn " mk_tr_lyrs 0" if debug_stacking_ord;
8017 0 $ll = $self->make_translated_layers($ll, $f, [$ln], '0000');
8018 #warn "... Result `@$ll' --> $self->{layers}{$ll->[0]}";
8019 (debug_face_layout_recipes and warn "Massaging: Using layout_recipe `$ll->[0]' for layer '$l'\n"),
8020 0 ▶ $self->{layers}{$l} = $self->{layers}{$ll->[0]} unless $self->{layers}{$l}; # Could autovivify in between???
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"layers"}{$l} 0 0 0
8021 }
8022
8023 1 my $w_o;
8024 0 ▶sub order_faces_4_massage ($) { # process LinkFace first (if no loops)
Subroutine order_faces_4_massage: not called CC=8 SCAR=42.8
Pod undocumented
8025 0 my($self, $prekeys) = (shift, 1e300);
8026 0 my(@res, @RES, %seen) = [sort keys %{$self->{faces}}];
8027 0 ▶ while ($prekeys > $#{$res[-1]}) { # Construct chains of LinkFace'ing; next element is made of linkface's of the previous one
Branch: 1 branch
BranchTrueFalseTotal
if ($prekeys > $#{$res[-1];}) 0 0 0
8028 0 $prekeys = $#{$res[-1]};
8029 0 push @res, [];
8030 0 for my $f (@{$res[-2]}) {
8031 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8032 0 ▶ if (my $LF = $self->{faces}{$f}{LinkFace}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $LF = $self->{"faces"}{$f}{"LinkFace"}) 0 0 0
8033 0 push @{$res[-1]}, $LF;
8034 }
8035 }
8036 }
8037 0 for my $r (reverse @res) {
8038 0 push @RES, grep !$seen{$_}++, sort @$r; # reverse? ??? Voodoo !!! Sorting changes the result... XXXX
8039 }
8040 0 ▶ warn 'Face order `', join("' `", @RES), "'" unless $w_o++;
Branch: 1 branch
BranchTrueFalseTotal
unless $w_o++ 0 0 0
8041 @RES
8042 0 }
8043
8044
8045 0 ▶sub massage_faces ($) {
Subroutine massage_faces: not called CC=158 SCAR=101.3
Pod undocumented
8046 0 my $self = shift;
8047 # warn "Massaging faces...";
8048 0 for my $f ($self->order_faces_4_massage) { # Needed for (pre_)link_layers...
8049 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8050 #warn "Massaging face `$f'...";
8051 0 for my $key ( qw( Flip_AltGr_Key Diacritic_if_undef DeadChar_DefaultTranslation DeadChar_32bitTranslation extra_report_DeadChar
8052 PrefixChains ctrl_after_modcol create_alpha_ctrl keep_missing_ctrl output_layers
8053 output_layers_WIN output_layers_XKB skip_extra_layers_WIN Prefix_Base_Altern Prefix_Force_Altern
8054 layers_modifiers layers_mods_keys mods_keys_KBD AltGrInv_AltGr_as_Ctrl
8055 ComposeKey_Show AltGr_Invert_Show Apple_Override Apple_Duplicate Apple_HexInput
8056 ComposeKey Explicit_AltGr_Invert Auto_Diacritic_Start CapsLOCKoverride
8057 WindowsEmitDeadkeyDescrREX ExtraChars modkeys_vk) ) {
8058 0 $self->{faces}{$f}{"[$key]"} = $self->get_deep_via_parents($self, undef, 'faces', (split m(/), $f), $key);
8059 }
8060 $self->{faces}{$f}{'[char2key_prefer_first]'}{$_}++ # Make a hash
8061 0 ▶ for @{ $self->{faces}{$f}{char2key_prefer_first} || [] } ;
Condition0%0/2
$self->{'faces'}{$f}{'char2key_prefer_first'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'char2key_prefer_first'} || []
$self->{'faces'}{$f}{'char2key_prefer_first'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'char2key_prefer_first'}
Aresult
11
00
8062 $self->{faces}{$f}{'[char2key_prefer_last]'}{$_}++ # Make a hash
8063 0 ▶ for @{ $self->{faces}{$f}{char2key_prefer_last} || [] } ;
Condition0%0/2
$self->{'faces'}{$f}{'char2key_prefer_last'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'char2key_prefer_last'} || []
$self->{'faces'}{$f}{'char2key_prefer_last'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'char2key_prefer_last'}
Aresult
11
00
8064 0 ▶ $self->{faces}{$f}{'[AltGrInv_AltGr_as_Ctrl]'} = 1 unless defined $self->{faces}{$f}{'[AltGrInv_AltGr_as_Ctrl]'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"faces"}{$f}{"[AltGrInv_AltGr_as_Ctrl]"} 0 0 0
8065
8066 0 my $idx = $self->get_deep($self, 'faces', (split m(/), $f), 'MetaData_Index');
8067 # defined $self->{faces}{$f}{"[$_]"} and not ref $self->{faces}{$f}{"[$_]"}
8068 # or
8069 $self->{faces}{$f}{"[$_]"} = $self->get_deep_via_parents($self, $idx, 'faces', (split m(/), $f), $_)
8070 0 for qw(LRM_RLM ALTGR SHIFTLOCK NOALTGR);
8071
8072 0 my %R = qw(ComposeKey_Show ⎄ AltGr_Invert_Show ⤨); # On Apple only
8073 0 ▶ defined $self->{faces}{$f}{"[$_]"} or $self->{faces}{$f}{"[$_]"} = $R{$_} for keys %R;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{"faces"}{$f}{"[$_]"} or $self->{"faces"}{$f}{"[$_]"} = $R{$_} 0 0 0
8074 $self->{faces}{$f}{"[ComposeKey_Show]"}[0] = '⎄' # Make a safe default
8075 0 ▶ if ref $self->{faces}{$f}{"[ComposeKey_Show]"} and not length $self->{faces}{$f}{"[ComposeKey_Show]"}[0];
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"faces"}{$f}{"[ComposeKey_Show]"} and not length $self->{"faces"}{$f}{"[ComposeKey_Show]"}[0] 0 0 0
Condition0%0/3
ref $self->{"faces"}{$f}{"[ComposeKey_Show]"} and not length $self->{"faces"}{$f}{"[ComposeKey_Show]"}[0]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $self->{"faces"}{$f}{"[ComposeKey_Show]"} and not length $self->{"faces"}{$f}{"[ComposeKey_Show]"}[0]
ref $self->{"faces"}{$f}{"[ComposeKey_Show]"} not length $self->{"faces"}{$f}{"[ComposeKey_Show]"}[0]
Truth table0%0/3
A and not(B)
A= ref $self->{"faces"}{$f}{"[ComposeKey_Show]"}B= not length $self->{"faces"}{$f}{"[ComposeKey_Show]"}[0]
ABresult
0X0
100
111
8076
8077 0 my ($compK, %compK) = $self->{faces}{$f}{'[ComposeKey]'};
8078 0 ▶ if ($compK and ref $compK) {
Branch: 2 branches
BranchTrueFalseTotal
if ($compK and ref $compK) { } 0 0 0
elsif (defined $compK) { } 0 0 0
Condition0%0/3
$compK and ref $compK
!ll&&!rl&&r
000
MC/DC0%0/2
$compK and ref $compK
$compK ref $compK
Truth table0%0/3
A and B
A= $compKB= ref $compK
ABresult
0X0
100
111
8079 0 for my $cK (@$compK) {
8080 0 my @kkk = split /,/, $cK;
8081 0 ▶ $compK{ $self->key2hex($self->charhex2key($kkk[3])) }++ if defined $kkk[3] and length $kkk[3];
Branch: 1 branch
BranchTrueFalseTotal
if defined $kkk[3] and length $kkk[3] 0 0 0
Condition0%0/3
defined $kkk[3] and length $kkk[3]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $kkk[3] and length $kkk[3]
defined $kkk[3] length $kkk[3]
Truth table0%0/3
A and B
A= defined $kkk[3]B= length $kkk[3]
ABresult
0X0
100
111
8082 }
8083 } elsif (defined $compK) {
8084 0 $compK{ $self->key2hex($self->charhex2key($compK)) }++;
8085 }
8086 0 $self->{faces}{$f}{'[ComposeKeys]'} = \%compK;
8087
8088 0 ▶ unless ($self->{faces}{$f}{layers}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"faces"}{$f}{"layers"}) 0 0 0
8089 0 ▶ next unless $self->{face_recipes}{$f};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"face_recipes"}{$f} 0 0 0
8090 0 $self->face_by_face_recipe($f, $f);
8091 }
8092 0 ▶ for my $ln ( 0..$#{$self->{faces}{$f}{layers} || []} ) {
Condition0%0/2
$self->{'faces'}{$f}{'layers'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'layers'} || []
$self->{'faces'}{$f}{'layers'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'layers'}
Aresult
11
00
8093 0 my $l = $self->{faces}{$f}{layers}[$ln];
8094 0 ▶ $self->revive_layer($f, $ln, $l) unless $self->{layers}{$l};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"layers"}{$l} 0 0 0
8095 }
8096 ### warn "Layer names (face=`$f', layer[0]=`$self->{faces}{$f}{layers}[0]'):\n\t`", join("'\n\t`", sort keys %{$self->{layers}}), "'"
8097 ### if debug_face_layout_recipes or not defined $self->{layers}{$self->{faces}{$f}{layers}[0]};
8098 }
8099
8100 0 for my $f ($self->order_faces_4_massage) { # Needed for LinkFace inside massage_VK()... Breaks CopticTens etc.
8101 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8102 0 (my ($seen, $seen_dead), $self->{faces}{$f}{'[dead_in_VK]'}) = $self->massage_VK($f);
8103 0 $self->{faces}{$f}{'[dead_in_VK_array]'} = $seen_dead;
8104 0 $self->{faces}{$f}{'[coverage_hex]'}{$self->key2hex($_)}++ for @$seen;
8105 $self->{faces}{$f}{"Altern$_"} ||= $self->{faces}{$f}{"AltGr$_"}
8106 0 ▶ for qw(CharSubstitutions CharSubstitutionFaces CharSubstitutionLayers);
Condition0%0/3
$self->{"faces"}{$f}{"Altern$_"} ||= $self->{"faces"}{$f}{"AltGr$_"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"faces"}{$f}{"Altern$_"} ||= $self->{"faces"}{$f}{"AltGr$_"}
$self->{"faces"}{$f}{"Altern$_"} $self->{"faces"}{$f}{"AltGr$_"}
Truth table0%0/3
A ||= B
A= $self->{"faces"}{$f}{"Altern$_"}B= $self->{"faces"}{$f}{"AltGr$_"}
ABresult
1X1
011
000
8107 # Obsolete names
8108 0 ▶ for my $S (@{ $self->{faces}{$f}{AlternCharSubstitutions} || []}) {
Condition0%0/2
$self->{'faces'}{$f}{'AlternCharSubstitutions'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'AlternCharSubstitutions'} || []
$self->{'faces'}{$f}{'AlternCharSubstitutions'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'AlternCharSubstitutions'}
Aresult
11
00
8109 0 my $s = $self->stringHEX2string($S);
8110 0 $s =~ s/\p{Blank}(?=\p{NonspacingMark})//g;
8111 0 ▶ die "Expect 2 chars in AltGr-char substitution rule; I see <$s> (from <$S>)" unless 2 == (my @s = split //, $s);
Branch: 1 branch
BranchTrueFalseTotal
unless 2 == (my @s = split(//, $s, 0)) 0 0 0
8112 0 push @{ $self->{faces}{$f}{'[AltSubstitutions]'}{$s[0]} }, [$s[1], 'manual'];
8113 0 ▶ push @{ $self->{faces}{$f}{'[AltSubstitutions]'}{lc $s[0]} }, [lc $s[1], 'manual']
Branch: 1 branch
BranchTrueFalseTotal
if &UI::KeyboardLayout::lc($s[0]) ne $s[0] and &UI::KeyboardLayout::lc($s[1]) ne $s[1] 0 0 0
Condition0%0/3
&UI::KeyboardLayout::lc($s[0]) ne $s[0] and &UI::KeyboardLayout::lc($s[1]) ne $s[1]
!ll&&!rl&&r
000
MC/DC0%0/2
&UI::KeyboardLayout::lc($s[0]) ne $s[0] and &UI::KeyboardLayout::lc($s[1]) ne $s[1]
&UI::KeyboardLayout::lc($s[0]) ne $s[0] &UI::KeyboardLayout::lc($s[1]) ne $s[1]
Truth table0%0/3
A and B
A= &UI::KeyboardLayout::lc($s[0]) ne $s[0]B= &UI::KeyboardLayout::lc($s[1]) ne $s[1]
ABresult
0X0
100
111
8114 if lc $s[0] ne $s[0] and lc $s[1] ne $s[1];
8115 0 ▶ push @{ $self->{faces}{$f}{'[AltSubstitutions]'}{uc $s[0]} }, [uc $s[1], 'manual']
Branch: 1 branch
BranchTrueFalseTotal
if &UI::KeyboardLayout::uc($s[0]) ne $s[0] and &UI::KeyboardLayout::uc($s[1]) ne $s[1] 0 0 0
Condition0%0/3
&UI::KeyboardLayout::uc($s[0]) ne $s[0] and &UI::KeyboardLayout::uc($s[1]) ne $s[1]
!ll&&!rl&&r
000
MC/DC0%0/2
&UI::KeyboardLayout::uc($s[0]) ne $s[0] and &UI::KeyboardLayout::uc($s[1]) ne $s[1]
&UI::KeyboardLayout::uc($s[0]) ne $s[0] &UI::KeyboardLayout::uc($s[1]) ne $s[1]
Truth table0%0/3
A and B
A= &UI::KeyboardLayout::uc($s[0]) ne $s[0]B= &UI::KeyboardLayout::uc($s[1]) ne $s[1]
ABresult
0X0
100
111
8116 if uc $s[0] ne $s[0] and uc $s[1] ne $s[1];
8117 }
8118 0 ▶ s/^\s+//, s/\s+$//, $_ = $self->stringHEX2string($_) for @{ $self->{faces}{$f}{Import_Prefix_Keys} || []};
Condition0%0/2
$self->{'faces'}{$f}{'Import_Prefix_Keys'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'Import_Prefix_Keys'} || []
$self->{'faces'}{$f}{'Import_Prefix_Keys'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'Import_Prefix_Keys'}
Aresult
11
00
8119 0 ▶ my %h = @{ $self->{faces}{$f}{Import_Prefix_Keys} || []};
Condition0%0/2
$self->{'faces'}{$f}{'Import_Prefix_Keys'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'Import_Prefix_Keys'} || []
$self->{'faces'}{$f}{'Import_Prefix_Keys'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'Import_Prefix_Keys'}
Aresult
11
00
8120 0 ▶ $self->{faces}{$f}{'[imported2key]'} = \%h if %h;
Branch: 1 branch
BranchTrueFalseTotal
if %h 0 0 0
8121 0 my ($l0, $c);
8122 0 ▶ unless ($c = $self->{layer_counts}{$l0 = $self->{faces}{$f}{layers}[0]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c = $self->{"layer_counts"}{$l0 = $self->{"faces"}{$f}{"layers"}[0]}) 0 0 0
8123 0 $l0 = $self->get_deep_via_parents($self, undef, 'faces', (split m(/), $f), 'geometry_via_layer');
8124 0 ▶ $c = $self->{layer_counts}{$l0} if defined $l0;
Branch: 1 branch
BranchTrueFalseTotal
if defined $l0 0 0 0
8125 }
8126 0 ▶ my $o = $self->{layer_offsets}{$l0} if defined $l0;
Branch: 1 branch
BranchTrueFalseTotal
if defined $l0 0 0 0
8127 0 ▶ $self->{faces}{$f}{'[geometry]'} = $c if $c;
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
8128 0 ▶ $self->{faces}{$f}{'[g_offsets]'} = $o if $o;
Branch: 1 branch
BranchTrueFalseTotal
if $o 0 0 0
8129 }
8130 # $self->__dbg_latin_CtrlD;
8131 0 for my $f ($self->order_faces_4_massage) { # Needed for face_make_backlinks: must know which keys in faces will be finally present
8132 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8133 0 ▶ for my $F (@{ $self->{faces}{$f}{AlternCharSubstitutionFaces} || []}) { # Now has a chance to have real layers
Condition0%0/2
$self->{'faces'}{$f}{'AlternCharSubstitutionFaces'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'AlternCharSubstitutionFaces'} || []
$self->{'faces'}{$f}{'AlternCharSubstitutionFaces'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'AlternCharSubstitutionFaces'}
Aresult
11
00
8134 0 ▶ unless ($self->{faces}{$F}{layers}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"faces"}{$F}{"layers"}) 0 0 0
8135 0 ▶ next unless $self->{face_recipes}{$F};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"face_recipes"}{$F} 0 0 0
8136 0 $self->face_by_face_recipe($F, $f);
8137 }
8138 0 for my $L (0..$#{$self->{faces}{$f}{layers}}) {
8139 0 my $from = $self->{faces}{$f}{layers}[$L];
8140 0 ▶ next unless my $to = $self->{faces}{$F}{layers}[$L];
Branch: 1 branch
BranchTrueFalseTotal
unless my $to = $self->{"faces"}{$F}{"layers"}[$L] 0 0 0
8141 0 $_ = $self->{layers}{$_} for $from, $to;
8142 0 for my $k (0..$#$from) {
8143 0 ▶ next unless $from->[$k] and $to->[$k];
Branch: 1 branch
BranchTrueFalseTotal
unless $from->[$k] and $to->[$k] 0 0 0
Condition0%0/3
$from->[$k] and $to->[$k]
!ll&&!rl&&r
000
MC/DC0%0/2
$from->[$k] and $to->[$k]
$from->[$k] $to->[$k]
Truth table0%0/3
A and B
A= $from->[$k]B= $to->[$k]
ABresult
0X0
100
111
8144 0 for my $shift (0..1) {
8145 0 ▶ next unless defined (my $s = $from->[$k][$shift]) and defined (my $ss = $to->[$k][$shift]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $s = $from->[$k][$shift]) and defined(my $ss = $to->[$k][$shift]) 0 0 0
Condition0%0/3
defined(my $s = $from->[$k][$shift]) and defined(my $ss = $to->[$k][$shift])
!ll&&!rl&&r
000
MC/DC0%0/2
defined(my $s = $from->[$k][$shift]) and defined(my $ss = $to->[$k][$shift])
defined(my $s = $from->[$k][$shift]) defined(my $ss = $to->[$k][$shift])
Truth table0%0/3
A and B
A= defined(my $s = $from->[$k][$shift])B= defined(my $ss = $to->[$k][$shift])
ABresult
0X0
100
111
8146 0 ▶ $_ and ref and $_ = $_->[0] for $s, $ss;
Branch: 1 branch
BranchTrueFalseTotal
$_ and ref $_ and $_ = $_->[0] 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
8147 0 push @{ $self->{faces}{$f}{'[AltSubstitutions]'}{$s} }, [$ss, "F=$F"];
8148 }
8149 }
8150 }
8151 }
8152 } # ^^^ This is not used yet???
8153 # $self->__dbg_latin_CtrlD;
8154 0 for my $f ($self->order_faces_4_massage) { # Needed for face_make_backlinks: must know which keys in faces will be finally present
8155 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8156 0 my $linked = $self->{faces}{$f}{LinkFace};
8157 0 ▶ for my $N (0..$#{ $self->{faces}{$f}{AlternCharSubstitutionLayers} || []}) { # Now has a chance to have real layers
Condition0%0/2
$self->{'faces'}{$f}{'AlternCharSubstitutionLayers'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'AlternCharSubstitutionLayers'} || []
$self->{'faces'}{$f}{'AlternCharSubstitutionLayers'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'AlternCharSubstitutionLayers'}
Aresult
11
00
8158 0 my $TO = my $to = $self->{faces}{$f}{AlternCharSubstitutionLayers}[$N];
8159 0 ▶ my $from = $self->{faces}{$f}{layers}[$N] or next;
Branch: 1 branch
BranchTrueFalseTotal
my $from = $self->{"faces"}{$f}{"layers"}[$N] or next 0 0 0
8160 0 ▶ $self->revive_layer($f, $N, $TO) unless $self->{layers}{$TO};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"layers"}{$TO} 0 0 0
8161 0 $_ = $self->{layers}{$_} for $from, $to;
8162 0 my $from_linked;
8163 0 ▶ if ($linked) {
Branch: 1 branch
BranchTrueFalseTotal
if ($linked) 0 0 0
8164 0 $from_linked = $self->{faces}{$linked}{layers}[$N];
8165 0 ▶ $from_linked = $self->{layers}{$from_linked} if defined $from_linked;
Branch: 1 branch
BranchTrueFalseTotal
if defined $from_linked 0 0 0
8166 }
8167 0 for my $k (0..$#$from) {
8168 0 ▶ next unless ($from->[$k] or $from_linked and $from_linked->[$k]) and $to->[$k];
Branch: 1 branch
BranchTrueFalseTotal
unless $from->[$k] || $from_linked && $from_linked->[$k] and $to->[$k] 0 0 0
Condition0%0/9
$from->[$k] || $from_linked && $from_linked->[$k] and $to->[$k]
!ll&&!rl&&r
000
$from->[$k] or $from_linked and $from_linked->[$k]
l!l&&r!l&&!r
000
$from_linked and $from_linked->[$k]
!ll&&!rl&&r
000
MC/DC0%0/4
$from->[$k] || $from_linked && $from_linked->[$k] and $to->[$k]
$from->[$k] $from_linked $from_linked->[$k] $to->[$k]
Truth table0%0/6
A or B and C and D
A= $from->[$k]B= $from_linkedC= $from_linked->[$k]D= $to->[$k]
ABCDresult
00XX0
010X0
1XX00
01100
1XX11
01111
8169 0 for my $shift (0..1) {
8170 0 ▶ next unless defined (my $s = ($from->[$k][$shift] or $from_linked and $from_linked->[$k][$shift]))
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $s = $from->[$k][$shift] || $from_linked && $from_linked->[$k][$shift]) and defined(my $ss = $to->[$k][$shift]) 0 0 0
Condition0%0/9
defined(my $s = $from->[$k][$shift] || $from_linked && $from_linked->[$k][$shift]) and defined(my $ss = $to->[$k][$shift])
!ll&&!rl&&r
000
$from->[$k][$shift] || $from_linked && $from_linked->[$k][$shift]
l!l&&r!l&&!r
000
$from_linked and $from_linked->[$k][$shift]
!ll&&!rl&&r
000
MC/DC0%0/4
defined(my $s = $from->[$k][$shift] || $from_linked && $from_linked->[$k][$shift]) and defined(my $ss = $to->[$k][$shift])
$from->[$k][$shift] $from_linked $from_linked->[$k][$shift] defined(my $ss = $to->[$k][$shift])
Truth table0%0/6
A || B and C and D
A= $from->[$k][$shift]B= $from_linkedC= $from_linked->[$k][$shift]D= defined(my $ss = $to->[$k][$shift])
ABCDresult
00XX0
010X0
1XX00
01100
1XX11
01111
8171 and defined (my $ss = $to->[$k][$shift]);
8172 0 ▶ $_ and ref and $_ = $_->[0] for $s, $ss;
Branch: 1 branch
BranchTrueFalseTotal
$_ and ref $_ and $_ = $_->[0] 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
8173 0 push @{ $self->{faces}{$f}{'[AltSubstitutions]'}{$s} }, [$ss, "L=$TO"];
8174 }
8175 }
8176 }
8177 0 ▶ if ($f =~ /^(Latin|CyrillicPhonetic|GreekPoly|Hebrew)$/ and $self->{faces}{$f}{'[AltSubstitutions]'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f =~ /^(Latin|CyrillicPhonetic|GreekPoly|Hebrew)$/ and $self->{"faces"}{$f}{"[AltSubstitutions]"}) 0 0 0
Condition0%0/3
$f =~ /^(Latin|CyrillicPhonetic|GreekPoly|Hebrew)$/ and $self->{"faces"}{$f}{"[AltSubstitutions]"}
!ll&&!rl&&r
000
MC/DC0%0/2
$f =~ /^(Latin|CyrillicPhonetic|GreekPoly|Hebrew)$/ and $self->{"faces"}{$f}{"[AltSubstitutions]"}
$f =~ /^(Latin|CyrillicPhonetic|GreekPoly|Hebrew)$/ $self->{"faces"}{$f}{"[AltSubstitutions]"}
Truth table0%0/3
A and B
A= $f =~ /^(Latin|CyrillicPhonetic|GreekPoly|Hebrew)$/B= $self->{"faces"}{$f}{"[AltSubstitutions]"}
ABresult
0X0
100
111
8178 0 warn " `$f' AltSubstitutions: ", join '', sort keys %{$self->{faces}{$f}{'[AltSubstitutions]'}};
8179 }
8180 }
8181 # $self->__dbg_latin_CtrlD;
8182 0 for my $f ($self->order_faces_4_massage) { # Linking uses the number of slots in layer 0 as the limit; fill to make into max
8183 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8184 0 my $L = $self->{faces}{$f}{layers};
8185 0 my @last = map $#{$self->{layers}{$_}}, @$L;
8186 0 my $last = $last[0];
8187 0 ▶ $last < $_ and $last = $_ for @last;
Branch: 1 branch
BranchTrueFalseTotal
$last < $_ and $last = $_ 0 0 0
8188 0 push @{$self->{layers}{$L->[0]}}, [] for 1..($last-$last[0]);
8189 }
8190 # $self->__dbg_latin_CtrlD;
8191 0 for my $f ($self->order_faces_4_massage) { # Needed for face_make_backlinks: must know which keys in faces will be finally present
8192 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8193 0 ▶ next unless defined (my $o = $self->{faces}{$f}{LinkFace});
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $o = $self->{"faces"}{$f}{"LinkFace"}) 0 0 0
8194 0 $self->export_layers($o, $f); # Process recipes
8195 0 $self->pre_link_layers($o, $f); # May add keys to $f
8196 # warn("pre_link <$o> <$f>\n") if defined $o;
8197 }
8198 # $self->__dbg_latin_CtrlD;
8199 0 for my $f ($self->order_faces_4_massage) {
8200 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8201 0 $self->face_make_backlinks($f, $self->{faces}{$f}{'[char2key_prefer_first]'}, $self->{faces}{$f}{'[char2key_prefer_last]'});
8202 }
8203 # $self->__dbg_latin_CtrlD;
8204 0 for my $f ($self->order_faces_4_massage) {
8205 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8206 0 my $o = $self->{faces}{$f}{LinkFace};
8207 0 ▶ next unless defined $o;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 0 0
8208 0 $self->faces_link_via_backlinks($f, $o);
8209 0 $self->faces_link_via_backlinks($o, $f);
8210 }
8211 # $self->__dbg_latin_CtrlD;
8212 0 for my $f ($self->order_faces_4_massage) {
8213 0 ▶ next if 'HASH' ne ref $self->{faces}{$f} or $f =~ m(\bVK$); # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$f} or $f =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$f} $f =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$f}B= $f =~ /\bVK$/
ABresult
1X1
011
000
8214 0 ▶ if (defined( my $r = $self->{faces}{$f}{"[CapsLOCKoverride]"} )) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $r = $self->{"faces"}{$f}{"[CapsLOCKoverride]"})) 0 0 0
8215 0 warn "Massaging CapsLock for face `$f'...\n" if debug_face_layout_recipes;
8216 0 $self->{faces}{$f}{'[CapsLOCKlayers]'} = $self->layers_by_face_recipe($r, $f, $r);
8217 }
8218 0 ▶ my ($DDD, $export, $vk) = map $self->{faces}{$f}{"[$_]"} ||= {}, qw(DEAD export dead_in_VK);
Condition0%0/2
$self->{"faces"}{$f}{"[$_]"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"faces"}{$f}{"[$_]"} ||= {}
$self->{"faces"}{$f}{"[$_]"}
Truth table0%0/2
A
A= $self->{"faces"}{$f}{"[$_]"}
Aresult
11
00
8219 0 ▶ my ($ddd) = map $self->{faces}{$f}{"[$_]"} ||= [], qw(dead);
Condition0%0/2
$self->{"faces"}{$f}{"[$_]"} ||= []
l!l
00
MC/DC0%0/1
$self->{"faces"}{$f}{"[$_]"} ||= []
$self->{"faces"}{$f}{"[$_]"}
Truth table0%0/2
A
A= $self->{"faces"}{$f}{"[$_]"}
Aresult
11
00
8220 0 $self->coverage_hex($f);
8221 0 my $S = $self->{faces}{$f}{layers};
8222 0 my ($c,%s,@d) = 0;
8223 0 ▶ for my $D (@{$self->{faces}{$f}{layerDeadKeys} || []}) { # deprecated...
Condition0%0/2
$self->{'faces'}{$f}{'layerDeadKeys'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'layerDeadKeys'} || []
$self->{'faces'}{$f}{'layerDeadKeys'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'layerDeadKeys'}
Aresult
11
00
8224 0 ▶ $c++, next unless length $D; # or $D ~= /^\s*--+$/ ; # XXX How to put empty elements in an array???
Branch: 1 branch
BranchTrueFalseTotal
unless length $D 0 0 0
8225 0 $D =~ s/^\s+//;
8226 0 (my $name, my @k) = split /\s+/, $D;
8227 0 @k = map $self->charhex2key($_), @k;
8228 die "name of layerDeadKeys' element in face `$f' does not match:\n\tin `$D'\n\t`$name' vs `$self->{faces}{$f}{layers}[$c]'"
8229 0 ▶ unless $self->{faces}{$f}{layers}[$c] =~ /^\Q$name\E(<.*>)?$/; # Name might have changed in VK processing
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"faces"}{$f}{"layers"}[$c] =~ /^\Q$name\E(<.*>)?$/ 0 0 0
8230 0 ▶ 1 < length and die "not a character as a deadkey: `$_'" for @k;
Branch: 1 branch
BranchTrueFalseTotal
1 < length $_ and die "not a character as a deadkey: `${_}'" 0 0 0
8231 0 $ddd->[$c] = {map +($_,1), @k};
8232 0 ▶ ($s{$_}++ or push @d, $_), $DDD->{$_} = 1 for @k;
Branch: 1 branch
BranchTrueFalseTotal
$s{$_}++ or push @d, $_ 0 0 0
8233 0 $c++;
8234 }
8235 0 ▶ for my $k (split /\p{Blank}+(?:\|{3}\p{Blank}+)?/,
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'faces'}{$f}{'faceDeadKeys'} ? : 0 0 0
8236 (defined $self->{faces}{$f}{faceDeadKeys} ? $self->{faces}{$f}{faceDeadKeys} : '')) {
8237 0 ▶ next unless length $k;
Branch: 1 branch
BranchTrueFalseTotal
unless length $k 0 0 0
8238 0 $k = $self->charhex2key($k);
8239 0 ▶ 1 < length $k and die "not a character as a deadkey: `$k'";
Branch: 1 branch
BranchTrueFalseTotal
1 < length $k and die "not a character as a deadkey: `${k}'" 0 0 0
8240 0 $ddd->[$_]{$k} = 1 for 0..$#{ $self->{faces}{$f}{layers} }; # still used...
8241 0 $DDD->{$k} = 1;
8242 0 ▶ $s{$k}++ or push @d, $k;
Branch: 1 branch
BranchTrueFalseTotal
$s{$k}++ or push @d, $k 0 0 0
8243 }
8244 0 ▶ for my $k (split /\p{Blank}+/, (defined $self->{faces}{$f}{ExportDeadKeys} ? $self->{faces}{$f}{ExportDeadKeys} : '')) {
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'faces'}{$f}{'ExportDeadKeys'} ? : 0 0 0
8245 0 ▶ next unless length $k;
Branch: 1 branch
BranchTrueFalseTotal
unless length $k 0 0 0
8246 0 $k = $self->charhex2key($k);
8247 0 ▶ 1 < length $k and die "not a character as an exported deadkey: `$k'";
Branch: 1 branch
BranchTrueFalseTotal
1 < length $k and die "not a character as an exported deadkey: `${k}'" 0 0 0
8248 0 $export->{$k} = 1;
8249 }
8250 0 ▶ if (my $LL = $self->{faces}{$f}{'[ini_layers]'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $LL = $self->{'faces'}{$f}{'[ini_layers]'}) { } 0 0 0
8251 0 my @out;
8252 0 for my $L ( @$LL ) {
8253 0 push @out, "$L++prefix+";
8254 0 my $l = $self->{layers}{$out[-1]} = $self->deep_copy($self->{layers}{$L});
8255 0 for my $n (0 .. $#$l) {
8256 0 my $K = $l->[$n];
8257 0 for my $k (@$K) {
8258 #warn "face `$f' layer `$L' ini_layers_prefix: key `$k' marked as a deadkey" if defined $k and $DDD->{$k};
8259 0 ▶ $k = [$k] if defined $k and not ref $k; # Allow addition of doc strings
Branch: 1 branch
BranchTrueFalseTotal
if defined $k and not ref $k 0 0 0
Condition0%0/3
defined $k and not ref $k
!ll&&!rl&&r
000
MC/DC0%0/2
defined $k and not ref $k
defined $k not ref $k
Truth table0%0/3
A and not(B)
A= defined $kB= not ref $k
ABresult
0X0
100
111
8260 0 ▶ if (defined $k and ($DDD->{$k->[0]} or $vk->{$k->[0]})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $k and $$DDD{$k->[0]} || $$vk{$k->[0]}) 0 0 0
Condition0%0/6
defined $k and $$DDD{$k->[0]} || $$vk{$k->[0]}
!ll&&!rl&&r
000
$$DDD{$k->[0]} or $$vk{$k->[0]}
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $k and $$DDD{$k->[0]} || $$vk{$k->[0]}
defined $k $$DDD{$k->[0]} $$vk{$k->[0]}
Truth table0%0/4
A and B or C
A= defined $kB= $$DDD{$k->[0]}C= $$vk{$k->[0]}
ABCresult
0XX0
1000
11X1
1011
8261 0 ▶ @$k[1,2] = ($f, $k->[2] || ($export->{$k->[0]} ? 2 : 1)); # Is exportable?
Branch: 1 branch
BranchTrueFalseTotal
$$export{$k->[0]} ? : 0 0 0
Condition0%0/3
$k->[2] || ($$export{$k->[0]} ? 2 : 1)
l!l&&r!l&&!r
000
MC/DC0%0/2
$k->[2] || ($$export{$k->[0]} ? 2 : 1)
$k->[2] ($$export{$k->[0]} ? 2 : 1)
Truth table0%0/3
A || B
A= $k->[2]B= ($$export{$k->[0]} ? 2 : 1)
ABresult
1X1
011
000
8262 }
8263 }
8264 }
8265 }
8266 0 $self->{faces}{$f}{'[ini_layers_prefix]'} = \@out;
8267 0 $LL = $self->{faces}{$f}{'[ini_filled_layers]'} = [ @{ $self->{faces}{$f}{layers} } ]; # Deep copy
8268 0 my @OUT;
8269 0 for my $L ( @$LL ) {
8270 0 push @OUT, "$L++PREFIX+";
8271 0 my $l = $self->{layers}{$OUT[-1]} = $self->deep_copy($self->{layers}{$L});
8272 0 for my $n (0 .. $#$l) {
8273 0 my $K = $l->[$n];
8274 0 for my $k (@$K) {
8275 #warn "face `$f' layer `$L' layers_prefix: key `$k' marked as a deadkey" if defined $k and $DDD->{$k};
8276 0 ▶ $k = [$k] if defined $k and not ref $k; # Allow addition of doc strings
Branch: 1 branch
BranchTrueFalseTotal
if defined $k and not ref $k 0 0 0
Condition0%0/3
defined $k and not ref $k
!ll&&!rl&&r
000
MC/DC0%0/2
defined $k and not ref $k
defined $k not ref $k
Truth table0%0/3
A and not(B)
A= defined $kB= not ref $k
ABresult
0X0
100
111
8277 0 ▶ if (defined $k and ($DDD->{$k->[0]} or $vk->{$k->[0]})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $k and $$DDD{$k->[0]} || $$vk{$k->[0]}) 0 0 0
Condition0%0/6
defined $k and $$DDD{$k->[0]} || $$vk{$k->[0]}
!ll&&!rl&&r
000
$$DDD{$k->[0]} or $$vk{$k->[0]}
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $k and $$DDD{$k->[0]} || $$vk{$k->[0]}
defined $k $$DDD{$k->[0]} $$vk{$k->[0]}
Truth table0%0/4
A and B or C
A= defined $kB= $$DDD{$k->[0]}C= $$vk{$k->[0]}
ABCresult
0XX0
1000
11X1
1011
8278 0 ▶ @$k[1,2] = ($f, $k->[2] || ($export->{$k->[0]} ? 2 : 1)); # Is exportable?
Branch: 1 branch
BranchTrueFalseTotal
$$export{$k->[0]} ? : 0 0 0
Condition0%0/3
$k->[2] || ($$export{$k->[0]} ? 2 : 1)
l!l&&r!l&&!r
000
MC/DC0%0/2
$k->[2] || ($$export{$k->[0]} ? 2 : 1)
$k->[2] ($$export{$k->[0]} ? 2 : 1)
Truth table0%0/3
A || B
A= $k->[2]B= ($$export{$k->[0]} ? 2 : 1)
ABresult
1X1
011
000
8279 }
8280 }
8281 }
8282 }
8283 0 $self->{faces}{$f}{layers} = \@OUT;
8284 } else {
8285 0 warn "Face `$f' has no ini_layers";
8286 }
8287 0 $self->{faces}{$f}{'[dead_array]'} = \@d;
8288 0 ▶ for my $D (@{$self->{faces}{$f}{faceDeadKeys2} || $self->{faces}{$f}{layerDeadKeys2} || []}) { # layerDeadKeys2 obsolete
Condition0%0/5
$self->{'faces'}{$f}{'faceDeadKeys2'} || $self->{'faces'}{$f}{'layerDeadKeys2'} || []
l!l
00
$self->{"faces"}{$f}{"faceDeadKeys2"} or $self->{"faces"}{$f}{"layerDeadKeys2"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'faces'}{$f}{'faceDeadKeys2'} || $self->{'faces'}{$f}{'layerDeadKeys2'} || []
$self->{"faces"}{$f}{"faceDeadKeys2"} $self->{"faces"}{$f}{"layerDeadKeys2"}
Truth table0%0/3
A or B
A= $self->{"faces"}{$f}{"faceDeadKeys2"}B= $self->{"faces"}{$f}{"layerDeadKeys2"}
ABresult
1X1
011
000
8289 0 $D =~ s/^\s+//; $D =~ s/\s+$//;
8290 0 my @k = split //, $self->stringHEX2string($D);
8291 0 ▶ 2 != @k and die "not two characters as a chained deadkey: `@k'";
Branch: 1 branch
BranchTrueFalseTotal
2 != @k and die "not two characters as a chained deadkey: `@{k}'" 0 0 0
8292 #warn "dead2 for <@k>";
8293 0 $self->{faces}{$f}{'[dead2]'}{$k[0]}{$k[1]}++;
8294 # $k[1] is "untranslated"; it is not good for [DEAD]:
8295 #$self->{faces}{"$f###" . $self->key2hex($k[0])}{'[DEAD]'}{$k[1]}++;
8296 }
8297 }
8298 # $self->__dbg_latin_CtrlD;
8299 $self
8300 0 }
8301
8302 0 ▶sub massage_hash_values($) {
Subroutine massage_hash_values: not called CC=5 SCAR=34.0
Pod undocumented
8303 0 my($self) = (shift);
8304 0 for my $K ( @{$self->{'[keys]'}} ) {
8305 0 my $h = $self->get_deep($self, split m(/), $K);
8306 0 ▶ $_ = $self->charhex2key($_) for @{ $h->{char2key_prefer_first} || []}, @{ $h->{char2key_prefer_last} || []};
Condition0%0/4
$h->{'char2key_prefer_first'} || []
l!l
00
$h->{'char2key_prefer_last'} || []
l!l
00
MC/DC0%0/1
$h->{'char2key_prefer_first'} || []
$h->{'char2key_prefer_first'}
MC/DC0%0/1
$h->{'char2key_prefer_last'} || []
$h->{'char2key_prefer_last'}
Truth table0%0/2
A
A= $h->{'char2key_prefer_first'}
Aresult
11
00
Truth table0%0/2
A
A= $h->{'char2key_prefer_last'}
Aresult
11
00
8307 }
8308
8309 }
8310 #use Dumpvalue;
8311
8312 0 ▶sub print_codepoint ($$;$$) { # $postfix may be a name of base-font. Then the coverage_how is used instead of $postfix
Subroutine print_codepoint: not called CC=7 SCAR=40.3
Pod undocumented
8313 0 my ($self, $k, $prefix, $postfix) = (shift, shift, shift, shift);
8314 0 ▶ my $K = ($k =~ /$rxCombining/ ? " $k" : $k);
Branch: 1 branch
BranchTrueFalseTotal
$k =~ /$rxCombining/ ? : 0 0 0
8315 0 ▶ if (defined $postfix) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $postfix) 0 0 0
8316 0 my $how = $self->{faces}{$postfix}{'[coverage_how]'}{$k};
8317 # $how2 =~ s/(1+)/length $1/e;
8318 # defined($how) ? $how .= " $how2" : $how = $how2 if $how2;
8319 0 ▶ $postfix = '' if $self->{faces}{$postfix}{'[coverage_how]'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"faces"}{$postfix}{"[coverage_how]"} 0 0 0
8320 0 ▶ $postfix = " $how" if $how;
Branch: 1 branch
BranchTrueFalseTotal
if $how 0 0 0
8321 }
8322 0 ▶ $prefix = '' unless defined $prefix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prefix 0 0 0
8323 0 ▶ $postfix = '' unless defined $postfix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $postfix 0 0 0
8324 0 my $kk = join '.', map $self->key2hex($_), split //, $k;
8325 0 my $UN = join ' + ', map $self->UName($_, 'verbose', 'vbell'), split //, $k;
8326 0 printf "%s%s\t<%s>%s\t%s\n", $prefix, $kk, $K, $postfix, $UN;
8327 }
8328
8329 0 ▶sub require_unidata_age ($) {
Subroutine require_unidata_age: not called CC=4 SCAR=30.0
Pod undocumented
8330 0 my $self = shift;
8331 0 my $f = $self->get_NamesList;
8332 0 ▶ $self->load_compositions($f) if defined $f;
Branch: 1 branch
BranchTrueFalseTotal
if defined $f 0 0 0
8333
8334 0 $f = $self->get_AgeList;
8335 0 ▶ $self->load_uniage($f) if defined $f and not $self->{Age};
Branch: 1 branch
BranchTrueFalseTotal
if defined $f and not $self->{"Age"} 0 0 0
Condition0%0/3
defined $f and not $self->{"Age"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and not $self->{"Age"}
defined $f not $self->{"Age"}
Truth table0%0/3
A and not(B)
A= defined $fB= not $self->{"Age"}
ABresult
0X0
100
111
8336 0 $self;
8337 }
8338
8339 0 ▶sub print_coverage_string ($$) {
Subroutine print_coverage_string: not called CC=6 SCAR=37.4
Pod undocumented
8340 0 my ($self, $s, %seen) = (shift, shift);
8341 0 $seen{$_}++ for split //, $s;
8342
8343 0 my $f = $self->get_NamesList;
8344 0 ▶ $self->load_compositions($f) if defined $f;
Branch: 1 branch
BranchTrueFalseTotal
if defined $f 0 0 0
8345
8346 0 $f = $self->get_AgeList;
8347 0 ▶ $self->load_uniage($f) if defined $f and not $self->{Age};
Branch: 1 branch
BranchTrueFalseTotal
if defined $f and not $self->{"Age"} 0 0 0
Condition0%0/3
defined $f and not $self->{"Age"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and not $self->{"Age"}
defined $f not $self->{"Age"}
Truth table0%0/3
A and not(B)
A= defined $fB= not $self->{"Age"}
ABresult
0X0
100
111
8348
8349 0 require Unicode::UCD;
8350
8351 0 $self->print_codepoint($_) for sort keys %seen;
8352 }
8353
8354 0 ▶sub print_coverage ($$) {
Subroutine print_coverage: not called CC=53 SCAR=79.6
Pod undocumented
8355 0 my ($self, $F) = (shift, shift);
8356
8357 0 my $f = $self->get_NamesList;
8358 0 ▶ $self->load_compositions($f) if defined $f;
Branch: 1 branch
BranchTrueFalseTotal
if defined $f 0 0 0
8359
8360 0 $f = $self->get_AgeList;
8361 0 ▶ $self->load_uniage($f) if defined $f and not $self->{Age};
Branch: 1 branch
BranchTrueFalseTotal
if defined $f and not $self->{"Age"} 0 0 0
Condition0%0/3
defined $f and not $self->{"Age"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and not $self->{"Age"}
defined $f not $self->{"Age"}
Truth table0%0/3
A and not(B)
A= defined $fB= not $self->{"Age"}
ABresult
0X0
100
111
8362
8363 0 my $file = $self->{'[file]'};
8364 0 ▶ my $app = (defined $file and @$file > 1 and 's');
Condition0%0/5
defined $file && @$file > 1 && 's'
!ll
00
defined $file and @$file > 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $file && @$file > 1 && 's'
defined $file @$file > 1
Truth table0%0/3
A and B
A= defined $fileB= @$file > 1
ABresult
0X0
100
111
8365 0 ▶ $file = (defined $file) ? "file$app @$file" : 'string descriptor';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 0 0 0
8366 0 my $v = $self->{VERSION};
8367 0 ▶ $file .= " version $v" if defined $v;
Branch: 1 branch
BranchTrueFalseTotal
if defined $v 0 0 0
8368 0 ▶ $file .= " Unicode tables version $self->{uniVersion}" if defined $self->{uniVersion};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"uniVersion"} 0 0 0
8369
8370 0 print "############# Generated with UI::KeyboardLayout v$UI::KeyboardLayout::VERSION for $file, face=$F\n#\n";
8371
8372 0 my $is32 = $self->{faces}{$F}{'[32-bit]'};
8373 0 ▶ my $cnt32 = keys %{$is32 || {}};
Condition0%0/2
$is32 || {}
l!l
00
MC/DC0%0/1
$is32 || {}
$is32
Truth table0%0/2
A
A= $is32
Aresult
11
00
8374 0 my $c1 = @{ $self->{faces}{$F}{'[coverage1only]'} }; # - $cnt32;
8375 0 my $c2 = @{ $self->{faces}{$F}{'[coverage1]'} } - @{ $self->{faces}{$F}{'[coverage1only]'} };
8376 0 my $more = ''; #$cnt32 ? " (and up to $cnt32 not available on Windows - at end of this section above FFFF)" : '';
8377 0 my @multi;
8378 0 for my $n (0, 1) {
8379 0 $multi[$n]{$_}++ for grep 1 < length, @{ $self->{faces}{$F}{"[coverage$n]"} };
8380 }
8381 0 my @multi_c = map { scalar keys %{$multi[$_]} } 0, 1;
8382 0 ▶ my %comp = %{ $self->{faces}{$F}{'[inCompose]'} || {} };
Condition0%0/2
$self->{'faces'}{$F}{'[inCompose]'} || {}
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{'[inCompose]'} || {}
$self->{'faces'}{$F}{'[inCompose]'}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{'[inCompose]'}
Aresult
11
00
8383 0 delete $comp{$_} for @{ $self->{faces}{$F}{"[coverage0]"} }, @{ $self->{faces}{$F}{"[coverage1]"} };
8384 0 ▶ my @comp = grep {2 > length and 0x10000 > ord} sort keys %comp;
Condition0%0/3
2 > length $_ && 65536 > ord $_
!ll&&!rl&&r
000
MC/DC0%0/2
2 > length $_ && 65536 > ord $_
2 > length $_ 65536 > ord $_
Truth table0%0/3
A && B
A= 2 > length $_B= 65536 > ord $_
ABresult
0X0
100
111
8385 0 my %in_comp;
8386 0 $in_comp{$_}++ for @comp;
8387 printf "######### %i = %i + %i + %i + %i bindings [1-char + base multi-char-strings (MCS) + “extra layers” MCS + only via Compose key]\n",
8388 0 @{ $self->{faces}{$F}{'[coverage0]'} } + $c1 + $c2 + @comp,
8389 0 @{ $self->{faces}{$F}{'[coverage0]'} } + $c1 + $c2 - $multi_c[0] - $multi_c[1],
8390 $multi_c[0], $multi_c[1], scalar @comp;
8391 printf "######### %i = %i + %i + %i%s [direct + via single prefix keys and “extra layers” (both=%i) + via repeated prefix key] chars\n",
8392 0 @{ $self->{faces}{$F}{'[coverage0]'} } + $c1 + $c2 - $multi_c[0] - $multi_c[1],
8393 0 scalar @{ $self->{faces}{$F}{'[coverage0]'} } - $multi_c[0],
8394 0 $c1 - $multi_c[1], $c2, $more, @{ $self->{faces}{$F}{'[coverage0oneChar]'} } + $c1 - $multi_c[0] - $multi_c[1];
8395 0 print "Marks mean: b = “in base face”, each of: e = “base with extra modifiers”, 1 = “with single prefix key”, 2/3 likewise, 9=“>3 | ∞”\n" .
8396 "\t\t①/②/③/⑨ = “needs ‘extra modifiers’-prefix”, ⓕ/ƒ/ᶠ/φ = “via flat map”, Ⓕ/F/ℱ/Φ = “with extra (impossible!)”; likewise\n" .
8397 "\t\tⓔ/ₑ/ᵉ/ε | Ⓔ/E/ᴱ/έ ⫿ ⓐ/a/ᵃ/α | Ⓐ/A/ᴬ/ά = “on Arrow-like keys (⫿ with-AltGr-inversion)”, ⇑⤊^⦽|⇡⥀ˆꞈ = “on AltGr-inverted Ctrl-keys”.\n";
8398 0 for my $k (@{ $self->{faces}{$F}{'[coverage0oneChar]'} }) {
8399 0 $self->print_codepoint($k, undef, $F);
8400 }
8401 0 print "############# Base multi-char strings:\n";
8402 0 for my $k (@{ $self->{faces}{$F}{'[coverage0multiChar]'} }) {
8403 0 $self->print_codepoint($k, undef, $F);
8404 }
8405 0 print "############# Via single prefix keys (or with extra modifiers):\n";
8406 0 for my $k (@{ $self->{faces}{$F}{'[coverage1only]'} }) {
8407 0 ▶ $self->print_codepoint($k, undef, $F) if 2 > length $k;
Branch: 1 branch
BranchTrueFalseTotal
if 2 > length $k 0 0 0
8408 }
8409 0 print "############# Multi-char via single prefix keys (or with extra modifiers):\n";
8410 0 for my $k (@{ $self->{faces}{$F}{'[coverage1only]'} }) {
8411 0 ▶ $self->print_codepoint($k, undef, $F) if 1 < length $k;
Branch: 1 branch
BranchTrueFalseTotal
if 1 < length $k 0 0 0
8412 }
8413 0 my $h1 = $self->{faces}{$F}{'[coverage1only_hash]'};
8414 0 print "############# Via repeated prefix keys:\n";
8415 0 for my $k (@{ $self->{faces}{$F}{'[coverage1]'} }) {
8416 0 ▶ $h1->{$k} or $self->print_codepoint($k, undef, $F) if 2 > length $k;
Branch: 1 branch
BranchTrueFalseTotal
if 2 > length $k 0 0 0
Condition0%0/6
2 > length $k && ($h1->{$k} || $self->print_codepoint($k, undef, $F))
!ll&&!rl&&r
000
$h1->{$k} or $self->print_codepoint($k, undef, $F)
l!l&&r!l&&!r
000
MC/DC0%0/3
2 > length $k && ($h1->{$k} || $self->print_codepoint($k, undef, $F))
2 > length $k $h1->{$k} $self->print_codepoint($k, undef, $F)
Truth table0%0/4
A && B or C
A= 2 > length $kB= $h1->{$k}C= $self->print_codepoint($k, undef, $F)
ABCresult
0XX0
1000
11X1
1011
8417 }
8418 0 print "############# Multi-char via repeated prefix keys:\n";
8419 0 for my $k (@{ $self->{faces}{$F}{'[coverage1]'} }) {
8420 0 ▶ $h1->{$k} or $self->print_codepoint($k, undef, $F) if 1 < length $k;
Branch: 1 branch
BranchTrueFalseTotal
if 1 < length $k 0 0 0
Condition0%0/6
1 < length $k && ($h1->{$k} || $self->print_codepoint($k, undef, $F))
!ll&&!rl&&r
000
$h1->{$k} or $self->print_codepoint($k, undef, $F)
l!l&&r!l&&!r
000
MC/DC0%0/3
1 < length $k && ($h1->{$k} || $self->print_codepoint($k, undef, $F))
1 < length $k $h1->{$k} $self->print_codepoint($k, undef, $F)
Truth table0%0/4
A && B or C
A= 1 < length $kB= $h1->{$k}C= $self->print_codepoint($k, undef, $F)
ABCresult
0XX0
1000
11X1
1011
8421 }
8422 0 print "############# Difficult to reach (or unreachable) in prefix maps (prefix = +2, “extra” modifiers = +1, etc. ⇒ >4):\n";
8423 0 for my $c (sort keys %{ $self->{faces}{$F}{'[coverage_difficulty]'} }) {
8424 0 ▶ $self->print_codepoint($c, undef, $F) if $self->{faces}{$F}{'[coverage_difficulty]'}{$c} > 4;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"faces"}{$F}{"[coverage_difficulty]"}{$c} > 4 0 0 0
8425 }
8426 0 print "############# Went through the cracks in accounting:\n";
8427 0 for my $k (sort keys %{ $self->{faces}{$F}{'[coverage_how]'} }) {
8428 0 ▶ $self->print_codepoint($k, '¿ ', $F) unless $self->{faces}{$F}{'[coverage_hash]'}{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"faces"}{$F}{"[coverage_hash]"}{$k} 0 0 0
8429 }
8430 0 print "############# Via Compose key, but not simply accessible:\n";
8431 0 for my $k (@comp) {
8432 0 $self->print_codepoint($k, '= ', $F);
8433 }
8434 0 print "############# Have lost the competition (for prefixed position), but available elsewhere:\n";
8435 0 for my $k (sort keys %{ $self->{faces}{$F}{'[in_dia_chains]'} }) {
8436 0 ▶ next unless $self->{faces}{$F}{'[coverage_hash]'}{$k} and not $self->{faces}{$F}{'[from_dia_chains]'}{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"faces"}{$F}{"[coverage_hash]"}{$k} and not $self->{"faces"}{$F}{"[from_dia_chains]"}{$k} 0 0 0
Condition0%0/3
$self->{"faces"}{$F}{"[coverage_hash]"}{$k} and not $self->{"faces"}{$F}{"[from_dia_chains]"}{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"faces"}{$F}{"[coverage_hash]"}{$k} and not $self->{"faces"}{$F}{"[from_dia_chains]"}{$k}
$self->{"faces"}{$F}{"[coverage_hash]"}{$k} not $self->{"faces"}{$F}{"[from_dia_chains]"}{$k}
Truth table0%0/3
A and not(B)
A= $self->{"faces"}{$F}{"[coverage_hash]"}{$k}B= not $self->{"faces"}{$F}{"[from_dia_chains]"}{$k}
ABresult
0X0
100
111
8437 0 $self->print_codepoint($k, '+ ', $F); # May be in from_dia_chains, but be obscured later...
8438 }
8439 0 print "############# Have lost the competition (not counting those explicitly prohibited by \\\\):\n";
8440 0 for my $k (sort keys %{ $self->{faces}{$F}{'[in_dia_chains]'} }) {
8441 0 ▶ next if $self->{faces}{$F}{'[coverage_hash]'}{$k};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"faces"}{$F}{"[coverage_hash]"}{$k} 0 0 0
8442 0 $self->print_codepoint($k, '- ', $F);
8443 }
8444 0 my ($tot_diac, $lost_diac) = (0,0);
8445 $tot_diac++, $self->{faces}{$F}{'[coverage_hash]'}{$_} || $lost_diac++
8446 0 ▶ for keys %{ $self->{'[map2diac]'} };
Branch: 1 branch
BranchTrueFalseTotal
$self->{"faces"}{$F}{"[coverage_hash]"}{$_} or ++$lost_diac 0 0 0
8447 0 print "############# Lost among known classified modifiers/standalone/combining ($lost_diac/$tot_diac):\n";
8448 0 for my $k (sort keys %{ $self->{'[map2diac]'} }) {
8449 0 ▶ next if $self->{faces}{$F}{'[coverage_hash]'}{$k};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"faces"}{$F}{"[coverage_hash]"}{$k} 0 0 0
8450 0 $self->print_codepoint($k, '?- ', $F);
8451 }
8452 0 print "############# Per key list:\n";
8453 0 my $OOut = $self->print_table_coverage($F);
8454 0 for my $HOW ([{}, ''], [\%in_comp, ', even with Compose']) {
8455 0 my ($OUT, $CC, $CC1) = ('', 0, 0);
8456 0 for my $r ([0x2200, 0x40], [0x2240, 0x40], [0x2280, 0x40], [0x22c0, 0x40],
8457 [0x27c0, 0x30], [0x2980, 0x40], [0x29c0, 0x40],
8458 [0x2a00, 0x40], [0x2a40, 0x40], [0x2a80, 0x40], [0x2ac0, 0x40], [0xa720, 0x80-0x20], [0xa780, 0x80] ) {
8459 0 my $C = join '', grep { (0xa720 >= ord $_ or $self->{UNames}{$_}) and !$self->{faces}{$F}{'[coverage_hash]'}{$_}
8460 0 ▶ and !$HOW->[0]{$_} }
Condition0%0/9
(42784 >= ord $_ || $self->{'UNames'}{$_}) && !$self->{'faces'}{$F}{'[coverage_hash]'}{$_} && !$HOW->[0]{$_}
!ll&&!rl&&r
000
42784 >= ord $_ || $self->{"UNames"}{$_} and not $self->{"faces"}{$F}{"[coverage_hash]"}{$_}
!ll&&!rl&&r
000
42784 >= ord $_ or $self->{"UNames"}{$_}
l!l&&r!l&&!r
000
MC/DC0%0/4
(42784 >= ord $_ || $self->{'UNames'}{$_}) && !$self->{'faces'}{$F}{'[coverage_hash]'}{$_} && !$HOW->[0]{$_}
42784 >= ord $_ $self->{"UNames"}{$_} not $self->{"faces"}{$F}{"[coverage_hash]"}{$_} !$HOW->[0]{$_}
Truth table0%0/7
A or B and not(C) && not(D)
A= 42784 >= ord $_B= $self->{"UNames"}{$_}C= not $self->{"faces"}{$F}{"[coverage_hash]"}{$_}D= !$HOW->[0]{$_}
ABCDresult
00XX0
1X0X0
010X0
1X100
01100
1X111
01111
8461 map chr($_), $r->[0]..($r->[0]+$r->[1]-1); # before a720, the tables are filled up...
8462 0 ▶ ${ $r->[0] < 0xa720 ? \$CC : \$CC1 } += length $C;
Branch: 1 branch
BranchTrueFalseTotal
$r->[0] < 42784 ? : 0 0 0
8463 0 $OUT .= "-==-\t$C\n";
8464 }
8465 0 print "############# Not covered in the math+latin-D ranges ($CC+$CC1)$HOW->[1]:\n$OUT";
8466 }
8467 0 my ($OUT, $CC, $CC1) = ('', 0, 0);
8468 0 for my $r ([0x2200, 0x80], [0x2280, 0x80],
8469 [0x27c0, 0x30], [0x2980, 0x80],
8470 [0x2a00, 0x80], [0x2a80, 0x80], [0xa720, 0x100-0x20] ) {
8471 0 my $C = join '', grep {(0xa720 >= ord $_ or $self->{UNames}{$_}) and !$self->{faces}{$F}{'[coverage_hash]'}{$_}
8472 0 ▶ and !$self->{faces}{$F}{'[in_dia_chains]'}{$_}} map chr($_), $r->[0]..($r->[0]+$r->[1]-1);
Condition0%0/9
(42784 >= ord $_ || $self->{'UNames'}{$_}) && !$self->{'faces'}{$F}{'[coverage_hash]'}{$_} && !$self->{'faces'}{$F}{'[in_dia_chains]'}{$_}
!ll&&!rl&&r
000
42784 >= ord $_ || $self->{"UNames"}{$_} and not $self->{"faces"}{$F}{"[coverage_hash]"}{$_}
!ll&&!rl&&r
000
42784 >= ord $_ or $self->{"UNames"}{$_}
l!l&&r!l&&!r
000
MC/DC0%0/4
(42784 >= ord $_ || $self->{'UNames'}{$_}) && !$self->{'faces'}{$F}{'[coverage_hash]'}{$_} && !$self->{'faces'}{$F}{'[in_dia_chains]'}{$_}
42784 >= ord $_ $self->{"UNames"}{$_} not $self->{"faces"}{$F}{"[coverage_hash]"}{$_} !$self->{'faces'}{$F}{'[in_dia_chains]'}{$_}
Truth table0%0/7
A or B and not(C) && not(D)
A= 42784 >= ord $_B= $self->{"UNames"}{$_}C= not $self->{"faces"}{$F}{"[coverage_hash]"}{$_}D= !$self->{'faces'}{$F}{'[in_dia_chains]'}{$_}
ABCDresult
00XX0
1X0X0
010X0
1X100
01100
1X111
01111
8473 0 ▶ ${ $r->[0] < 0xa720 ? \$CC : \$CC1 } += length $C;
Branch: 1 branch
BranchTrueFalseTotal
$r->[0] < 42784 ? : 0 0 0
8474 0 $OUT .= "-==-\t$C\n";
8475 }
8476 0 print "############# Not competing, in the math+latin-D ranges ($CC+$CC1):\n$OUT";
8477 0 $OOut
8478 }
8479
8480 1 my %html_esc = qw( & &amp; < &lt; > &gt; );
8481 1 my %ctrl_special = qw( \r Enter \n Control-Enter \b BackSpace \x7f Control-Backspace \t Tab
8482 \x1b Esc; Control-[ \x1d Control-] \x1c Control-\ ^C Control-Break \x1e Control-^ \x1f Control-_ \x00 Control-@);
8483 1 my %alt_symb;
8484 1 ▶{ no warnings 'qw';
Subroutine BEGIN: called CC=1 SCAR=0.0
8485 # ZWS ZWNJ ZWJ LRM RLM WJ=ZWNBSP Func Times Sep Plus
8486 1 my %a = (qw(200b ∅ 200c ‸ 200d & 200e → 200f ← 2060 ⊕ 2061 () 2062 × 2063 | 2064 +),
8487 # SPC NBSP obs-N obs-M n m m/3 m/4 m/6 figure=digit punctuation thin hair Soft-hyphen
8488 qw(0020 ␣ 00a0 ⍽ 2000 N 2001 M 2002 n 2003 m 2004 ᵐ⁄₃ 2005 ᵐ⁄₄ 2006 ᵐ⁄₆ 2007 ᵈ 2008 , 2009 ᵐ⁄₅ 200a ᵐ⁄₈ 00ad -),
8489 # LineSep ParSep LRE RLE PopDirForm LRO RLO narrowNBSP
8490 qw(2028 ⏎ 2029 ¶ 202a ⇒ 202b ⇐ 202c ↺ 202d ⇉ 202e ⇇ 202f ⁿ));
8491 1 @alt_symb{map chr hex, keys %a} = values %a;
8492 }
8493
8494 # Make: span for control, soft-hyphen, white-space; include in <span class=l> with popup; include in span with special highlight
8495 0 ▶sub char_2_html_span ($$$$$$;@) {
Subroutine char_2_html_span: not called CC=66 SCAR=83.9
Pod undocumented
8496 0 my ($self, $base_c, $C, $c, $F, $opts, @types, $expl, $title, $vbell) = @_;
8497 0 my $aInv = $self->charhex2key($self->{faces}{$F}{'[Flip_AltGr_Key]'});
8498 0 ▶ $expl = $C->[3] if 'ARRAY' eq ref $C and $C->[3];
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $C and $C->[3] 0 0 0
Condition0%0/3
"ARRAY" eq ref $C and $C->[3]
!ll&&!rl&&r
000
MC/DC0%0/2
"ARRAY" eq ref $C and $C->[3]
"ARRAY" eq ref $C $C->[3]
Truth table0%0/3
A and B
A= "ARRAY" eq ref $CB= $C->[3]
ABresult
0X0
100
111
8499 0 ▶ $expl =~ s/(?=\p{NonspacingMark})/ /g if $expl;
Branch: 1 branch
BranchTrueFalseTotal
if $expl 0 0 0
8500 0 ▶ my $prefix = (ref $C and $C->[2]);
Condition0%0/3
ref $C && $C->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $C && $C->[2]
ref $C $C->[2]
Truth table0%0/3
A && B
A= ref $CB= $C->[2]
ABresult
0X0
100
111
8501 0 my $cc = $c;
8502 0 ▶ $aInv = ($base_c || 'N/A') eq $aInv;
Condition0%0/2
$base_c || 'N/A'
l!l
00
MC/DC0%0/1
$base_c || 'N/A'
$base_c
Truth table0%0/2
A
A= $base_c
Aresult
11
00
8503 0 ▶ my $docs = ($prefix and $self->{faces}{$F}{'[prefixDocs]'}{$self->key2hex($cc)}); # or $pre and warn "No docs: face=`$F', c=`$cc'\n";
Condition0%0/3
$prefix && $self->{'faces'}{$F}{'[prefixDocs]'}{$self->key2hex($cc)}
!ll&&!rl&&r
000
MC/DC0%0/2
$prefix && $self->{'faces'}{$F}{'[prefixDocs]'}{$self->key2hex($cc)}
$prefix $self->{'faces'}{$F}{'[prefixDocs]'}{$self->key2hex($cc)}
Truth table0%0/3
A && B
A= $prefixB= $self->{'faces'}{$F}{'[prefixDocs]'}{$self->key2hex($cc)}
ABresult
0X0
100
111
8504 0 ▶ $docs =~ s/([''&])/sprintf '&#x%02x;', ord $1/ge if defined $docs;
Branch: 1 branch
BranchTrueFalseTotal
if defined $docs 0 0 0
8505 # warn "... is_D2: ", $self->array2string([$c, $baseK[$L][$shift]]);
8506 0 $c =~ s/(?=$rxCombining)/\x{25cc}/go; # dotted circle ◌ 25CC
8507 0 $c =~ s/([&<>])/$html_esc{$1}/g;
8508 0 my $create_a_c = $self->{faces}{$F}{'[create_alpha_ctrl]'};
8509 0 ▶ $create_a_c = $create_alpha_ctrl unless defined $create_a_c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $create_a_c 0 0 0
8510 0 ▶ my $alpha_ctrl = ($create_a_c and $cc =~ /[\cA-\cZ]/);
Condition0%0/3
$create_a_c && $cc =~ /[\cA-\cZ]/
!ll&&!rl&&r
000
MC/DC0%0/2
$create_a_c && $cc =~ /[\cA-\cZ]/
$create_a_c $cc =~ /[\cA-\cZ]/
Truth table0%0/3
A && B
A= $create_a_cB= $cc =~ /[\cA-\cZ]/
ABresult
0X0
100
111
8511 0 ▶ my $with_shift = (($create_a_c > 1 and $alpha_ctrl) ? '(Shift-)' : '');
Branch: 1 branch
BranchTrueFalseTotal
$create_a_c > 1 && $alpha_ctrl ? : 0 0 0
Condition0%0/3
$create_a_c > 1 and $alpha_ctrl
!ll&&!rl&&r
000
MC/DC0%0/2
$create_a_c > 1 and $alpha_ctrl
$create_a_c > 1 $alpha_ctrl
Truth table0%0/3
A and B
A= $create_a_c > 1B= $alpha_ctrl
ABresult
0X0
100
111
8512 0 ▶ $c =~ s{([\x00-\x1F\x7F])}{ my $C = $self->control2prt("$1"); my $S = $ctrl_special{$C} || '';
Condition0%0/2
$ctrl_special{$C} || ''
l!l
00
MC/DC0%0/1
$ctrl_special{$C} || ''
$ctrl_special{$C}
Truth table0%0/2
A
A= $ctrl_special{$C}
Aresult
11
00
8513 0 ▶ ($S and $S .= ", "), $S .= "Control-$with_shift".chr(0x40+ord $1) if $alpha_ctrl;
Branch: 1 branch
BranchTrueFalseTotal
if $alpha_ctrl 0 0 0
Condition0%0/2
$S and $S .= ', '
!ll
00
MC/DC0%0/1
$S and $S .= ', '
$S
Truth table0%0/2
A
A= $S
Aresult
00
11
8514 0 ▶ $C = "<span class=yyy title='$S'>$C</span>" if $S; $C }ge;
Branch: 1 branch
BranchTrueFalseTotal
if $S 0 0 0
8515 0 ▶ my $type = ($cc =~ /[^\P{Blank}\x00-\x1f]/ && 'WS'); # Blank and not control char
Condition0%0/2
$cc =~ /[^\P{Blank}\x00-\x1f]/ && 'WS'
!ll
00
MC/DC0%0/1
$cc =~ /[^\P{Blank}\x00-\x1f]/ && 'WS'
$cc =~ /[^\P{Blank}\x00-\x1f]/
Truth table0%0/2
A
A= $cc =~ /[^\P{Blank}\x00-\x1f]/
Aresult
00
11
8516 0 my ($fill, $prefill, $zw) = ('', '');
8517 0 ▶ if ($type or $c =~ /($rxZW)$/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type or $c =~ /($rxZW)$/o) 0 0 0
Condition0%0/3
$type or $c =~ /($rxZW)$/o
l!l&&r!l&&!r
000
MC/DC0%0/2
$type or $c =~ /($rxZW)$/o
$type $c =~ /($rxZW)$/o
Truth table0%0/3
A or B
A= $typeB= $c =~ /($rxZW)$/o
ABresult
1X1
011
000
8518 0 ▶ my $alt = ($alt_symb{$cc} ? qq( convention="$alt_symb{$cc}") : '');
Branch: 1 branch
BranchTrueFalseTotal
$alt_symb{$cc} ? : 0 0 0
8519 0 $fill = "<span$alt class=lFILL></span>"; # Soft hyphen etc
8520 }
8521 0 ▶ if ($type) { # Putting WS inside l makes gaps between adjacent WS blocks
Branch: 1 branch
BranchTrueFalseTotal
if ($type) 0 0 0
8522 0 $prefill = '<span class=WS>';
8523 0 $fill .= '</span>';
8524 }
8525 0 ▶ push @types, 'no-mirror-rtl' if "\x{34f}" eq $cc; # CGJ
Branch: 1 branch
BranchTrueFalseTotal
if "\x{34f}" eq $cc 0 0 0
8526 0 ▶ $zw = !!$fill || $cc eq "\x{034f}";
Condition0%0/3
!!$fill || $cc eq "\x{34f}"
l!l&&r!l&&!r
000
MC/DC0%0/2
!!$fill || $cc eq "\x{34f}"
!!$fill $cc eq "\x{34f}"
Truth table0%0/3
A || B
A= !!$fillB= $cc eq "\x{34f}"
ABresult
1X1
011
000
8527 0 $vbell = !defined $C;
8528 0 ▶ unless (defined $title) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $title) 0 0 0
8529 0 ▶ $title = ((ord $cc >= 0x80 or $cc eq ' ') && sprintf '%04X %s', ord $cc, $self->UName($cc, 'verbose', $vbell));
Condition0%0/6
(ord $cc >= 128 || $cc eq ' ') && sprintf('%04X %s', ord $cc, $self->UName($cc, 'verbose', $vbell))
!ll&&!rl&&r
000
ord $cc >= 128 or $cc eq " "
l!l&&r!l&&!r
000
MC/DC0%0/3
(ord $cc >= 128 || $cc eq ' ') && sprintf('%04X %s', ord $cc, $self->UName($cc, 'verbose', $vbell))
ord $cc >= 128 $cc eq " " sprintf('%04X %s', ord $cc, $self->UName($cc, 'verbose', $vbell))
Truth table0%0/5
A or B && C
A= ord $cc >= 128B= $cc eq " "C= sprintf('%04X %s', ord $cc, $self->UName($cc, 'verbose', $vbell))
ABCresult
00X0
1X00
0100
1X11
0111
8530 0 ▶ if ($title and $docs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($title and $docs) 0 0 0
Condition0%0/3
$title and $docs
!ll&&!rl&&r
000
MC/DC0%0/2
$title and $docs
$title $docs
Truth table0%0/3
A and B
A= $titleB= $docs
ABresult
0X0
100
111
8531 0 $title = "$docs (on $title)";
8532 }
8533 0 ▶ $title ||= ($docs || '');
Condition0%0/5
$title ||= $docs || ""
l!l&&r!l&&!r
000
$docs || ''
l!l
00
MC/DC0%0/2
$title ||= $docs || ""
$title $docs
Truth table0%0/3
A ||= B
A= $titleB= $docs
ABresult
1X1
011
000
8534 0 ▶ if (defined $expl and length $expl and (1 or 0x7f <= ord $cc)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $expl and length $expl and 1) 0 0 0
Condition0%0/5
defined $expl and length $expl and 1
!ll
00
defined $expl and length $expl
!ll&&!rl&&r
000
MC/DC0%0/2
defined $expl and length $expl and 1
defined $expl length $expl
Truth table0%0/3
A and B
A= defined $explB= length $expl
ABresult
0X0
100
111
8535 0 ▶ $title .= ' ' if length $title;
Branch: 1 branch
BranchTrueFalseTotal
if length $title 0 0 0
8536 0 $title .= " {via $expl}";
8537 }
8538 0 ▶ $title .= ' (visual bell indicates unassigned keypress)' if $title and !$expl and $vbell;
Branch: 1 branch
BranchTrueFalseTotal
if $title and not $expl and $vbell 0 0 0
Condition0%0/6
$title and not $expl and $vbell
!ll&&!rl&&r
000
$title and not $expl
!ll&&!rl&&r
000
MC/DC0%0/3
$title and not $expl and $vbell
$title not $expl $vbell
Truth table0%0/4
A and not(B) and C
A= $titleB= not $explC= $vbell
ABCresult
0XX0
10X0
1100
1111
8539 0 ▶ $title = 'This prefix key accesses this column with AltGr-invertion' if $aInv;
Branch: 1 branch
BranchTrueFalseTotal
if $aInv 0 0 0
8540 0 ▶ $title =~ s/([''&])/sprintf '&#x%02x;', ord $1/ge if $title;
Branch: 1 branch
BranchTrueFalseTotal
if $title 0 0 0
8541 0 ▶ $title = qq( title='$title') if $title;
Branch: 1 branch
BranchTrueFalseTotal
if $title 0 0 0
8542 }
8543 0 ▶ if ($type) { # Already covered
Branch: 10 branches
BranchTrueFalseTotal
if ($type) { } 0 0 0
elsif ($zw) { } 0 0 0
elsif (not defined $C) { } 0 0 0
elsif ($title =~ /(\b(N-ARY|BIG(?!\s+YUS\b)|GREEK\s+PROSGEGRAMMENI|KORONIS|SOF\s+PASUQ|PUNCTUATION\s+(?:GERESH|GERSHAYIM)|PALOCHKA|CYRILLIC\s.*\s(DZE|JE|QA|WE|A\s+IE)|ANO\s+TELEIA|GREEK\s+QUESTION\s+MARK)|"\w+\s+(?:BIG|LARGE))\b.*\s+\[/) { } 0 0 0
elsif ($title =~ /\b(OPERATOR|SIGN|SYMBOL|PROOF|EXISTS|FOR\s+ALL|(DIVISION|LOGICAL)\b.*)\s+\[/) { } 0 0 0
elsif ($title =~ /\b(RELATION|PERPENDICULAR|PARALLEL\s*TO|DIVIDES|FRACTION\s+SLASH)\s+\[/) { } 0 0 0
elsif ($title =~ /\[.*\b(IPA)\b|\bCLICK\b/) { } 0 0 0
elsif ($title =~ /\bLETTER\s+[AEUIYO]\b/ and $title =~ /\b(WITH|AND)\s+(HOOK\s+ABOVE|HORN)|(\s+(WITH|AND)\s+(CIRCUMFLEX|BREVE|ACUTE|GRAVE|TILDE|DOT\s+BELOW)\b){2}/) { } 0 0 0
elsif (index(&UI::KeyboardLayout::lc("\x{204a}\x{1f7}\x{a765}\x{195}\x{1f6}\x{1d79}"), &UI::KeyboardLayout::lc($cc)) != -1 or 42800 <= ord $cc and 42891 > ord $cc or 43003 <= ord $cc and 43007 >= ord $cc) { } 0 0 0
elsif ($title =~ /(\s+(WITH|AND)\s+((DOUBLE\s+)?\w+(\s+(BELOW|ABOVE))?)\b){2}/) { } 0 0 0
8544 } elsif ($zw) {
8545 0 push @types,'ZW';
8546 } elsif (not defined $C) {
8547 0 push @types,'vbell';
8548 } elsif ($title =~ /(\b(N-ARY|BIG(?!\s+YUS\b)|GREEK\s+PROSGEGRAMMENI|KORONIS|SOF\s+PASUQ|PUNCTUATION\s+(?:GERESH|GERSHAYIM)|PALOCHKA|CYRILLIC\s.*\s(DZE|JE|QA|WE|A\s+IE)|ANO\s+TELEIA|GREEK\s+QUESTION\s+MARK)|"\w+\s+(?:BIG|LARGE))\b.*\s+\[/) { # "0134 BIG GUY#"
8549 0 push @types,'nAry';
8550 } elsif ($title =~ /\b(OPERATOR|SIGN|SYMBOL|PROOF|EXISTS|FOR\s+ALL|(DIVISION|LOGICAL)\b.*)\s+\[/) {
8551 0 push @types,'operator';
8552 } elsif ($title =~ /\b(RELATION|PERPENDICULAR|PARALLEL\s*TO|DIVIDES|FRACTION\s+SLASH)\s+\[/) {
8553 0 push @types,'relation';
8554 } elsif ($title =~ /\[.*\b(IPA)\b|\bCLICK\b/) {
8555 0 push @types,'ipa';
8556 ▶ } elsif ($title =~ /\bLETTER\s+[AEUIYO]\b/ and
Condition0%0/3
$title =~ /\bLETTER\s+[AEUIYO]\b/ and $title =~ /\b(WITH|AND)\s+(HOOK\s+ABOVE|HORN)|(\s+(WITH|AND)\s+(CIRCUMFLEX|BREVE|ACUTE|GRAVE|TILDE|DOT\s+BELOW)\b){2}/
!ll&&!rl&&r
000
MC/DC0%0/2
$title =~ /\bLETTER\s+[AEUIYO]\b/ and $title =~ /\b(WITH|AND)\s+(HOOK\s+ABOVE|HORN)|(\s+(WITH|AND)\s+(CIRCUMFLEX|BREVE|ACUTE|GRAVE|TILDE|DOT\s+BELOW)\b){2}/
$title =~ /\bLETTER\s+[AEUIYO]\b/ $title =~ /\b(WITH|AND)\s+(HOOK\s+ABOVE|HORN)|(\s+(WITH|AND)\s+(CIRCUMFLEX|BREVE|ACUTE|GRAVE|TILDE|DOT\s+BELOW)\b){2}/
Truth table0%0/3
A and B
A= $title =~ /\bLETTER\s+[AEUIYO]\b/B= $title =~ /\b(WITH|AND)\s+(HOOK\s+ABOVE|HORN)|(\s+(WITH|AND)\s+(CIRCUMFLEX|BREVE|ACUTE|GRAVE|TILDE|DOT\s+BELOW)\b){2}/
ABresult
0X0
100
111
8557 $title =~ /\b(WITH|AND)\s+(HOOK\s+ABOVE|HORN)|(\s+(WITH|AND)\s+(CIRCUMFLEX|BREVE|ACUTE|GRAVE|TILDE|DOT\s+BELOW)\b){2}/) {
8558 0 push @types,'viet';
8559 ▶ } elsif (0 <= index(lc '⁊ǷꝥƕǶᵹ', lc $cc) or 0xa730 <= ord $cc and 0xa78b > ord $cc or 0xa7fb <= ord $cc and 0xa7ff >= ord $cc) {
Condition0%0/12
index(&UI::KeyboardLayout::lc("\x{204a}\x{1f7}\x{a765}\x{195}\x{1f6}\x{1d79}"), &UI::KeyboardLayout::lc($cc)) != -1 or 42800 <= ord $cc and 42891 > ord $cc or 43003 <= ord $cc and 43007 >= ord $cc
l!l&&r!l&&!r
000
index(&UI::KeyboardLayout::lc("\x{204a}\x{1f7}\x{a765}\x{195}\x{1f6}\x{1d79}"), &UI::KeyboardLayout::lc($cc)) != -1 or 42800 <= ord $cc and 42891 > ord $cc
l!l&&r!l&&!r
000
42800 <= ord $cc and 42891 > ord $cc
!ll&&!rl&&r
000
43003 <= ord $cc and 43007 >= ord $cc
!ll&&!rl&&r
000
MC/DC0%0/5
index(&UI::KeyboardLayout::lc("\x{204a}\x{1f7}\x{a765}\x{195}\x{1f6}\x{1d79}"), &UI::KeyboardLayout::lc($cc)) != -1 or 42800 <= ord $cc and 42891 > ord $cc or 43003 <= ord $cc and 43007 >= ord $cc
index(&UI::KeyboardLayout::lc("\x{204a}\x{1f7}\x{a765}\x{195}\x{1f6}\x{1d79}"), &UI::KeyboardLayout::lc($cc)) != -1 42800 <= ord $cc 42891 > ord $cc 43003 <= ord $cc 43007 >= ord $cc
Truth table0%0/8
A or B and C or D and E
A= index(&UI::KeyboardLayout::lc("\x{204a}\x{1f7}\x{a765}\x{195}\x{1f6}\x{1d79}"), &UI::KeyboardLayout::lc($cc)) != -1B= 42800 <= ord $ccC= 42891 > ord $ccD= 43003 <= ord $ccE= 43007 >= ord $cc
ABCDEresult
1XXXX1
011XX1
00X111
010111
00X0X0
00X100
0100X0
010100
8560 0 push @types,'paleo';
8561 } elsif ($title =~ /(\s+(WITH|AND)\s+((DOUBLE\s+)?\w+(\s+(BELOW|ABOVE))?)\b){2}/) {
8562 0 push @types,'doubleaccent';
8563 }
8564 0 ▶ push @types, ($1 ? 'withSubst' : 'isSubst') if ($expl || '') =~ /\sSubst\{(\S*\}\s+\S)?/;
Branch: 2 branches
BranchTrueFalseTotal
if ($expl || "") =~ /\sSubst\{(\S*\}\s+\S)?/ 0 0 0
$1 ? : 0 0 0
Condition0%0/2
$expl || ''
l!l
00
MC/DC0%0/1
$expl || ''
$expl
Truth table0%0/2
A
A= $expl
Aresult
11
00
8565 0 ▶ push @types, 'altGrInv' if $aInv;
Branch: 1 branch
BranchTrueFalseTotal
if $aInv 0 0 0
8566 0 ▶ my $q = ("@types" =~ /\s/ ? "'" : '');
Branch: 1 branch
BranchTrueFalseTotal
join($", @types) =~ /\s/ ? : 0 0 0
8567 # ($prefill, $fill) = ("<span class=l$title>$prefill", "$fill</span>");
8568 0 ▶ @types = " class=$q@types$q" if @types;
Branch: 1 branch
BranchTrueFalseTotal
if @types 0 0 0
8569 0 ▶ my($T,$OPT) = ($opts && $opts->{ltr} ? ('bdo', ' dir=ltr') : ('span', '')); # Just `span´ does not work in FF15
Branch: 1 branch
BranchTrueFalseTotal
$opts && $opts->{'ltr'} ? : 0 0 0
Condition0%0/3
$opts and $opts->{"ltr"}
!ll&&!rl&&r
000
MC/DC0%0/2
$opts and $opts->{"ltr"}
$opts $opts->{"ltr"}
Truth table0%0/3
A and B
A= $optsB= $opts->{"ltr"}
ABresult
0X0
100
111
8570 0 ▶ $c = '⇅' if $aInv and $cc ne ($base_c || 'N/A'); # &nbsp;
Branch: 1 branch
BranchTrueFalseTotal
if $aInv and $cc ne ($base_c || "N/A") 0 0 0
Condition0%0/5
$aInv and $cc ne ($base_c || "N/A")
!ll&&!rl&&r
000
$base_c || 'N/A'
l!l
00
MC/DC0%0/2
$aInv and $cc ne ($base_c || "N/A")
$aInv $cc ne ($base_c || "N/A")
MC/DC0%0/1
$base_c || 'N/A'
$base_c
Truth table0%0/3
A and B
A= $aInvB= $cc ne ($base_c || "N/A")
ABresult
0X0
100
111
Truth table0%0/2
A
A= $base_c
Aresult
11
00
8571 0 "<$T$OPT@types$title>$prefill$c$fill</$T>"
8572 }
8573
8574 0 ▶sub print_table_coverage ($$;$$) {
Subroutine print_table_coverage: not called CC=103 SCAR=92.8
Pod undocumented
8575 0 ▶ my ($self, $F, $html, $extra_headers) = (shift, shift, shift, shift || '');
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
8576 0 my $file = $self->{'[file]'};
8577 0 ▶ my $app = (defined $file and @$file > 1 and 's');
Condition0%0/5
defined $file && @$file > 1 && 's'
!ll
00
defined $file and @$file > 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $file && @$file > 1 && 's'
defined $file @$file > 1
Truth table0%0/3
A and B
A= defined $fileB= @$file > 1
ABresult
0X0
100
111
8578 0 ▶ my $f = (defined $file) ? "file$app @$file" : 'string descriptor';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 0 0 0
8579 0 my $v = $self->{VERSION};
8580 0 ▶ $f .= " version $v" if defined $v;
Branch: 1 branch
BranchTrueFalseTotal
if defined $v 0 0 0
8581 0 ▶ $f .= " Unicode tables version $self->{uniVersion}" if defined $self->{uniVersion};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"uniVersion"} 0 0 0
8582 0 ▶ print <<EOP if $html;
Branch: 1 branch
BranchTrueFalseTotal
if $html 0 0 0
8583 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
8584 "http://www.w3.org/TR/html4/loose.dtd">
8585 <html>
8586 <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
8587 <!-- Generated with UI::KeyboardLayout v$UI::KeyboardLayout::VERSION for $f, face=$F -->
8588 $extra_headers<style type="text/css"><!--
8589 /* <!-- Font size 10pt OK with Landscape Letter PaperSize, 0.1in margins, no footer, %96 for Latin, %150 for Cyrillic of izKeys --> */
8590 table.coverage { font-size: 10pt; font-family: sans-serif, DejaVu Sans, serif, junicode, Symbola; }
8591 .dead { font-size: 50%; color: red; }
8592 .dead_i { font-size: 50%; background-color: red; color: white; }
8593 .altGrInv { font-size: 70%; background-color: red; }
8594 .vbell { color: SandyBrown; }
8595 .withSubst { outline: 1px dotted blue; outline-offset: -1px; }
8596 .isSubst { outline: 1px solid blue; outline-offset: -1px; }
8597 .operator { background-color: rgb(255,192,203) /*pink*/; }
8598 .relation { background-color: rgb(255,160,122) /*lightsalmon*/; }
8599 .ipa { background-color: rgb(173,255,47) /*greenyellow*/; }
8600 .nAry { background-color: rgb(144,238,144) /*lightgreen*/; }
8601 .paleo { background-color: rgb(240,230,140) /*Khaki*/; }
8602 .viet { background-color: rgb(220,220,220) /*Gainsboro*/; }
8603 .doubleaccent { background-color: rgb(255,228,196) /*Bisque*/; }
8604 .ZW { background-color: rgb(220,20,60) /*crimson*/; }
8605 .WS { background-color: rgb(128,0,0) /*maroon*/; }
8606 span.lFILL[convention]:before { content: attr(convention);
8607 color: white;
8608 font-size: 50%; }
8609 .lFILL:not([convention]) { margin: 0ex 0.35ex; }
8610 .l { margin: 0ex 0.06ex; }
8611 .yyy { padding: 0px !important; }
8612 td.headerbase { font-size: 50%; color: blue; }
8613 td.header { font-size: 50%; color: green; }
8614 table { border-collapse: collapse; margin: 0px; padding: 0px; }
8615 body { margin: 1px; padding: 0px; }
8616 tr, td, .yyy {
8617 padding: 0px 0.2ex !important;
8618 margin: 0px !important;
8619 border: 0px !important;
8620 }
8621 tr.headerRow { border-bottom: 1px solid green !important;}
8622 tr.lastKeyInKRow { border-bottom: 1px solid red !important;}
8623 tr:hover { background-color: #fff6f6; }
8624 tr.headerRow:hover { background-color: #fff; }
8625
8626 col.column1 { border-right: 1px solid green !important;}
8627 col.endPair { border-right: 1px solid SandyBrown !important;}
8628 col.pre_ExtraCols { border-right: 1px solid green !important;}
8629
8630 //--></style>
8631 </head>
8632 <body>
8633 <table class=coverage>
8634 EOP
8635 0 my($LL, $INV, %s, @d, %access, %docs) = ($self->{faces}{$F}{layers}, $self->{faces}{$F}{'[Flip_AltGr_Key]'});
8636 0 ▶ $s{$self->charhex2key($INV)}++ if defined $INV; # Skip in reports '
Branch: 1 branch
BranchTrueFalseTotal
if defined $INV 0 0 0
8637 0 my @LL = map $self->{layers}{$_}, @$LL;
8638 0 ▶ $s{$_}++ or push @d, $_ for map @{ $self->{faces}{$F}{"[$_]"} || [] }, qw(dead_array dead_in_VK_array extra_report_DeadChar);
Branch: 1 branch
BranchTrueFalseTotal
$s{$_}++ or push @d, $_ 0 0 0
Condition0%0/2
$self->{'faces'}{$F}{"[$_]"} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{"[$_]"} || []
$self->{'faces'}{$F}{"[$_]"}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{"[$_]"}
Aresult
11
00
8639 0 my (@A, %isD2, @Dface, @DfaceKey, %d_seen) = [];
8640 0 my $compK = $self->{faces}{$F}{'[ComposeKeys]'};
8641 #warn 'prefix keys to report: <', join('> <', @d), '>';
8642 0 for my $ddK (@d) {
8643 0 (my $dK = $ddK) =~ s/^\s+//;
8644 0 my $c = $self->key2hex($self->charhex2key($dK));
8645 0 ▶ next if $d_seen{$c}++;
Branch: 1 branch
BranchTrueFalseTotal
if $d_seen{$c}++ 0 0 0
8646 ($compK->{$c} or warn("??? Skip non-array prefix key `$c' for face `$F', k=`$dK'")), next
8647 0 ▶ unless defined (my $FF = $self->{faces}{$F}{'[deadkeyFace]'}{$c});
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $FF = $self->{"faces"}{$F}{"[deadkeyFace]"}{$c}) 0 0 0
Condition0%0/2
$compK->{$c} or warn "??? Skip non-array prefix key `${c}' for face `${F}', k=`${dK}'"
l!l
00
MC/DC0%0/1
$compK->{$c} or warn "??? Skip non-array prefix key `${c}' for face `${F}', k=`${dK}'"
$compK->{$c}
Truth table0%0/2
A
A= $compK->{$c}
Aresult
11
00
8648 0 $access{$FF} = [$self->charhex2key($dK)];
8649 0 push @Dface, $FF;
8650 0 push @DfaceKey, $c;
8651 0 $docs{$FF} = $self->{faces}{$F}{'[prefixDocs]'}{$c}; # and warn "Found docs: face=`$F', c=`$c'\n";
8652 0 push @A, [$self->charhex2key($dK)];
8653 }
8654
8655 0 my ($lastDface, $prevCol, $COLS, @colOrn, %S, @joinedPairs) = ($#Dface, -1, '', [qw(0 column1)]);
8656 0 ▶ for my $kk (split /\p{Blank}+\|{3}\p{Blank}+/,
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'faces'}{$F}{'faceDeadKeys'} ? : 0 0 0
8657 (defined $self->{faces}{$F}{faceDeadKeys} ? $self->{faces}{$F}{faceDeadKeys} : ''), -1) {
8658 0 my $cnt = 0;
8659 0 ▶ length and $cnt++ for split /\p{Blank}+/, $kk;
Branch: 1 branch
BranchTrueFalseTotal
length $_ and ++$cnt 0 0 0
8660 0 push @joinedPairs, $cnt;
8661 }
8662 0 pop @joinedPairs;
8663 0 my $done = 0;
8664 0 push @colOrn, [$done += $_, 'endPair'] for @joinedPairs;
8665 0 my @skip_sections;
8666 0 for my $s (values %start_SEC) {
8667 0 $skip_sections[$_]++ for $s->[0]..($s->[0]+$s->[1]-1);
8668 }
8669
8670 0 for my $reported (1, 0) {
8671 0 ▶ for my $DD (@{ $self->{faces}{$F}{$reported ? 'LayoutTable_add_double_prefix_keys' : 'faceDeadKeys2'} }) {
Branch: 1 branch
BranchTrueFalseTotal
$reported ? : 0 0 0
8672 0 (my $dd = $DD) =~ s/^\s+//;
8673 # XXXX BUG in PERL??? This gives 3: DB<4> x scalar (my ($x, $y) = split //, 'ab')
8674 0 ▶ 2 == (my (@D) = split //, $self->stringHEX2string($dd)) or die "Not a double character in LayoutTable_add_double_prefix_keys for `$F': `$DD' -> `", $self->stringHEX2string($dd), "'";
Branch: 1 branch
BranchTrueFalseTotal
2 == (my @D = split(//, $self->stringHEX2string($dd), 0)) or die "Not a double character in LayoutTable_add_double_prefix_keys for `${F}': `${DD}' -> `", $self->stringHEX2string($dd), "'" 0 0 0
8675 0 ▶ my $map1 = $self->{faces}{$F}{'[deadkeyFaceHexMap]'}{$self->key2hex($D[0])}
Branch: 2 branches
BranchTrueFalseTotal
my $map1 = $self->{"faces"}{$F}{"[deadkeyFaceHexMap]"}{$self->key2hex($D[0])} or $reported ? die("Can't find prefix key face for `$D[0]' in `${F}'") : (next) 0 0 0
$reported ? : 0 0 0
8676 or ($reported ? die "Can't find prefix key face for `$D[0]' in `$F'" : next); # inverted faces bring havoc
8677 0 ▶ defined (my $Dead2 = $map1->{$self->key2hex($D[1])}) or die "Can't map `$D[1]' in `$F'+prefix `$D[0]'"; # in hex already
Branch: 1 branch
BranchTrueFalseTotal
defined(my $Dead2 = $$map1{$self->key2hex($D[1])}) or die "Can't map `$D[1]' in `${F}'+prefix `$D[0]'" 0 0 0
8678 0 ▶ $Dead2 = $Dead2->[0] if 'ARRAY' eq ref $Dead2;
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $Dead2 0 0 0
8679 0 ▶ defined (my $ddd = $self->{faces}{$F}{'[deadkeyFace]'}{$Dead2}) or die "Can't find prefix key face for `$D[1]' -> `$Dead2' in `$F'+prefix `$D[0]'";
Branch: 1 branch
BranchTrueFalseTotal
defined(my $ddd = $self->{"faces"}{$F}{"[deadkeyFace]"}{$Dead2}) or die "Can't find prefix key face for `$D[1]' -> `${Dead2}' in `${F}'+prefix `$D[0]'" 0 0 0
8680 0 ▶ next if $S{"@D"}++;
Branch: 1 branch
BranchTrueFalseTotal
if $S{join $", @D}++ 0 0 0
8681 0 ▶ push(@Dface, $ddd), push @DfaceKey, $Dead2 if $reported;
Branch: 1 branch
BranchTrueFalseTotal
if $reported 0 0 0
8682 0 ▶ $access{$ddd} ||= \@D;
Condition0%0/2
$access{$ddd} ||= \@D
l!l
00
MC/DC0%0/1
$access{$ddd} ||= \@D
$access{$ddd}
Truth table0%0/2
A
A= $access{$ddd}
Aresult
11
00
8683 0 $docs{$ddd} = $self->{faces}{$F}{'[prefixDocs]'}{$Dead2};
8684 0 ▶ push @A, \@D if $reported;
Branch: 1 branch
BranchTrueFalseTotal
if $reported 0 0 0
8685 # warn "set is_D2: @D";
8686 0 $isD2{$D[0]}{$D[1]}++;
8687 }
8688 }
8689 0 ▶ push @colOrn, [$lastDface+1, 'pre_ExtraCols'] if $#Dface != $lastDface;
Branch: 1 branch
BranchTrueFalseTotal
if $#Dface != $lastDface 0 0 0
8690 0 for my $orn (@colOrn) {
8691 0 my $skip = $orn->[0] - $prevCol - 1;
8692 0 ▶ warn("Multiple classes on columns of report unsupported: face=$F, col [@$orn]"), next if $skip < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $skip < 0 0 0 0
8693 0 $prevCol = $orn->[0];
8694 0 ▶ my $many = $skip > 1 ? " span=$skip" : '';
Branch: 1 branch
BranchTrueFalseTotal
$skip > 1 ? : 0 0 0
8695 0 ▶ $skip = $skip > 0 ? "\n <col$many />" : '';
Branch: 1 branch
BranchTrueFalseTotal
$skip > 0 ? : 0 0 0
8696 0 $COLS .= "$skip\n <col class=$orn->[1] />";
8697 }
8698 0 ▶ print <<EOP if $html;
Branch: 1 branch
BranchTrueFalseTotal
if $html 0 0 0
8699 <colgroup>$COLS
8700 </colgroup>
8701 EOP
8702 0 ▶ my ($k, $first_ctrl, $post_ctrl, @last_in_row) = (-1, map $self->{faces}{$F}{"[$_]"} || 0, qw(start_ctrl end_ctrl));
Condition0%0/2
$self->{'faces'}{$F}{"[$_]"} || 0
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{"[$_]"} || 0
$self->{'faces'}{$F}{"[$_]"}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{"[$_]"}
Aresult
11
00
8703 0 ▶ $last_in_row[ $k += $_ ]++ for @{ $self->{faces}{$F}{'[geometry]'} || [] };
Condition0%0/2
$self->{'faces'}{$F}{'[geometry]'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{'[geometry]'} || []
$self->{'faces'}{$F}{'[geometry]'}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{'[geometry]'}
Aresult
11
00
8704 #warn 'prefix key faces to report: <', join('> <', @Dface), '>';
8705 0 my @maps = (undef, map $self->{faces}{$F}{'[deadkeyFaceHexMap]'}{$_}, @DfaceKey); # element of Dface may be false if this is non-autonamed AltGr-inverted face
8706 0 ▶ my $dead = $html ? "<span class=dead title='what follows is a prefix key; find the corresponding column'>\x{2620}</span>" : "\x{2620}";
Branch: 1 branch
BranchTrueFalseTotal
$html ? : 0 0 0
8707 0 ▶ my $dead_i = $html ? "<span class=dead_i title='what follows is a prefix key with AltGr-invertion; find the matching column'>\x{2620}</span>" : "\x{2620}";
Branch: 1 branch
BranchTrueFalseTotal
$html ? : 0 0 0
8708 0 my $header = '';
8709 0 for my $dFace ('', @Dface) { # '' is no-dead
8710 0 my $base_t = 'Characters immediately on keys (without prefix keys); the first two are without/with Shift, two others same, but with added AltGr (excluding the special-key zone)';
8711 0 my $prefix_t = 'After tapping a prefix key, the base keys are replaced by what is in the column of the prefix key';
8712 0 ▶ $header .= qq( <td align=center class=headerbase title=' '><span title='$base_t'>↓Base</span> <span title='$prefix_t'>Prefix→</span></td>), next unless $dFace;
Branch: 1 branch
BranchTrueFalseTotal
unless $dFace 0 0 0
8713 0 my @a = map {(my $a = $_) =~ s/^(?=$rxCombining)/\x{25cc}/o; $a } @{ $access{$dFace} };
8714 0 my $docs = $docs{$dFace};
8715 0 ▶ $docs =~ s/([''&])/sprintf '&#x%02x;', ord $1/ge if $docs;
Branch: 1 branch
BranchTrueFalseTotal
if $docs 0 0 0
8716 0 ▶ my $withDocs = (defined $docs ? "<span title='$docs'>@a</span>" : "@a");
Branch: 1 branch
BranchTrueFalseTotal
defined $docs ? : 0 0 0
8717 0 $header .= " <td align=center class=header>$withDocs</td>";
8718 }
8719 0 ▶ print " <thead><tr class=headerRow title='Prefix key (or key sequence) accessing this column. To find how to type the prefix key, find it preceded by ☠ in the table below (mostly in the base column)'>$header</tr></thead>\n <tbody>\n"
Branch: 1 branch
BranchTrueFalseTotal
if $html 0 0 0
8720 if $html;
8721 0 my $vbell = '♪';
8722 0 my $OOut = '';
8723 0 for my $n ( 0 .. $#{ $LL[0] } ) {
8724 0 my ($out, $out_c, $prev, @KKK, $base_c) = ('', 0, '');
8725 0 my @baseK;
8726 0 ▶ next if $n >= $first_ctrl and $n < $post_ctrl or $skip_sections[$n] or $n >= $LAST_SEC;
Branch: 1 branch
BranchTrueFalseTotal
if $n >= $first_ctrl and $n < $post_ctrl or $skip_sections[$n] or $n >= $LAST_SEC 0 0 0
Condition0%0/9
$n >= $first_ctrl and $n < $post_ctrl or $skip_sections[$n] or $n >= $LAST_SEC
l!l&&r!l&&!r
000
$n >= $first_ctrl and $n < $post_ctrl or $skip_sections[$n]
l!l&&r!l&&!r
000
$n >= $first_ctrl and $n < $post_ctrl
!ll&&!rl&&r
000
MC/DC0%0/4
$n >= $first_ctrl and $n < $post_ctrl or $skip_sections[$n] or $n >= $LAST_SEC
$n >= $first_ctrl $n < $post_ctrl $skip_sections[$n] $n >= $LAST_SEC
Truth table0%0/7
A and B or C or D
A= $n >= $first_ctrlB= $n < $post_ctrlC= $skip_sections[$n]D= $n >= $LAST_SEC
ABCDresult
11XX1
0X1X1
101X1
0X011
10011
0X000
10000
8727 0 for my $dn (0..@Dface) { # 0 is no-dead
8728 0 ▶ next if $dn and not $maps[$dn];
Branch: 1 branch
BranchTrueFalseTotal
if $dn and not $maps[$dn] 0 0 0
Condition0%0/3
$dn and not $maps[$dn]
!ll&&!rl&&r
000
MC/DC0%0/2
$dn and not $maps[$dn]
$dn not $maps[$dn]
Truth table0%0/3
A and not(B)
A= $dnB= not $maps[$dn]
ABresult
0X0
100
111
8729 0 ▶ $out .= $html ? '</td><td>' : ($prev =~ /\X{7}/ ? ' ' : "\t") if length $out;
Branch: 3 branches
BranchTrueFalseTotal
if length $out 0 0 0
$html ? : 0 0 0
$prev =~ /\X{7}/ ? : 0 0 0
8730 0 ▶ my $is_D2 = $isD2{ @{$A[$dn]} == 1 ? $A[$dn][0] : 'n/a' };
Branch: 1 branch
BranchTrueFalseTotal
@{$A[$dn];} == 1 ? : 0 0 0
8731 # warn "is_D2: ", $self->array2string([$dn, $is_D2, $A[$dn], $A[$dn][0]]);
8732 0 my $o = '';
8733 0 for my $L (0..$#$LL) {
8734 0 for my $shift (0..1) {
8735 0 my $c = $LL[$L][$n][$shift];
8736 0 my ($pre, $expl, $C, $expl1, $invert_dead) = ('', '', $c);
8737 0 ▶ $o .= ' ', next unless defined $c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
8738 0 $out_c++;
8739 0 ▶ $pre = $dead if not $dn and 'ARRAY' eq ref $c and $c->[2];
Branch: 1 branch
BranchTrueFalseTotal
if not $dn and "ARRAY" eq ref $c and $c->[2] 0 0 0
Condition0%0/6
not $dn and "ARRAY" eq ref $c and $c->[2]
!ll&&!rl&&r
000
not $dn and "ARRAY" eq ref $c
!ll&&!rl&&r
000
MC/DC0%0/3
not $dn and "ARRAY" eq ref $c and $c->[2]
not $dn "ARRAY" eq ref $c $c->[2]
Truth table0%0/4
not(A) and B and C
A= not $dnB= "ARRAY" eq ref $cC= $c->[2]
ABCresult
0XX0
10X0
1100
1111
8740 0 ▶ $c = $c->[0] if 'ARRAY' eq ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $c 0 0 0
8741 0 ▶ $KKK[$L][$shift] = $c unless $dn;
Branch: 1 branch
BranchTrueFalseTotal
unless $dn 0 0 0
8742 0 $base_c = $KKK[$L][$shift];
8743 # warn "int_struct -> dead; face `$F', KeyPos=$n, Mods=$L, shift=$shift, ch=$c\n" if $pre;
8744 0 ▶ if ($dn) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dn) { } 0 0 0
8745 0 $C = $c = $maps[$dn]{$self->key2hex($c)};
8746 0 ▶ $c = $vbell unless defined $c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
8747 0 ▶ $invert_dead = (3 == ($c->[2] || 0) || (3 << 3) == ($c->[2] || 0)) if ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c 0 0 0
Condition0%0/7
3 == ($c->[2] || 0) || 24 == ($c->[2] || 0)
l!l&&r!l&&!r
000
$c->[2] || 0
l!l
00
$c->[2] || 0
l!l
00
MC/DC0%0/2
3 == ($c->[2] || 0) || 24 == ($c->[2] || 0)
3 == ($c->[2] || 0) 24 == ($c->[2] || 0)
MC/DC0%0/1
$c->[2] || 0
$c->[2]
MC/DC0%0/1
$c->[2] || 0
$c->[2]
Truth table0%0/3
A || B
A= 3 == ($c->[2] || 0)B= 24 == ($c->[2] || 0)
ABresult
1X1
011
000
Truth table0%0/2
A
A= $c->[2]
Aresult
11
00
Truth table0%0/2
A
A= $c->[2]
Aresult
11
00
8748 0 ▶ $pre = $invert_dead ? $dead_i : $dead if 'ARRAY' eq ref $c and $c->[2];
Branch: 2 branches
BranchTrueFalseTotal
if "ARRAY" eq ref $c and $c->[2] 0 0 0
$invert_dead ? : 0 0 0
Condition0%0/3
"ARRAY" eq ref $c and $c->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
"ARRAY" eq ref $c and $c->[2]
"ARRAY" eq ref $c $c->[2]
Truth table0%0/3
A and B
A= "ARRAY" eq ref $cB= $c->[2]
ABresult
0X0
100
111
8749 0 ▶ $c = $c->[0] if 'ARRAY' eq ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $c 0 0 0
8750 0 $c = $self->charhex2key($c);
8751 } else {
8752 # warn "coverage0_prefix -> dead; face `$F', KeyPos=$n, Mods=$L, shift=$shift, ch=$c\n" if $self->{faces}{$F}{'[coverage0_prefix]'}{$c};
8753 0 ▶ $invert_dead = (3 == ($c->[2] || 0) || (3 << 3) == ($c->[2] || 0)) if ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c 0 0 0
Condition0%0/7
3 == ($c->[2] || 0) || 24 == ($c->[2] || 0)
l!l&&r!l&&!r
000
$c->[2] || 0
l!l
00
$c->[2] || 0
l!l
00
MC/DC0%0/2
3 == ($c->[2] || 0) || 24 == ($c->[2] || 0)
3 == ($c->[2] || 0) 24 == ($c->[2] || 0)
MC/DC0%0/1
$c->[2] || 0
$c->[2]
MC/DC0%0/1
$c->[2] || 0
$c->[2]
Truth table0%0/3
A || B
A= 3 == ($c->[2] || 0)B= 24 == ($c->[2] || 0)
ABresult
1X1
011
000
Truth table0%0/2
A
A= $c->[2]
Aresult
11
00
Truth table0%0/2
A
A= $c->[2]
Aresult
11
00
8754 0 ▶ $pre = $invert_dead ? $dead_i : $dead if $pre or $self->{faces}{$F}{'[coverage0_prefix]'}{$c};
Branch: 2 branches
BranchTrueFalseTotal
if $pre or $self->{"faces"}{$F}{"[coverage0_prefix]"}{$c} 0 0 0
$invert_dead ? : 0 0 0
Condition0%0/3
$pre or $self->{"faces"}{$F}{"[coverage0_prefix]"}{$c}
l!l&&r!l&&!r
000
MC/DC0%0/2
$pre or $self->{"faces"}{$F}{"[coverage0_prefix]"}{$c}
$pre $self->{"faces"}{$F}{"[coverage0_prefix]"}{$c}
Truth table0%0/3
A or B
A= $preB= $self->{"faces"}{$F}{"[coverage0_prefix]"}{$c}
ABresult
1X1
011
000
8755 }
8756 0 ▶ $baseK[$L][$shift] = $c unless $dn;
Branch: 1 branch
BranchTrueFalseTotal
unless $dn 0 0 0
8757 0 ▶ $pre ||= $dead if $dn and $is_D2->{$baseK[$L][$shift]};
Branch: 1 branch
BranchTrueFalseTotal
if $dn and $$is_D2{$baseK[$L][$shift]} 0 0 0
Condition0%0/6
$dn and $$is_D2{$baseK[$L][$shift]}
!ll&&!rl&&r
000
$pre ||= $dead
l!l&&r!l&&!r
000
MC/DC0%0/2
$dn and $$is_D2{$baseK[$L][$shift]}
$dn $$is_D2{$baseK[$L][$shift]}
MC/DC0%0/2
$pre ||= $dead
$pre $dead
Truth table0%0/3
A and B
A= $dnB= $$is_D2{$baseK[$L][$shift]}
ABresult
0X0
100
111
Truth table0%0/3
A ||= B
A= $preB= $dead
ABresult
1X1
011
000
8758
8759 0 ▶ if ($html) {
Branch: 1 branch
BranchTrueFalseTotal
if ($html) { } 0 0 0
8760 0 $c = $self->char_2_html_span($base_c, $C, $c, $F, {ltr => 1}, 'l');
8761 } else {
8762 0 $c =~ s/(?=$rxCombining)/\x{25cc}/go; # dotted circle ◌ 25CC
8763 0 $c =~ s{([\x00-\x1F\x7F])}{ $self->control2prt("$1") }ge;
8764 }
8765 0 $c = "$pre$c";
8766 0 $o .= $c;
8767 }
8768 }
8769 0 $o =~ s/ +$//;
8770 0 $prev = $o;
8771 0 $out .= $o;
8772 }
8773 0 ▶ my $class = $last_in_row[$n] ? ' class=lastKeyInKRow' : '';
Branch: 1 branch
BranchTrueFalseTotal
$last_in_row[$n] ? : 0 0 0
8774 0 ▶ $out = " <tr$class><td><bdo dir=ltr>$out</bdo></td></tr>" if $html; # Do not make RTL chars mix up the order
Branch: 1 branch
BranchTrueFalseTotal
if $html 0 0 0
8775 0 ▶ $OOut .= "$out\n", print "$out\n" if $out_c;
Branch: 1 branch
BranchTrueFalseTotal
if $out_c 0 0 0
8776 }
8777 0 ▶ my @extra = map {(my $s = $_) =~ s/^\s+//; "\n\n<p>$s"} @{ $self->{faces}{$F}{TableSummaryAddHTML} || [] };
Condition0%0/2
$self->{'faces'}{$F}{'TableSummaryAddHTML'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{'TableSummaryAddHTML'} || []
$self->{'faces'}{$F}{'TableSummaryAddHTML'}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{'TableSummaryAddHTML'}
Aresult
11
00
8778 0 my $create_a_c = $self->{faces}{$F}{'[create_alpha_ctrl]'};
8779 0 ▶ $create_a_c = $create_alpha_ctrl unless defined $create_a_c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $create_a_c 0 0 0
8780 0 ▶ my $extra_ctrl = ($create_a_c >= 1) && '/[/]/\\';
Condition0%0/2
$create_a_c >= 1 && '/[/]/\\'
!ll
00
MC/DC0%0/1
$create_a_c >= 1 && '/[/]/\\'
$create_a_c >= 1
Truth table0%0/2
A
A= $create_a_c >= 1
Aresult
00
11
8781 0 ▶ $extra_ctrl .= ($create_a_c >= 2) && '/^/_';
Condition0%0/2
$create_a_c >= 2 && '/^/_'
!ll
00
MC/DC0%0/1
$create_a_c >= 2 && '/^/_'
$create_a_c >= 2
Truth table0%0/2
A
A= $create_a_c >= 2
Aresult
00
11
8782 0 ▶ my $more .= ($create_a_c >= 1) && ' Most of Ctrl-letters are omitted from the table; deduce them from reports for C/H/I/J/M/Z.';
Condition0%0/2
$create_a_c >= 1 && ' Most of Ctrl-letters are omitted from the table; deduce them from reports for C/H/I/J/M/Z.'
!ll
00
MC/DC0%0/1
$create_a_c >= 1 && ' Most of Ctrl-letters are omitted from the table; deduce them from reports for C/H/I/J/M/Z.'
$create_a_c >= 1
Truth table0%0/2
A
A= $create_a_c >= 1
Aresult
00
11
8783 0 ▶ print <<EOP if $html;
Branch: 1 branch
BranchTrueFalseTotal
if $html 0 0 0
8784 </tbody>
8785 </table>
8786
8787 @extra<p>Highlights (homographs and special needs): zero-width or SOFT HYPHEN: <span class=ZW><span class=l title="ANY ZEROWIDTH CHAR"><span class=lFILL></span></span></span>, whitespace: <span class=WS><span class=l title="ANY SPACE CHAR"> <span class=lFILL></span></span></span>, <span class=viet>Vietnamese</span>; <span class=doubleaccent>other double-accent</span>; <span class=paleo>paleo-Latin</span>;
8788 or <span class=ipa>IPA</span>.
8789 Or name having <span class=relation>RELATION, PERPENDICULAR,
8790 PARALLEL, DIVIDES, FRACTION SLASH</span>; or <span class=nAry>BIG, LARGE, N-ARY, CYRILLIC PALOCHKA/DZE/JE/QA/WE/A-IE,
8791 ANO TELEIA, KORONIS, PROSGEGRAMMENI, GREEK QUESTION MARK, SOF PASUQ, PUNCTUATION GERESH/GERSHAYIM</span>; or <span class=operator>OPERATOR, SIGN,
8792 SYMBOL, PROOF, EXISTS, FOR ALL, DIVISION, LOGICAL</span>; or <span class=altGrInv>AltGr-inverter prefix</span>;
8793 or via a rule <span class=withSubst>involving</span>/<span class=isSubst>exposing</span> a “BlueKey” substitution rule.
8794 (Some browsers fail to show highlights for whitespace/zero-width.)
8795 <p>Vertical lines separate: the column of the base face, paired
8796 prefix keys with “inverted bindings”, and explicitly selected multi-key prefixes. Horizontal lines separate key rows of
8797 the keyboard (including a fake row with the “left extra key” [one with <code>&lt;&gt;</code> or <code>\\|</code> - it is missing on many keyboards]
8798 and the <code>KP_Decimal</code> key [often marked as <code>. Del</code> on numeric keypad]); the last group is for semi-fake keys for
8799 <code>Enter/C-Enter/Backspace/C-Backspace/Tab</code> and <code>C-Break$extra_ctrl</code> (make sense after prefix keys) and special keys explicitly added
8800 in <b>.kbdd</b> files (usually <code>SPACE</code>).$more
8801 <p>Hover mouse over any appropriate place to get more information.
8802 In popups: brackets enclose Script, Range, “1st Unicode version with this character”;
8803 braces enclose “the reason why this position was assigned to this character” (<code>VisLr</code> means that a visual table was
8804 used; in <code>Subst{HOW}</code>, <code>L=Layer</code> and <code>F=Face</code> mean that a “BlueKey” substitution
8805 rule was defined via a special layer/face — see C<AlternCharSubstitutions>, C<AlternCharSubstitutionFaces> and C<AlternCharSubstitutionLayers>).
8806 </body>
8807 </html>
8808 EOP
8809 0 $OOut
8810 }
8811
8812 0 ▶sub coverage_face0 ($$;$) {
Subroutine coverage_face0: not called CC=29 SCAR=67.7
Pod undocumented
8813 0 my ($self, $F, $after_import, $after) = (shift, shift, shift);
8814 0 my $H = $self->{faces}{$F};
8815 0 my $LL = $H->{layers};
8816 0 ▶ return $H->{'[coverage0]'} if exists $H->{'[coverage0]'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $H->{"[coverage0]"} 0 0 0
8817 0 my (%seen, %seen_prefix, %imported);
8818 0 ▶ my $d = { %{ $H->{'[DEAD]'} || {} }, %{ $H->{'[dead_in_VK]'} || {} } };
Condition0%0/4
$H->{'[DEAD]'} || {}
l!l
00
$H->{'[dead_in_VK]'} || {}
l!l
00
MC/DC0%0/1
$H->{'[DEAD]'} || {}
$H->{'[DEAD]'}
MC/DC0%0/1
$H->{'[dead_in_VK]'} || {}
$H->{'[dead_in_VK]'}
Truth table0%0/2
A
A= $H->{'[DEAD]'}
Aresult
11
00
Truth table0%0/2
A
A= $H->{'[dead_in_VK]'}
Aresult
11
00
8819 # warn "coverage0 for `$F'" if $after_import;
8820 0 for my $l (@$LL) {
8821 0 my $L = $self->{layers}{$l};
8822 0 for my $k (@$L) {
8823 warn "Face `$F', layer `$l': coverage check is run too late: after the importation translation is performed"
8824 0 ▶ if not $after_import and $F !~ /^(.*)##Inv#([a-f0-9]{4,})$/is and grep {defined and ref and $_->[4]} @$k;
Branch: 1 branch
BranchTrueFalseTotal
if not $after_import || $F =~ /^(.*)##Inv#([a-f0-9]{4,})$/is and grep {defined $_ and ref $_ and $_->[4];} @$k 0 0 0
Condition0%0/12
not $after_import || $F =~ /^(.*)##Inv#([a-f0-9]{4,})$/is and grep {defined $_ and ref $_ and $_->[4];} @$k
!ll&&!rl&&r
000
$after_import || $F =~ /^(.*)##Inv#([a-f0-9]{4,})$/is
l!l&&r!l&&!r
000
defined $_ && ref $_ && $_->[4]
!ll&&!rl&&r
000
defined $_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/3
not $after_import || $F =~ /^(.*)##Inv#([a-f0-9]{4,})$/is and grep {defined $_ and ref $_ and $_->[4];} @$k
$after_import $F =~ /^(.*)##Inv#([a-f0-9]{4,})$/is grep {defined $_ and ref $_ and $_->[4];} @$k
MC/DC0%0/3
defined $_ && ref $_ && $_->[4]
defined $_ ref $_ $_->[4]
Truth table0%0/4
not(A || B) and C
A= $after_importB= $F =~ /^(.*)##Inv#([a-f0-9]{4,})$/isC= grep {defined $_ and ref $_ and $_->[4];} @$k
ABCresult
1XX0
01X0
0000
0011
Truth table0%0/4
A and B && C
A= defined $_B= ref $_C= $_->[4]
ABCresult
0XX0
10X0
1100
1111
8825 0 ▶ $seen{ref() ? $_->[0] : $_}++ for grep {defined and !(ref and $_->[2]) and !$d->{ref() ? $_->[0] : $_}} @$k;
Branch: 2 branches
BranchTrueFalseTotal
ref $_ ? : 0 0 0
ref $_ ? : 0 0 0
Condition0%0/9
defined $_ && !(ref $_ && $_->[2]) && !$$d{ref $_ ? $_->[0] : $_}
!ll&&!rl&&r
000
defined $_ and not ref $_ && $_->[2]
!ll&&!rl&&r
000
ref $_ && $_->[2]
!ll&&!rl&&r
000
MC/DC0%0/4
defined $_ && !(ref $_ && $_->[2]) && !$$d{ref $_ ? $_->[0] : $_}
defined $_ ref $_ $_->[2] !$$d{ref $_ ? $_->[0] : $_}
Truth table0%0/6
A and not(B && C) && not(D)
A= defined $_B= ref $_C= $_->[2]D= !$$d{ref $_ ? $_->[0] : $_}
ABCDresult
0XXX0
111X0
10X00
11000
10X11
11011
8826 0 ▶ $seen_prefix{ref() ? $_->[0] : $_}++ for grep {defined and (ref and $_->[2] or $d->{ref() ? $_->[0] : $_})} @$k;
Branch: 2 branches
BranchTrueFalseTotal
ref $_ ? : 0 0 0
ref $_ ? : 0 0 0
Condition0%0/9
defined $_ && (ref $_ && $_->[2] || $$d{ref $_ ? $_->[0] : $_})
!ll&&!rl&&r
000
ref $_ and $_->[2] or $$d{ref $_ ? $_->[0] : $_}
l!l&&r!l&&!r
000
ref $_ and $_->[2]
!ll&&!rl&&r
000
MC/DC0%0/4
defined $_ && (ref $_ && $_->[2] || $$d{ref $_ ? $_->[0] : $_})
defined $_ ref $_ $_->[2] $$d{ref $_ ? $_->[0] : $_}
Truth table0%0/6
A && B and C or D
A= defined $_B= ref $_C= $_->[2]D= $$d{ref $_ ? $_->[0] : $_}
ABCDresult
0XXX0
10X00
11000
111X1
10X11
11011
8827 0 ▶ $imported{"$_->[0]:$_->[1]"}++ for grep {defined and ref and 2 == ($_->[2] || 0)} @$k; # exportable
Condition0%0/8
defined $_ && ref $_ && 2 == ($_->[2] || 0)
!ll&&!rl&&r
000
defined $_ and ref $_
!ll&&!rl&&r
000
$_->[2] || 0
l!l
00
MC/DC0%0/3
defined $_ && ref $_ && 2 == ($_->[2] || 0)
defined $_ ref $_ 2 == ($_->[2] || 0)
MC/DC0%0/1
$_->[2] || 0
$_->[2]
Truth table0%0/4
A and B && C
A= defined $_B= ref $_C= 2 == ($_->[2] || 0)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/2
A
A= $_->[2]
Aresult
11
00
8828 }
8829 0 ▶ unless ($after++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($after++) 0 0 0
8830 0 $H->{'[layer0coverage0]'} = [sort keys %seen];
8831 }
8832 }
8833 0 $H->{'[coverage0_prefix]'} = \%seen_prefix; # prefix keys available on $F
8834 0 $H->{'[coverage0]'} = [sort keys %seen]; # non-prefix chars available on $F
8835 0 ▶ $H->{'[coverage0oneUTF16]'} = [grep { 2>length and 0x10000 > ord } @{$H->{'[coverage0]'}}]; # may be easy-postfixes on Windows
Condition0%0/3
2 > length $_ && 65536 > ord $_
!ll&&!rl&&r
000
MC/DC0%0/2
2 > length $_ && 65536 > ord $_
2 > length $_ 65536 > ord $_
Truth table0%0/3
A && B
A= 2 > length $_B= 65536 > ord $_
ABresult
0X0
100
111
8836 # $H->{'[coverage0+]'} = [grep {!(2>length and 0x10000 > ord)} @{$H->{'[coverage0]'}}]; # 1.74 has only partial support for these
8837 0 $H->{'[coverage0oneChar]'} = [grep { 2>length } @{$H->{'[coverage0]'}}]; # only for stats
8838 0 $H->{'[coverage0multiChar]'} = [grep { 1<length } @{$H->{'[coverage0]'}}]; # only for stats
8839 0 $H->{'[imported]'} = [sort keys %imported];
8840 0 $H->{'[coverage0oneUTF16hash]'} = { map { ($_, 1) } @{ $H->{'[coverage0oneUTF16]'} } };
8841 0 $H->{'[coverage0]'};
8842 }
8843
8844 # %imported is analysed: if manual deadkey is specified, this value is used, otherwised new value is generated and rememebered.
8845 # (but is not put in the keymap???]
8846 0 ▶sub massage_imported ($$) {
Subroutine massage_imported: not called CC=13 SCAR=52.0
Pod undocumented
8847 0 my ($self, $f) = (shift, shift);
8848 0 ▶ return unless my ($F, $KKK) = $f =~ /^(.*)###([a-f0-9]{4,})$/is;
Branch: 1 branch
BranchTrueFalseTotal
unless () = $f =~ /^(.*)###([a-f0-9]{4,})$/is 0 0 0
8849 0 my $H = $self->{faces}{$F};
8850 0 ▶ for my $i ( @{ $self->{faces}{$f}{'[imported]'} || [] } ) {
Condition0%0/2
$self->{'faces'}{$f}{'[imported]'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'[imported]'} || []
$self->{'faces'}{$f}{'[imported]'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'[imported]'}
Aresult
11
00
8851 0 ▶ my($k,$face) = $i =~ /^(.):(.*)/s or die "Unrecognized imported: `$i'";
Branch: 1 branch
BranchTrueFalseTotal
() = $i =~ /^(.):(.*)/s or die "Unrecognized imported: `${i}'" 0 0 0
8852 0 my $K;
8853 0 ▶ if (exists $H->{'[imported2key]'}{$i} or exists $H->{'[imported2key_auto]'}{$i}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $H->{'[imported2key]'}{$i} or exists $H->{'[imported2key_auto]'}{$i}) { } 0 0 0
elsif ($H->{'[coverage0_prefix]'}{$k} or $H->{'[auto_dead]'}{$k}) { } 0 0 0
Condition0%0/3
exists $H->{"[imported2key]"}{$i} or exists $H->{"[imported2key_auto]"}{$i}
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $H->{"[imported2key]"}{$i} or exists $H->{"[imported2key_auto]"}{$i}
exists $H->{"[imported2key]"}{$i} exists $H->{"[imported2key_auto]"}{$i}
Truth table0%0/3
A or B
A= exists $H->{"[imported2key]"}{$i}B= exists $H->{"[imported2key_auto]"}{$i}
ABresult
1X1
011
000
8854 0 ▶ $K = exists $H->{'[imported2key]'}{$i} ? $H->{'[imported2key]'}{$i} : $H->{'[imported2key_auto]'}{$i};
Branch: 1 branch
BranchTrueFalseTotal
exists $H->{'[imported2key]'}{$i} ? : 0 0 0
8855 ▶ } elsif ($H->{'[coverage0_prefix]'}{$k} or $H->{'[auto_dead]'}{$k}) { # it is already used
Condition0%0/3
$H->{"[coverage0_prefix]"}{$k} or $H->{"[auto_dead]"}{$k}
l!l&&r!l&&!r
000
MC/DC0%0/2
$H->{"[coverage0_prefix]"}{$k} or $H->{"[auto_dead]"}{$k}
$H->{"[coverage0_prefix]"}{$k} $H->{"[auto_dead]"}{$k}
Truth table0%0/3
A or B
A= $H->{"[coverage0_prefix]"}{$k}B= $H->{"[auto_dead]"}{$k}
ABresult
1X1
011
000
8856 # Assign a fake prefix key to imported map
8857 warn("Imported prefix keys exist, but Auto_Diacritic_Start is not defined in face `$F'"), return
8858 0 ▶ unless defined $H->{'[first_auto_dead]'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $H->{"[first_auto_dead]"} 0 0 0
8859 0 $K = $H->{'[imported2key_auto]'}{$i} = $self->next_auto_dead($H);
8860 } else { # preserve the prefix key
8861 0 $K = $H->{'[imported2key_auto]'}{$i} = $k;
8862 0 $H->{'[auto_dead]'}{$k}++;
8863 }
8864 0 ▶ my $LL = $self->{faces}{$face}{'[deadkeyLayers]'}{$self->key2hex($k)}
Branch: 1 branch
BranchTrueFalseTotal
my $LL = $self->{"faces"}{$face}{"[deadkeyLayers]"}{$self->key2hex($k)} or die "Cannot import a deadkey `${k}' from `${face}'" 0 0 0
8865 or die "Cannot import a deadkey `$k' from `$face'";
8866 0 $LL = [@$LL]; # Deep copy, so may override
8867 0 my $KK = $self->key2hex($K);
8868 0 ▶ if (my $over = $H->{'[AdddeadkeyLayers]'}{$KK}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $over = $H->{"[AdddeadkeyLayers]"}{$KK}) 0 0 0
8869 #warn "face `$F': additional bindings for deadkey $KK exist.\n";
8870 0 warn " mk_tr_lyrs_st 0" if debug_stacking_ord;
8871 0 $LL = [$self->make_translated_layers_stack($over, $LL)];
8872 }
8873 0 $H->{'[imported2key_all]'}{"$k:$face"} = $self->charhex2key($KK);
8874 0 $H->{'[deadkeyLayers]'}{$KK} = $LL;
8875 0 my $new_facename = "$F#\@#\@#\@$i";
8876 0 $self->{faces}{$new_facename}{layers} = $LL;
8877 0 $H->{'[deadkeyFace]'}{$KK} = $new_facename;
8878 0 $self->link_layers($F, $new_facename, 'skipfix', 'no-slot-warn');
8879
8880 0 $self->coverage_face0($new_facename);
8881 }
8882 }
8883
8884 0 ▶sub massage_imported2 ($$) {
Subroutine massage_imported2: not called CC=11 SCAR=48.8
Pod undocumented
8885 0 my ($self, $f) = (shift, shift);
8886 0 warn "... Importing into face=`$f" if debug_import;
8887 0 ▶ return unless my ($F, $KKK) = ($f =~ /^(.*)###([a-f0-9]{4,})$/is); # what about multiple prefixes???
Branch: 1 branch
BranchTrueFalseTotal
unless () = $f =~ /^(.*)###([a-f0-9]{4,})$/is 0 0 0
8888 0 ▶ return unless my $HH = $self->{faces}{$F}{'[imported2key_all]'};
Branch: 1 branch
BranchTrueFalseTotal
unless my $HH = $self->{"faces"}{$F}{"[imported2key_all]"} 0 0 0
8889 0 my $H = $self->{faces}{$f};
8890 0 warn "Importing into face=`$F' prefix=$KKK" if debug_import;
8891 0 my $LL = $H->{layers};
8892 0 my @unresolved;
8893 0 for my $l (@$LL) {
8894 0 my $L = $self->{layers}{$l};
8895 0 for my $k (@$L) {
8896 0 ▶ for my $kk (grep {defined and ref and $_->[2]} @$k) { # exportable
Condition0%0/6
defined $_ && ref $_ && $_->[2]
!ll&&!rl&&r
000
defined $_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/3
defined $_ && ref $_ && $_->[2]
defined $_ ref $_ $_->[2]
Truth table0%0/4
A and B && C
A= defined $_B= ref $_C= $_->[2]
ABCresult
0XX0
10X0
1100
1111
8897 0 $kk = [@$kk]; # deep copy
8898 0 ▶ if (2 == $kk->[2]) { # exportable
Branch: 1 branch
BranchTrueFalseTotal
if (2 == $kk->[2]) { } 0 0 0
8899 0 ▶ my $v = (defined $kk->[4] ? $kk->[4] : $kk->[0]);
Branch: 1 branch
BranchTrueFalseTotal
defined $kk->[4] ? : 0 0 0
8900 0 my $j = $HH->{"$v:$kk->[1]"};
8901 # push(@unresolved, "$v:$kk->[1]"),
8902 0 ▶ warn "Can't resolve `$v:$kk->[1]' to an imported dead key, face=`$F' prefix=$KKK; layer=$l"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $j 0 0 0
8903 unless defined $j;
8904 0 warn "Importing `$v:$kk->[1]' as `$j', face=`$F' prefix=$KKK; layer=$l" if debug_import;
8905 0 @$kk[0,4] = ($j, $v);
8906 } else {
8907 #warn "massage_imported2: shift $kk->[2] <<= 3 key `$kk->[0]' face `$f' layer `$l'\n" if $kk->[2] >> 3;
8908 0 $kk->[2] >>= 3; # ByPairs makes <<= 3 !
8909 }
8910 }
8911 }
8912 }
8913 0 delete $self->{faces}{$f}{'[coverage0]'};
8914 0 $self->coverage_face0($f, 'after_import'); # recalculate
8915 # $H->{'[unresolved_imported]'} = \@unresolved if @unresolved;
8916 }
8917
8918 0 ▶sub massage_char_substitutions($$) { # Read $self->{Substitutions}
Subroutine massage_char_substitutions: not called CC=10 SCAR=47.0
Pod undocumented
8919 0 my($self, $data) = (shift, shift);
8920 0 ▶ die "Too late to load char substitutions" if $self->{Compositions};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"Compositions"} 0 0 0
8921 0 ▶ for my $K (keys %{ $data->{Substitutions} || {}}) {
Condition0%0/2
$data->{'Substitutions'} || {}
l!l
00
MC/DC0%0/1
$data->{'Substitutions'} || {}
$data->{'Substitutions'}
Truth table0%0/2
A
A= $data->{'Substitutions'}
Aresult
11
00
8922 0 my $arr = $data->{Substitutions}{$K};
8923 0 for my $S (@$arr) {
8924 0 my $s = $self->stringHEX2string($S);
8925 0 $s =~ s/\p{Blank}(?=\p{NonspacingMark})//g;
8926 0 ▶ die "Expect 2 chars in substitution rule; I see <$s> (from <$S>)" unless 2 == (my @s = split //, $s);
Branch: 1 branch
BranchTrueFalseTotal
unless 2 == (my @s = split(//, $s, 0)) 0 0 0
8927 0 $self->{'[Substitutions]'}{"<subst-$K>"}{$s[0]} = [[0, $s[1]]]; # Format as in Compositions
8928 0 ▶ $self->{'[Substitutions]'}{"<subst-$K>"}{lc $s[0]} = [[0, lc $s[1]]]
Branch: 1 branch
BranchTrueFalseTotal
if &UI::KeyboardLayout::lc($s[0]) ne $s[0] and &UI::KeyboardLayout::lc($s[1]) ne $s[1] 0 0 0
Condition0%0/3
&UI::KeyboardLayout::lc($s[0]) ne $s[0] and &UI::KeyboardLayout::lc($s[1]) ne $s[1]
!ll&&!rl&&r
000
MC/DC0%0/2
&UI::KeyboardLayout::lc($s[0]) ne $s[0] and &UI::KeyboardLayout::lc($s[1]) ne $s[1]
&UI::KeyboardLayout::lc($s[0]) ne $s[0] &UI::KeyboardLayout::lc($s[1]) ne $s[1]
Truth table0%0/3
A and B
A= &UI::KeyboardLayout::lc($s[0]) ne $s[0]B= &UI::KeyboardLayout::lc($s[1]) ne $s[1]
ABresult
0X0
100
111
8929 if lc $s[0] ne $s[0] and lc $s[1] ne $s[1];
8930 0 ▶ $self->{'[Substitutions]'}{"<subst-$K>"}{uc $s[0]} = [[0, uc $s[1]]]
Branch: 1 branch
BranchTrueFalseTotal
if &UI::KeyboardLayout::uc($s[0]) ne $s[0] and &UI::KeyboardLayout::uc($s[1]) ne $s[1] 0 0 0
Condition0%0/3
&UI::KeyboardLayout::uc($s[0]) ne $s[0] and &UI::KeyboardLayout::uc($s[1]) ne $s[1]
!ll&&!rl&&r
000
MC/DC0%0/2
&UI::KeyboardLayout::uc($s[0]) ne $s[0] and &UI::KeyboardLayout::uc($s[1]) ne $s[1]
&UI::KeyboardLayout::uc($s[0]) ne $s[0] &UI::KeyboardLayout::uc($s[1]) ne $s[1]
Truth table0%0/3
A and B
A= &UI::KeyboardLayout::uc($s[0]) ne $s[0]B= &UI::KeyboardLayout::uc($s[1]) ne $s[1]
ABresult
0X0
100
111
8931 if uc $s[0] ne $s[0] and uc $s[1] ne $s[1];
8932 }
8933 }
8934 }
8935
8936 0 ▶sub new_from_configfile ($$) {
Subroutine new_from_configfile: not called CC=3 SCAR=24.8
Pod undocumented
8937 0 my ($class, $F) = (shift, shift);
8938 0 ▶ open my $f, '< :utf8', $F or die "Can't open `$F' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $f, "< :utf8", $F or die "Can't open `${F}' for read: $!" 0 0 0
8939 0 my $s = do {local $/; <$f>};
8940 0 ▶ close $f or die "Can't close `$F' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $f or die "Can't close `${F}' for read: $!" 0 0 0
8941 #warn "Got `$s'";
8942 0 my $self = $class->new_from_configfile_string($s);
8943 0 push @{$self->{'[file]'}}, $F;
8944 0 $self;
8945 }
8946
8947 0 ▶sub parse_add_configfile ($$) {
Subroutine parse_add_configfile: not called CC=3 SCAR=24.8
Pod undocumented
8948 0 my ($self, $F) = (shift, shift);
8949 0 ▶ open my $f, '< :utf8', $F or die "Can't open `$F' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $f, "< :utf8", $F or die "Can't open `${F}' for read: $!" 0 0 0
8950 0 my $s = do {local $/; <$f>};
8951 0 ▶ close $f or die "Can't close `$F' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $f or die "Can't close `${F}' for read: $!" 0 0 0
8952 #warn "Got `$s'";
8953 0 $self->parse_add_configstring($s, $self);
8954 # Dumpvalue->new()->dumpValue($self);
8955 0 push @{$self->{'[file]'}}, $F;
8956 0 $self;
8957 }
8958
8959 0 ▶sub new_from_configfile_string ($$) {
Subroutine new_from_configfile_string: not called CC=2 SCAR=17.9
Pod undocumented
8960 0 my ($class, $ss) = (shift, shift);
8961 0 ▶ die "too many arguments to UI::KeyboardLayout->new_from_configfile_string" if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
8962 0 my $self = $class->new;
8963 0 $self->parse_add_configstring($ss, $self);
8964 # Dumpvalue->new()->dumpValue($self);
8965 0 $self->massage_full;
8966 }
8967
8968 0 ▶sub doout ($$) {my(undef, $in) = (shift,shift); return '[u/d]' unless defined $in; $in = $in->[0] if ref $in; $in . chr hex $in};
Subroutine doout: not called CC=3 SCAR=24.8
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
unless defined $in 0 0 0
if ref $in 0 0 0
8969
8970 0 ▶sub massage_full($) {
Subroutine massage_full: not called CC=202 SCAR=106.2
Pod undocumented
8971 0 my $self = shift;
8972 0 my ($layers, $counts, $offsets) = $self->fill_kbd_layers($self);
8973 0 @{$self->{layers}}{keys %$layers} = values %$layers;
8974 0 @{$self->{layer_counts} }{keys %$counts} = values %$counts;
8975 0 @{$self->{layer_offsets}}{keys %$offsets} = values %$offsets;
8976 0 $self->massage_hash_values;
8977 0 $self->massage_diacritics; # Read $self->{Diacritics}
8978 0 $self->massage_char_substitutions($self); # Read $self->{Substitutions}
8979 0 $self->massage_faces;
8980
8981 0 $self->massage_deadkeys_win($self); # Process (embedded) MSKLC-style deadkey maps
8982 0 $self->scan_for_DeadKey_Maps(); # Makes a direct-access synonym, scan for DeadKey_Map* keys
8983 0 $self->create_DeadKey_Maps();
8984 0 $self->create_composite_layers; # Needs to be after simple deadkey maps are known
8985
8986 ### Not implemented yet!!! XXXXX ???? (The logic moved from output_deadkeys())
8987 0 for my $F (keys %{ $self->{faces} }) { # Fine-tune inverted-AltGr faces
8988 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
8989 0 ▶ next if $F =~ /#\@?#\@?(Inv)?#\@?/; # Face-on-a-deadkey
Branch: 1 branch
BranchTrueFalseTotal
if $F =~ /#\@?#\@?(Inv)?#\@?/ 0 0 0
8990 0 my $H = $self->{faces}{$F};
8991
8992 0 my($flip_AltGr_hex, %nn) = $H->{'[Flip_AltGr_Key]'};
8993 0 ▶ $flip_AltGr_hex = $self->key2hex($self->charhex2key($flip_AltGr_hex)) if defined $flip_AltGr_hex;
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr_hex 0 0 0
8994 0 for my $deadKey ( sort keys %{ $H->{'[deadkeyFaceHexMap]'} } ) {
8995 0 ▶ next if $H->{'[only_extra]'}{$self->charhex2key($deadKey)};
Branch: 1 branch
BranchTrueFalseTotal
if $H->{"[only_extra]"}{$self->charhex2key($deadKey)} 0 0 0
8996
8997 0 ▶ next unless $deadKey eq ($flip_AltGr_hex || 'n/a');
Branch: 1 branch
BranchTrueFalseTotal
unless $deadKey eq ($flip_AltGr_hex || "n/a") 0 0 0
Condition0%0/2
$flip_AltGr_hex || 'n/a'
l!l
00
MC/DC0%0/1
$flip_AltGr_hex || 'n/a'
$flip_AltGr_hex
Truth table0%0/2
A
A= $flip_AltGr_hex
Aresult
11
00
8998 0 my($is_invAltGr_Base_with_chain, $invertAlt, $AMap) = (1, 1, {}); # XXXX under the preceding assumption only ???
8999
9000 0 my $auto_inv_AltGr = $H->{'[deadkeyInvAltGrKey]'}{$deadKey};
9001 0 ▶ $auto_inv_AltGr = $self->key2hex($auto_inv_AltGr) if defined $auto_inv_AltGr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $auto_inv_AltGr 0 0 0
9002 ## (my $nonempty, my $MAP) = $self->output_deadkeys($F, $deadKey, $H->{'[dead2]'}, $flip_AltGr_hex, $auto_inv_AltGr);
9003 ## $self->massage_main_Inv_AltGr($F); # Moved from output_deadkeys()
9004
9005 0 my($map_AltGr_over, $over_dead2);
9006 0 ▶ if (my $override_InvAltGr = $H->{'[InvAltGrFace]'}{''}) { # NOW: needed only for invAltGr
Branch: 1 branch
BranchTrueFalseTotal
if (my $override_InvAltGr = $H->{"[InvAltGrFace]"}{""}) 0 0 0
9007 0 $map_AltGr_over = $self->linked_faces_2_hex_map($F, $override_InvAltGr);
9008 }
9009 0 ▶ $over_dead2 = $H->{'[dead2]'}->{$self->charhex2key($flip_AltGr_hex)} || {} if defined $flip_AltGr_hex; # used in CyrPhonetic v0.04
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr_hex 0 0 0
Condition0%0/2
$H->{'[dead2]'}{$self->charhex2key($flip_AltGr_hex)} || {}
l!l
00
MC/DC0%0/1
$H->{'[dead2]'}{$self->charhex2key($flip_AltGr_hex)} || {}
$H->{'[dead2]'}{$self->charhex2key($flip_AltGr_hex)}
Truth table0%0/2
A
A= $H->{'[dead2]'}{$self->charhex2key($flip_AltGr_hex)}
Aresult
11
00
9010 0 my $dead2 = { %{ $H->{'[DEAD]'} }, %{ $H->{'[dead_in_VK]'} } };
9011
9012 ## joined_map is a merge of enhanced-map (via alternative chars, like Menu-*), flat-map, and merged-multichar-map
9013 0 my %joined_map = (); # XXXX ????
9014 0 my @keys = sort keys %joined_map; # Sorting not OK for 6-byte keys - but after joining they disappear
9015 0 my %sp; # XXXX ???? Should be obtained from scancodes
9016 @keys = (grep((!/^d[89a-f]/i and lc(chr hex $_) ne uc(chr hex $_)and not $sp{chr hex $_} ), @keys),
9017 grep((!/^d[89a-f]/i and (lc(chr hex $_) eq uc chr hex $_ and (chr hex $_) !~ /\p{Blank}/) and not $sp{chr hex $_}), @keys),
9018 0 ▶ grep((!/^d[89a-f]/i and ((lc(chr hex $_) eq uc chr hex $_ and (chr hex $_) =~ /\p{Blank}/) or $sp{chr hex $_}) and $_ ne '0020'), @keys),
Condition0%0/27
!/^d[89a-f]/i && &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
!ll&&!rl&&r
000
not /^d[89a-f]/i and &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))
!ll&&!rl&&r
000
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !(&UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
!ll&&!rl&&r
000
not /^d[89a-f]/i and (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/)
!ll&&!rl&&r
000
&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/
!ll&&!rl&&r
000
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ || $sp{&UI::KeyboardLayout::chr(hex $_)}) && $_ ne '0020'
!ll&&!rl&&r
000
not /^d[89a-f]/i and &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ || $sp{&UI::KeyboardLayout::chr(hex $_)}
!ll&&!rl&&r
000
&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ or $sp{&UI::KeyboardLayout::chr(hex $_)}
l!l&&r!l&&!r
000
&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/
!ll&&!rl&&r
000
MC/DC0%0/3
!/^d[89a-f]/i && &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
not /^d[89a-f]/i &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) !$sp{&UI::KeyboardLayout::chr(hex $_)}
MC/DC0%0/4
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !(&UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
not /^d[89a-f]/i &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ !$sp{&UI::KeyboardLayout::chr(hex $_)}
MC/DC0%0/5
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ || $sp{&UI::KeyboardLayout::chr(hex $_)}) && $_ ne '0020'
not /^d[89a-f]/i &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ $sp{&UI::KeyboardLayout::chr(hex $_)} $_ ne '0020'
Truth table0%0/4
not(A) and B && not(C)
A= not /^d[89a-f]/iB= &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))C= !$sp{&UI::KeyboardLayout::chr(hex $_)}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/5
not(A) and B and not(C) && not(D)
A= not /^d[89a-f]/iB= &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))C= not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/D= !$sp{&UI::KeyboardLayout::chr(hex $_)}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
Truth table0%0/9
not(A) and B and C or D && E
A= not /^d[89a-f]/iB= &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))C= &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/D= $sp{&UI::KeyboardLayout::chr(hex $_)}E= $_ ne '0020'
ABCDEresult
0XXXX0
10X0X0
1100X0
111X00
10X100
110100
111X11
10X111
110111
9019 grep( /^d[89a-f]/i, @keys), # 16-bit surrogates
9020 grep( $_ eq '0020', @keys)); # make SPACE last
9021 0 for my $n (@keys) { # Only 4-byte keys reach this (except for Apple)
9022 my ($alt_n, $use_dead2) = (($is_invAltGr_Base_with_chain and defined $map_AltGr_over->{$n})
9023 ? ($n, $over_dead2)
9024 0 ▶ : (($invertAlt ? $AMap->{$n} : $n), $dead2));
Branch: 2 branches
BranchTrueFalseTotal
$is_invAltGr_Base_with_chain && defined $map_AltGr_over->{$n} ? : 0 0 0
$invertAlt ? : 0 0 0
Condition0%0/3
$is_invAltGr_Base_with_chain and defined $map_AltGr_over->{$n}
!ll&&!rl&&r
000
MC/DC0%0/2
$is_invAltGr_Base_with_chain and defined $map_AltGr_over->{$n}
$is_invAltGr_Base_with_chain defined $map_AltGr_over->{$n}
Truth table0%0/3
A and B
A= $is_invAltGr_Base_with_chainB= defined $map_AltGr_over->{$n}
ABresult
0X0
100
111
9025 }
9026 }
9027 }
9028
9029 0 for my $F (keys %{ $self->{faces} }) {
9030 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
9031 0 $self->coverage_face0($F); # creates coverage0, imported array (c0 excludes diacritics), coverage0_prefix hash
9032 }
9033 0 for my $F (sort keys %{ $self->{faces} }) {
9034 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
9035 0 $self->massage_imported($F); # calc new values for imported prefix keys, augments imported maps with Add-maps
9036 }
9037 0 for my $F (keys %{ $self->{faces} }) {
9038 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
9039 0 $self->massage_imported2($F); # changes imported prefix keys to appropriate values for the target personality
9040 }
9041 0 $self->create_prefix_chains;
9042 0 $self->create_inverted_faces;
9043 0 $self->link_composite_layers; # Needs to be after imported keys are reassigned...
9044 0 for my $F (keys %{ $self->{faces} }) { # Fine-tune inverted-AltGr faces
9045 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
9046 0 ▶ next if $F =~ /#\@?#\@?(Inv)?#\@?/; # Face-on-a-deadkey
Branch: 1 branch
BranchTrueFalseTotal
if $F =~ /#\@?#\@?(Inv)?#\@?/ 0 0 0
9047
9048 0 my $D = $self->{faces}{$F}{'[deadkeyFace]'};
9049 0 my $Ex = $self->{faces}{$F}{'[AltGr_Invert_Show]'};
9050 0 for my $d (keys %$D) {
9051 0 $self->{faces}{$F}{'[deadkeyFaceHexMap]'}{$d} = $self->linked_faces_2_hex_map($F, $D->{$d});
9052 0 ▶ defined (my $auto_inv_AltGr = $self->{faces}{$F}{'[deadkeyInvAltGrKey]'}{$d}) or next;
Branch: 1 branch
BranchTrueFalseTotal
defined(my $auto_inv_AltGr = $self->{"faces"}{$F}{"[deadkeyInvAltGrKey]"}{$d}) or next 0 0 0
9053 0 my $b1 = $self->{faces}{$F}{'[deadkeyFaceInvAltGr]'}{my $a = $self->charhex2key($auto_inv_AltGr)};
9054 0 ▶ $self->{faces}{$F}{'[deadkeyFaceHexMapInv]'}{$d} = $self->linked_faces_2_hex_map($F, $b1) if $b1;
Branch: 1 branch
BranchTrueFalseTotal
if $b1 0 0 0
9055 0 my $D = $self->{faces}{$F}{'[prefixDocs]'}{$d};
9056 0 ▶ $self->{faces}{$F}{'[prefixDocs]'}{$self->key2hex($a)} = 'AltGr-inverted: ' . (defined $D ? $D : "[[$d]]");
Branch: 1 branch
BranchTrueFalseTotal
defined $D ? : 0 0 0
9057 0 my $S = $self->{faces}{$F}{'[Show]'}{$d};
9058 0 ▶ $self->{faces}{$F}{'[Show]'}{$self->key2hex($a)} = (defined $S ? $S : $self->charhex2key($d)) . $Ex;
Branch: 1 branch
BranchTrueFalseTotal
defined $S ? : 0 0 0
9059 }
9060
9061 0 my($flip_AltGr, @protect_chr) = $self->{faces}{$F}{'[Flip_AltGr_Key]'}; # Who put it into deadkeyFace???
9062 0 ▶ if (defined $flip_AltGr) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flip_AltGr) 0 0 0
9063 0 $flip_AltGr = $self->key2hex($self->charhex2key($flip_AltGr));
9064 0 push @protect_chr, $flip_AltGr;
9065 $self->{faces}{$F}{'[prefixDocs]'}{$flip_AltGr} = 'AltGr-inverted base face'
9066 0 ▶ unless defined $self->{faces}{$F}{'[prefixDocs]'}{$flip_AltGr};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"faces"}{$F}{"[prefixDocs]"}{$flip_AltGr} 0 0 0
9067 0 ▶ $self->{faces}{$F}{'[Show]'}{$flip_AltGr} = $Ex unless defined $self->{faces}{$F}{'[Show]'}{$flip_AltGr};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"faces"}{$F}{"[Show]"}{$flip_AltGr} 0 0 0
9068 }
9069 0 ▶ my $expl = $self->{faces}{$F}{'[Explicit_AltGr_Invert]'} || [];
Condition0%0/2
$self->{'faces'}{$F}{'[Explicit_AltGr_Invert]'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{'[Explicit_AltGr_Invert]'} || []
$self->{'faces'}{$F}{'[Explicit_AltGr_Invert]'}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{'[Explicit_AltGr_Invert]'}
Aresult
11
00
9070 0 for my $i (1..(@$expl/2)) {
9071 0 my @C = map $self->key2hex($expl->[2*$i + $_]), -2, -1;
9072 0 push @protect_chr, $C[1];
9073 0 my $D = $self->{faces}{$F}{'[prefixDocs]'}{$C[0]};
9074 0 ▶ $self->{faces}{$F}{'[prefixDocs]'}{$C[1]} = 'AltGr-inverted: ' . (defined $D ? $D : "[[$C[0]]]");
Branch: 1 branch
BranchTrueFalseTotal
defined $D ? : 0 0 0
9075 0 my $S = $self->{faces}{$F}{'[Show]'}{$C[0]};
9076 0 ▶ $self->{faces}{$F}{'[Show]'}{$C[1]} = (defined $S ? $S : $self->charhex2key($C[0])) . $Ex;
Branch: 1 branch
BranchTrueFalseTotal
defined $S ? : 0 0 0
9077 }
9078 0 $self->{faces}{$F}{'[auto_dead]'}{ord $self->charhex2key($_)}++ for @protect_chr;
9079 # warn " Keys HexMap: ", join ', ', sort keys %{$self->{faces}{$F}{'[deadkeyFaceHexMap]'}};
9080 }
9081
9082 0 for my $F (sort keys %{ $self->{faces} }) { # Finally, collect the reachable no-prefix keys (include extra), make Compose
9083 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
9084 0 ▶ next if $F =~ /#\@?#\@?(Inv)?#\@?/; # Face-on-a-deadkey
Branch: 1 branch
BranchTrueFalseTotal
if $F =~ /#\@?#\@?(Inv)?#\@?/ 0 0 0
9085 0 my(%seenExtra, %seenExtraWithPrefix, %seenExtraPrefix); # non-prefix, all, prefix-only
9086 0 ▶ my @extras = ( "@{ $self->{faces}{$F}{'[output_layers]'} || [''] }" =~ /\bprefix(?:\w*)=([0-9a-fA-F]{4,6}\b|.(?![^ ]))/g );
Condition0%0/2
$self->{'faces'}{$F}{'[output_layers]'} || ['']
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{'[output_layers]'} || ['']
$self->{'faces'}{$F}{'[output_layers]'}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{'[output_layers]'}
Aresult
11
00
9087 0 my %is_extra = map { ($self->charhex2key($_), 1) } @extras; # extra layers (on bizarre modifiers)
9088 0 for my $deadKEY ( sort keys %{ $self->{faces}{$F}{'[deadkeyFace]'}} ) { # process Extra-basekeys
9089 0 my $deadKey = $self->charhex2key($deadKEY);
9090 0 ▶ next unless $is_extra{$deadKey};
Branch: 1 branch
BranchTrueFalseTotal
unless $is_extra{$deadKey} 0 0 0
9091 # warn "$F ExtraPrefix=$deadKEY\n";
9092 0 my($FFF,$C) = $self->{faces}{$F}{'[deadkeyFace]'}{$deadKEY};
9093 0 ▶ my $cov0 = $self->{faces}{$FFF}{'[layer0coverage0]'} # non-prefix base keys: can access all of these
Branch: 1 branch
BranchTrueFalseTotal
my $cov0 = $self->{"faces"}{$FFF}{"[layer0coverage0]"} or warn("Deadkey `${deadKey}' on face `${F}' -> unmassaged face"), next 0 0 0
9094 or warn("Deadkey `$deadKey' on face `$F' -> unmassaged face"), next;
9095 # XXXX this is heuristical only: we do not actually check sliding down and/or multi-codepoing!!! ???
9096 0 my $cov1 = $self->{faces}{$FFF}{'[coverage0]'}; # non-prefix; may slide down; may access with AltGr-invertor if not multi-codepoint
9097 0 ▶ $seenExtraWithPrefix{$_}++, $seenExtra{$_}++ for map {ref() ? $_->[0] : $_} @$cov1;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
9098 0 $seenExtraWithPrefix{$_}++, $seenExtraPrefix{$_}++ for keys %{$self->{faces}{$FFF}{'[coverage0_prefix]'}};
9099 }
9100 0 $self->{faces}{$F}{'[coverageExtra]'} = \%seenExtra;
9101 0 $self->{faces}{$F}{'[coverageExtraPrefix]'} = \%seenExtraPrefix;
9102 0 $self->{faces}{$F}{'[coverageExtraInclPrefix]'} = \%seenExtraWithPrefix; # used in massage_flat_maps_extra_keys()
9103 # warn "$F coverageExtraPrefix; ". join(' ', keys %seenExtraPrefix) . "\n" if keys %seenExtraPrefix;
9104 0 ▶ warn "$F coverageExtraPrefix HIDDEN; ", join(' ', grep !$self->{faces}{$F}{'[deadkeyFace]'}{$_},
Branch: 1 branch
BranchTrueFalseTotal
if keys %seenExtraPrefix 0 0 0
9105 map $self->key2hex($_), sort keys %seenExtraPrefix) . "\n" if keys %seenExtraPrefix;
9106
9107 0 ▶ next unless my $prefix = $self->{faces}{$F}{'[ComposeKey]'};
Branch: 1 branch
BranchTrueFalseTotal
unless my $prefix = $self->{"faces"}{$F}{"[ComposeKey]"} 0 0 0
9108 0 $self->auto_dead_can_wrap($F); # All manual deadkeys are set, so auto may be flexible
9109 0 $self->create_composekey($F, $prefix);
9110 }
9111
9112 0 $self->massage_flat_maps_extra_keys(); # Process Flat extra maps (used on Windows only); fill FlatPrefixMapFiltered, report results
9113
9114 0 for my $F (sort keys %{ $self->{faces} }) { # Handle enhanced maps (used on Windows only)
9115 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
9116 0 ▶ next if $F =~ /#\@?#\@?(Inv)?#\@?/; # Face-on-a-deadkey
Branch: 1 branch
BranchTrueFalseTotal
if $F =~ /#\@?#\@?(Inv)?#\@?/ 0 0 0
9117 0 my $H = $self->{faces}{$F};
9118 0 ▶ next unless defined( my $enhGray = $H->{'[Prefix_Base_Altern]'} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $enhGray = $H->{"[Prefix_Base_Altern]"}) 0 0 0
9119 0 $self->export_layers($enhGray, $F); # Process recipes
9120 0 $self->face_make_backlinks($enhGray, undef, undef, 'skipfix'); # no prefer-1st/last; without skipfix errors on 2nd call
9121 0 ▶ my %enhForce = map {($self->keys2hex($_), 1)} @{$H->{'[Prefix_Force_Altern]'} || []};
Condition0%0/2
$H->{'[Prefix_Force_Altern]'} || []
l!l
00
MC/DC0%0/1
$H->{'[Prefix_Force_Altern]'} || []
$H->{'[Prefix_Force_Altern]'}
Truth table0%0/2
A
A= $H->{'[Prefix_Force_Altern]'}
Aresult
11
00
9122 0 for my $deadKey ( sort keys %{ $H->{'[deadkeyFaceHexMap]'} } ) {
9123 0 ▶ next if $H->{'[only_extra]'}{$self->charhex2key($deadKey)};
Branch: 1 branch
BranchTrueFalseTotal
if $H->{"[only_extra]"}{$self->charhex2key($deadKey)} 0 0 0
9124 0 ▶ next unless my $dF = $H->{'[deadkeyFace]'}{$deadKey}; # may be Compose etc
Branch: 1 branch
BranchTrueFalseTotal
unless my $dF = $H->{"[deadkeyFace]"}{$deadKey} 0 0 0
9125 # if ("$F//$deadKey" eq "Latin//00a3") {
9126 # my $layers = $H->{'[deadkeyLayers]'}{$deadKey};
9127 # warn " make enh map $F//$deadKey: `$_': ", $self->layer2string($self->{layers}{$_}), "\n" for @$layers;
9128 # }
9129 # or warn "d=$deadKey; <", join(' ', keys %{$H->{'[deadkeyFace]'}}), '>';
9130 0 $self->faces_link_via_backlinks($enhGray, $dF);
9131 0 $H->{'[enhGrayHexMaps]'}{$deadKey} = my $enhMaps = [map $self->linked_faces_2_hex_map($enhGray, $dF, $_), 0, 1]; # 2 maps
9132 $H->{'[enhGrayHexMapsForce]'}{$deadKey} = [map { # submaps made of keys in 'Prefix_Force_Altern' and with defined values
9133 0 my $m = $enhMaps->[$_]; # These bindings are prefered to those present also on non-enhGray maps
9134 0 ▶ + { map { ($_, $m->{$_})} grep {$enhForce{$_} and defined $m->{$_}} keys %$m }} (0, 1)];
Condition0%0/3
$enhForce{$_} && defined $m->{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
$enhForce{$_} && defined $m->{$_}
$enhForce{$_} defined $m->{$_}
Truth table0%0/3
A && B
A= $enhForce{$_}B= defined $m->{$_}
ABresult
0X0
100
111
9135 0 my @LLL = map $self->{layers}{$_}, @{ $self->{faces}{$dF}{layers} };
9136 0 my($n, %agi_ctrl) = '[]';
9137 0 ▶ if (defined $self->{faces}{$F}{'[Flip_AltGr_Key]'} or defined $self->{faces}{$F}{'[invAltGr_Accessor]'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"faces"}{$F}{"[Flip_AltGr_Key]"} or defined $self->{"faces"}{$F}{"[invAltGr_Accessor]"}) 0 0 0
Condition0%0/3
defined $self->{"faces"}{$F}{"[Flip_AltGr_Key]"} or defined $self->{"faces"}{$F}{"[invAltGr_Accessor]"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $self->{"faces"}{$F}{"[Flip_AltGr_Key]"} or defined $self->{"faces"}{$F}{"[invAltGr_Accessor]"}
defined $self->{"faces"}{$F}{"[Flip_AltGr_Key]"} defined $self->{"faces"}{$F}{"[invAltGr_Accessor]"}
Truth table0%0/3
A or B
A= defined $self->{"faces"}{$F}{"[Flip_AltGr_Key]"}B= defined $self->{"faces"}{$F}{"[invAltGr_Accessor]"}
ABresult
1X1
011
000
9138 0 ▶ my ($first_ctrl, $post_ctrl) = map $self->{faces}{$F}{"[$_]"} || 0, qw(start_ctrl0 end_ctrl);
Condition0%0/2
$self->{'faces'}{$F}{"[$_]"} || 0
l!l
00
MC/DC0%0/1
$self->{'faces'}{$F}{"[$_]"} || 0
$self->{'faces'}{$F}{"[$_]"}
Truth table0%0/2
A
A= $self->{'faces'}{$F}{"[$_]"}
Aresult
11
00
9139 0 $n = "[$first_ctrl .. $post_ctrl]";
9140 0 for my $k ($first_ctrl .. $post_ctrl) {
9141 0 for my $shft ('','s') {
9142 0 my $kk = "agi_c${shft}_" . ($k-$first_ctrl);
9143 0 my $c = $LLL[1][$k][!!$shft];
9144 0 $agi_ctrl{$kk} = $c;
9145 }
9146 }
9147 }
9148 0 $self->{faces}{$F}{'[Inv_AltGr_Ctrl_Keys]'}{$deadKey} = \%agi_ctrl;
9149 # warn " agi_ctrl($F : $deadKey $n): ", join ' ', map {defined() ? (ref() ? $_->[0] : $_) : '[u/d]'} %agi_ctrl, "\n";
9150 }
9151 }
9152
9153 0 for my $F (sort keys %{ $self->{faces} }) { # Finally, collect the stats
9154 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
9155 0 ▶ next if $F =~ /#\@?#\@?(Inv)?#\@?/; # Face-on-a-deadkey
Branch: 1 branch
BranchTrueFalseTotal
if $F =~ /#\@?#\@?(Inv)?#\@?/ 0 0 0
9156 0 my $H = $self->{faces}{$F};
9157 0 my($prefix_in_base, %SEEN, %seen0oneUTF16, %seen1, %seen1only, %seenExtra) = $H->{'[coverage0_prefix]'};
9158 # warn("Face `$F' has no [deadkeyFace]"),
9159 0 ▶ next unless $H->{'[deadkeyFace]'};
Branch: 1 branch
BranchTrueFalseTotal
unless $H->{"[deadkeyFace]"} 0 0 0
9160 # next;
9161 0 my (%check_later, %coverage1_prefix, %prefix_with_1prefix, %prefix_with_2prefices, @difficult, %difficult, %reach_how);
9162 # warn "...... face `$F',\tprefixes0 ", keys %$prefix_in_base;
9163 # $prefix_in_base = {%$prefix_in_base}; # Deep copy
9164 # $prefix_in_base->{$_}++ for @{ $H->{'[dead_in_VK_array]'} || [] };
9165 0 ▶ my @extras = ( "@{ $H->{'[output_layers]'} || [''] }" =~ /\bprefix(?:\w*)=([0-9a-fA-F]{4,6}\b|.(?![^ ]))/g );
Condition0%0/2
$H->{'[output_layers]'} || ['']
l!l
00
MC/DC0%0/1
$H->{'[output_layers]'} || ['']
$H->{'[output_layers]'}
Truth table0%0/2
A
A= $H->{'[output_layers]'}
Aresult
11
00
9166 0 my %is_extra = map { ($self->charhex2key($_), 1) } @extras; # extra layers (on bizarre modifiers)
9167 0 $reach_how{$_} = 'b', $difficult[0]{$_}++ for @{ $H->{'[coverage0]'} };
9168 0 ▶ $reach_how{$_} ||= '', $reach_how{$_} .= 'e', $difficult[1]{$_}++ for keys %{ $H->{'[coverageExtra]'} };
Condition0%0/2
$reach_how{$_} ||= ""
l!l
00
MC/DC0%0/1
$reach_how{$_} ||= ""
$reach_how{$_}
Truth table0%0/2
A
A= $reach_how{$_}
Aresult
11
00
9169
9170 0 for my $pass (1,2,3) {
9171 0 for my $deadKEY ( sort keys %{ $H->{'[deadkeyFace]'}} ) {
9172 0 ▶ unless (%SEEN) { # Do not calculate if $F has no deadkeys...
Branch: 1 branch
BranchTrueFalseTotal
unless (%SEEN) 0 0 0
9173 0 $seen0oneUTF16{$_}++ for @{ $H->{'[coverage0oneUTF16]'} };
9174 0 %SEEN = %seen0oneUTF16; # XXX $SEEN includes $seen0oneUTF16 and $seen1 ???
9175 }
9176 ### XXXXX Directly linked faces may have some chars unreachable via the switch-prefixKey
9177 0 my ($deadKey, $not_in_base, $in_1prefix, $in_2prefices, $dK_of_extra) = $self->charhex2key($deadKEY);
9178 # It does not make sense to not include it into the summary: 0483 on US is such...
9179 0 ▶ $not_in_base++, $check_later{$deadKey}++ unless $prefix_in_base->{$deadKey}; # For multi-prefix maps, and extra layers
Branch: 1 branch
BranchTrueFalseTotal
unless $prefix_in_base->{$deadKey} 0 0 0
9180 0 ▶ next if $pass > 1 and not $not_in_base or $pass == 1 and $not_in_base; # 1st: in base; 2nd: needs 1 prefix
Branch: 1 branch
BranchTrueFalseTotal
if $pass > 1 and not $not_in_base or $pass == 1 and $not_in_base 0 0 0
Condition0%0/9
$pass > 1 and not $not_in_base or $pass == 1 and $not_in_base
l!l&&r!l&&!r
000
$pass > 1 and not $not_in_base
!ll&&!rl&&r
000
$pass == 1 and $not_in_base
!ll&&!rl&&r
000
MC/DC0%0/4
$pass > 1 and not $not_in_base or $pass == 1 and $not_in_base
$pass > 1 not $not_in_base $pass == 1 $not_in_base
Truth table0%0/7
A and not(B) or C and D
A= $pass > 1B= not $not_in_baseC= $pass == 1D= $not_in_base
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
9181 0 ▶ $in_1prefix = $prefix_with_1prefix{$deadKEY} if $pass > 1 and $not_in_base;
Branch: 1 branch
BranchTrueFalseTotal
if $pass > 1 and $not_in_base 0 0 0
Condition0%0/3
$pass > 1 and $not_in_base
!ll&&!rl&&r
000
MC/DC0%0/2
$pass > 1 and $not_in_base
$pass > 1 $not_in_base
Truth table0%0/3
A and B
A= $pass > 1B= $not_in_base
ABresult
0X0
100
111
9182 0 ▶ next if $pass == 2 and not $in_1prefix or $pass > 2 and $in_1prefix; # Third: 1 prefix is not enough
Branch: 1 branch
BranchTrueFalseTotal
if $pass == 2 and not $in_1prefix or $pass > 2 and $in_1prefix 0 0 0
Condition0%0/9
$pass == 2 and not $in_1prefix or $pass > 2 and $in_1prefix
l!l&&r!l&&!r
000
$pass == 2 and not $in_1prefix
!ll&&!rl&&r
000
$pass > 2 and $in_1prefix
!ll&&!rl&&r
000
MC/DC0%0/4
$pass == 2 and not $in_1prefix or $pass > 2 and $in_1prefix
$pass == 2 not $in_1prefix $pass > 2 $in_1prefix
Truth table0%0/7
A and not(B) or C and D
A= $pass == 2B= not $in_1prefixC= $pass > 2D= $in_1prefix
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
9183 0 ▶ $in_2prefices = $prefix_with_2prefices{$deadKEY} if $pass == 3 and ($not_in_base and not $in_1prefix);
Branch: 1 branch
BranchTrueFalseTotal
if $pass == 3 and ($not_in_base and not $in_1prefix) 0 0 0
Condition0%0/6
$pass == 3 and ($not_in_base and not $in_1prefix)
!ll&&!rl&&r
000
$not_in_base and not $in_1prefix
!ll&&!rl&&r
000
MC/DC0%0/3
$pass == 3 and ($not_in_base and not $in_1prefix)
$pass == 3 $not_in_base not $in_1prefix
Truth table0%0/4
A and B and not(C)
A= $pass == 3B= $not_in_baseC= not $in_1prefix
ABCresult
0XX0
10X0
1100
1111
9184
9185 0 $dK_of_extra = $H->{'[coverageExtraPrefix]'}{$deadKey}; # compose keys are not in deadkeyFace, so we do not see them here
9186 # warn "See $F\[$deadKEY] from extra only" if $not_in_base and $dK_of_extra;
9187 0 my ($FFF, @dd2) = $H->{'[deadkeyFace]'}{$deadKEY};
9188 0 ▶ my $cov1 = $self->{faces}{$FFF}{$is_extra{$deadKey} ? '[coverage0]' : '[coverage0oneUTF16]'} # XXXX not layer0coverage0 - may slide down to layer0
Branch: 2 branches
BranchTrueFalseTotal
my $cov1 = $self->{"faces"}{$FFF}{$is_extra{$deadKey} ? "[coverage0]" : "[coverage0oneUTF16]"} or warn("Deadkey `${deadKey}' on face `${F}' -> unmassaged face"), next 0 0 0
$is_extra{$deadKey} ? : 0 0 0
9189 or warn("Deadkey `$deadKey' on face `$F' -> unmassaged face"), next;
9190 0 my($map, %haveChar, %havePref, %cDifc) = $self->linked_faces_2_hex_map($F, $FFF); # hex → hex
9191 0 ▶ my $enhGrayMapsForce = $H->{'[enhGrayHexMapsForce]'}{$deadKEY} || [{},{}]; # prefered to those present also on non-extra maps
Condition0%0/2
$H->{'[enhGrayHexMapsForce]'}{$deadKEY} || [{}, {}]
l!l
00
MC/DC0%0/1
$H->{'[enhGrayHexMapsForce]'}{$deadKEY} || [{}, {}]
$H->{'[enhGrayHexMapsForce]'}{$deadKEY}
Truth table0%0/2
A
A= $H->{'[enhGrayHexMapsForce]'}{$deadKEY}
Aresult
11
00
9192 0 delete $map->{$_} for keys %{$enhGrayMapsForce->[0]}, keys %{$enhGrayMapsForce->[1]};
9193 $cDifc{$_} = 1, $haveChar{$_} = '1①2②3③9⑨'
9194 0 ▶ for grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and not (ref $_ and $_->[2])} values %$map;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/9
$_ and ref $_
!ll&&!rl&&r
000
$_ && !(ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ && $_->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && !(ref $_ && $_->[2])
$_ ref $_ $_->[2]
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && not(B && C)
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
1110
10X1
1101
9195 $havePref{$_} = 1
9196 0 ▶ for grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and (ref $_ and $_->[2])} values %$map;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/9
$_ and ref $_
!ll&&!rl&&r
000
$_ && (ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ and $_->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && (ref $_ && $_->[2])
$_ ref $_ $_->[2]
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && B and C
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
10X0
1100
1111
9197 0 ▶ if (my $Emap = $H->{'[enhGrayHexMaps]'}{$deadKEY}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $Emap = $H->{"[enhGrayHexMaps]"}{$deadKEY}) 0 0 0
9198 # warn "map/emap $F [$deadKEY]: @{[%$map]}[0,1] / @{[%{$Emap->[0]}]}[0,1]\n";
9199 0 my %mapAltGr = map {("0$_", $Emap->[1]{$_})} keys %{$Emap->[1]};
9200 0 my %mapF = ((map {("0$_", $enhGrayMapsForce->[1]{$_})} keys %{$enhGrayMapsForce->[1]}), %{$enhGrayMapsForce->[0]});
9201 0 ▶ for my $extrakeyMap ($Emap->[0] || {}, \%mapAltGr) {
Condition0%0/2
$Emap->[0] || {}
l!l
00
MC/DC0%0/1
$Emap->[0] || {}
$Emap->[0]
Truth table0%0/2
A
A= $Emap->[0]
Aresult
11
00
9202 warn " ... extra-key map $F [$deadKEY]: ", join(' ' ,
9203 0 map {$_ . (chr hex) . " ⇒ " . $self->doout($extrakeyMap->{$_})} sort keys %$extrakeyMap), "\n" if warnReached and %$extrakeyMap;
9204 # warn " ... wholemap $F [$deadKEY]: ", join(' ' ,
9205 # map {$_ . (chr hex) . " ⇒ " . $self->doout($map->{$_})} sort keys %$map), "\n"; # if warnReached and %$map;
9206 }
9207 0 ▶ $cDifc{$_} ||= 2, $haveChar{$_} ||= 'ⓔⒺₑEᵉᴱεέ' for grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and not (ref $_ and $_->[2])} values %{$Emap->[0]};
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/13
$_ and ref $_
!ll&&!rl&&r
000
$_ && !(ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ && $_->[2]
!ll&&!rl&&r
000
$cDifc{$_} ||= 2
l!l
00
$haveChar{$_} ||= "\x{24d4}\x{24ba}\x{2091}E\x{1d49}\x{1d31}\x{3b5}\x{1f73}"
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && !(ref $_ && $_->[2])
$_ ref $_ $_->[2]
MC/DC0%0/1
$cDifc{$_} ||= 2
$cDifc{$_}
MC/DC0%0/1
$haveChar{$_} ||= "\x{24d4}\x{24ba}\x{2091}E\x{1d49}\x{1d31}\x{3b5}\x{1f73}"
$haveChar{$_}
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && not(B && C)
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
1110
10X1
1101
Truth table0%0/2
A
A= $cDifc{$_}
Aresult
11
00
Truth table0%0/2
A
A= $haveChar{$_}
Aresult
11
00
9208 0 ▶ $cDifc{$_} ||= 4, $haveChar{$_} ||= 'ⓐⒶaAᵃᴬαά' for grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and not (ref $_ and $_->[2])} values %mapAltGr;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/13
$_ and ref $_
!ll&&!rl&&r
000
$_ && !(ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ && $_->[2]
!ll&&!rl&&r
000
$cDifc{$_} ||= 4
l!l
00
$haveChar{$_} ||= "\x{24d0}\x{24b6}aA\x{1d43}\x{1d2c}\x{3b1}\x{1f71}"
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && !(ref $_ && $_->[2])
$_ ref $_ $_->[2]
MC/DC0%0/1
$cDifc{$_} ||= 4
$cDifc{$_}
MC/DC0%0/1
$haveChar{$_} ||= "\x{24d0}\x{24b6}aA\x{1d43}\x{1d2c}\x{3b1}\x{1f71}"
$haveChar{$_}
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && not(B && C)
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
1110
10X1
1101
Truth table0%0/2
A
A= $cDifc{$_}
Aresult
11
00
Truth table0%0/2
A
A= $haveChar{$_}
Aresult
11
00
9209 0 ▶ $havePref{$_} ||= 'E' for grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and (ref $_ and $_->[2])} values %{$Emap->[0]}, values %mapAltGr;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/11
$_ and ref $_
!ll&&!rl&&r
000
$_ && (ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ and $_->[2]
!ll&&!rl&&r
000
$havePref{$_} ||= "E"
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && (ref $_ && $_->[2])
$_ ref $_ $_->[2]
MC/DC0%0/1
$havePref{$_} ||= "E"
$havePref{$_}
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && B and C
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/2
A
A= $havePref{$_}
Aresult
11
00
9210 }
9211 0 ▶ my($mapAi_C, $flat) = ($H->{'[Inv_AltGr_Ctrl_Keys]'}{$deadKEY} || {}, $H->{"[FlatPrefixMapAccessibleHex]"}{$deadKEY} || {});
Condition0%0/4
$H->{'[Inv_AltGr_Ctrl_Keys]'}{$deadKEY} || {}
l!l
00
$H->{'[FlatPrefixMapAccessibleHex]'}{$deadKEY} || {}
l!l
00
MC/DC0%0/1
$H->{'[Inv_AltGr_Ctrl_Keys]'}{$deadKEY} || {}
$H->{'[Inv_AltGr_Ctrl_Keys]'}{$deadKEY}
MC/DC0%0/1
$H->{'[FlatPrefixMapAccessibleHex]'}{$deadKEY} || {}
$H->{'[FlatPrefixMapAccessibleHex]'}{$deadKEY}
Truth table0%0/2
A
A= $H->{'[Inv_AltGr_Ctrl_Keys]'}{$deadKEY}
Aresult
11
00
Truth table0%0/2
A
A= $H->{'[FlatPrefixMapAccessibleHex]'}{$deadKEY}
Aresult
11
00
9212 # warn " lookup flat $F / $deadKEY: <", join("> <", %$flat), ">\n";
9213 # warn " lookup ACtrl $F / $deadKEY: <", join("> <", map $_->[0], grep defined, values %$mapAi_C), ">\n";
9214 0 ▶ $cDifc{$_} ||= 3, $haveChar{$_} ||= '⇑⇡⤊⥀^ˆ⦽ꞈ' for map $self->key2hex($_), grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and not (ref $_ and $_->[2])} values %$mapAi_C;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/13
$_ and ref $_
!ll&&!rl&&r
000
$_ && !(ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ && $_->[2]
!ll&&!rl&&r
000
$cDifc{$_} ||= 3
l!l
00
$haveChar{$_} ||= "\x{21d1}\x{21e1}\x{290a}\x{2940}^\x{2c6}\x{29bd}\x{a788}"
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && !(ref $_ && $_->[2])
$_ ref $_ $_->[2]
MC/DC0%0/1
$cDifc{$_} ||= 3
$cDifc{$_}
MC/DC0%0/1
$haveChar{$_} ||= "\x{21d1}\x{21e1}\x{290a}\x{2940}^\x{2c6}\x{29bd}\x{a788}"
$haveChar{$_}
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && not(B && C)
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
1110
10X1
1101
Truth table0%0/2
A
A= $cDifc{$_}
Aresult
11
00
Truth table0%0/2
A
A= $haveChar{$_}
Aresult
11
00
9215 0 ▶ $havePref{$_} ||= '⇑' for map $self->key2hex($_), grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and (ref $_ and $_->[2])} values %$mapAi_C;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/11
$_ and ref $_
!ll&&!rl&&r
000
$_ && (ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ and $_->[2]
!ll&&!rl&&r
000
$havePref{$_} ||= "\x{21d1}"
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && (ref $_ && $_->[2])
$_ ref $_ $_->[2]
MC/DC0%0/1
$havePref{$_} ||= "\x{21d1}"
$havePref{$_}
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && B and C
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/2
A
A= $havePref{$_}
Aresult
11
00
9216 $SEEN{$self->charhex2key($_)}++,
9217 0 ▶ $cDifc{$_} ||= 2, $haveChar{$_} ||= 'ⓕⒻƒFᶠℱφΦ' for grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and not (ref $_ and $_->[2])} keys %$flat;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/13
$_ and ref $_
!ll&&!rl&&r
000
$_ && !(ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ && $_->[2]
!ll&&!rl&&r
000
$cDifc{$_} ||= 2
l!l
00
$haveChar{$_} ||= "\x{24d5}\x{24bb}\x{192}F\x{1da0}\x{2131}\x{3c6}\x{3a6}"
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && !(ref $_ && $_->[2])
$_ ref $_ $_->[2]
MC/DC0%0/1
$cDifc{$_} ||= 2
$cDifc{$_}
MC/DC0%0/1
$haveChar{$_} ||= "\x{24d5}\x{24bb}\x{192}F\x{1da0}\x{2131}\x{3c6}\x{3a6}"
$haveChar{$_}
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && not(B && C)
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
1110
10X1
1101
Truth table0%0/2
A
A= $cDifc{$_}
Aresult
11
00
Truth table0%0/2
A
A= $haveChar{$_}
Aresult
11
00
9218 0 ▶ $havePref{$_} ||= 'ⓕ' for grep defined, map {($_ and ref $_) ? $_->[0] : $_} grep {$_ and (ref $_ and $_->[2])} keys %$flat;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/11
$_ and ref $_
!ll&&!rl&&r
000
$_ && (ref $_ && $_->[2])
!ll&&!rl&&r
000
ref $_ and $_->[2]
!ll&&!rl&&r
000
$havePref{$_} ||= "\x{24d5}"
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/3
$_ && (ref $_ && $_->[2])
$_ ref $_ $_->[2]
MC/DC0%0/1
$havePref{$_} ||= "\x{24d5}"
$havePref{$_}
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/4
A && B and C
A= $_B= ref $_C= $_->[2]
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/2
A
A= $havePref{$_}
Aresult
11
00
9219 0 ▶ unless ($is_extra{$deadKey}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($is_extra{$deadKey}) 0 0 0
9220 # my $is_extra = ($not_in_base ? ($dK_of_extra ? 1 : 2 ) : 0) + 3*($pass - 1);
9221 0 ▶ my $diffclty = $pass - 1 + !!($pass == 3 and not $in_2prefices);
Condition0%0/3
$pass == 3 && !$in_2prefices
!ll&&!rl&&r
000
MC/DC0%0/2
$pass == 3 && !$in_2prefices
$pass == 3 !$in_2prefices
Truth table0%0/3
A && not(B)
A= $pass == 3B= !$in_2prefices
ABresult
0X0
100
111
9222 0 my $D = !!$dK_of_extra + 2*$diffclty;
9223 0 for my $c (keys %haveChar) {
9224 0 my $cc = $self->charhex2key($c);
9225 0 $reach_how{$cc} .= substr $haveChar{$c}, $D, 1;
9226 0 my $d = $diffclty + $cDifc{$c} + 1; # base:0, every prefix = +2, extra modifier = +1 etc
9227 0 $difficult[$d]{$cc}++;
9228 0 $difficult{$cc}++;
9229 }
9230 }
9231 0 my %flat = map {("fl=$_", $_)} keys %$flat;
9232 # warn "Flat in [$deadKEY] $F: ", join(' ', sort @reached), "\n" if warnReached;
9233 # warn " agi_ctrl: ", join ' ', map {(not $_ or /agi/) ? $_ : $self->doout($_)} %agi_ctrl, "\n";
9234 # warn " agi_ctrl($F : $deadKEY): ", join ' ', map {defined() ? (ref() ? $_->[0] : $_) : '[u/d]'} %$mapAi_C, "\n";
9235
9236 0 my @reached = map $self->charhex2key($_), keys %haveChar;
9237 # my @reached_prefix = $self->charhex2key($_->[0]), grep +($_ and ref $_ and $_->[2]), values %$map;
9238 0 my(%reached, %u) = map +($_, 1), @reached; # , map chr, 0..0x1F; control-chars ∉ the base map, but can be produced on Win
9239 0 warn "Reached in [$deadKEY] $F: ", join(' ', sort @reached), "\n" if warnReached;
9240 ### my @e = each %$map; warn "map-start $F=>$FFF: $e[0] <@{ref $e[1] ? $e[1] : [$e[1]||'---']}>\n";
9241 ($SEEN{$_}++ or $seen1{$_}++), # micro-optimization
9242 $reached{$_} || $u{$_}++,
9243 ($not_in_base and not $is_extra{$deadKey}) || $seen0oneUTF16{$_} || $seen1only{$_}++, # Only for multi-prefix maps
9244 0 ▶ for map {ref() ? $_->[0] : $_} grep !(ref and $_->[2]), @$cov1; # Skip 2nd level deadkeys
Branch: 4 branches
BranchTrueFalseTotal
ref $_ ? : 0 0 0
$SEEN{$_}++ or ++$seen1{$_} 0 0 0
$reached{$_} or ++$u{$_} 0 0 0
$not_in_base and not $is_extra{$deadKey} or $seen0oneUTF16{$_} or ++$seen1only{$_} 0 0 0
Condition0%0/9
ref $_ && $_->[2]
!ll&&!rl&&r
000
$not_in_base and not $is_extra{$deadKey} or $seen0oneUTF16{$_}
l!l&&r!l&&!r
000
$not_in_base and not $is_extra{$deadKey}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $_ && $_->[2]
ref $_ $_->[2]
MC/DC0%0/3
$not_in_base and not $is_extra{$deadKey} or $seen0oneUTF16{$_}
$not_in_base not $is_extra{$deadKey} $seen0oneUTF16{$_}
Truth table0%0/3
A && B
A= ref $_B= $_->[2]
ABresult
0X0
100
111
Truth table0%0/5
A and not(B) or C
A= $not_in_baseB= not $is_extra{$deadKey}C= $seen0oneUTF16{$_}
ABCresult
11X1
0X11
1011
0X00
1000
9245 # !$is_extra{$deadKey} && ($reach_how{$_} ||= '', $reach_how{$_} .= (($not_in_base and $dK_of_extra) ? 'Ⓔ' : 'E')),
9246 # $_ eq '⏩' && warn "See ⏩ on [$deadKEY] !base=$not_in_base deadKey_of_ExtraFace=$dK_of_extra; of $F\n"
9247 ### $is_extra{$deadKey} && $seenExtra{$_}++ # Only for extra modifiers maps
9248 # for keys %{$H->{'[coverageExtra]'}};
9249 0 ▶ %u and warn "Unreached: <<$_>> in [$deadKEY] of $F\n" for join ' ', sort keys %u;
Branch: 1 branch
BranchTrueFalseTotal
%u and warn "Unreached: <<$_>> in [$deadKEY] of $F\n" 0 0 0
9250 0 ▶ if (my $d2 = $H->{'[dead2]'}{$deadKey}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $d2 = $H->{"[dead2]"}{$deadKey}) 0 0 0
9251 # warn "linked map (face=$F) = ", keys %$d2;
9252 0 ▶ @dd2 = map $self->charhex2key($_), map {($_ and ref $_) ? $_->[0] : $_} map $map->{$self->key2hex($_)}, keys %$d2;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
9253 # warn "sub-D2 (face=$F) = ", @dd2;
9254 }
9255 #warn "2nd level prefixes for `$deadKey': ", keys %{$self->{faces}{$FFF}{'[coverage0_prefix]'} || {}};
9256 #warn "2nd level prefixes for `$deadKey': <@dd2> ", keys %{$H->{'[dead2]'}{$deadKey} || {}};
9257 0 ▶ unless ($not_in_base) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($not_in_base) 0 0 0
9258 # warn "sub-cov0 (face=$F) = ", keys %{ $self->{faces}{$FFF}{'[coverage0_prefix]'} || {} };
9259 0 ▶ $coverage1_prefix{$_}++ for keys %{ $self->{faces}{$FFF}{'[coverage0_prefix]'} || {} }; # XXXX prefix keys (maybe unreachable???)
Condition0%0/2
$self->{'faces'}{$FFF}{'[coverage0_prefix]'} || {}
l!l
00
MC/DC0%0/1
$self->{'faces'}{$FFF}{'[coverage0_prefix]'} || {}
$self->{'faces'}{$FFF}{'[coverage0_prefix]'}
Truth table0%0/2
A
A= $self->{'faces'}{$FFF}{'[coverage0_prefix]'}
Aresult
11
00
9260 # warn "sub-D2 (face=$F) = ", @dd2;
9261 0 $coverage1_prefix{$_}++ for @dd2;
9262 }
9263 # warn "...... deadkey `$deadKey' reached0 in face `$F'" unless $not_in_base;
9264 0 ▶ %prefix_with_1prefix = (%prefix_with_1prefix, %havePref) if $pass == 1; # Hex
Branch: 1 branch
BranchTrueFalseTotal
if $pass == 1 0 0 0
9265 0 ▶ %prefix_with_2prefices = (%prefix_with_2prefices, %havePref) if $pass == 2; # Hex
Branch: 1 branch
BranchTrueFalseTotal
if $pass == 2 0 0 0
9266 # %prefix_with_3prefices = (%prefix_with_3prefices, %havePref) if $pass == 3; # Hex
9267 }
9268 }
9269 0 for my $c (keys %difficult) {
9270 0 $difficult{$c} = 9;
9271 0 for my $d (0..8) {
9272 0 ▶ $difficult{$c} = $d, last if $difficult[$d]{$c};
Branch: 1 branch
BranchTrueFalseTotal
if $difficult[$d]{$c} 0 0 0
9273 }
9274 }
9275 0 ▶ my @check = grep { !$coverage1_prefix{$_} and !$is_extra{$_} } sort keys %check_later; # dead: ∉ base ∪ 1-prefix ∪ extra
Condition0%0/3
$coverage1_prefix{$_} || $is_extra{$_}
l!l&&r!l&&!r
000
MC/DC0%0/2
$coverage1_prefix{$_} || $is_extra{$_}
$coverage1_prefix{$_} $is_extra{$_}
Truth table0%0/3
A || B
A= $coverage1_prefix{$_}B= $is_extra{$_}
ABresult
1X1
011
000
9276 0 ▶ my @only_extra = grep { !$coverage1_prefix{$_} and $is_extra{$_} } sort keys %check_later;
Condition0%0/3
!$coverage1_prefix{$_} && $is_extra{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
!$coverage1_prefix{$_} && $is_extra{$_}
!$coverage1_prefix{$_} $is_extra{$_}
Truth table0%0/3
not(A) && B
A= !$coverage1_prefix{$_}B= $is_extra{$_}
ABresult
0X0
100
111
9277 0 $H->{'[only_extra]'} = { map {($_, 1)} @only_extra }; # extra layers which are not reachable by 2 prefix keys
9278
9279 0 ▶ my $_s = (@check > 1 ? 's' : '');
Branch: 1 branch
BranchTrueFalseTotal
@check > 1 ? : 0 0 0
9280 0 ▶ warn("Prefix key$_s <@check> not reached (without double prefix keys?) in face `$F'; later=", sort(keys %check_later), " ; cov1=", sort keys %coverage1_prefix) if @check;
Branch: 1 branch
BranchTrueFalseTotal
if @check 0 0 0
9281 0 $H->{'[coverage1]'} = [sort keys %seen1];
9282 0 $H->{'[coverage1only]'} = [sort keys %seen1only];
9283 0 $H->{'[coverage1only_hash]'} = \%seen1only;
9284 0 $H->{'[coverage_hash]'} = \%SEEN;
9285 0 $H->{'[coverage_how]'} = \%reach_how;
9286 0 $H->{'[coverage_difficulty]'} = \%difficult;
9287 warn "$F coverage_how: ", join(' ', map +"$_ $reach_how{$_}", sort keys %reach_how), "\n"
9288 0 if warnReached and ( keys %{$H->{'[deadkeyFace]'}} or keys %{$H->{'[coverageExtra]'}} );
9289 # $H->{'[coverageExtra]'} = \%seenExtra; # also done above???
9290 }
9291 $self
9292 0 }
9293
9294 0 ▶sub massage_deadkeys_win ($$) {
Subroutine massage_deadkeys_win: not called CC=11 SCAR=48.8
Pod undocumented
9295 0 my($self, $h, @process, @to) = (shift, shift);
9296 0 my @K = grep m(^\[unparsed]/DEADKEYS\b), @{$h->{'[keys]'}};
9297 # warn "Found deadkey sections `@K'";
9298 # my $H = $h->{'[unparsed]'};
9299 0 for my $k (@K) {
9300 0 push @process, $self->get_deep($h, (split m(/), $k), 'unparsed_data');
9301 0 (my $k1 = $k) =~ s(^\[unparsed]/)();
9302 0 push @to, $k1
9303 }
9304 0 @K = grep m(^DEADKEYS\b), @{$h->{'[keys]'}};
9305 0 for my $k (@K) {
9306 0 my $slot = $self->get_deep($h, split m(/), $k);
9307 0 ▶ next unless exists $slot->{klc_filename};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $slot->{"klc_filename"} 0 0 0
9308 open my $fh, '< :encoding(UTF-16)', $slot->{klc_filename}
9309 0 ▶ or die "open of <klc_filename>=`$slot->{klc_filename}' failed: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "< :encoding(UTF-16)", $slot->{"klc_filename"} or die qq[open of <klc_filename>=`$slot->{"klc_filename"}' failed: $!] 0 0 0
9310 0 local $/;
9311 0 my $in = <$fh>;
9312 0 push @process, $in;
9313 0 push @to, $k;
9314 }
9315 0 for my $k1 (@to) {
9316 #warn "DK sec `$k' -> `$v', <", join('> <', keys %{$h->{'[unparsed]'}{DEADKEYS}{la_ru}}), ">";
9317 #warn "DK sec `$k' -> `$v', <$h->{'[unparsed]'}{DEADKEYS}{la_ru}{unparsed_data}>";
9318 0 my $v = shift @process;
9319 0 my($o,$d,$t) = $self->read_deadkeys_win($v); # Translation tables, names, rest of input
9320 0 my (@parts, @h) = split m(/), $k1;
9321 0 my %seen = (%$o, %$d);
9322 0 for my $kk (keys %seen) {
9323 #warn "DK sec `$k1', deadkey `$kk'. Map: ", $self->array2string( [%{$o->{$kk} || {}}] );
9324 0 my $slot = $self->get_deep($h, @parts, $kk);
9325 warn "Deadkey `$kk' defined for `$k1' conflicts with previous definition"
9326 0 ▶ if $slot and grep exists $slot->{$_}, qw(map name);
Branch: 1 branch
BranchTrueFalseTotal
if $slot and grep exists $slot->{$_}, ("map", "name") 0 0 0
Condition0%0/3
$slot and grep exists $slot->{$_}, ("map", "name")
!ll&&!rl&&r
000
MC/DC0%0/2
$slot and grep exists $slot->{$_}, ("map", "name")
$slot grep exists $slot->{$_}, ("map", "name")
Truth table0%0/3
A and B
A= $slotB= grep exists $slot->{$_}, ("map", "name")
ABresult
0X0
100
111
9327 0 ▶ $self->put_deep($h, $o->{$kk}, @parts, $kk, 'map') if exists $o->{$kk};
Branch: 1 branch
BranchTrueFalseTotal
if exists $o->{$kk} 0 0 0
9328 0 ▶ $self->put_deep($h, $d->{$kk}, @parts, $kk, 'name') if exists $d->{$kk};
Branch: 1 branch
BranchTrueFalseTotal
if exists $d->{$kk} 0 0 0
9329 }
9330 }
9331 $self
9332 0 }
9333
9334 # http://bepo.fr/wiki/Pilote_Windows
9335 # http://www.phon.ucl.ac.uk/home/wells/dia/diacritics-revised.htm#two
9336 # http://msdn.microsoft.com/en-us/library/windows/desktop/ms646280%28v=vs.85%29.aspx
9337
9338 1 ▶my %oem_keys = do {{ no warnings 'qw' ; reverse (qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
9339 OEM_MINUS -
9340 OEM_PLUS =
9341 OEM_4 [
9342 OEM_6 ]
9343 OEM_1 ;
9344 OEM_7 '
9345 OEM_3 `
9346 OEM_5 \
9347 OEM_COMMA ,
9348 OEM_PERIOD .
9349 OEM_2 /
9350 OEM_102 \#
9351 SPACE #
9352 DECIMAL .#
9353 DECIMAL ,#
9354 ABNT_C1 /#
9355 ABNT_C1 ¥
9356 ABNT_C1 ¦
9357 )) }}; #'# Here # marks "second occurence" of keys...
9358 # Extra bindings: see http://www.fysh.org/~zefram/keyboard/xt_scancodes.txt (after “===”)
9359 # e005 Messenger (or Files); e007 Redo; e008 undo; e009 ApplicationLeft; e00a Paste;
9360 # e00b,e011,e012,e01f ScrollWheel-to-key-emulation
9361 # e013 Word; e014 Excel; e015 Calendar; e016 Log Off; e017 Cut; e018 Copy; e01e ApplicationRight
9362 # e03b -- e044 (Microsoft/Logitech Fkeys_without_Flock, F1...F10)
9363 # e063 Wake; e064 My Pictures [or Keypad-) ]
9364
9365 # (for yet more VK_-symbols see https://learn.microsoft.com/en-us/previous-versions/aa931968(v=msdn.10))
9366 # OEM_ATTN OEM_COPY OEM_CUSEL OEM_ENLW do not have any scancodes assigned anywhere???
9367 # The discussion: https://stackoverflow.com/questions/11740958/js-what-keyboard-keys-are-specified-for-key-codes-in-intervals-146-185-193-218
9368
9369 # More details in (change “Arrangement” if needed): https://kbdlayout.info/kbdibm02/scancodes
9370 # see also this (and references there): https://bsakatu.net/doc/virtual-key-of-windows/
9371 # One of (industrial) keyboards with 000-key: https://geekhack.org/index.php?topic=60355.0
9372 # (Part of a huge family: https://telcontar.net/KBK/Fujitsu/series
9373
9374 # Before OEM_8: For type 4 of keyboard (same as types 1,3, except OEM_AX, (NON)CONVERT, ABNT_C1)
9375 # except KANA,(NON)CONVERT; after OEM_8 all is junk (non-scancodes???)...
9376 1 my %scan_codes = (reverse qw(
9377 02 1
9378 03 2
9379 04 3
9380 05 4
9381 06 5
9382 07 6
9383 08 7
9384 09 8
9385 0a 9
9386 0b 0
9387 0c OEM_MINUS
9388 0d OEM_PLUS
9389 10 Q
9390 11 W
9391 12 E
9392 13 R
9393 14 T
9394 15 Y
9395 16 U
9396 17 I
9397 18 O
9398 19 P
9399 1a OEM_4
9400 1b OEM_6
9401 1e A
9402 1f S
9403 20 D
9404 21 F
9405 22 G
9406 23 H
9407 24 J
9408 25 K
9409 26 L
9410 27 OEM_1
9411 28 OEM_7
9412 29 OEM_3
9413 2b OEM_5
9414 2c Z
9415 2d X
9416 2e C
9417 2f V
9418 30 B
9419 31 N
9420 32 M
9421 33 OEM_COMMA
9422 34 OEM_PERIOD
9423 35 OEM_2
9424 39 SPACE
9425 56 OEM_102
9426
9427 01 ESCAPE
9428 0E BACK
9429 0F TAB
9430 1C RETURN
9431 1D LCONTROL
9432 2A LSHIFT
9433 36 RSHIFT
9434 37 MULTIPLY
9435 38 LMENU
9436 3A CAPITAL
9437 3B F1
9438 3C F2
9439 3D F3
9440 3E F4
9441 3F F5
9442 40 F6
9443 41 F7
9444 42 F8
9445 43 F9
9446 44 F10
9447 45 NUMLOCK
9448 46 SCROLL
9449 47 HOME
9450 48 UP
9451 49 PRIOR
9452 4A SUBTRACT
9453 4B LEFT
9454 4C CLEAR
9455 4D RIGHT
9456 4E ADD
9457 4F END
9458 50 DOWN
9459 51 NEXT
9460 52 INSERT
9461 e053 DELETE
9462 54 SNAPSHOT
9463 57 F11
9464 58 F12
9465 59 CLEAR
9466 5A OEM_WSCTRL
9467 5B OEM_FINISH
9468 5C OEM_JUMP
9469 5C OEM_AX
9470 5D EREOF
9471 5E OEM_BACKTAB
9472 5F OEM_AUTO
9473 62 ZOOM
9474 63 HELP
9475 64 F13
9476 65 F14
9477 66 F15
9478 67 F16
9479 68 F17
9480 69 F18
9481 6A F19
9482 6B F20
9483 6C F21
9484 6D F22
9485 6E F23
9486 6F OEM_PA3
9487 70 KANA
9488 71 OEM_RESET
9489 73 ABNT_C1
9490 76 F24
9491 79 CONVERT
9492 7B NONCONVERT
9493 7B OEM_PA1
9494 7C TAB
9495 7E ABNT_C2
9496 7F OEM_PA2
9497
9498 e010 MEDIA_PREV_TRACK
9499 e019 MEDIA_NEXT_TRACK
9500 e01C RETURN
9501 e01D RCONTROL
9502 e020 VOLUME_MUTE
9503 e021 LAUNCH_APP2
9504 e022 MEDIA_PLAY_PAUSE
9505 e024 MEDIA_STOP
9506 e02E VOLUME_DOWN
9507 e030 VOLUME_UP
9508 e032 BROWSER_HOME
9509 e035 DIVIDE
9510 e037 SNAPSHOT
9511 e038 RMENU
9512 e046 CANCEL
9513 e047 HOME
9514 e048 UP
9515 e049 PRIOR
9516 e04B LEFT
9517 e04D RIGHT
9518 e04F END
9519 e050 DOWN
9520 e051 NEXT
9521 e052 INSERT
9522 e05B LWIN
9523 e05C RWIN
9524 e05D APPS
9525 e05E POWER
9526 e05F SLEEP
9527 e065 BROWSER_SEARCH
9528 e066 BROWSER_FAVORITES
9529 e067 BROWSER_REFRESH
9530 e068 BROWSER_STOP
9531 e069 BROWSER_FORWARD
9532 e06A BROWSER_BACK
9533 e06B LAUNCH_APP1
9534 e06C LAUNCH_MAIL
9535 e06D LAUNCH_MEDIA_SELECT
9536 e11D PAUSE
9537
9538 7D OEM_8
9539 )); # http://www.opensource.apple.com/source/WebCore/WebCore-1C25/platform/gdk/KeyboardCodes.h
9540
9541 # [ ] \ space
9542 1 my %oem_control = (qw(
9543 OEM_4 [001b
9544 OEM_6 ]001d
9545 OEM_5 \001c
9546 SPACE 0020
9547 OEM_102 \001c
9548 )); # In ru layouts, only entries which match the char are present
9549 1 my %do_control = map /^(.)(.+)/, values %oem_control;
9550 1 $do_control{' '} = '0020';
9551 1 delete $do_control{0};
9552
9553 1 my %default_bind = ( (map {( "NUMPAD$_" => [[$_]] )} 0..9 ),
9554 TAB => [["\t", "\t"]],
9555 ADD => [["+", "+"]],
9556 SUBTRACT => [["-", "-"]],
9557 MULTIPLY => [["*", "*"]],
9558 DIVIDE => [["/", "/"]],
9559 RETURN => [["\r", "\r"], ["\n"]],
9560 BACK => [["\b", "\b"], ["\x7f"]],
9561 ESCAPE => [["\e", "\e"], ["\e"]],
9562 CANCEL => [["\cC", "\cC"], ["\cC"]],
9563 );
9564
9565 0 ▶sub get_VK ($$) {
Subroutine get_VK: not called CC=2 SCAR=17.9
Pod undocumented
9566 0 my ($self, $f) = (shift, shift);
9567 0 ▶ $self->get_deep_via_parents($self, undef, 'faces', (split m(/), $f), 'VK') || {}
Branch: 1 branch
BranchTrueFalseTotal
$self->get_deep_via_parents($self, undef, "faces", split(m[/], $f, 0), "VK") or {} 0 0 0
9568 # $self->{faces}{$f}{VK} || {}
9569 }
9570
9571 1 my $min_sec;
9572 0 ▶sub last_pre_funckeys($$) {
Subroutine last_pre_funckeys: not called CC=9 SCAR=45.0
Pod undocumented
9573 0 my ($self, $l0) = (shift, shift);
9574 0 ▶ unless (defined $min_sec) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $min_sec) 0 0 0
9575 0 $min_sec = 1e300;
9576 0 ▶ $min_sec > $_->[0] and $min_sec = $_->[0] for values %start_SEC;
Branch: 1 branch
BranchTrueFalseTotal
$min_sec > $_->[0] and $min_sec = $_->[0] 0 0 0
9577 }
9578 ## warn "Layer disappeared: `$l0'; layer names:\n\t`", join("'\n\t`", sort keys %{$self->{layers}}), "'"
9579 ## unless defined $self->{layers}{$l0};
9580 0 my $post_main = @{ $self->{layers}{$l0} };
9581 0 ▶ if ($post_main >= $min_sec) {
Branch: 1 branch
BranchTrueFalseTotal
if ($post_main >= $min_sec) 0 0 0
9582 0 $post_main = $min_sec;
9583 0 ▶ while ($post_main > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($post_main > 0) 0 0 0
9584 0 ▶ last if grep defined, map {ref() ? $_->[0] : $_} grep defined, @{ $self->{layers}{$l0}[$post_main - 1] || [] };
Branch: 2 branches
BranchTrueFalseTotal
if grep defined($_), map({ref $_ ? $_->[0] : $_;} grep(defined($_), @{$self->{"layers"}{$l0}[$post_main - 1] or [];})) 0 0 0
ref $_ ? : 0 0 0
Condition0%0/2
$self->{'layers'}{$l0}[$post_main - 1] || []
l!l
00
MC/DC0%0/1
$self->{'layers'}{$l0}[$post_main - 1] || []
$self->{'layers'}{$l0}[$post_main - 1]
Truth table0%0/2
A
A= $self->{'layers'}{$l0}[$post_main - 1]
Aresult
11
00
9585 0 $post_main--;
9586 }
9587 }
9588 0 $post_main;
9589 }
9590
9591 0 ▶sub massage_VK ($$) {
Subroutine massage_VK: not called CC=45 SCAR=76.4
Pod undocumented
9592 0 my ($self, $f, %seen, %seen_dead, @dead, @ctrl) = (shift, shift);
9593 0 my $l0 = $self->{faces}{$f}{layers}[0];
9594 0 warn "Finding last key for face `$f' layer[0] = `$l0'...\n" if debug_face_layout_recipes;
9595 0 my $post_main = $self->last_pre_funckeys($l0);
9596
9597 0 ▶ if (my $LF = $self->{faces}{$f}{LinkFace}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $LF = $self->{"faces"}{$f}{"LinkFace"}) 0 0 0
9598 0 my $l00 = ($self->export_layers($LF))->[0];
9599 0 ▶ $self->revive_layer($LF, 0, $l00) unless $self->{layers}{$l00};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"layers"}{$l00} 0 0 0
9600 0 warn "Finding last key for face `$f' LinkFace = `$l00'...\n" if debug_face_layout_recipes;
9601 0 my $post_main0 = $self->last_pre_funckeys($l00);
9602 0 ▶ $post_main = $post_main0 if $post_main0 > $post_main;
Branch: 1 branch
BranchTrueFalseTotal
if $post_main0 > $post_main 0 0 0
9603 }
9604
9605 0 ▶ if (defined (my $b = $self->{faces}{$f}{BaseLayer})) { # Cannot bump into known keycodes
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $b = $self->{"faces"}{$f}{"BaseLayer"})) 0 0 0
9606 0 warn " mk_tr_lyrs 1" if debug_stacking_ord;
9607 0 ▶ $b = $self->make_translated_layers($b, $f, [0])->[0] if defined $b and not $self->{layers}{$b};
Branch: 1 branch
BranchTrueFalseTotal
if defined $b and not $self->{"layers"}{$b} 0 0 0
Condition0%0/3
defined $b and not $self->{"layers"}{$b}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $b and not $self->{"layers"}{$b}
defined $b not $self->{"layers"}{$b}
Truth table0%0/3
A and not(B)
A= defined $bB= not $self->{"layers"}{$b}
ABresult
0X0
100
111
9608 0 warn "Finding last key for face `$f' BaseLayer = `$b'...\n" if debug_face_layout_recipes;
9609 0 my $post_main0 = $self->last_pre_funckeys($b);
9610 0 ▶ $post_main = $post_main0 if $post_main0 > $post_main;
Branch: 1 branch
BranchTrueFalseTotal
if $post_main0 > $post_main 0 0 0
9611 }
9612 ## warn "post_main=$post_main; layer=$l0 min_sec=$min_sec";
9613
9614 0 $self->{faces}{$f}{'[non_VK]'} = $post_main;
9615 0 my $create_a_c = $self->{faces}{$f}{'[create_alpha_ctrl]'};
9616 0 ▶ $create_a_c = $create_alpha_ctrl unless defined $create_a_c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $create_a_c 0 0 0
9617 0 ▶ my $EXTR = [ ["\r","\n"], ["\b","\x7F"], ["\t","\cC"], ["\x1b","\x1d"], # Enter/C-Enter/Bsp/C-Bsp/Tab/Cancel/Esc=C-[/C-]
Branch: 2 branches
BranchTrueFalseTotal
$create_a_c ? : 0 0 0
$create_a_c > 1 ? : 0 0 0
9618 ["\x1c", ($create_a_c ? "\cZ" : ())], ($create_a_c>1 ? (["\x1e", "\x1f"], ["\x00"]) : ())]; # C-\ C-z, C-^ C-_
9619 0 ▶ if ($create_a_c) { # Fill all control-chars too
Branch: 1 branch
BranchTrueFalseTotal
if ($create_a_c) 0 0 0
9620 0 my %s;
9621 0 push @ctrl, scalar @$EXTR;
9622 0 $s{$_}++ for $self->flatten_arrays($EXTR);
9623 0 my @ctrl_l = grep !$s{$_}, map chr($_), 1..26;
9624 0 ▶ push @$EXTR, [shift @ctrl_l, shift @ctrl_l] while @ctrl_l > 1;
Branch: 1 branch
BranchTrueFalseTotal
@ctrl_l > 1 and do { push @$EXTR, [shift @ctrl_l, shift @ctrl_l] } 0 0 0
9625 0 ▶ push @$EXTR, [@ctrl_l] if @ctrl_l;
Branch: 1 branch
BranchTrueFalseTotal
if @ctrl_l 0 0 0
9626 0 push @ctrl, scalar @$EXTR;
9627 }
9628 0 my @extra = ( $EXTR, map [([]) x @$EXTR], 1..$#{ $self->{faces}{$f}{layers} } );
9629 0 my $VK = $self->get_VK($f);
9630 0 $self->{faces}{$f}{'[VK_off]'} = \ my %VK_off;
9631 0 $self->{faces}{$f}{'[scancodes]'} = \ my %scan;
9632 0 for my $K (reverse sort keys %$VK) { # want SPACE to come before ABNT_* and OEM_102 ;-)
9633 0 my ($v, @C) = $VK->{$K};
9634 0 my $vv = $v->[0];
9635 0 ▶ die("Can't reset the scancode for the VK key `$K'") if @$v < 2 and not length $v->[0];
Branch: 1 branch
BranchTrueFalseTotal
if @$v < 2 and not length $v->[0] 0 0 0
Condition0%0/3
@$v < 2 and not length $v->[0]
!ll&&!rl&&r
000
MC/DC0%0/2
@$v < 2 and not length $v->[0]
@$v < 2 not length $v->[0]
Truth table0%0/3
A and not(B)
A= @$v < 2B= not length $v->[0]
ABresult
0X0
100
111
9636 0 ▶ if ($v->[0] =~ /\|/ or @$v <= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v->[0] =~ /\|/ or @$v <= 1) 0 0 0
Condition0%0/3
$v->[0] =~ /\|/ or @$v <= 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$v->[0] =~ /\|/ or @$v <= 1
$v->[0] =~ /\|/ @$v <= 1
Truth table0%0/3
A or B
A= $v->[0] =~ /\|/B= @$v <= 1
ABresult
1X1
011
000
9637 0 $scan{$K} = $_, $self->{faces}{$f}{'[scancodes_more]'}{$_} = $K for split /\|/, uc $v->[0]; # the last one is put into %scan
9638 0 $vv = $scan{$K};
9639 }
9640 0 ▶ next unless @$v > 1; # Do not modify %VK_off; only memorize the scancode
Branch: 1 branch
BranchTrueFalseTotal
unless @$v > 1 0 0 0
9641 0 ▶ $vv = $scan_codes{$K} or die("Can't find the scancode for the VK key `$K'")
Branch: 1 branch
BranchTrueFalseTotal
unless length $vv 0 0 0
Condition0%0/5
length $vv || (($vv = $scan_codes{$K}) || die("Can't find the scancode for the VK key `${K}'"))
l!l&&r!l&&!r
000
$vv = $scan_codes{$K} or die "Can't find the scancode for the VK key `${K}'"
l!l
00
MC/DC0%0/2
length $vv || (($vv = $scan_codes{$K}) || die("Can't find the scancode for the VK key `${K}'"))
length $vv $vv = $scan_codes{$K}
Truth table0%0/3
A || B
A= length $vvB= $vv = $scan_codes{$K}
ABresult
1X1
011
000
9642 unless length $vv;
9643 0 $scan{$K} = $vv;
9644 # warn 'Key: <', join('> <', @$v), '>';
9645 0 my $c = 0;
9646 0 $VK_off{$K} = @{ $extra[0] }; # Where in the layouts is the VK key
9647 0 for my $k (@$v[1..$#$v]) {
9648 0 ▶ ($k, my $dead) = ($k =~ /^(.+?)(\@?)$/) or die "Empty key in VK list";
Branch: 1 branch
BranchTrueFalseTotal
($k, my $dead) = $k =~ /^(.+?)(\@?)$/ or die "Empty key in VK list" 0 0 0
9649 0 ▶ $seen{$k eq '-1' ? '' : ($k = $self->charhex2key($k))}++;
Branch: 1 branch
BranchTrueFalseTotal
$k eq '-1' ? : 0 0 0
9650 0 ▶ $seen_dead{$k}++ or push @dead, $k if $dead and $k ne '-1';
Branch: 1 branch
BranchTrueFalseTotal
if $dead and $k ne -1 0 0 0
Condition0%0/9
$dead && $k ne '-1' && ($seen_dead{$k}++ || push(@dead, $k))
!ll&&!rl&&r
000
$dead and $k ne -1
!ll&&!rl&&r
000
$seen_dead{$k}++ or push @dead, $k
l!l&&r!l&&!r
000
MC/DC0%0/4
$dead && $k ne '-1' && ($seen_dead{$k}++ || push(@dead, $k))
$dead $k ne -1 $seen_dead{$k}++ push @dead, $k
Truth table0%0/5
A and B && C or D
A= $deadB= $k ne -1C= $seen_dead{$k}++D= push @dead, $k
ABCDresult
0XXX0
10XX0
11000
111X1
11011
9651 0 ▶ my $kk = ($k eq '-1' ? undef : $k);
Branch: 1 branch
BranchTrueFalseTotal
$k eq '-1' ? : 0 0 0
9652 0 ▶ push @{ $extra[int($c/2)] }, [] unless $c % 2;
Branch: 1 branch
BranchTrueFalseTotal
unless $c % 2 0 0 0
9653 0 ▶ push @{ $extra[int($c/2)][-1] }, ($dead ? [$kk, undef, 1] : $kk); # $extra[$N] is [[$k0, $k1] ...]
Branch: 1 branch
BranchTrueFalseTotal
$dead ? : 0 0 0
9654 0 ▶ $kk .= $dead if defined $kk;
Branch: 1 branch
BranchTrueFalseTotal
if defined $kk 0 0 0
9655 0 push @C, $kk;
9656 0 $c++;
9657 }
9658 # warn 'Key: <', join('> <', @C), '>';
9659 0 @$v = ($v->[0], @C); # update the entry in %$VK (may be shared with other Faces!!!)
9660 }
9661 0 ▶warn "eScanCodes($f): [", join(' ', sort keys %{$self->{faces}{$f}{'[scancodes_more]'}||{}}), ']';
Condition0%0/2
$self->{'faces'}{$f}{'[scancodes_more]'} || {}
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'[scancodes_more]'} || {}
$self->{'faces'}{$f}{'[scancodes_more]'}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'[scancodes_more]'}
Aresult
11
00
9662 0 $self->{faces}{$f}{'[ini_layers]'} = [ @{ $self->{faces}{$f}{layers} } ]; # Deep copy
9663 0 ▶ if (@extra) {
Branch: 1 branch
BranchTrueFalseTotal
if (@extra) 0 0 0
9664 0 my($start_append, @Ln);
9665 0 for my $l (0 .. $#{ $self->{faces}{$f}{layers} } ) { # Assume that in every layer a few positions after end of the
9666 0 my $oLn = my $Ln = $self->{faces}{$f}{layers}[$l]; # first layer are empty
9667 0 my $L = $self->{layers}{$Ln};
9668 0 ▶ unless ($l) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($l) 0 0 0
9669 0 $start_append = $post_main;
9670 0 $self->{faces}{$f}{'[start_ctrl0]'} = $start_append;
9671 0 ▶ $self->{faces}{$f}{'[start_ctrl]'} = $start_append + ($ctrl[0]||0);
Condition0%0/2
$ctrl[0] || 0
l!l
00
MC/DC0%0/1
$ctrl[0] || 0
$ctrl[0]
Truth table0%0/2
A
A= $ctrl[0]
Aresult
11
00
9672 0 ▶ $self->{faces}{$f}{'[end_ctrl]'} = $start_append + ($ctrl[1]||0);
Condition0%0/2
$ctrl[1] || 0
l!l
00
MC/DC0%0/1
$ctrl[1] || 0
$ctrl[1]
Truth table0%0/2
A
A= $ctrl[1]
Aresult
11
00
9673 0 $_ += $start_append for values %VK_off;
9674 }
9675 0 my @L = map [$_->[0], $_->[1]], @$L; # Each element is []; 1-level deep copy
9676 0 ▶ warn "Main keys + ctrl slots overwrite FUNKEYS sections" if $start_append + @{ $extra[$l] } > $min_sec;
Branch: 1 branch
BranchTrueFalseTotal
if $start_append + @{$extra[$l];} > $min_sec 0 0 0
9677 0 ▶ $L[$start_append+$_] ||= [] for 0..$#{ $extra[$l] }; # Avoid splicing after the end of array
Condition0%0/2
$L[$start_append + $_] ||= []
l!l
00
MC/DC0%0/1
$L[$start_append + $_] ||= []
$L[$start_append + $_]
Truth table0%0/2
A
A= $L[$start_append + $_]
Aresult
11
00
9678 0 splice @L, $start_append, @{ $extra[$l] }, @{ $extra[$l] };
9679 0 push @Ln, ($Ln .= "<$f>");
9680 0 $self->{layers}{$Ln} = \@L;
9681 # At this moment ini_copy should not exist yet
9682 0 ▶warn "ini_copy of `$oLn' exists; --> `$Ln'" if $self->{layers}{'[ini_copy]'}{$oLn};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"layers"}{"[ini_copy]"}{$oLn} 0 0 0
9683 # $self->{layers}{'[ini_copy]'}{$Ln} = $self->{layers}{'[ini_copy]'}{$oLn} if $self->{layers}{'[ini_copy]'}{$oLn};
9684 #??? Why does not this works???
9685 #warn "ini_copy1: `$Ln' --> `$oLn'";
9686 0 $self->{layers}{'[ini_copy1]'}{$Ln} = $self->deep_copy($self->{layers}{$oLn});
9687 }
9688 ## if (my $add = $self->{faces}{$f}{'[ExtraChars]'}) {
9689 ## @$add = map {my $c = $_; s/^\s+//, s/\s+$// for $c; $self->charhex2key($c)} @$add);
9690 ## }
9691 0 $self->{faces}{$f}{layers} = \@Ln;
9692 }
9693 0 ([keys %seen], \@dead, \%seen_dead)
9694 }
9695
9696 0 ▶sub format_key ($$$$) {
Subroutine format_key: not called CC=7 SCAR=40.3
Pod undocumented
9697 0 my ($self, $k, $dead, $used) = (shift, shift, shift, shift);
9698 0 ▶ return -1 unless defined $k;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k 0 0 0
9699 0 ▶ my $mod = ($dead ? '@' : '') and $used->{$k}++;
Branch: 2 branches
BranchTrueFalseTotal
my $mod = $dead ? "\@" : "" and ++$used->{$k} 0 0 0
$dead ? : 0 0 0
9700 0 ▶ return "$k$mod" if $k =~ /^[A-Z0-9]$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $k =~ /^[A-Z0-9]$/i 0 0 0
9701 0 ▶ return '%%' if 1 != length $k or ord $k > 0xFFFF;
Branch: 1 branch
BranchTrueFalseTotal
if 1 != length $k or ord $k > 65535 0 0 0
Condition0%0/3
1 != length $k or ord $k > 65535
l!l&&r!l&&!r
000
MC/DC0%0/2
1 != length $k or ord $k > 65535
1 != length $k ord $k > 65535
Truth table0%0/3
A or B
A= 1 != length $kB= ord $k > 65535
ABresult
1X1
011
000
9702 0 $self->key2hex($k) . $mod;
9703 }
9704
9705 # wget -O - http://cgit.freedesktop.org/xorg/proto/xproto/plain/keysymdef.h | perl -C31 -wlne 'next unless /\bXK_(\w+)\s+0x00([a-fA-F\d]+)/; print chr hex $2, qq(\t$1)' > ! oooo1
9706 # wget -O - http://cgit.freedesktop.org/xorg/proto/xproto/plain/keysymdef.h | perl -C31 -wlne "next unless /\bXK_(\w+)\s+0x([a-fA-F\d]+)\s+\/\*(?:\(?|\s+)U\+([a-fA-F\d]+)/; print chr hex $3, qq(\t$1)" > oooo3
9707
9708 # See XK_ARMENIAN for an alternative way to encode Unicode to XK_: 0x1000587 /* U+0587
9709 1 my(%KeySyms,%deadSyms,%invKeySyms);
9710 0 ▶sub load_KeySyms($) {
Subroutine load_KeySyms: not called CC=13 SCAR=52.0
Pod undocumented
9711 0 ▶ return if %KeySyms;
Branch: 1 branch
BranchTrueFalseTotal
if %KeySyms 0 0 0
9712 0 my$self = shift;
9713 0 ▶ my $names = $self->get__value('KeySyms') or return;
Branch: 1 branch
BranchTrueFalseTotal
my $names = $self->get__value("KeySyms") or return 0 0 0
9714 0 my(%macro);
9715 0 for my $fn (@$names) {
9716 0 ▶ open my $fh, '<', $fn or warn("Cannot open $fn: $!"), next;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $fn or warn("Cannot open ${fn}: $!"), next 0 0 0
9717 0 ▶ while (defined(my $l = <$fh>)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $l = readline $fh)) 0 0 0
9718 0 chomp $l;
9719 0 ▶ $deadSyms{$1}++ if $l =~ /\bXK_dead_(\w+)\s+0x([a-fA-F\d]+)\b/;
Branch: 1 branch
BranchTrueFalseTotal
if $l =~ /\bXK_dead_(\w+)\s+0x([a-fA-F\d]+)\b/ 0 0 0
9720 0 my $dup = ( $l =~ m[\bXK_(\w+)\s+0x([a-fA-F\d]+)\s+/\*.*\b(obsolete|alias)\b] );
9721 0 ▶ next unless $l =~ m[\bXK_(\w+)\s+0x([a-fA-F\d]+)\s+/\*\s*(\()?U\+([a-fA-F\d]+)];
Branch: 1 branch
BranchTrueFalseTotal
unless $l =~ m[\bXK_(\w+)\s+0x([a-fA-F\d]+)\s+/\*\s*(\()?U\+([a-fA-F\d]+)] 0 0 0
9722 0 ▶ warn "not yet defined: <$l>" if $dup and not $macro{$2};
Branch: 1 branch
BranchTrueFalseTotal
if $dup and not $macro{$2} 0 0 0
Condition0%0/3
$dup and not $macro{$2}
!ll&&!rl&&r
000
MC/DC0%0/2
$dup and not $macro{$2}
$dup not $macro{$2}
Truth table0%0/3
A and not(B)
A= $dupB= not $macro{$2}
ABresult
0X0
100
111
9723 0 ▶ warn "sym re-defined: <$l>" if $KeySyms{$1};
Branch: 1 branch
BranchTrueFalseTotal
if $KeySyms{$1} 0 0 0
9724 # warn "macro re-defined: <$l>\n" if $macro{$2} and not $dup; # several offenders
9725 0 $KeySyms{$1} = my $c = chr hex $4;
9726 0 ▶ $invKeySyms{$c} = $1 unless $3;
Branch: 1 branch
BranchTrueFalseTotal
unless $3 0 0 0
9727 0 ▶ $macro{$2} = $1 unless $dup;
Branch: 1 branch
BranchTrueFalseTotal
unless $dup 0 0 0
9728 }
9729 }
9730 }
9731
9732 my %extra_X11_map = (qw(dead+asciicircum dead_circumflex dead+0338 dead_stroke
9733 dead+02f5 dead_doublegrave), # Does work even if we remove `ascii´
9734 1 map {("dead+$_", 'dead_currency')} qw(sterling dollar cent yen copyright registered));
9735
9736 0 ▶sub format_key_XKB ($$$$$$) { ##### Unfinished
Subroutine format_key_XKB: not called CC=31 SCAR=69.0
Pod undocumented
9737 0 my ($self, $face, $k, $dead, $guess, $used) = (shift, shift, shift, shift, shift, shift);
9738 0 ▶ return 'NoSymbol' unless defined $k;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k 0 0 0
9739 0 ▶ $self->load_KeySyms unless %KeySyms;
Branch: 1 branch
BranchTrueFalseTotal
unless %KeySyms 0 0 0
9740 0 ▶ my $mod = ($dead ? 'dead_' : '') and $used->{$k}++;
Branch: 2 branches
BranchTrueFalseTotal
my $mod = $dead ? "dead_" : "" and ++$used->{$k} 0 0 0
$dead ? : 0 0 0
9741 0 ▶ my $MAP = ($self->{faces}{$face}{"[${mod}X11symbol]"} ||= {});
Condition0%0/2
$self->{"faces"}{$face}{"[${mod}X11symbol]"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"faces"}{$face}{"[${mod}X11symbol]"} ||= {}
$self->{"faces"}{$face}{"[${mod}X11symbol]"}
Truth table0%0/2
A
A= $self->{"faces"}{$face}{"[${mod}X11symbol]"}
Aresult
11
00
9742 0 my $hexK = $self->keys2hex($k);
9743 0 ▶ return $MAP->{$hexK} if exists $MAP->{$hexK};
Branch: 1 branch
BranchTrueFalseTotal
if exists $MAP->{$hexK} 0 0 0
9744 # return $MAP->{$hexK} = "multichar=<$k>???" if 1 != length $k;
9745 0 ▶ if (1 != length $k) {
Branch: 1 branch
BranchTrueFalseTotal
if (1 != length $k) 0 0 0
9746 0 my $v = sprintf '0x%x', 0x1000000 - 0x10000 - ++$self->{faces}{$face}{"[X11multicharC]"}; # map to near 0x1000000 – 0x1110000 ????
9747 # warn "$face + «$hexK» ⇒ $v; «", join('», «', grep /\./, keys %$MAP), '»';
9748 0 return $MAP->{$hexK} = $v; # "multichar=<$k>???"
9749 }
9750 0 my $sym = $invKeySyms{$k};
9751 return $MAP->{$self->{faces}{$face}{"[${mod}iX11]"}{$sym} = $hexK} = "$mod$sym"
9752 0 ▶ if defined $sym and (not $mod or exists $deadSyms{$sym});
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym and !$mod || exists $deadSyms{$sym} 0 0 0
Condition0%0/6
defined $sym and !$mod || exists $deadSyms{$sym}
!ll&&!rl&&r
000
not $mod or exists $deadSyms{$sym}
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $sym and !$mod || exists $deadSyms{$sym}
defined $sym not $mod exists $deadSyms{$sym}
Truth table0%0/4
A and not(B) or C
A= defined $symB= not $modC= exists $deadSyms{$sym}
ABCresult
0XX0
1000
11X1
1011
9753 0 ▶ my $sym1 = (defined $sym ? $sym : $hexK);
Branch: 1 branch
BranchTrueFalseTotal
defined $sym ? : 0 0 0
9754 return $MAP->{$self->{faces}{$face}{"[${mod}iX11]"}{$sym} = $hexK} = $extra_X11_map{"dead+$sym1"}
9755 0 ▶ if $mod and exists $extra_X11_map{"dead+$sym1"};
Branch: 1 branch
BranchTrueFalseTotal
if $mod and exists $extra_X11_map{"dead+$sym1"} 0 0 0
Condition0%0/3
$mod and exists $extra_X11_map{"dead+$sym1"}
!ll&&!rl&&r
000
MC/DC0%0/2
$mod and exists $extra_X11_map{"dead+$sym1"}
$mod exists $extra_X11_map{"dead+$sym1"}
Truth table0%0/3
A and B
A= $modB= exists $extra_X11_map{"dead+$sym1"}
ABresult
0X0
100
111
9756 0 ▶ if ($guess and $mod and my $D = $self->{'[map2diac]'}{$k}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($guess and $mod and my $D = $self->{"[map2diac]"}{$k}) 0 0 0
Condition0%0/6
$guess and $mod and my $D = $self->{"[map2diac]"}{$k}
!ll&&!rl&&r
000
$guess and $mod
!ll&&!rl&&r
000
MC/DC0%0/3
$guess and $mod and my $D = $self->{"[map2diac]"}{$k}
$guess $mod my $D = $self->{"[map2diac]"}{$k}
Truth table0%0/4
A and B and C
A= $guessB= $modC= my $D = $self->{"[map2diac]"}{$k}
ABCresult
0XX0
10X0
1100
1111
9757 0 my $DD = $self->{'[diacritics]'}{$D};
9758 # warn "... diac($k): ", join ' ', map @$_, @$DD;
9759 0 for my $c (map @$_, @$DD) { # flatten the list
9760 0 ▶ next unless defined (my $SYM = $invKeySyms{$c});
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $SYM = $invKeySyms{$c}) 0 0 0
9761 0 ▶ next if exists $self->{faces}{$face}{"[${mod}iX11]"}{$SYM}; # already taken
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"faces"}{$face}{"[${mod}iX11]"}{$SYM} 0 0 0
9762 0 my $res;
9763 0 ▶ { $res = "$mod$SYM", last if exists $deadSyms{$SYM}; # Try other chars on the same diacritic-list
Branch: 1 branch
BranchTrueFalseTotal
if exists $deadSyms{$SYM} 0 0 0
9764 0 ▶ $res = $extra_X11_map{"dead+$SYM"}, last if exists $extra_X11_map{"dead+$SYM"};
Branch: 1 branch
BranchTrueFalseTotal
if exists $extra_X11_map{"dead+$SYM"} 0 0 0
9765 0 ▶ last unless $SYM =~ s/^ascii//;
Branch: 1 branch
BranchTrueFalseTotal
unless $SYM =~ s/^ascii// 0 0 0
9766 0 ▶ $res = "$mod$SYM", last if exists $deadSyms{$SYM}; # Try other chars on the same diacritic-list
Branch: 1 branch
BranchTrueFalseTotal
if exists $deadSyms{$SYM} 0 0 0
9767 0 ▶ $res = $extra_X11_map{"dead+$SYM"}, last if exists $extra_X11_map{"dead+$SYM"};
Branch: 1 branch
BranchTrueFalseTotal
if exists $extra_X11_map{"dead+$SYM"} 0 0 0
9768 }
9769 0 ▶ return $MAP->{$self->{faces}{$face}{"[${mod}iX11]"}{$SYM} = $hexK} = $res if defined $res;
Branch: 1 branch
BranchTrueFalseTotal
if defined $res 0 0 0
9770 }
9771 }
9772 0 ▶ $sym = sprintf 'U%0' . (ord $k > 0xFFFF ? 6 : 4) . 'x', ord $k unless defined $sym;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $sym 0 0 0
ord $k > 65535 ? : 0 0 0
9773 0 ▶ return $MAP->{$hexK} = $sym unless $mod;
Branch: 1 branch
BranchTrueFalseTotal
unless $mod 0 0 0
9774 0 ▶ return unless $guess;
Branch: 1 branch
BranchTrueFalseTotal
unless $guess 0 0 0
9775 # The Udddd are mapped to 0x1000000 + 0xdddd, so take up to 0x1110000
9776 0 ▶ return $MAP->{$hexK} = sprintf '0x%x', 0x1000000 - 0x10000 + ord $k if ord $k < 0x10000; # map to near 0x1000000 – 0x1110000 ????
Branch: 1 branch
BranchTrueFalseTotal
if ord $k < 65536 0 0 0
9777 0 return $MAP->{$hexK} = "<$mod$sym>???"; # Maybe map to something near 0x1000000 – 0x1110000 ????
9778 }
9779
9780 0 ▶sub auto_capslock($$) {
Subroutine auto_capslock: not called CC=8 SCAR=42.8
Pod undocumented
9781 0 my ($self, $u) = (shift, shift);
9782 0 my %fix = qw( ӏ Ӏ ); # Perl 5.8.8 uc is wrong
9783 0 ▶ return 0 unless defined $u->[0] and defined $u->[1] and $u->[0] ne $u->[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $u->[0] and defined $u->[1] and $u->[0] ne $u->[1] 0 0 0
Condition0%0/6
defined $u->[0] and defined $u->[1] and $u->[0] ne $u->[1]
!ll&&!rl&&r
000
defined $u->[0] and defined $u->[1]
!ll&&!rl&&r
000
MC/DC0%0/3
defined $u->[0] and defined $u->[1] and $u->[0] ne $u->[1]
defined $u->[0] defined $u->[1] $u->[0] ne $u->[1]
Truth table0%0/4
A and B and C
A= defined $u->[0]B= defined $u->[1]C= $u->[0] ne $u->[1]
ABCresult
0XX0
10X0
1100
1111
9784 0 ▶ return 1 if ($fix{$u->[0]} || uc($u->[0])) eq $u->[1];
Branch: 1 branch
BranchTrueFalseTotal
if ($fix{$u->[0]} || &UI::KeyboardLayout::uc($u->[0])) eq $u->[1] 0 0 0
Condition0%0/3
$fix{$u->[0]} || &UI::KeyboardLayout::uc($u->[0])
l!l&&r!l&&!r
000
MC/DC0%0/2
$fix{$u->[0]} || &UI::KeyboardLayout::uc($u->[0])
$fix{$u->[0]} &UI::KeyboardLayout::uc($u->[0])
Truth table0%0/3
A || B
A= $fix{$u->[0]}B= &UI::KeyboardLayout::uc($u->[0])
ABresult
1X1
011
000
9785 0 ▶ return 1 if ($fix{$u->[0]} || ucfirst($u->[0])) eq $u->[1];
Branch: 1 branch
BranchTrueFalseTotal
if ($fix{$u->[0]} || &UI::KeyboardLayout::ucfirst($u->[0])) eq $u->[1] 0 0 0
Condition0%0/3
$fix{$u->[0]} || &UI::KeyboardLayout::ucfirst($u->[0])
l!l&&r!l&&!r
000
MC/DC0%0/2
$fix{$u->[0]} || &UI::KeyboardLayout::ucfirst($u->[0])
$fix{$u->[0]} &UI::KeyboardLayout::ucfirst($u->[0])
Truth table0%0/3
A || B
A= $fix{$u->[0]}B= &UI::KeyboardLayout::ucfirst($u->[0])
ABresult
1X1
011
000
9786 0 return 0;
9787 }
9788
9789 0 ▶sub flatten_unit ($$$$) {
Subroutine flatten_unit: not called CC=44 SCAR=75.9
Pod undocumented
9790 0 my ($self, $face, $N, $E) = (shift, shift, shift, shift);
9791 0 my(%ss, $cnt); # Set Control-KEY if is [ or ] or \
9792 0 my @KK;
9793 0 my $L = $self->{faces}{$face}{layers};
9794 0 my $b = @$L;
9795 0 ▶ if ($E) { # = $self->{faces}{$face}{'[output_layers_XKB]'} || $self->{faces}{$face}{'[output_layers]'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($E) 0 0 0
9796 0 for my $Ln (@$E) { # Construct $ss from the numbered layers
9797 0 ▶ next unless $Ln =~ /^\s*\d+\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $Ln =~ /^\s*\d+\s*$/ 0 0 0
9798 0 ▶ die "Layer number too large in output_layers" unless $Ln < $b;
Branch: 1 branch
BranchTrueFalseTotal
unless $Ln < $b 0 0 0
9799 0 my $LL = $L->[$Ln]; # Numeric are for numbered layers
9800 0 my $l = $self->{layers}{$LL}[$N];
9801 0 my(@CC, @pp, @OK);
9802 0 my(%s1, @was);
9803 0 for my $sh (0..$#$l) { # These `map´s have 1 arg
9804 0 ▶ my @C = map {defined() ? (ref() ? $self->dead_with_inversion(!'hex', $_, $face, $self->{faces}{$face}) : $_) : $_} $l->[$sh];
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
ref $_ ? : 0 0 0
9805 0 ▶ my @p = map {defined() ? (ref() ? $_->[2] : 0 ) : 0 } $l->[$sh];
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
ref $_ ? : 0 0 0
9806 0 ▶ next unless defined (my $c = $C[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $c = $C[0]) 0 0 0
9807 0 ▶ my $pref = !!$p[0] || 0;
Condition0%0/2
!!$p[0] || 0
l!l
00
MC/DC0%0/1
!!$p[0] || 0
!!$p[0]
Truth table0%0/2
A
A= !!$p[0]
Aresult
11
00
9808 0 $ss{"$pref$c"}++;
9809 }
9810 }
9811 }
9812 0 ▶ my $extra = $E || [0..$b-1];
Condition0%0/2
$E || [0 .. $b - 1]
l!l
00
MC/DC0%0/1
$E || [0 .. $b - 1]
$E
Truth table0%0/2
A
A= $E
Aresult
11
00
9813 0 ▶ if ($extra and defined $N) { # $N not supported on VK...
Branch: 1 branch
BranchTrueFalseTotal
if ($extra and defined $N) 0 0 0
Condition0%0/3
$extra and defined $N
!ll&&!rl&&r
000
MC/DC0%0/2
$extra and defined $N
$extra defined $N
Truth table0%0/3
A and B
A= $extraB= defined $N
ABresult
0X0
100
111
9814 0 for my $f (0..$#$extra) {
9815 # warn "Extra layer number $f, base=$b requested while the character N=$N has " . (scalar @$u) . " layers" if $f+$b <= $#$u;
9816 0 my($notsame, $case, $LL, $num);
9817 0 ▶ if ((my $lll = $extra->[$f]) =~ /^\s*\d+\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ((my $lll = $extra->[$f]) =~ /^\s*\d+\s*$/) { } 0 0 0
9818 0 ▶ die "Layer number too large in output_layers" unless $lll < $b;
Branch: 1 branch
BranchTrueFalseTotal
unless $lll < $b 0 0 0
9819 0 $LL = [$L->[$lll]]; # Numeric are for numbered layers
9820 0 $num = 1;
9821 } else {
9822 0 ▶ $lll =~ s/^prefix(NOTSAME(case)?)?=// or die "Extra layer: expected `prefix=PREFIX', see: `$extra->[$f]'";
Branch: 1 branch
BranchTrueFalseTotal
$lll =~ s/^prefix(NOTSAME(case)?)?=// or die "Extra layer: expected `prefix=PREFIX', see: `$extra->[$f]'" 0 0 0
9823 0 ($notsame, $case) = ($1,$2);
9824 0 my $c = $self->key2hex($self->charhex2key($lll));
9825 0 ▶ $LL = $self->{faces}{$face}{'[deadkeyLayers]'}{$c} or die "Unknown prefix character `$c´ in extra layers";
Branch: 1 branch
BranchTrueFalseTotal
$LL = $self->{"faces"}{$face}{"[deadkeyLayers]"}{$c} or die "Unknown prefix character `$c\264 in extra layers" 0 0 0
9826 }
9827 0 my @L = map $self->{layers}{$_}[$N], @$LL;
9828 0 my(@CC, @pp, @OK); # char/is_prefix/??? ; Indexed by $sh=Shift_state
9829 # With notsame, squeeze a face into a layer; dups are marked “free”, so have a chance to squeeze Alt to Shift (w/o “case”)
9830 0 ▶ for my $l (@L[0 .. ($notsame ? $b-1 : 0)]) {
Branch: 1 branch
BranchTrueFalseTotal
$notsame ? : 0 0 0
9831 0 my(%s1, @unsh); # s1 is "seen in this layer"
9832 0 for my $sh (0..$#$l) { # These `map´s have 1 arg
9833 0 ▶ my @C = map {defined() ? (ref() ? $self->dead_with_inversion(!'hex', $_, $face, $self->{faces}{$face}) : $_) : $_} $l->[$sh];
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
ref $_ ? : 0 0 0
9834 0 ▶ my @p = map {defined() ? (ref() ? $_->[2] : 0 ) : 0 } $l->[$sh];
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
ref $_ ? : 0 0 0
9835 0 ▶ next unless defined (my $c = $C[0]); # Get rid of this fake array with 1 element
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $c = $C[0]) 0 0 0
9836 0 ▶ my $pref = !!$p[0] || 0; # Likewise
Condition0%0/2
!!$p[0] || 0
l!l
00
MC/DC0%0/1
!!$p[0] || 0
!!$p[0]
Truth table0%0/2
A
A= !!$p[0]
Aresult
11
00
9837 0 ▶ ($CC[$sh], $pp[$sh]) = ($c, $pref) unless defined $CC[$sh]; # fallback: fill if not defined yet in preceding layers
Branch: 1 branch
BranchTrueFalseTotal
unless defined $CC[$sh] 0 0 0
9838 0 ▶ $cnt++ if defined $CC[$sh];
Branch: 1 branch
BranchTrueFalseTotal
if defined $CC[$sh] 0 0 0
9839 0 ▶ next if $num; # Continue for “extra” layers only
Branch: 1 branch
BranchTrueFalseTotal
if $num 0 0 0
9840 # $ss{$C[0]}++ if $num; # Fill into the same Shift-position if “not-anywhere-in-the-main-layers”
9841 0 ▶ ($CC[$sh], $pp[$sh], $OK[$sh], $s1{"$pref$c"}) = ($c, $pref, 1,1) if !$OK[$sh] and not $ss{"$pref$c"};
Branch: 1 branch
BranchTrueFalseTotal
unless $OK[$sh] or $ss{"$pref$c"} 0 0 0
Condition0%0/3
$OK[$sh] or $ss{"$pref$c"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$OK[$sh] or $ss{"$pref$c"}
$OK[$sh] $ss{"$pref$c"}
Truth table0%0/3
A or B
A= $OK[$sh]B= $ss{"$pref$c"}
ABresult
1X1
011
000
9842 ($CC[$sh], $pp[$sh], $OK[$sh], $s1{"$unsh[1]$unsh[0]"}) = (@unsh, 1,1) # use unshifted if needed
9843 0 ▶ if $sh and !$OK[$sh] and defined $unsh[0] and not $ss{"$unsh[1]$unsh[0]"} and not $s1{"$unsh[1]$unsh[0]"};
Branch: 1 branch
BranchTrueFalseTotal
if $sh and not $OK[$sh] and defined $unsh[0] and not $ss{"$unsh[1]$unsh[0]"} and not $s1{"$unsh[1]$unsh[0]"} 0 0 0
Condition0%0/12
$sh and not $OK[$sh] and defined $unsh[0] and not $ss{"$unsh[1]$unsh[0]"} and not $s1{"$unsh[1]$unsh[0]"}
!ll&&!rl&&r
000
$sh and not $OK[$sh] and defined $unsh[0] and not $ss{"$unsh[1]$unsh[0]"}
!ll&&!rl&&r
000
$sh and not $OK[$sh] and defined $unsh[0]
!ll&&!rl&&r
000
$sh and not $OK[$sh]
!ll&&!rl&&r
000
MC/DC0%0/5
$sh and not $OK[$sh] and defined $unsh[0] and not $ss{"$unsh[1]$unsh[0]"} and not $s1{"$unsh[1]$unsh[0]"}
$sh not $OK[$sh] defined $unsh[0] not $ss{"$unsh[1]$unsh[0]"} not $s1{"$unsh[1]$unsh[0]"}
Truth table0%0/6
A and not(B) and C and not(D) and not(E)
A= $shB= not $OK[$sh]C= defined $unsh[0]D= not $ss{"$unsh[1]$unsh[0]"}E= not $s1{"$unsh[1]$unsh[0]"}
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
9844 0 ▶ @unsh = ($c, $pref) unless $case or $sh; # move AltGr-LETTER to Shift-LETTER if free and not $case (may omit `or $sh´)
Branch: 1 branch
BranchTrueFalseTotal
unless $case or $sh 0 0 0
Condition0%0/3
$case or $sh
l!l&&r!l&&!r
000
MC/DC0%0/2
$case or $sh
$case $sh
Truth table0%0/3
A or B
A= $caseB= $sh
ABresult
1X1
011
000
9845 0 ▶ $cnt++ if defined $CC[$sh];
Branch: 1 branch
BranchTrueFalseTotal
if defined $CC[$sh] 0 0 0
9846 }
9847 }
9848 # Avoid read-only values (can get via $#KK) which cannot be autovivified
9849 0 ▶ push @KK, ([]) x (2*$f - @KK) if @KK < 2*$f; # splice can't do with a gap after the end of array
Branch: 1 branch
BranchTrueFalseTotal
if @KK < 2 * $f 0 0 0
9850 0 splice @KK, 2*$f, 0, map [$CC[$_], $f-$b, $pp[$_]], 0..$#CC;
9851 }
9852 }
9853 0 ▶ return unless $cnt;
Branch: 1 branch
BranchTrueFalseTotal
unless $cnt 0 0 0
9854 0 return \@KK;
9855 }
9856
9857 1 my %double_scan_VK = ('56 OEM_102' => '7D OEM_8', # ISO vs JIS (right) keyboard
9858 # '73 ABNT_C1' => '7E ABNT_C2', # ABNT2 (right) = JIS (left) keyboard vs ABNT2 (numpad)
9859 # '53 DECIMAL' => '7E ABNT_C2', # NUMPAD-period vs ABNT2 (numpad) [Does not work??? DECIMAL too late?]
9860 # '34 OEM_PERIOD' => '7E ABNT_C2', # period vs ABNT2 (numpad)
9861 '33 OEM_COMMA' => '7E ABNT_C2', # comma vs ABNT2 (numpad) — should be the opposite of DECIMAL!
9862 # '7B NONCONVERT' => '79 CONVERT', # JIS keyboard: left of SPACE, right of SPACE
9863 '39 SPACE' => '79 CONVERT/7B NONCONVERT', # JIS keyboard: right of SPACE, left of SPACE
9864 );
9865 1 my %shift_control_extra = (2 => "\x00", 6 => "\x1e", OEM_MINUS => "\x1f"); # unshifted 2 hardwired below
9866
9867 1 { my(%seen, %seen_scan, %seen_VK, @add_scan_VK, @ligatures, @decimal);
9868 0 ▶ sub reset_units ($) { @decimal = @ligatures = @add_scan_VK = %seen_scan = %seen_VK = %seen = () }
Subroutine reset_units: not called CC=1 SCAR=6.9
Pod undocumented
9869
9870 0 ▶ sub output_unit00 ($$$$$$$;$$) { # $UU->[$i] is the entry for the key in the layer No. $i; $N is an ordinal of a key; $k is VK_-names
Subroutine output_unit00: not called CC=50 SCAR=78.4
Pod undocumented
9871 0 my ($self, $face, $k, $UU, $N, $deadkeys, $Used, $known_scancode, $skippable) = (shift, shift, shift, shift, shift, shift, shift, shift, shift);
9872 0 ▶ my $sc = ($known_scancode or $self->{faces}{$face}{'[scancodes]'}{$k} or $scan_codes{$k}
Branch: 2 branches
BranchTrueFalseTotal
my $sc = $known_scancode || $self->{"faces"}{$face}{"[scancodes]"}{$k} || $scan_codes{$k} || $k eq "DECIMAL" && 53 || $k =~ /^(?:NUMPAD(\d)|DECIMAL)$/ && (defined $1 ? "E0E$1" : "E0EA") or warn("Can't find the scancode for the key `${k}'"), return 0 0 0
defined $1 ? : 0 0 0
Condition0%0/17
$known_scancode || $self->{'faces'}{$face}{'[scancodes]'}{$k} || $scan_codes{$k} || $k eq 'DECIMAL' && '53' || $k =~ /^(?:NUMPAD(\d)|DECIMAL)$/ && (defined $1 ? "E0E$1" : 'E0EA')
l!l&&r!l&&!r
000
$known_scancode or $self->{"faces"}{$face}{"[scancodes]"}{$k} or $scan_codes{$k} or $k eq "DECIMAL" and 53
l!l&&r!l&&!r
000
$known_scancode or $self->{"faces"}{$face}{"[scancodes]"}{$k} or $scan_codes{$k}
l!l&&r!l&&!r
000
$known_scancode or $self->{"faces"}{$face}{"[scancodes]"}{$k}
l!l&&r!l&&!r
000
$k eq "DECIMAL" and 53
!ll
00
$k =~ /^(?:NUMPAD(\d)|DECIMAL)$/ and defined $1 ? "E0E$1" : "E0EA"
!ll&&!rl&&r
000
MC/DC0%0/6
$known_scancode || $self->{'faces'}{$face}{'[scancodes]'}{$k} || $scan_codes{$k} || $k eq 'DECIMAL' && '53' || $k =~ /^(?:NUMPAD(\d)|DECIMAL)$/ && (defined $1 ? "E0E$1" : 'E0EA')
$known_scancode $self->{"faces"}{$face}{"[scancodes]"}{$k} $scan_codes{$k} $k eq "DECIMAL" $k =~ /^(?:NUMPAD(\d)|DECIMAL)$/ defined $1 ? "E0E$1" : "E0EA"
Truth table0%0/7
A or B or C or D || E and F
A= $known_scancodeB= $self->{"faces"}{$face}{"[scancodes]"}{$k}C= $scan_codes{$k}D= $k eq "DECIMAL"E= $k =~ /^(?:NUMPAD(\d)|DECIMAL)$/F= defined $1 ? "E0E$1" : "E0EA"
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
0000111
00000X0
0000100
9873 or $k eq 'DECIMAL' and '53' # kbdutool only accepts DECIMAL on 53
9874 or $k =~ /^(?:NUMPAD(\d)|DECIMAL)$/ and (defined $1 ? "E0E$1" : 'E0EA'))
9875 or warn("Can't find the scancode for the key `$k'"), return;
9876 0 $sc = uc $sc; # Probably already uc⸣ed (need for comparison)
9877 0 ▶ $sc =~ /^E0E/ and warn "Redirected numpad key $k to a fake scancode $sc";
Branch: 1 branch
BranchTrueFalseTotal
$sc =~ /^E0E/ and warn "Redirected numpad key $k to a fake scancode $sc" 0 0 0
9878 0 $self->{faces}{$face}{'[emitted_scancodes]'}{$sc} = $k;
9879 0 my ($cnt, @KK) = 0;
9880 0 my $skip = grep $k eq $_, @{$self->{faces}{$face}{'[skip_extra_layers_WIN]'}};
9881 my $flat = $self->flatten_unit($face, $N,
9882 (!$skip and $self->{faces}{$face}{'[output_layers_WIN]'}
9883 0 ▶ || $self->{faces}{$face}{'[output_layers]'}))
Branch: 1 branch
BranchTrueFalseTotal
my $flat = $self->flatten_unit($face, $N, !$skip && ($self->{"faces"}{$face}{"[output_layers_WIN]"} || $self->{"faces"}{$face}{"[output_layers]"})) and ++$cnt 0 0 0
Condition0%0/6
!$skip && ($self->{'faces'}{$face}{'[output_layers_WIN]'} || $self->{'faces'}{$face}{'[output_layers]'})
!ll&&!rl&&r
000
$self->{"faces"}{$face}{"[output_layers_WIN]"} or $self->{"faces"}{$face}{"[output_layers]"}
l!l&&r!l&&!r
000
MC/DC0%0/3
!$skip && ($self->{'faces'}{$face}{'[output_layers_WIN]'} || $self->{'faces'}{$face}{'[output_layers]'})
!$skip $self->{"faces"}{$face}{"[output_layers_WIN]"} $self->{"faces"}{$face}{"[output_layers]"}
Truth table0%0/4
not(A) && B or C
A= !$skipB= $self->{"faces"}{$face}{"[output_layers_WIN]"}C= $self->{"faces"}{$face}{"[output_layers]"}
ABCresult
0XX0
1000
11X1
1011
9884 and $cnt++;
9885 0 ▶ @KK = ($cnt ? @$flat : map [], @$UU);
Branch: 1 branch
BranchTrueFalseTotal
$cnt ? : 0 0 0
9886
9887 0 my(@cntrl); # Set Control-KEY if is [ or ] or \ etc
9888 0 my @U = @KK;
9889 0 ▶ $#U = 3 if $#U > 3;
Branch: 1 branch
BranchTrueFalseTotal
if $#U > 3 0 0 0
9890 0 ▶ $_ and ref $_ and $_ = $_->[0] for @U;
Branch: 1 branch
BranchTrueFalseTotal
$_ and ref $_ and $_ = $_->[0] 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
9891 0 my @u = [@U[0,1]];
9892 0 ▶ $u[1] = [@U[2,3]] if @U > 2;
Branch: 1 branch
BranchTrueFalseTotal
if @U > 2 0 0 0
9893 0 my $b = $KK[0];
9894 0 ▶ $b = $b->[0] if $b and ref $b;
Branch: 1 branch
BranchTrueFalseTotal
if $b and ref $b 0 0 0
Condition0%0/3
$b and ref $b
!ll&&!rl&&r
000
MC/DC0%0/2
$b and ref $b
$b ref $b
Truth table0%0/3
A and B
A= $bB= ref $b
ABresult
0X0
100
111
9895 0 ▶ @cntrl = chr hex $do_control{$b} if $do_control{$b || 'N/A'}; # \ ---> ^\
Branch: 1 branch
BranchTrueFalseTotal
if $do_control{$b or "N/A"} 0 0 0
Condition0%0/2
$b || 'N/A'
l!l
00
MC/DC0%0/1
$b || 'N/A'
$b
Truth table0%0/2
A
A= $b
Aresult
11
00
9896 0 ▶ @cntrl = chr hex substr $oem_control{$k}, 1 if !@cntrl and $oem_control{$k};
Branch: 1 branch
BranchTrueFalseTotal
if not @cntrl and $oem_control{$k} 0 0 0
Condition0%0/3
not @cntrl and $oem_control{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
not @cntrl and $oem_control{$k}
not @cntrl $oem_control{$k}
Truth table0%0/3
not(A) and B
A= not @cntrlB= $oem_control{$k}
ABresult
0X0
100
111
9897 0 ▶ @cntrl = @{ $default_bind{$k}[1] } if !@cntrl and $default_bind{$k}[1];
Branch: 1 branch
BranchTrueFalseTotal
if not @cntrl and $default_bind{$k}[1] 0 0 0
Condition0%0/3
not @cntrl and $default_bind{$k}[1]
!ll&&!rl&&r
000
MC/DC0%0/2
not @cntrl and $default_bind{$k}[1]
not @cntrl $default_bind{$k}[1]
Truth table0%0/3
not(A) and B
A= not @cntrlB= $default_bind{$k}[1]
ABresult
0X0
100
111
9898 0 my $create_a_c = $self->{faces}{$face}{'[create_alpha_ctrl]'};
9899 0 ▶ $create_a_c = $create_alpha_ctrl unless defined $create_a_c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $create_a_c 0 0 0
9900 0 ▶ @cntrl = (chr(0x1F & ord $k)) x $create_a_c if $k =~ /^[A-Z]$/ and $create_a_c;
Branch: 1 branch
BranchTrueFalseTotal
if $k =~ /^[A-Z]$/ and $create_a_c 0 0 0
Condition0%0/3
$k =~ /^[A-Z]$/ and $create_a_c
!ll&&!rl&&r
000
MC/DC0%0/2
$k =~ /^[A-Z]$/ and $create_a_c
$k =~ /^[A-Z]$/ $create_a_c
Truth table0%0/3
A and B
A= $k =~ /^[A-Z]$/B= $create_a_c
ABresult
0X0
100
111
9901 0 ▶ @cntrl = (undef, $shift_control_extra{$k}) if $create_a_c > 1 and $shift_control_extra{$k};
Branch: 1 branch
BranchTrueFalseTotal
if $create_a_c > 1 and $shift_control_extra{$k} 0 0 0
Condition0%0/3
$create_a_c > 1 and $shift_control_extra{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
$create_a_c > 1 and $shift_control_extra{$k}
$create_a_c > 1 $shift_control_extra{$k}
Truth table0%0/3
A and B
A= $create_a_c > 1B= $shift_control_extra{$k}
ABresult
0X0
100
111
9902 0 ▶ @cntrl = ($shift_control_extra{$k}) x 2 if $create_a_c > 1 and $k eq '2';
Branch: 1 branch
BranchTrueFalseTotal
if $create_a_c > 1 and $k eq 2 0 0 0
Condition0%0/3
$create_a_c > 1 and $k eq 2
!ll&&!rl&&r
000
MC/DC0%0/2
$create_a_c > 1 and $k eq 2
$create_a_c > 1 $k eq 2
Truth table0%0/3
A and B
A= $create_a_c > 1B= $k eq 2
ABresult
0X0
100
111
9903 0 ▶ $cnt ||= @cntrl;
Condition0%0/3
$cnt ||= @cntrl
l!l&&r!l&&!r
000
MC/DC0%0/2
$cnt ||= @cntrl
$cnt @cntrl
Truth table0%0/3
A ||= B
A= $cntB= @cntrl
ABresult
1X1
011
000
9904 0 ▶ return if $skippable and not $cnt;
Branch: 1 branch
BranchTrueFalseTotal
if $skippable and not $cnt 0 0 0
Condition0%0/3
$skippable and not $cnt
!ll&&!rl&&r
000
MC/DC0%0/2
$skippable and not $cnt
$skippable not $cnt
Truth table0%0/3
A and not(B)
A= $skippableB= not $cnt
ABresult
0X0
100
111
9905
9906 0 my $CL;
9907 0 ▶ if (my $Caps = $self->{faces}{$face}{'[CapsLOCKlayers]'} and defined $N) { # $N not supported on VK...
Branch: 1 branch
BranchTrueFalseTotal
if (my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} and defined $N) 0 0 0
Condition0%0/3
my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} and defined $N
!ll&&!rl&&r
000
MC/DC0%0/2
my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} and defined $N
my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} defined $N
Truth table0%0/3
A and B
A= my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"}B= defined $N
ABresult
0X0
100
111
9908 0 $CL = [map $self->{layers}{$_}[$N], @$Caps];
9909 # warn "See CapsLock layers: <<<", join('>>> <<<', @$Caps), ">>>";
9910 }
9911 0 ▶ if ($skippable) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skippable) 0 0 0
9912 0 for my $shft (0,1) {
9913 0 ▶ $KK[$shft] = [$default_bind{$k}[0][$shft], 0] if not defined $KK[$shft][0] and defined $default_bind{$k}[0][$shft];
Branch: 1 branch
BranchTrueFalseTotal
if not defined $KK[$shft][0] and defined $default_bind{$k}[0][$shft] 0 0 0
Condition0%0/3
not defined $KK[$shft][0] and defined $default_bind{$k}[0][$shft]
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $KK[$shft][0] and defined $default_bind{$k}[0][$shft]
not defined $KK[$shft][0] defined $default_bind{$k}[0][$shft]
Truth table0%0/3
not(A) and B
A= not defined $KK[$shft][0]B= defined $default_bind{$k}[0][$shft]
ABresult
0X0
100
111
9914 ### $KK[$shft] = [$decimal[$shft], 0] if $k eq 'DECIMAL' and @decimal;
9915 }
9916 }
9917 0 my $pre_ctrl = $self->{faces}{$face}{'[ctrl_after_modcol]'};
9918 0 ▶ $pre_ctrl = 2*$ctrl_after unless defined $pre_ctrl;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pre_ctrl 0 0 0
9919 0 $#cntrl = $create_a_c - 1; # if $pre_ctrl < 2*@$u or $self->{faces}{$face}{'[keep_missing_ctrl]'};
9920 0 ▶ warn "cac=$create_a_c #cntrl=$#cntrl pre=$pre_ctrl \@KK=", scalar @KK if $pre_ctrl > @KK;
Branch: 1 branch
BranchTrueFalseTotal
if $pre_ctrl > @KK 0 0 0
9921 0 splice @KK, $pre_ctrl, 0, map [$_, 0], @cntrl;
9922 0 ▶ splice @KK, 15, 0, [undef, 0] if @KK >= 16; # col=15 is the fake one
Branch: 1 branch
BranchTrueFalseTotal
if @KK >= 16 0 0 0
9923
9924 0 ▶ if ($k eq 'DECIMAL') { # may be described both via visual maps and NUMPAD
Branch: 1 branch
BranchTrueFalseTotal
if ($k eq "DECIMAL") 0 0 0
9925 0 ▶ my @d = @{ $decimal[1] || [] };
Condition0%0/2
$decimal[1] || []
l!l
00
MC/DC0%0/1
$decimal[1] || []
$decimal[1]
Truth table0%0/2
A
A= $decimal[1]
Aresult
11
00
9926 0 ▶ defined $KK[$_][0] or $KK[$_] = $d[$_] for 0..$#d; # fill on the second round
Branch: 1 branch
BranchTrueFalseTotal
defined $KK[$_][0] or $KK[$_] = $d[$_] 0 0 0
9927 0 @decimal = ([$k, \@u, $sc, $Used], [@KK]);
9928 0 return;
9929 }
9930 # warn "Undefined \$N ==> <<<", join '>>> <<<', map $_->[0], @KK unless defined $N; # SPACE and ABNT_C1 ???
9931 0 $self->output_unit_KK($k, \@u, $sc, $Used, $CL, @KK);
9932 }
9933
9934 0 ▶ sub output_unit_KK($$@) {
Subroutine output_unit_KK: not called CC=22 SCAR=62.3
Pod undocumented
9935 0 my ($self, $k, $u, $sc, $Used, $CL, @KK) = @_;
9936 0 ▶ my @K = map $self->format_key($_->[0], $_->[2], $Used->[$_->[1] || 0]), @KK;
Condition0%0/2
$_->[1] || 0
l!l
00
MC/DC0%0/1
$_->[1] || 0
$_->[1]
Truth table0%0/2
A
A= $_->[1]
Aresult
11
00
9937 #warn "keys with ligatures: <@K>" if grep $K[$_] eq '%%', 0..$#K;
9938 0 push @ligatures, map [$k, $_, $KK[$_][0]], grep $K[$_] eq '%%', 0..$#K;
9939 0 my $keys = join "\t", @K;
9940 0 my @kk = map $_->[0], @KK;
9941 0 ▶ my $fill = ((8 <= length $k) ? '' : "\t");
Branch: 1 branch
BranchTrueFalseTotal
8 <= length $k ? : 0 0 0
9942 0 ▶ my $expl = join ", ", map +(defined() ? (0x20 > ord() ? '^'.chr(0x40+ord) : $_) : ' '), @kk;
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
32 > ord $_ ? : 0 0 0
9943 0 ▶ my $expl1 = exists $self->{UNames} ? "\t// " . join ", ", map +((defined $_) ? $self->UName($_) : ' '), @kk : '';
Branch: 2 branches
BranchTrueFalseTotal
exists $self->{'UNames'} ? : 0 0 0
defined $_ ? : 0 0 0
9944 0 ▶ my($CL0, $extra) = ($CL and $CL->[0]);
Condition0%0/3
$CL && $CL->[0]
!ll&&!rl&&r
000
MC/DC0%0/2
$CL && $CL->[0]
$CL $CL->[0]
Truth table0%0/3
A && B
A= $CLB= $CL->[0]
ABresult
0X0
100
111
9945 0 ▶ undef $CL0 unless $CL0 and @$CL0 and grep defined, map { ($_ and ref $_) ? $_->[0] : $_ } @$CL0;
Branch: 2 branches
BranchTrueFalseTotal
unless $CL0 and @$CL0 and grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0) 0 0 0
$_ && ref $_ ? : 0 0 0
Condition0%0/9
$CL0 and @$CL0 and grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
!ll&&!rl&&r
000
$CL0 and @$CL0
!ll&&!rl&&r
000
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/3
$CL0 and @$CL0 and grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
$CL0 @$CL0 grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/4
A and B and C
A= $CL0B= @$CL0C= grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
9946 # warn "u0($k) = <$u->[0]>" if defined $u->[0];
9947 0 ▶ my $capslock = (defined $CL0 ? 2 : $self->auto_capslock($u->[0]));
Branch: 1 branch
BranchTrueFalseTotal
defined $CL0 ? : 0 0 0
9948 # warn "u1($k) = <$u->[1]>" if defined $u->[1];
9949 0 $capslock |= (($self->auto_capslock($u->[1])) << 2);
9950 0 ▶ $capslock = 'SGCap' if $capslock == 2; # Not clear if we can combine a string SGCap with 0x4 in a .klc file
Branch: 1 branch
BranchTrueFalseTotal
if $capslock == 2 0 0 0
9951 0 ▶ if ($CL0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CL0) 0 0 0
9952 0 my $a_cl = $self->auto_capslock($u->[0]);
9953 0 ▶ my @KKK = @KK[$a_cl ? (1,0) : (0,1)];
Branch: 1 branch
BranchTrueFalseTotal
$a_cl ? : 0 0 0
9954 0 ▶ defined(($CL0->[$_] and ref $CL0->[$_]) ? $CL0->[$_][0] : $CL0->[$_]) and $KKK[$_] = $CL0->[$_] for 0, 1;
Branch: 2 branches
BranchTrueFalseTotal
defined($CL0->[$_] && ref $CL0->[$_] ? $CL0->[$_][0] : $CL0->[$_]) and $KKK[$_] = $CL0->[$_] 0 0 0
$CL0->[$_] && ref $CL0->[$_] ? : 0 0 0
Condition0%0/3
$CL0->[$_] and ref $CL0->[$_]
!ll&&!rl&&r
000
MC/DC0%0/2
$CL0->[$_] and ref $CL0->[$_]
$CL0->[$_] ref $CL0->[$_]
Truth table0%0/3
A and B
A= $CL0->[$_]B= ref $CL0->[$_]
ABresult
0X0
100
111
9955 # my @c = map { ($_ and ref $_) ? $_->[0] : $_ } @$CL0;
9956 # my @d = map { ($_ and ref $_) ? $_->[2] : {} } @$CL0; # dead
9957 # my @f = map $self->format_key($c[$_], $d[$_], ), 0 .. $#$CL0;
9958 # $extra = [@f];
9959 0 ▶ $extra = [map $self->format_key($_->[0], $_->[2], $Used->[$_->[1] || 0]), @KKK];
Condition0%0/2
$_->[1] || 0
l!l
00
MC/DC0%0/1
$_->[1] || 0
$_->[1]
Truth table0%0/2
A
A= $_->[1]
Aresult
11
00
9960 }
9961 0 $seen_scan{$sc}++;
9962 0 $seen_VK{$k}++;
9963 0 ($sc, $k, $fill, <<EOP, $extra);
9964 $capslock\t$keys\t// $expl$expl1
9965 EOP
9966 }
9967
9968 0 ▶ sub output_unit0 ($$$$$$$;$$) { # $u is an ordinal of a key
Subroutine output_unit0: not called CC=4 SCAR=30.0
Pod undocumented
9969 0 ▶ my(@i) = &output_unit00 or return;
Branch: 1 branch
BranchTrueFalseTotal
my(@i) = &output_unit00 or return 0 0 0
9970 0 ▶ my @add = split '/', ($double_scan_VK{uc "$i[0] $i[1]"} || '');
Condition0%0/2
$double_scan_VK{&UI::KeyboardLayout::uc("$i[0] $i[1]")} || ''
l!l
00
MC/DC0%0/1
$double_scan_VK{&UI::KeyboardLayout::uc("$i[0] $i[1]")} || ''
$double_scan_VK{&UI::KeyboardLayout::uc("$i[0] $i[1]")}
Truth table0%0/2
A
A= $double_scan_VK{&UI::KeyboardLayout::uc("$i[0] $i[1]")}
Aresult
11
00
9971 #warn "<<<<< Secondary key <$add> for <$i[0] $i[1]>" if $add;
9972 0 push @add_scan_VK, map [split(/ /, $_), @i[2,3]], grep $_, @add;
9973 0 ▶ my $add = ($i[4] ? "-1\t-1\t\t0\t" . join("\t", @{$i[4]}) . "\n" : '');
Branch: 1 branch
BranchTrueFalseTotal
$i[4] ? : 0 0 0
9974 0 "$i[0]\t$i[1]$i[2]\t$i[3]$add"
9975 }
9976
9977 0 ▶ sub output_added_units ($) {
Subroutine output_added_units: not called CC=7 SCAR=40.3
Pod undocumented
9978 0 my ($self, @i, @o, @dec) = shift;
9979 0 for my $i (@add_scan_VK) {
9980 0 ▶ next if $seen_scan{$i->[0]} or $seen_VK{$i->[1]}; # Cannot duplicate either one...
Branch: 1 branch
BranchTrueFalseTotal
if $seen_scan{$i->[0]} or $seen_VK{$i->[1]} 0 0 0
Condition0%0/3
$seen_scan{$i->[0]} or $seen_VK{$i->[1]}
l!l&&r!l&&!r
000
MC/DC0%0/2
$seen_scan{$i->[0]} or $seen_VK{$i->[1]}
$seen_scan{$i->[0]} $seen_VK{$i->[1]}
Truth table0%0/3
A or B
A= $seen_scan{$i->[0]}B= $seen_VK{$i->[1]}
ABresult
1X1
011
000
9981 0 push @i, $i;
9982 }
9983 0 ▶ if ($decimal[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($decimal[0]) 0 0 0
9984 # @decimal = ([$self->output_unit_KK($k, $u, $sc, $Used, @KK)], [@KK]);
9985 0 my ($k, $u, $sc, $Used) = @{$decimal[0]};
9986 0 push @dec, [$self->output_unit_KK($k, $u, $sc, $Used, undef, @{$decimal[1]})];
9987 }
9988 0 for my $i (@i, @dec) {
9989 0 ▶ my $add = ($i->[4] ? "-1\t-1\t\t0\t" . join("\t", @{$i->[4]}) . "\n" : '');
Branch: 1 branch
BranchTrueFalseTotal
$i->[4] ? : 0 0 0
9990 0 push @o, "$i->[0]\t$i->[1]$i->[2]\t$i->[3]$add";
9991 }
9992 @o
9993 0 }
9994
9995 1 my $enc_UTF16LE;
9996 0 ▶ sub to_UTF16LE_units ($) {
Subroutine to_UTF16LE_units: not called CC=4 SCAR=30.0
Pod undocumented
9997 0 my $k = shift;
9998 0 ▶ unless ($k =~ /^[\x00-\x{FFFF}]*$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($k =~ /^[\x00-\x{FFFF}]*$/) 0 0 0
9999 0 ▶ (require Encode), $enc_UTF16LE = Encode::find_encoding('UTF-16LE') unless $enc_UTF16LE;
Branch: 1 branch
BranchTrueFalseTotal
unless $enc_UTF16LE 0 0 0
10000 0 ▶ die "Can't arrange encoding to UTF-16LE" unless $enc_UTF16LE;
Branch: 1 branch
BranchTrueFalseTotal
unless $enc_UTF16LE 0 0 0
10001 0 $k = $enc_UTF16LE->encode($k);
10002 # warn join '> <', ($k =~ /(..)/sg); # Can't use decode() on surrogates...
10003 # warn join '> <', map {unpack 'v', $_} ($k =~ /(..)/sg); # Can't use decode() on surrogates...
10004 0 $k = join '', map chr(unpack 'v', $_), ($k =~ /(..)/sg); # Can't use decode() on surrogates...
10005 }
10006 0 $k;
10007 }
10008
10009 0 ▶ sub output_ligatures ($) {
Subroutine output_ligatures: not called CC=5 SCAR=34.0
Pod undocumented
10010 0 my ($self, @o, %s) = shift;
10011 0 for my $l (@ligatures) {
10012 0 ▶ warn("Repeated LIGATURE $l->[0] $l->[1]"), next if $s{"$l->[0] $l->[1]"}++;
Branch: 1 branch
BranchTrueFalseTotal
if $s{"$l->[0] $l->[1]"}++ 0 0 0
10013 0 my $k = to_UTF16LE_units $l->[2];
10014 0 my @k = ((map $self->key2hex($_), split //, $k), ('') x 4);
10015 0 ▶ my @expl = exists $self->{UNames} ? "// " . join " + ", map $self->UName($_), split //, $l->[2] : ();
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'UNames'} ? : 0 0 0
10016 0 ▶ my $add = ((8 <= length $l->[0]) ? '' : "\t");
Branch: 1 branch
BranchTrueFalseTotal
8 <= length $l->[0] ? : 0 0 0
10017 0 push @o, (join "\t", "$l->[0]$add", $l->[1], @k[0..3], @expl) . "\n";
10018 }
10019 @o
10020 0 }
10021
10022 0 ▶ sub base_unit ($$$$) { # Find a suitable “ID” for this position in the layout (VK_-name for f-key groups, or key of %oem_keys)
Subroutine base_unit: not called CC=9 SCAR=45.0
Pod undocumented
10023 0 my ($self, $basesub, $u, $ingroup, $k) = (shift, shift, shift, shift);
10024 0 ▶ if (!$ingroup) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ingroup) 0 0 0
10025 0 my @c = map $self->{layers}{$_}[$u][0], @$basesub;
10026 0 my($c) = grep defined, @c;
10027 0 ▶ my $c0 = $c = $c->[0] if 'ARRAY' eq ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $c 0 0 0
10028 0 ▶ warn "base_u($u) undefined" unless defined $c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
10029 0 ▶ $c .= '#' if $seen{uc $c}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen{&UI::KeyboardLayout::uc($c)}++ 0 0 0
10030 0 ▶ $c = '#' if $c eq ' ';
Branch: 1 branch
BranchTrueFalseTotal
if $c eq " " 0 0 0
10031 0 $c = uc $c;
10032 0 return [0, $c, $c0]
10033 } # Now do the VK groups
10034 0 for my $v (values %start_SEC) {
10035 0 ▶ $k = $v->[2]($self, $u, $v), last if $v->[0] <= $u and $v->[0] + $v->[1] > $u;
Branch: 1 branch
BranchTrueFalseTotal
if $v->[0] <= $u and $v->[0] + $v->[1] > $u 0 0 0
Condition0%0/3
$v->[0] <= $u and $v->[0] + $v->[1] > $u
!ll&&!rl&&r
000
MC/DC0%0/2
$v->[0] <= $u and $v->[0] + $v->[1] > $u
$v->[0] <= $u $v->[0] + $v->[1] > $u
Truth table0%0/3
A and B
A= $v->[0] <= $uB= $v->[0] + $v->[1] > $u
ABresult
0X0
100
111
10036 }
10037 0 [1, $k]
10038 }
10039
10040 0 ▶ sub output_unit ($$$$$$$$) { # $u is an ordinal of a key; $baseK contains the VK_-names
Subroutine output_unit: not called CC=2 SCAR=17.9
Pod undocumented
10041 0 my ($self, $face, $layers, $u, $deadkeys, $Used, $canskip, $baseK, $k) = (shift, shift, shift, shift, shift, shift, shift, shift);
10042 0 my $U = [map $self->{layers}{$_}[$u], @$layers];
10043 0 ▶ defined ($k = $baseK->[$u]) or return;
Branch: 1 branch
BranchTrueFalseTotal
defined($k = $baseK->[$u]) or return 0 0 0
10044 0 $self->output_unit0($face, $k, $U, $u, $deadkeys, $Used, undef, $canskip);
10045 }
10046 }
10047
10048 1 ▶sub output_layout_win_only_scancodes ($$) {
Subroutine output_layout_win_only_scancodes: not called CC=6 SCAR=35.8
Pod undocumented
10049 0 my ($self, $face) = (shift, shift);
10050 0 ▶ my $only_sc = $self->{faces}{$face}{'[scancodes_more]'} || {};
Condition0%0/2
$self->{'faces'}{$face}{'[scancodes_more]'} || {}
l!l
00
MC/DC0%0/1
$self->{'faces'}{$face}{'[scancodes_more]'} || {}
$self->{'faces'}{$face}{'[scancodes_more]'}
Truth table0%0/2
A
A= $self->{'faces'}{$face}{'[scancodes_more]'}
Aresult
11
00
10051 0 ▶ my $emitted = $self->{faces}{$face}{'[emitted_scancodes]'} || {}; # Now all the unit00 are done, so this is filled
Condition0%0/2
$self->{'faces'}{$face}{'[emitted_scancodes]'} || {}
l!l
00
MC/DC0%0/1
$self->{'faces'}{$face}{'[emitted_scancodes]'} || {}
$self->{'faces'}{$face}{'[emitted_scancodes]'}
Truth table0%0/2
A
A= $self->{'faces'}{$face}{'[emitted_scancodes]'}
Aresult
11
00
10052 0 warn 'eScanCodes: [', join(' ', sort keys %$only_sc), '] emitted=', join(' ', sort keys %$emitted), ']';
10053 0 for my $sc (sort keys %$only_sc) {
10054 0 ▶ next unless exists $emitted->{$sc};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $emitted->{$sc} 0 0 0
10055 0 ▶ warn "An extra scancode $sc for $only_sc->{$sc} conflicts with one for $emitted->{$_}" unless $only_sc->{$sc} eq $emitted->{$_}
Branch: 1 branch
BranchTrueFalseTotal
unless $only_sc->{$sc} eq $emitted->{$_} 0 0 0
10056 }
10057 0 map "$_\t$only_sc->{$_}\n", grep !exists $emitted->{$_}, sort keys %$only_sc;
10058 }
10059
10060 0 ▶sub output_layout_win ($$$$$$$) { # $baseK contains the VK_-names
Subroutine output_layout_win: not called CC=1 SCAR=6.9
Pod undocumented
10061 0 my ($self, $face, $layers, $deadkeys, $Used, $cnt, $baseK) = (shift, shift, shift, shift, shift, shift, shift);
10062 # die "Count of non-VK entries mismatched: $cnt vs ", scalar @{$self->{layers}{$layers->[0]}}
10063 # unless $cnt <= scalar @{$self->{layers}{$layers->[0]}};
10064 0 ( map($self->output_unit($face, $layers, $_, $deadkeys, $Used, $_ >= $cnt, $baseK), 0..$#$baseK),
10065 output_layout_win_only_scancodes($self, $face)
10066 );
10067 }
10068
10069 0 ▶sub output_VK_win ($$$) { # Not used anymore!!! XXXX ???
Subroutine output_VK_win: not called CC=2 SCAR=17.9
Pod undocumented
10070 0 my ($self, $face, $Used, @O) = (shift, shift, shift);
10071 0 my $VK = $self->{faces}{$face}{'[VK_off]'};
10072 0 for my $k (keys %$VK) {
10073 0 my $off = $VK->{$k};
10074 0 my $scan = $self->{faces}{$face}{'[scancodes]'}{$k};
10075 0 push @O, $self->output_unit0($face, $k, undef, $off, [], $Used, $scan);
10076 # my ($self, $face, $k, $U, $N, $deadkeys, $Used, $known_scancode, $skippable) = (shift, shift, shift, shift, shift, shift, shift, shift, shift);
10077 }
10078 @O
10079 0 }
10080
10081 0 ▶sub read_deadkeys_win ($$) {
Subroutine read_deadkeys_win: not called CC=13 SCAR=52.0
Pod undocumented
10082 0 my ($self, $t, $dead, $next, @p, %o) = (shift, shift, '', '');
10083
10084 0 $t =~ s(\s*//.*)()g; # remove comments
10085 0 $t =~ s([^\S\n]+$)()gm; # remove trailing whitespace (including \r!)
10086 # deadkey lines, empty lines, HEX HEX keymap lines
10087 0 ▶ $t =~ s/(^(?=DEADKEY)(?:(?:(?:DEADKEY|\s*[0-9a-f]{4,})\s+[0-9a-f]{4,})?(?:\n|\Z))*)(?=(.*))/DEADKEYS\n\n/mi
Branch: 1 branch
BranchTrueFalseTotal
$t =~ s/(^(?=DEADKEY)(?:(?:(?:DEADKEY|\s*[0-9a-f]{4,})\s+[0-9a-f]{4,})?(?:\n|\Z))*)(?=(.*))/DEADKEYS\n\n/im and () = ($1, $2) 0 0 0
10088 and ($dead, $next) = ($1, $2);
10089 0 ▶ warn "Unknown keyword follows deadkey descriptions in MSKLC map file: `$next'; dead=<$dead>"
Branch: 1 branch
BranchTrueFalseTotal
if length $next and not $next =~ /^(KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i 0 0 0
Condition0%0/3
length $next and not $next =~ /^(KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
!ll&&!rl&&r
000
MC/DC0%0/2
length $next and not $next =~ /^(KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
length $next not $next =~ /^(KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
Truth table0%0/3
A and not(B)
A= length $nextB= not $next =~ /^(KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
ABresult
0X0
100
111
10090 if length $next and not $next =~ /^(KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i;
10091 # $dead =~ /\S/ or warn "EMPTY DEADKEY section";
10092 #warn "got `$dead' from `$t'";
10093
10094 # when a pattern has parens, split does not remove the leading empty fields (?!!!)
10095 0 (undef, my %d) = split /^DEADKEY\s+([0-9a-f]+)\s*\n/im, $dead;
10096 0 for my $d (keys %d) {
10097 #warn "split `$d' from `$d{$d}'";
10098 0 @p = split /\n+/, $d{$d};
10099 0 my @bad;
10100 0 ▶ die "unrecognized part in deadkey map for $d: `@bad'"
Branch: 1 branch
BranchTrueFalseTotal
if @bad = grep((!/^\s*([0-9a-f]+)\s+([0-9a-f]+)$/i), @p) 0 0 0
10101 if @bad = grep !/^\s*([0-9a-f]+)\s+([0-9a-f]+)$/i, @p;
10102 0 %{$o{lc $d}} = map /^\s*([0-9a-f]+)\s+([0-9a-f]+)/i, @p;
10103 }
10104
10105 # empty lines, HEX "NAME" lines
10106 0 ▶ if ($t =~ s/^KEYNAME_DEAD\n((?:(?:\s*[0-9a-f]{4,}\s+".*")?(?:\n|\Z))*)(?=(.*))/KEYNAMES_DEAD\n\n/mi) {
Branch: 2 branches
BranchTrueFalseTotal
if ($t =~ s/^KEYNAME_DEAD\n((?:(?:\s*[0-9a-f]{4,}\s+".*")?(?:\n|\Z))*)(?=(.*))/KEYNAMES_DEAD\n\n/im) { } 0 0 0
elsif ($dead =~ /\S/) { } 0 0 0
10107 0 ($dead, $next) = ($1,$2);
10108 0 ▶ warn "Unknown keyword follows deadkey names descriptions in MSKLC map file: `$next'"
Branch: 1 branch
BranchTrueFalseTotal
if length $next and not $next =~ /^(DEADKEY|KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i 0 0 0
Condition0%0/3
length $next and not $next =~ /^(DEADKEY|KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
!ll&&!rl&&r
000
MC/DC0%0/2
length $next and not $next =~ /^(DEADKEY|KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
length $next not $next =~ /^(DEADKEY|KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
Truth table0%0/3
A and not(B)
A= length $nextB= not $next =~ /^(DEADKEY|KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i
ABresult
0X0
100
111
10109 if length $next and not $next =~ /^(DEADKEY|KEYNAME|LIGATURE|COPYRIGHT|COMPANY|LOCALENAME|LOCALEID|VERSION|SHIFTSTATE|LAYOUT|ATTRIBUTES|KEYNAME_EXT|KEYNAME_DEAD|DESCRIPTIONS|LANGUAGENAMES|ENDKBD)$/i;
10110 0 ▶ $dead =~ /\S/ or warn "EMPTY KEYNAME_DEAD section";
Branch: 1 branch
BranchTrueFalseTotal
$dead =~ /\S/ or warn "EMPTY KEYNAME_DEAD section" 0 0 0
10111 0 %d = map /^([0-9a-f]+)\s+"(.*)"\s*$/i, split /\n\s*/, $dead;
10112 0 $d{lc $_} = $d{$_} for keys %d;
10113 0 ▶ $self->{'[seen_knames]'} ||= {};
Condition0%0/2
$self->{"[seen_knames]"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"[seen_knames]"} ||= {}
$self->{"[seen_knames]"}
Truth table0%0/2
A
A= $self->{"[seen_knames]"}
Aresult
11
00
10114 0 @{$self->{'[seen_knames]'}}{map {chr hex $_} keys %d} = values %d; # XXXX Overwrites older values
10115 } elsif ($dead =~ /\S/) {
10116 0 warn "no KEYNAME_DEAD section found" if 0;
10117 }
10118 0 \%o, \%d, $t; # %o - translation tables; %d - names; $t is what is left of input
10119 }
10120
10121 0 ▶sub massage_template ($$$) {
Subroutine massage_template: not called CC=5 SCAR=34.0
Pod undocumented
10122 0 my ($self, $t, $r, %seen, %miss) = (shift, shift, shift);
10123 0 ▶ my $keys = join '|', sort {length $b <=> length $a or $a cmp $b} keys %$r; # Prefer matching a longer key
Condition0%0/3
length $b <=> length $a || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
length $b <=> length $a || $a cmp $b
length $b <=> length $a $a cmp $b
Truth table0%0/3
A || B
A= length $b <=> length $aB= $a cmp $b
ABresult
1X1
011
000
10124 0 $t =~ s/($keys)/ # warn "Plugging in `$1'";
10125 0 $seen{$1}++, $r->{$1} /ge; # Can't use \b: see SORT_ORDER_ID_ LOCALE_ID
10126 0 ▶ $seen{$_} or $miss{$_}++ for keys %$r;
Branch: 1 branch
BranchTrueFalseTotal
$seen{$_} or ++$miss{$_} 0 0 0
10127 0 ▶ warn "The following parts missing in the template: ", join ' ', sort keys %miss if %miss;
Branch: 1 branch
BranchTrueFalseTotal
if %miss 0 0 0
10128 0 $t
10129 }
10130
10131 # http://msdn.microsoft.com/en-us/library/dd373763
10132 # http://msdn.microsoft.com/en-us/library/dd374060
10133 1 my $template_win = <<'EO_TEMPLATE';
10134 KBD DLLNAME "LAYOUTNAME"
10135
10136 COPYRIGHT "(c) COPYR_YEARS COMPANYNAME"
10137
10138 COMPANY "COMPANYNAME"
10139
10140 LOCALENAME "LOCALE_NAME"
10141
10142 LOCALEID "SORT_ORDER_ID_LOCALE_ID"
10143
10144 VERSION 1.0 // UI::KeyboardLayout version=UIKL_VERSION
10145
10146 MODIFIERS
10147 SHIFTSTATE // With kbdutool the SHIFTSTATE should map to at least 2 columns, and map the Control key (= “have 2 present”)
10148
10149 BITS_TEMPLATE
10150 ATTRIBS
10151 LAYOUT // an extra '@' at the end is a dead key
10152
10153 //SC VK_ Cap COL_HEADERS
10154 // in this row ⒸⒶ mean “right”: COL_HUMAN
10155 //-- ---- ---- COL_EXPL
10156 LAYOUT_KEYS
10157 DO_LIGA
10158 DEADKEYS
10159
10160 // KEYNAME KEYNAME_EXT KEYNAME_DEAD - used to map a Scancode to Key Name via GetKeyNameText(); null-terminated.
10161 //
10162 // If the name is not found in the first two tables,
10163 // then it is deduced from the character/deadkey this key produces in the unshifted position (as MapVirtualKeyEx()).
10164 // In particular, the special-case in the latter function covers VK_A to VK_Z!
10165 //
10166 // As a corollary, the third table needs only to contain dead keys in the unshifted positions, and only
10167 // at positions not present in the first two tables.
10168
10169 KEYNAME // Mostly from type 4 keyboard, not producing a printable char, non-variable in types 1...6, Ctrl/etc are left versions
10170
10171 01 Esc
10172 0e Backspace
10173 0f Tab
10174 1c Enter
10175 1d Ctrl
10176 2a Shift
10177 36 "Right Shift"
10178 37 "Num *"
10179 38 Alt
10180 39 Space
10181 3a "Caps Lock"
10182 3b F1
10183 3c F2
10184 3d F3
10185 3e F4
10186 3f F5
10187 40 F6
10188 41 F7
10189 42 F8
10190 43 F9
10191 44 F10
10192 45 Pause // VK_NUMLOCK
10193 46 "Scroll Lock"
10194 47 "Num 7" // VK_HOME (starts a block)
10195 48 "Num 8" // ...
10196 49 "Num 9" // ...
10197 4a "Num -" // ...
10198 4b "Num 4" // ...
10199 4c "Num 5" // ...
10200 4d "Num 6" // ...
10201 4e "Num +" // ...
10202 4f "Num 1" // ...
10203 50 "Num 2" // ...
10204 51 "Num 3" // ...
10205 52 "Num 0" // VK_INSERT (ends a block)
10206 53 "Num Del"
10207 54 "Sys Req" // VK_SNAPSHOT ("Print Screen")
10208 56 "Oem 102"
10209 57 F11
10210 58 F12
10211 59 Clear
10212 5a Wctrl
10213 5b Finish
10214 5c Jump // Was AX in older versions
10215 5d EREOF
10216 5e Backtab
10217 5f Auto
10218 62 Zoom
10219 63 Help
10220 64 F13 // These F-keys were wrong in MSKLC (VK-codes, not scancodes)
10221 65 F14
10222 66 F15
10223 67 F16
10224 68 F17
10225 69 F18
10226 6a F19
10227 6b F20
10228 6c F21
10229 6d F22
10230 6e F23
10231 6f PA3
10232 70 KANA // From Types 30 33
10233 71 Reset
10234 73 "ABNT C1"
10235 76 F24
10236 79 CONVERT // From Types 7 8
10237 7b PA1
10238 7c "KB3270 Tab"
10239 7e "ABNT C2"
10240 7f PA2
10241
10242 KEYNAME_EXT // Type 4
10243
10244 10 "Prev Track"
10245 19 "Next Track"
10246 1c "Num Enter"
10247 1d "Right Ctrl"
10248 20 "Volume Mute"
10249 21 "Launch App2"
10250 22 "Pause Play"
10251 24 "Stop"
10252 2e "Volume Down"
10253 30 "Volume ߙp"
10254 32 "Browser Home"
10255 35 "Num /"
10256 37 "Prnt Scrn"
10257 38 "Right Alt"
10258 45 "Num Lock"
10259 46 Break // VK_CANCEL
10260 47 Home
10261 48 Up
10262 49 "Page Up"
10263 4b Left
10264 4d Right
10265 4f End
10266 50 Down
10267 51 "Page Down" // Types 1 3 4
10268 52 Insert
10269 53 Delete
10270 54 <00> // ??? from MSKLC; not in kbd.h (on no Type) (does not seem to be used on any layout)
10271 56 Help // ??? from MSKLC; not in kbd.h (on no Type) (does not seem to be used on any layout)
10272 5b "Left Windows"
10273 5c "Right Windows"
10274 5d Application
10275 5e Power
10276 5f Sleep
10277 65 "Browser Search"
10278 66 "Browser Favorites"
10279 67 "Browser Refresh"
10280 68 "Browser Stop"
10281 69 "Browser Forward"
10282 6a "Browser Back"
10283 6b "Launch App1"
10284 6c "Launch Mail"
10285 6c "Launch Media Select"
10286
10287 KEYNAMES_DEAD
10288
10289 DESCRIPTIONS
10290
10291 LOCALE_ID LAYOUTNAME
10292
10293 LANGUAGENAMES
10294
10295 LOCALE_ID LANGUAGE_NAME
10296
10297 ENDKBD
10298
10299 EO_TEMPLATE
10300 # "
10301
10302 1 my $template_osx = <<'EO_TEMPLATE';
10303 <?xml version="1.1" encoding="UTF-8"?>
10304 <!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
10305 <!--Last edited by OSX_CREATOR version OSX_CREATOR_VERSION on OSX_EDIT_DATE-->
10306 <!--Created by OSX_CREATOR version OSX_CREATOR_VERSION on OSX_EDIT_DATE-->
10307 <!--Copyright © COPYR_YEARS COMPANYNAME-->
10308 <keyboard group="126" id="OSX_ID" name="OSX_LAYOUTNAME"> <!-- maxout="OSX_MAXOUT" -->
10309 <layouts>
10310 <layout first="0" last="17" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10311 <layout first="18" last="18" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10312 <layout first="21" last="23" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10313 <layout first="30" last="30" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10314 <layout first="194" last="194" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10315 <layout first="197" last="197" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10316 <layout first="200" last="201" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10317 <layout first="206" last="207" modifiers="commonModifiers" mapSet="ANSIJIS"/>
10318 </layouts>
10319 <modifierMap id="commonModifiers" defaultIndex="0">
10320 <keyMapSelect mapIndex="0">
10321 <modifier keys=""/>
10322 </keyMapSelect>
10323 <keyMapSelect mapIndex="8">
10324 <modifier keys="anyShift? caps? command"/>
10325 </keyMapSelect>
10326 <keyMapSelect mapIndex="1">
10327 <modifier keys="anyShift caps?"/>
10328 </keyMapSelect>
10329 <keyMapSelect mapIndex="2">
10330 <modifier keys="caps"/>
10331 </keyMapSelect>
10332 <keyMapSelect mapIndex="3">
10333 <modifier keys="anyOption"/>
10334 </keyMapSelect>
10335 <keyMapSelect mapIndex="4">
10336 <modifier keys="anyShift caps? anyOption command?"/>
10337 </keyMapSelect>
10338 <keyMapSelect mapIndex="5">
10339 <modifier keys="caps anyOption"/>
10340 </keyMapSelect>
10341 <keyMapSelect mapIndex="6">
10342 <modifier keys="caps? anyOption command"/>
10343 </keyMapSelect>
10344 <keyMapSelect mapIndex="7">
10345 <modifier keys="shift? caps? option? command? control"/>
10346 <modifier keys="shift? rightShift caps? option? command? control"/>
10347 <modifier keys="shift? caps? option? rightOption command? control"/>
10348 </keyMapSelect>
10349 </modifierMap>
10350 <keyMapSet id="ANSIJIS">
10351 <keyMap index="0">
10352 <!-- No modifiers -->
10353 OSX_KEYMAP_0_AND_COMMAND
10354 </keyMap>
10355 <keyMap index="1">
10356 <!-- shift -->
10357 OSX_KEYMAP_SHIFT
10358 </keyMap>
10359 <keyMap index="2">
10360 <!-- caps lock -->
10361 OSX_KEYMAP_CAPS
10362 </keyMap>
10363 <keyMap index="3">
10364 <!-- option -->
10365 OSX_KEYMAP_OPTION
10366 </keyMap>
10367 <keyMap index="4">
10368 <!-- option shift -->
10369 OSX_KEYMAP_OPTION_SHIFT
10370 </keyMap>
10371 <keyMap index="5">
10372 <!-- option caps lock -->
10373 OSX_KEYMAP_OPTION_CAPS
10374 </keyMap>
10375 <keyMap index="6">
10376 <!-- option command -->
10377 OSX_KEYMAP_OPTION_COMMAND
10378 </keyMap>
10379 <keyMap index="7">
10380 <!-- control -->
10381 OSX_KEYMAP_CTRL
10382 </keyMap>
10383 <keyMap index="8">
10384 <!-- command -->
10385 OSX_KEYMAP_COMMAND
10386 </keyMap>
10387 </keyMapSet>
10388 <actions>
10389 <!-- actions for initiating+completing dead key states -->
10390 OSX_ACTIONS_BASE
10391 <!-- actions for standalone chars (may complete dead key states) -->
10392 OSX_ACTIONS
10393 </actions>
10394 <terminators>
10395 <!-- terminators for primary dead key states -->
10396 OSX_TERMINATORS_BASE
10397 <!-- terminators for secondary dead key states
10398 (repeated dead keys); this may mention several extraneous states
10399 reachable only from Windows layouts (which allow more keys) -->
10400 OSX_TERMINATORS2
10401 </terminators>
10402 </keyboard>
10403 EO_TEMPLATE
10404 # "
10405
10406 0 ▶sub KEY2hex ($$) {
Subroutine KEY2hex: not called CC=2 SCAR=17.9
Pod undocumented
10407 0 my ($self, $k) = (shift, shift);
10408 0 ▶ return $self->key2hex($k) unless 'ARRAY' eq ref $k;
Branch: 1 branch
BranchTrueFalseTotal
unless "ARRAY" eq ref $k 0 0 0
10409 #warn "see a deadkey `@$k'";
10410 0 $k = [@$k]; # deeper copy
10411 0 $k->[0] = $self->key2hex($k->[0]);
10412 0 $k;
10413 }
10414
10415 0 ▶sub linked_faces_2_hex_map ($$$$) {
Subroutine linked_faces_2_hex_map: not called CC=5 SCAR=34.0
Pod undocumented
10416 0 my ($self, $name, $b, $inv) = (shift, shift, shift, shift);
10417 0 my $L = $self->{faces}{$name};
10418 0 ▶ my $remap = $L->{$inv ? 'Face_link_map_INV' : 'Face_link_map'}{$b};
Branch: 1 branch
BranchTrueFalseTotal
$inv ? : 0 0 0
10419 0 die "Face `$b' not linked to face `$name'; HAVE: <", join('> <', keys %{$L->{Face_link_map}}), '>'
10420 0 ▶ if $self->{faces}{$b} != $L and not $remap;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"faces"}{$b} != $L and not $remap 0 0 0
Condition0%0/3
$self->{"faces"}{$b} != $L and not $remap
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"faces"}{$b} != $L and not $remap
$self->{"faces"}{$b} != $L not $remap
Truth table0%0/3
A and not(B)
A= $self->{"faces"}{$b} != $LB= not $remap
ABresult
0X0
100
111
10421 ### my $cover = $L->{'[coverage_hex]'} or die "Face $name not preprocessed";
10422 # warn "Keys of the Map `$name' -> '$b': <", join('> <', keys %$remap), '>';
10423 # $remap ||= {map +(chr hex $_, chr hex $remap->{$_}), keys %$cover}; # This one in terms of chars, not hex
10424 0 my @k = keys %$remap;
10425 # warn "Map `$name' -> '$b': <", join('> <', map +($self->key2hex($_), $self->key2hex($remap->{$_})), @k), '>';
10426 0 ▶ return { map +($self->keys2hex($_), (defined $remap->{$_} ? $self->KEY2hex($remap->{$_}) : undef)), @k }
Branch: 1 branch
BranchTrueFalseTotal
defined $remap->{$_} ? : 0 0 0
10427 }
10428
10429 1 my $dead_descr;
10430 #my %control = split / /, "\n \\n \r \\r \t \\t \b \\b \cC \\x03 \x7f \\x7f \x1b \\x1b \x1c \\x1c \x1d \\x1d";
10431 1 my %control = split / /, "\n \\n \r \\r \t \\t \b \\b";
10432 1 ▶$control{$_->[0]} ||= $_->[1] for map [chr($_), '^'.chr(0x40+$_)], 1..26;
Condition66%2/3
$control{$_->[0]} ||= $_->[1]
l!l&&r!l&&!r
4220
MC/DC0%0/2
$control{$_->[0]} ||= $_->[1]
$control{$_->[0]} $_->[1]
Truth table66%2/3
A ||= B
A= $control{$_->[0]}B= $_->[1]
ABresult
1X1
011
000
10433 0 ▶sub control2prt ($$) {
Subroutine control2prt: not called CC=4 SCAR=30.0
Pod undocumented
10434 0 my($self, $c) = (shift, shift);
10435 0 ▶ return $c unless ord $c < 0x20 or ord $c == 0x7f;
Branch: 1 branch
BranchTrueFalseTotal
unless ord $c < 32 or ord $c == 127 0 0 0
Condition0%0/3
ord $c < 32 or ord $c == 127
l!l&&r!l&&!r
000
MC/DC0%0/2
ord $c < 32 or ord $c == 127
ord $c < 32 ord $c == 127
Truth table0%0/3
A or B
A= ord $c < 32B= ord $c == 127
ABresult
1X1
011
000
10436 0 ▶ $control{$c} or sprintf '\\x%02x', ord $c;
Branch: 1 branch
BranchTrueFalseTotal
$control{$c} or sprintf "\\x%02x", ord $c 0 0 0
10437 }
10438
10439 0 ▶sub dead_with_inversion ($$$$$) {
Subroutine dead_with_inversion: not called CC=8 SCAR=42.8
Pod undocumented
10440 0 my($self, $is_hex, $to, $nameF, $H) = (shift, shift, shift, shift, shift);
10441 0 ▶ my $invert_dead = (3 == ($to->[2] || 0) or 3 == (($to->[2] || 0) >> 3));
Condition0%0/7
3 == ($to->[2] || 0) || 3 == ($to->[2] || 0) >> 3
l!l&&r!l&&!r
000
$to->[2] || 0
l!l
00
$to->[2] || 0
l!l
00
MC/DC0%0/2
3 == ($to->[2] || 0) || 3 == ($to->[2] || 0) >> 3
3 == ($to->[2] || 0) 3 == ($to->[2] || 0) >> 3
MC/DC0%0/1
$to->[2] || 0
$to->[2]
MC/DC0%0/1
$to->[2] || 0
$to->[2]
Truth table0%0/3
A || B
A= 3 == ($to->[2] || 0)B= 3 == ($to->[2] || 0) >> 3
ABresult
1X1
011
000
Truth table0%0/2
A
A= $to->[2]
Aresult
11
00
Truth table0%0/2
A
A= $to->[2]
Aresult
11
00
10442 0 $to = $to->[0];
10443 0 ▶ if ($invert_dead) {
Branch: 1 branch
BranchTrueFalseTotal
if ($invert_dead) 0 0 0
10444 0 ▶ $to = $self->key2hex($to) unless $is_hex;
Branch: 1 branch
BranchTrueFalseTotal
unless $is_hex 0 0 0
10445 0 ▶ defined ($to = $H->{'[deadkeyInvAltGrKey]'}{$to}) or die "Cannot invert prefix key `$to' in face `$nameF'";
Branch: 1 branch
BranchTrueFalseTotal
defined($to = $H->{"[deadkeyInvAltGrKey]"}{$to}) or die "Cannot invert prefix key `${to}' in face `${nameF}'" 0 0 0
10446 # warn "invert $to in face=$nameF, inv=$invertAlt0 --> $inv\n";
10447 0 ▶ $to = $self->key2hex($to) if $is_hex;
Branch: 1 branch
BranchTrueFalseTotal
if $is_hex 0 0 0
10448 }
10449 0 $to;
10450 }
10451
10452 0 ▶sub output_deadkeys ($$$$$$;$) { # Emits 1 or 2 maps; for the 2nd, uses $prefix_flippedMap_hex as prefix
Subroutine output_deadkeys: not called CC=115 SCAR=95.0
Pod undocumented
10453 # If $d is $flip_AltGr_hex, does not emit the flipped map (if $flip_AltGr_hex is not defined, there should not be Inv map!).
10454 0 my ($self, $nameF, $d, $Dead2, $flip_AltGr_hex, $prefix_flippedMap_hex, $OUT_Apple) = (shift, shift, shift, shift, shift, shift, shift);
10455 0 my $H = $self->{faces}{$nameF};
10456 # warn "emit `$nameF' d=`$d' f=$H->{'[deadkeyFace]'}{$d}";
10457 # if (my $unres = $H->{'[unresolved_imported]'}) {
10458 # warn "Can't resolve `@$unres' to an imported dead key; face=`$nameF'" unless $H->{'[unresolved_imported_warned]'}++;
10459 # }
10460 #warn "See dead2 in <$nameF> for <$d>" if $dead2;
10461 0 ▶ my $dead2 = ($Dead2 || {})->{$self->charhex2key($d)} || {};
Condition0%0/4
($Dead2 || {})->{$self->charhex2key($d)} || {}
l!l
00
$Dead2 || {}
l!l
00
MC/DC0%0/1
($Dead2 || {})->{$self->charhex2key($d)} || {}
$Dead2
Truth table0%0/2
A
A= $Dead2
Aresult
11
00
10462 0 ▶ my(@sp, %sp) = map {(my $in = $_) =~ s/(?<=.)\@$//s; $in} @{ ($self->get_VK($nameF))->{SPACE} || [] };
Condition0%0/2
$self->get_VK($nameF)->{'SPACE'} || []
l!l
00
MC/DC0%0/1
$self->get_VK($nameF)->{'SPACE'} || []
$self->get_VK($nameF)->{'SPACE'}
Truth table0%0/2
A
A= $self->get_VK($nameF)->{'SPACE'}
Aresult
11
00
10463 0 @sp = map $self->charhex2key($_), @sp;
10464 0 @sp{@sp[1..$#sp]} = (0..$#sp); # The leading elt is the scancode
10465
10466 0 my @maps = map $H->{"[deadkeyFaceHexMap$_]"}{$d}, '', 'Inv';
10467 0 ▶ pop @maps unless defined $maps[-1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $maps[-1] 0 0 0
10468 0 my($D, @DD) = ($d, $d, $prefix_flippedMap_hex);
10469 0 my ($OUT, $keys) = '';
10470 # There are 3 situations:
10471 # 0) process one map without AltGr-inversion; 1) Process one map which is the AltGr-inversion of the principal one;
10472 # 2) process one map with AltGr-inversion (in 1-2 the inversion may have a customization put over it).
10473 # The problem is to recognize when deadkeys in the inversion come from non-inverted one, or from customization
10474 # And, in case (1), we must consider flip_AltGr specially... (the case (2) is now treated during face preparation)
10475 0 ▶ my($is_invAltGr_Base_with_chain, $AMap, $default) = ($D eq ($flip_AltGr_hex || 'n/a') and $H->{'[have_AltGr_chain]'});
Condition0%0/5
$D eq ($flip_AltGr_hex || 'n/a') && $H->{'[have_AltGr_chain]'}
!ll&&!rl&&r
000
$flip_AltGr_hex || 'n/a'
l!l
00
MC/DC0%0/2
$D eq ($flip_AltGr_hex || 'n/a') && $H->{'[have_AltGr_chain]'}
$D eq ($flip_AltGr_hex || 'n/a') $H->{'[have_AltGr_chain]'}
MC/DC0%0/1
$flip_AltGr_hex || 'n/a'
$flip_AltGr_hex
Truth table0%0/3
A && B
A= $D eq ($flip_AltGr_hex || 'n/a')B= $H->{'[have_AltGr_chain]'}
ABresult
0X0
100
111
Truth table0%0/2
A
A= $flip_AltGr_hex
Aresult
11
00
10476 0 $default = $self->default_char($nameF);
10477 0 ▶ $default = $self->key2hex($default) if defined $default;
Branch: 1 branch
BranchTrueFalseTotal
if defined $default 0 0 0
10478 0 ▶ if ($#maps or $is_invAltGr_Base_with_chain) { # One of the maps we will process is AltGr-inverted; calculate AltGr-inversion
Branch: 1 branch
BranchTrueFalseTotal
if ($#maps or $is_invAltGr_Base_with_chain) 0 0 0
Condition0%0/3
$#maps or $is_invAltGr_Base_with_chain
l!l&&r!l&&!r
000
MC/DC0%0/2
$#maps or $is_invAltGr_Base_with_chain
$#maps $is_invAltGr_Base_with_chain
Truth table0%0/3
A or B
A= $#mapsB= $is_invAltGr_Base_with_chain
ABresult
1X1
011
000
10479 0 $self->faces_link_via_backlinks($nameF, $nameF, 'no_ini'); # Create AltGr-invert self-mapping
10480 0 $AMap = $self->linked_faces_2_hex_map($nameF, $nameF, 1);
10481 #warn "deadkey=$D flip=$flip_AltGr_hex" if defined $default;;
10482 }
10483 0 my($docs, $map_AltGr_over, $over_dead2) = ($H->{'[prefixDocs]'}{$D}, {}, {});
10484 0 ▶ if ($is_invAltGr_Base_with_chain) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_invAltGr_Base_with_chain) 0 0 0
10485 0 ▶ if (my $override_InvAltGr = $H->{'[InvAltGrFace]'}{''}) { # NOW: needed only for invAltGr
Branch: 1 branch
BranchTrueFalseTotal
if (my $override_InvAltGr = $H->{"[InvAltGrFace]"}{""}) 0 0 0
10486 0 $map_AltGr_over = $self->linked_faces_2_hex_map($nameF, $override_InvAltGr);
10487 }
10488 0 ▶ $over_dead2 = $Dead2->{$self->charhex2key($flip_AltGr_hex)} || {} if defined $flip_AltGr_hex; # used in CyrPhonetic v0.04
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr_hex 0 0 0
Condition0%0/2
$$Dead2{$self->charhex2key($flip_AltGr_hex)} || {}
l!l
00
MC/DC0%0/1
$$Dead2{$self->charhex2key($flip_AltGr_hex)} || {}
$$Dead2{$self->charhex2key($flip_AltGr_hex)}
Truth table0%0/2
A
A= $$Dead2{$self->charhex2key($flip_AltGr_hex)}
Aresult
11
00
10489 0 $dead2 = { %{ $H->{'[DEAD]'} }, %{ $H->{'[dead_in_VK]'} } };
10490 # $docs ||= 'AltGr-inverted base face';
10491 }
10492 0 my $enhMaps = my $enhGrayMapsForce = [{}, {}];
10493 0 ▶ $enhMaps = $H->{'[enhGrayHexMaps]'}{$d} if !$OUT_Apple and $D ne ($flip_AltGr_hex || 'n/a') and $H->{'[enhGrayHexMaps]'}{$d};
Branch: 1 branch
BranchTrueFalseTotal
if not $OUT_Apple and $D ne ($flip_AltGr_hex || "n/a") and $H->{"[enhGrayHexMaps]"}{$d} 0 0 0
Condition0%0/8
not $OUT_Apple and $D ne ($flip_AltGr_hex || "n/a") and $H->{"[enhGrayHexMaps]"}{$d}
!ll&&!rl&&r
000
not $OUT_Apple and $D ne ($flip_AltGr_hex || "n/a")
!ll&&!rl&&r
000
$flip_AltGr_hex || 'n/a'
l!l
00
MC/DC0%0/3
not $OUT_Apple and $D ne ($flip_AltGr_hex || "n/a") and $H->{"[enhGrayHexMaps]"}{$d}
not $OUT_Apple $D ne ($flip_AltGr_hex || "n/a") $H->{"[enhGrayHexMaps]"}{$d}
MC/DC0%0/1
$flip_AltGr_hex || 'n/a'
$flip_AltGr_hex
Truth table0%0/4
not(A) and B and C
A= not $OUT_AppleB= $D ne ($flip_AltGr_hex || "n/a")C= $H->{"[enhGrayHexMaps]"}{$d}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/2
A
A= $flip_AltGr_hex
Aresult
11
00
10494 0 ▶ $enhGrayMapsForce = $H->{'[enhGrayHexMapsForce]'}{$d} if $enhMaps != $enhGrayMapsForce and $H->{'[enhGrayHexMapsForce]'}{$d};
Branch: 1 branch
BranchTrueFalseTotal
if $enhMaps != $enhGrayMapsForce and $H->{"[enhGrayHexMapsForce]"}{$d} 0 0 0
Condition0%0/3
$enhMaps != $enhGrayMapsForce and $H->{"[enhGrayHexMapsForce]"}{$d}
!ll&&!rl&&r
000
MC/DC0%0/2
$enhMaps != $enhGrayMapsForce and $H->{"[enhGrayHexMapsForce]"}{$d}
$enhMaps != $enhGrayMapsForce $H->{"[enhGrayHexMapsForce]"}{$d}
Truth table0%0/3
A and B
A= $enhMaps != $enhGrayMapsForceB= $H->{"[enhGrayHexMapsForce]"}{$d}
ABresult
0X0
100
111
10495 0 ▶ my %enhForce = map {($self->keys2hex($_), 1)} @{$H->{'[Prefix_Force_Altern]'} || []};
Condition0%0/2
$H->{'[Prefix_Force_Altern]'} || []
l!l
00
MC/DC0%0/1
$H->{'[Prefix_Force_Altern]'} || []
$H->{'[Prefix_Force_Altern]'}
Truth table0%0/2
A
A= $H->{'[Prefix_Force_Altern]'}
Aresult
11
00
10496 0 my($flat, $flatInv, @flatMap) = (map($self->{faces}{$nameF}{"[FlatPrefixMapFiltered$_]"}{$d}, ('', 'Inv')), {}, {});
10497 0 ▶ if (!$OUT_Apple and ($flat or $flatInv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $OUT_Apple and $flat || $flatInv) 0 0 0
Condition0%0/6
not $OUT_Apple and $flat || $flatInv
!ll&&!rl&&r
000
$flat or $flatInv
l!l&&r!l&&!r
000
MC/DC0%0/3
not $OUT_Apple and $flat || $flatInv
not $OUT_Apple $flat $flatInv
Truth table0%0/4
not(A) and B or C
A= not $OUT_AppleB= $flatC= $flatInv
ABCresult
0XX0
1000
11X1
1011
10498 0 ▶ $flatMap[0] = $flat || {};
Condition0%0/2
$flat || {}
l!l
00
MC/DC0%0/1
$flat || {}
$flat
Truth table0%0/2
A
A= $flat
Aresult
11
00
10499 0 ▶ $flatMap[1] = $flatInv || {};
Condition0%0/2
$flatInv || {}
l!l
00
MC/DC0%0/1
$flatInv || {}
$flatInv
Truth table0%0/2
A
A= $flatInv
Aresult
11
00
10500 }
10501
10502 # warn "output map for `$D' invert=", !!$is_invAltGr_Base_with_chain, ' <',join('> <', sort keys %$dead2),'>';
10503 0 for my $invertAlt0 (0..$#maps) {
10504 0 ▶ my $invertAlt = $invertAlt0 || $is_invAltGr_Base_with_chain;
Condition0%0/3
$invertAlt0 || $is_invAltGr_Base_with_chain
l!l&&r!l&&!r
000
MC/DC0%0/2
$invertAlt0 || $is_invAltGr_Base_with_chain
$invertAlt0 $is_invAltGr_Base_with_chain
Truth table0%0/3
A || B
A= $invertAlt0B= $is_invAltGr_Base_with_chain
ABresult
1X1
011
000
10505 0 my $map = $maps[$invertAlt0];
10506 0 $d = $DD[$invertAlt0];
10507 0 my($enhMap, $enhMapForce, $flMap) = ($enhMaps->[$invertAlt0], $enhGrayMapsForce->[$invertAlt0], $flatMap[$invertAlt0]);
10508 0 if (warnReached and my %enhMapForce = %$enhMapForce) {
10509 warn " enhForce: ", join ' ', %enhForce, "\n";
10510 warn " enhMap(for Force): ", join ' ', map {defined() ? $_ : '[u/d]'} %$enhMap, "\n";
10511 warn " enhMapForce: ", join ' ', %enhMapForce, "\n";
10512 }
10513 # warn " ... enhmap $nameF [$d]: ", join(' ' , map {"$_ ⇒ " . (defined $enhMap->{$_} ? $enhMap->{$_} : '[u/d]')} sort keys %$enhMap), "\n" if %$enhMap;
10514 # warn " map $nameF [$d]: ", join ' ', map {defined() ? $_ : '[u/d]'} %$map, "\n";
10515 0 $map = {%$enhMap, %$flMap, %$map, %$enhMapForce};
10516 0 my (%joined_map, %loopOK);
10517 0 for my $hex (sort keys %$map) { # Temprorarily??? Map joined keys to itself without resolving conficts (sort: consistent EXPL)
10518 0 ▶ $joined_map{$hex} = $map->{$hex}, next if $OUT_Apple or $hex =~ /^[a-f\d]{4}$/;
Branch: 1 branch
BranchTrueFalseTotal
if $OUT_Apple or $hex =~ /^[a-f\d]{4}$/ 0 0 0
Condition0%0/3
$OUT_Apple or $hex =~ /^[a-f\d]{4}$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$OUT_Apple or $hex =~ /^[a-f\d]{4}$/
$OUT_Apple $hex =~ /^[a-f\d]{4}$/
Truth table0%0/3
A or B
A= $OUT_AppleB= $hex =~ /^[a-f\d]{4}$/
ABresult
1X1
011
000
10519 # my(@comp,%seen,$seen) = split /\./, ($hex =~ /^[a-f\d]+$/
10520 # ? $self->keys2hex(to_UTF16LE_units(chr hex $hex))
10521 # : $hex);
10522 0 ▶ my(@comp,%seen,$seen) = map {/^[a-f\d]{4}$/ ? $_ : split /\./, $self->keys2hex(to_UTF16LE_units(chr hex $hex))}
Branch: 1 branch
BranchTrueFalseTotal
/^[a-f\d]{4}$/ ? : 0 0 0
10523 split /\./, $hex;
10524 0 ▶ $seen{$_}++ and $seen++ for @comp;
Branch: 1 branch
BranchTrueFalseTotal
$seen{$_}++ and ++$seen 0 0 0
10525 warn("Skipping a binding for $hex in deadkey=$d: conflicts"), next
10526 0 ▶ if $seen or grep exists $map->{$_} || exists $joined_map{$_} && not($joined_map{$_}[0] eq $d and $joined_map{$_}[2]==1), @comp;
Branch: 1 branch
BranchTrueFalseTotal
if $seen or grep((exists $map->{$_} || exists $joined_map{$_} && !($joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1)), @comp) 0 0 0
Condition0%0/12
$seen or grep((exists $map->{$_} || exists $joined_map{$_} && !($joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1)), @comp)
l!l&&r!l&&!r
000
exists $map->{$_} || exists $joined_map{$_} && !($joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1)
l!l&&r!l&&!r
000
exists $joined_map{$_} and not $joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1
!ll&&!rl&&r
000
$joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1
!ll&&!rl&&r
000
MC/DC0%0/2
$seen or grep((exists $map->{$_} || exists $joined_map{$_} && !($joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1)), @comp)
$seen grep((exists $map->{$_} || exists $joined_map{$_} && !($joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1)), @comp)
MC/DC0%0/4
exists $map->{$_} || exists $joined_map{$_} && !($joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1)
exists $map->{$_} exists $joined_map{$_} $joined_map{$_}[0] eq $d $joined_map{$_}[2] == 1
Truth table0%0/3
A or B
A= $seenB= grep((exists $map->{$_} || exists $joined_map{$_} && !($joined_map{$_}[0] eq $d && $joined_map{$_}[2] == 1)), @comp)
ABresult
1X1
011
000
Truth table0%0/5
A || B and not(C && D)
A= exists $map->{$_}B= exists $joined_map{$_}C= $joined_map{$_}[0] eq $dD= $joined_map{$_}[2] == 1
ABCDresult
1XXX1
010X1
01101
00XX0
01110
10527 0 for my $c (0..$#comp) {
10528 0 ▶ if ($c==$#comp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == $#comp) { } 0 0 0
10529 0 ▶ my @b = @{$map->{$hex}||[]};
Condition0%0/2
$map->{$hex} || []
l!l
00
MC/DC0%0/1
$map->{$hex} || []
$map->{$hex}
Truth table0%0/2
A
A= $map->{$hex}
Aresult
11
00
10530 0 ▶ $b[3] ||= '';
Condition0%0/2
$b[3] ||= ""
l!l
00
MC/DC0%0/1
$b[3] ||= ""
$b[3]
Truth table0%0/2
A
A= $b[3]
Aresult
11
00
10531 0 $b[3] .= " [from multi-codepoint source $hex]";
10532 0 $joined_map{$comp[$c]} = \@b;
10533 } else {
10534 0 $loopOK{$comp[$c]}++;
10535 0 ▶ if (exists $joined_map{$comp[$c]}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $joined_map{$comp[$c]}) { } 0 0 0
10536 0 $joined_map{$comp[$c]}[3] =~ s/(?<=source\b)/s/; #/
10537 0 $joined_map{$comp[$c]}[3] .= ", $hex";
10538 } else {
10539 0 $joined_map{$comp[$c]} = [$d, undef, 1, "Component=" . ($c+1) . " of ". ($#comp+1) . " of multi-codepoint source $hex"];
10540 }
10541 }
10542 }
10543 }
10544 0 ▶ my $docs1 = (defined $docs ? sprintf("\t// %s%s", ($invertAlt0 ? 'AltGr inverted: ' : ''), $docs) : '');
Branch: 2 branches
BranchTrueFalseTotal
defined $docs ? : 0 0 0
$invertAlt0 ? : 0 0 0
10545 0 $OUT .= "DEADKEY\t$d$docs1\n\n";
10546 0 my $OUT_Apple_map = $d;
10547 # Good order: first alphanum, then punctuation, then space
10548 0 my @keys = sort keys %joined_map; # Sorting not OK for 6-byte keys - but after joining they disappear
10549 @keys = (grep((!/^d[89a-f]/i and lc(chr hex $_) ne uc(chr hex $_)and not $sp{chr hex $_} ), @keys),
10550 grep((!/^d[89a-f]/i and (lc(chr hex $_) eq uc chr hex $_ and (chr hex $_) !~ /\p{Blank}/) and not $sp{chr hex $_}), @keys),
10551 0 ▶ grep((!/^d[89a-f]/i and ((lc(chr hex $_) eq uc chr hex $_ and (chr hex $_) =~ /\p{Blank}/) or $sp{chr hex $_}) and $_ ne '0020'), @keys),
Condition0%0/27
!/^d[89a-f]/i && &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
!ll&&!rl&&r
000
not /^d[89a-f]/i and &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))
!ll&&!rl&&r
000
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !(&UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
!ll&&!rl&&r
000
not /^d[89a-f]/i and (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/)
!ll&&!rl&&r
000
&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/
!ll&&!rl&&r
000
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ || $sp{&UI::KeyboardLayout::chr(hex $_)}) && $_ ne '0020'
!ll&&!rl&&r
000
not /^d[89a-f]/i and &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ || $sp{&UI::KeyboardLayout::chr(hex $_)}
!ll&&!rl&&r
000
&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ or $sp{&UI::KeyboardLayout::chr(hex $_)}
l!l&&r!l&&!r
000
&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) and &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/
!ll&&!rl&&r
000
MC/DC0%0/3
!/^d[89a-f]/i && &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
not /^d[89a-f]/i &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) !$sp{&UI::KeyboardLayout::chr(hex $_)}
MC/DC0%0/4
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && !(&UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/)) && !$sp{&UI::KeyboardLayout::chr(hex $_)}
not /^d[89a-f]/i &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ !$sp{&UI::KeyboardLayout::chr(hex $_)}
MC/DC0%0/5
!/^d[89a-f]/i && (&UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) && &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ || $sp{&UI::KeyboardLayout::chr(hex $_)}) && $_ ne '0020'
not /^d[89a-f]/i &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_)) &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/ $sp{&UI::KeyboardLayout::chr(hex $_)} $_ ne '0020'
Truth table0%0/4
not(A) and B && not(C)
A= not /^d[89a-f]/iB= &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) ne &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))C= !$sp{&UI::KeyboardLayout::chr(hex $_)}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/5
not(A) and B and not(C) && not(D)
A= not /^d[89a-f]/iB= &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))C= not &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/D= !$sp{&UI::KeyboardLayout::chr(hex $_)}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
Truth table0%0/9
not(A) and B and C or D && E
A= not /^d[89a-f]/iB= &UI::KeyboardLayout::lc(scalar &UI::KeyboardLayout::chr(hex $_)) eq &UI::KeyboardLayout::uc(scalar &UI::KeyboardLayout::chr(hex $_))C= &UI::KeyboardLayout::chr(hex $_) =~ /\p{Blank}/D= $sp{&UI::KeyboardLayout::chr(hex $_)}E= $_ ne '0020'
ABCDEresult
0XXXX0
10X0X0
1100X0
111X00
10X100
110100
111X11
10X111
110111
10552 grep( /^d[89a-f]/i, @keys), # 16-bit surrogates
10553 grep( $_ eq '0020', @keys)); # make SPACE last
10554 0 for my $n (@keys) { # Only 4-byte keys reach this (except for Apple)
10555 ### warn("do/skip $n in dk=$d\n") if $n =~ /[^a-f\d]/i or hex $n >= 0x10000;
10556 0 my ($to, $import_dead, $EXPL) = my $map_n = $joined_map{$n};
10557 0 ▶ if ($to and 'ARRAY' eq ref $to) {
Branch: 1 branch
BranchTrueFalseTotal
if ($to and "ARRAY" eq ref $to) 0 0 0
Condition0%0/3
$to and "ARRAY" eq ref $to
!ll&&!rl&&r
000
MC/DC0%0/2
$to and "ARRAY" eq ref $to
$to "ARRAY" eq ref $to
Truth table0%0/3
A and B
A= $toB= "ARRAY" eq ref $to
ABresult
0X0
100
111
10558 0 $EXPL = $to->[3];
10559 0 ▶ $EXPL =~ s/(?=\p{NonspacingMark})/ /g if $EXPL;
Branch: 1 branch
BranchTrueFalseTotal
if $EXPL 0 0 0
10560 0 ▶ $import_dead = (1 <= ($to->[2] || 0)); # was: exportable; now: any dead
Condition0%0/2
$to->[2] || 0
l!l
00
MC/DC0%0/1
$to->[2] || 0
$to->[2]
Truth table0%0/2
A
A= $to->[2]
Aresult
11
00
10561 0 $to = $self->dead_with_inversion('hex', $to, $nameF, $H);
10562 }
10563 0 ▶ warn "0000: face `$nameF' d=`$d': $n --> $to" if $to and $to eq '0000';
Branch: 1 branch
BranchTrueFalseTotal
if $to and $to eq "0000" 0 0 0
Condition0%0/3
$to and $to eq "0000"
!ll&&!rl&&r
000
MC/DC0%0/2
$to and $to eq "0000"
$to $to eq "0000"
Truth table0%0/3
A and B
A= $toB= $to eq "0000"
ABresult
0X0
100
111
10564 0 ▶ $to = '0000' if $to and $to eq '000000'; # A way to protect from a warning above!
Branch: 1 branch
BranchTrueFalseTotal
if $to and $to eq "000000" 0 0 0
Condition0%0/3
$to and $to eq "000000"
!ll&&!rl&&r
000
MC/DC0%0/2
$to and $to eq "000000"
$to $to eq "000000"
Truth table0%0/3
A and B
A= $toB= $to eq "000000"
ABresult
0X0
100
111
10565 0 ▶ $map_n = $map_n->[0] if $map_n and ref $map_n;
Branch: 1 branch
BranchTrueFalseTotal
if $map_n and ref $map_n 0 0 0
Condition0%0/3
$map_n and ref $map_n
!ll&&!rl&&r
000
MC/DC0%0/2
$map_n and ref $map_n
$map_n ref $map_n
Truth table0%0/3
A and B
A= $map_nB= ref $map_n
ABresult
0X0
100
111
10566 ### $H->{'[32-bit]'}{chr hex $map_n}++, next if hex $n > 0xFFFF and $map_n; # Cannot be put in a map...
10567 0 ▶ $H->{'[32-bit]'}{chr hex $map_n}++ if $n !~ /\./ and hex $n > 0xFFFF and $map_n; # Cannot be put in a map...
Branch: 1 branch
BranchTrueFalseTotal
if not $n =~ /\./ and hex $n > 65535 and $map_n 0 0 0
Condition0%0/6
not $n =~ /\./ and hex $n > 65535 and $map_n
!ll&&!rl&&r
000
not $n =~ /\./ and hex $n > 65535
!ll&&!rl&&r
000
MC/DC0%0/3
not $n =~ /\./ and hex $n > 65535 and $map_n
not $n =~ /\./ hex $n > 65535 $map_n
Truth table0%0/4
not(A) and B and C
A= not $n =~ /\./B= hex $n > 65535C= $map_n
ABCresult
0XX0
10X0
1100
1111
10568 0 ▶ $n = $self->keys2hex(to_UTF16LE_units(chr hex $n)) if hex(my $n_high = $n) >= 0x10000;
Branch: 1 branch
BranchTrueFalseTotal
if hex(my $n_high = $n) >= 65536 0 0 0
10569 0 ▶ if ($to and ($to =~ /\./ or hex $to > 0xFFFF)) {{ # Value cannot be put in a map...
Branch: 1 branch
BranchTrueFalseTotal
if ($to and $to =~ /\./ || hex $to > 65535) 0 0 0
Condition0%0/6
$to and $to =~ /\./ || hex $to > 65535
!ll&&!rl&&r
000
$to =~ /\./ or hex $to > 65535
l!l&&r!l&&!r
000
MC/DC0%0/3
$to and $to =~ /\./ || hex $to > 65535
$to $to =~ /\./ hex $to > 65535
Truth table0%0/4
A and B or C
A= $toB= $to =~ /\./C= hex $to > 65535
ABCresult
0XX0
1000
11X1
1011
10570 # warn "32-bit: n=$n map{n}=$map_n to=$to";
10571 0 my $trg = $to;
10572 0 $H->{'[32-bit]'}{chr hex $map_n}++;
10573 0 ▶ last unless defined ($to = $H->{'[DeadChar_32bitTranslation]'});
Branch: 1 branch
BranchTrueFalseTotal
unless defined($to = $H->{"[DeadChar_32bitTranslation]"}) 0 0 0
10574 0 $to =~ s/^\s+//; $to =~ s/\s+$//;
10575 0 $to = $self->key2hex($to);
10576 0 ▶ $EXPL .= ' ' if $EXPL ||= '';
Branch: 1 branch
BranchTrueFalseTotal
if $EXPL ||= "" 0 0 0
Condition0%0/2
$EXPL ||= ""
l!l
00
MC/DC0%0/1
$EXPL ||= ""
$EXPL
Truth table0%0/2
A
A= $EXPL
Aresult
11
00
10577 0 $EXPL .= "Windows’ limitation: multi-codepoint value U+$trg cannot be emitted after a prefix key";
10578 }}
10579 0 ▶ if ($n =~ /[^a-f\d]/i or hex $n >= 0x10000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n =~ /[^a-f\d]/i or hex $n >= 65536) 0 0 0
Condition0%0/3
$n =~ /[^a-f\d]/i or hex $n >= 65536
l!l&&r!l&&!r
000
MC/DC0%0/2
$n =~ /[^a-f\d]/i or hex $n >= 65536
$n =~ /[^a-f\d]/i hex $n >= 65536
Truth table0%0/3
A or B
A= $n =~ /[^a-f\d]/iB= hex $n >= 65536
ABresult
1X1
011
000
10580 0 ▶ next if $OUT_Apple;
Branch: 1 branch
BranchTrueFalseTotal
if $OUT_Apple 0 0 0
10581 0 ▶ die "Unexpected $n in dk=$d", ($to ? " -> $to" : '' );
Branch: 1 branch
BranchTrueFalseTotal
$to ? : 0 0 0
10582 0 next;
10583 }
10584 0 my $was_to = $to;
10585 0 ▶ $to ||= $default or next;
Branch: 1 branch
BranchTrueFalseTotal
$to ||= $default or next 0 0 0
Condition0%0/3
$to ||= $default
l!l&&r!l&&!r
000
MC/DC0%0/2
$to ||= $default
$to $default
Truth table0%0/3
A ||= B
A= $toB= $default
ABresult
1X1
011
000
10586 # Tricky: dead keys may come from the override map (which is indexed by NOT-INVERTED KEYS!); it is already merged into
10587 # the map - unless for inverted base face
10588 my ($alt_n, $use_dead2) = (($is_invAltGr_Base_with_chain and defined $map_AltGr_over->{$n})
10589 ? ($n, $over_dead2)
10590 0 ▶ : (($invertAlt ? $AMap->{$n} : $n), $dead2));
Branch: 2 branches
BranchTrueFalseTotal
$is_invAltGr_Base_with_chain && defined $map_AltGr_over->{$n} ? : 0 0 0
$invertAlt ? : 0 0 0
Condition0%0/3
$is_invAltGr_Base_with_chain and defined $map_AltGr_over->{$n}
!ll&&!rl&&r
000
MC/DC0%0/2
$is_invAltGr_Base_with_chain and defined $map_AltGr_over->{$n}
$is_invAltGr_Base_with_chain defined $map_AltGr_over->{$n}
Truth table0%0/3
A and B
A= $is_invAltGr_Base_with_chainB= defined $map_AltGr_over->{$n}
ABresult
0X0
100
111
10591 0 ▶ $alt_n = $alt_n->[0] if $alt_n and ref $alt_n; # AMap may have "complex" values
Branch: 1 branch
BranchTrueFalseTotal
if $alt_n and ref $alt_n 0 0 0
Condition0%0/3
$alt_n and ref $alt_n
!ll&&!rl&&r
000
MC/DC0%0/2
$alt_n and ref $alt_n
$alt_n ref $alt_n
Truth table0%0/3
A and B
A= $alt_nB= ref $alt_n
ABresult
0X0
100
111
10592 #warn "$D --> $d, `$n', `$alt_n', `$AMap->{$n}'; `$map_AltGr_over->{$n}' i=$invertAlt i0=$invertAlt0 d=$use_dead2->{chr hex $alt_n}";
10593 #warn "... n=`$n', alt=`$alt_n' Amap=`$AMap->{$n}'\n" if $AMap->{$n};
10594 0 ▶ my $DEAD = ( (defined $alt_n and $use_dead2->{chr hex $alt_n}) ? '@' : '' );
Branch: 1 branch
BranchTrueFalseTotal
defined $alt_n && $$use_dead2{&UI::KeyboardLayout::chr(hex $alt_n)} ? : 0 0 0
Condition0%0/3
defined $alt_n and $$use_dead2{&UI::KeyboardLayout::chr(hex $alt_n)}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $alt_n and $$use_dead2{&UI::KeyboardLayout::chr(hex $alt_n)}
defined $alt_n $$use_dead2{&UI::KeyboardLayout::chr(hex $alt_n)}
Truth table0%0/3
A and B
A= defined $alt_nB= $$use_dead2{&UI::KeyboardLayout::chr(hex $alt_n)}
ABresult
0X0
100
111
10595 #warn "AltGr flip: $nameF:$D: $n --> $H->{'[dead2_AltGr_chain]'}{$D}" if $n eq ($flip_AltGr_hex || 'n/a');
10596 0 my $from = $self->control2prt(chr hex $n);
10597 # This is now done inside the map:
10598 0 if (0 and (hex $n) == hex ($flip_AltGr_hex || 'ffffff') and @maps == 2 and !$invertAlt) {
10599 if (defined $was_to or $DEAD) {
10600 warn "AltGr_Flip key=", hex $n, " overwrites '$was_to', DEAD=", $DEAD||$import_dead||0, " on face=$nameF\[$d]";
10601 }
10602 ($DEAD, $to) = ('@', $DD[1]); # Join Inv to not-Inv on $flip_AltGr_hex; Do not overwrite existing binding... Warn???
10603 }
10604 0 ▶ $to = $default # Do not remap a Ctrl-char to Ctrl-char
Branch: 1 branch
BranchTrueFalseTotal
if not $DEAD || $import_dead and defined $default and 127 == hex $to || 32 > hex $to and 127 == hex $n || 32 > hex $n 0 0 0
Condition0%0/18
not $DEAD || $import_dead and defined $default and 127 == hex $to || 32 > hex $to and 127 == hex $n || 32 > hex $n
!ll&&!rl&&r
000
not $DEAD || $import_dead and defined $default and 127 == hex $to || 32 > hex $to
!ll&&!rl&&r
000
not $DEAD || $import_dead and defined $default
!ll&&!rl&&r
000
$DEAD || $import_dead
l!l&&r!l&&!r
000
127 == hex $to or 32 > hex $to
l!l&&r!l&&!r
000
127 == hex $n or 32 > hex $n
l!l&&r!l&&!r
000
MC/DC0%0/7
not $DEAD || $import_dead and defined $default and 127 == hex $to || 32 > hex $to and 127 == hex $n || 32 > hex $n
$DEAD $import_dead defined $default 127 == hex $to 32 > hex $to 127 == hex $n 32 > hex $n
Truth table0%0/10
not(A || B) and C and D or E and F or G
A= $DEADB= $import_deadC= defined $defaultD= 127 == hex $toE= 32 > hex $toF= 127 == hex $nG= 32 > hex $n
ABCDEFGresult
1XXXXXX0
01XXXXX0
000XXXX0
00100XX0
0011X000
00101000
0011X1X1
0011X011
001011X1
00101011
10605 if !($DEAD or $import_dead)
10606 and defined $default and (0x7f == hex $to or 0x20 > hex $to) and (0x7f == hex $n or 0x20 > hex $n);
10607 0 ▶ if (($DEAD or $import_dead) and $d eq $to and not $loopOK{$n}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($DEAD || $import_dead and $d eq $to and not $loopOK{$n}) 0 0 0
Condition0%0/9
$DEAD || $import_dead and $d eq $to and not $loopOK{$n}
!ll&&!rl&&r
000
$DEAD || $import_dead and $d eq $to
!ll&&!rl&&r
000
$DEAD or $import_dead
l!l&&r!l&&!r
000
MC/DC0%0/4
$DEAD || $import_dead and $d eq $to and not $loopOK{$n}
$DEAD $import_dead $d eq $to not $loopOK{$n}
Truth table0%0/7
A or B and C and not(D)
A= $DEADB= $import_deadC= $d eq $toD= not $loopOK{$n}
ABCDresult
00XX0
1X0X0
010X0
1X100
01100
1X111
01111
10608 0 ▶ if (($flip_AltGr_hex or 'n/a') eq $d) { # This is what routinely happens in Flip_AltGr face
Branch: 1 branch
BranchTrueFalseTotal
if (($flip_AltGr_hex || 'n/a') eq $d) { } 0 0 0
Condition0%0/2
$flip_AltGr_hex || 'n/a'
l!l
00
MC/DC0%0/1
$flip_AltGr_hex || 'n/a'
$flip_AltGr_hex
Truth table0%0/2
A
A= $flip_AltGr_hex
Aresult
11
00
10609 0 $import_dead = $DEAD = '';
10610 0 ▶ $to = $H->{'[DeadChar_32bitTranslation]'} || '003f'; # ? = U+003f
Condition0%0/2
$H->{'[DeadChar_32bitTranslation]'} || '003f'
l!l
00
MC/DC0%0/1
$H->{'[DeadChar_32bitTranslation]'} || '003f'
$H->{'[DeadChar_32bitTranslation]'}
Truth table0%0/2
A
A= $H->{'[DeadChar_32bitTranslation]'}
Aresult
11
00
10611 0 $to =~ s/^\s+//; $to =~ s/\s+$//;
10612 0 $to = $self->key2hex($to);
10613 0 $EXPL = 'removal of immediate deadkey loop in flip_AltGr variant of the base';
10614 } else {
10615 0 warn "Immediate deadkey loop: face `$nameF' d=`$d': $n --> $to";
10616 }
10617 }
10618 0 ▶ my $expl = exists $self->{UNames} ? "\t// " . join "\t-> ", # map $self->UName($_),
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'UNames'} ? : 0 0 0
10619 # chr hex $n, chr hex $map->{$n} : '';
10620 $self->UName(chr hex $n), $self->UName(chr hex $to, 'verbose', 'vbell') : '';
10621 0 ▶ $expl .= " (via $EXPL)" if $expl and $EXPL;
Branch: 1 branch
BranchTrueFalseTotal
if $expl and $EXPL 0 0 0
Condition0%0/3
$expl and $EXPL
!ll&&!rl&&r
000
MC/DC0%0/2
$expl and $EXPL
$expl $EXPL
Truth table0%0/3
A and B
A= $explB= $EXPL
ABresult
0X0
100
111
10622 0 my $to1 = $self->control2prt(chr hex $to);
10623 # warn "Both import_dead and DEAD properties hold for `$from' --> '$to1' via deadkey $d face=$nameF" if $DEAD and $import_dead;
10624 0 ▶ $DEAD = '@' if $import_dead;
Branch: 1 branch
BranchTrueFalseTotal
if $import_dead 0 0 0
10625 0 ▶ my $FROM = ($n =~ /^d[89a-f]/i ? '[u16]' : $from);
Branch: 1 branch
BranchTrueFalseTotal
$n =~ /^d[89a-f]/i ? : 0 0 0
10626 0 $OUT .= sprintf "%s\t%s%s\t// %s -> %s%s\n", $n, $to, $DEAD, $FROM, $to1, $expl;
10627 0 ▶ $OUT_Apple->{$n_high}{$OUT_Apple_map} = [$to, undef, $DEAD && 1]
Branch: 1 branch
BranchTrueFalseTotal
if $OUT_Apple and not $n_high =~ /\./ and 32 <= hex $n_high and 127 != hex $n_high 0 0 0
Condition0%0/11
$OUT_Apple and not $n_high =~ /\./ and 32 <= hex $n_high and 127 != hex $n_high
!ll&&!rl&&r
000
$OUT_Apple and not $n_high =~ /\./ and 32 <= hex $n_high
!ll&&!rl&&r
000
$OUT_Apple and not $n_high =~ /\./
!ll&&!rl&&r
000
$DEAD && 1
!ll
00
MC/DC0%0/4
$OUT_Apple and not $n_high =~ /\./ and 32 <= hex $n_high and 127 != hex $n_high
$OUT_Apple not $n_high =~ /\./ 32 <= hex $n_high 127 != hex $n_high
MC/DC0%0/1
$DEAD && 1
$DEAD
Truth table0%0/5
A and not(B) and C and D
A= $OUT_AppleB= not $n_high =~ /\./C= 32 <= hex $n_highD= 127 != hex $n_high
ABCDresult
0XXX0
10XX0
110X0
11100
11111
Truth table0%0/2
A
A= $DEAD
Aresult
00
11
10628 if $OUT_Apple and $n_high !~ /\./ and 0x20 <= hex $n_high and 0x7f != hex $n_high;
10629 }
10630 0 $OUT .= "\n";
10631 0 ▶ $keys ||= @keys;
Condition0%0/3
$keys ||= @keys
l!l&&r!l&&!r
000
MC/DC0%0/2
$keys ||= @keys
$keys @keys
Truth table0%0/3
A ||= B
A= $keysB= @keys
ABresult
1X1
011
000
10632 }
10633 0 ▶ warn "DEADKEY $d for face `$nameF' empty" unless $keys;
Branch: 1 branch
BranchTrueFalseTotal
unless $keys 0 0 0
10634 0 (!!$keys, $OUT, $OUT_Apple)
10635 }
10636
10637 0 ▶sub massage_diacritics ($) { # "
Subroutine massage_diacritics: not called CC=5 SCAR=34.0
Pod undocumented
10638 0 my ($self) = (shift);
10639 0 my %char2dia;
10640 0 for my $dia (sort keys %{$self->{Diacritics}}) { # Make order deterministic
10641 0 my @v = map { (my $v = $_) =~ s/\p{Blank}//g; $v } @{ $self->{Diacritics}{$dia} };
10642 # $self->{'[map2diac]'}{$_} = $dia for split //, join '', @v; # XXXX No check for duplicates???
10643 0 my @vv = map [ split // ], @v;
10644 0 for my $cc ( [ map @$_, @vv[0..3] ], [ map @$_, @vv[4..$#v] ] ) { # modifiers, combining
10645 0 $char2dia{$cc->[$_]}{$_} = $dia for 0..$#$cc; # XXXX No check for duplicates at the same distance???
10646 }
10647 0 $self->{'[diacritics]'}{$dia} = \@vv;
10648 }
10649 0 for my $c (keys %char2dia) {
10650 0 my @pos = sort {$a <=> $b} keys %{ $char2dia{$c} };
10651 # warn("map2diac( $c ): @pos; ", join '; ', values %{ $char2dia{$c} });
10652 0 $self->{'[map2diac]'}{$c} = $char2dia{$c}{$pos[0]}; # prefer the earliest possible occurence
10653 }
10654 }
10655
10656 0 ▶sub extract_diacritic ($$$$$$@) {
Subroutine extract_diacritic: not called CC=7 SCAR=40.3
Pod undocumented
10657 0 my ($self, $dia, $idx, $which, $warn_after__need, $skip2) = (shift, shift, shift, shift, shift, shift);
10658 0 my(@v, @elt0) = map @$_, my $elt0 = shift; # first one full
10659 0 ▶ push @v, map @$_[($skip2 ? 2 : 0)..$#$_], @_; # join the rest, omitting the first 2 (assumed: accessible in other ways)
Branch: 1 branch
BranchTrueFalseTotal
$skip2 ? : 0 0 0
10660 0 ▶ @elt0 = $elt0 if $skip2 and $skip2 eq 'skip2-include0'; # include penalized “first 2 of 0th group”; the caller adjusts $idx
Branch: 1 branch
BranchTrueFalseTotal
if $skip2 and $skip2 eq "skip2-include0" 0 0 0
Condition0%0/3
$skip2 and $skip2 eq "skip2-include0"
!ll&&!rl&&r
000
MC/DC0%0/2
$skip2 and $skip2 eq "skip2-include0"
$skip2 $skip2 eq "skip2-include0"
Truth table0%0/3
A and B
A= $skip2B= $skip2 eq "skip2-include0"
ABresult
0X0
100
111
10661 0 ▶ push @v, grep defined, map @$_[0..1], @elt0, @_ if $skip2;
Branch: 1 branch
BranchTrueFalseTotal
if $skip2 0 0 0
10662 # @v = grep +((ord $_) >= 128 and $_ ne $dia), @v;
10663 0 @v = grep +(ord $_) >= 0x80, @v;
10664 0 ▶ die "diacritic ` $dia ' has no $which no.$idx (0-based) assigned"
Branch: 1 branch
BranchTrueFalseTotal
unless $idx >= $warn_after__need or defined $v[$idx] 0 0 0
Condition0%0/3
$idx >= $warn_after__need or defined $v[$idx]
l!l&&r!l&&!r
000
MC/DC0%0/2
$idx >= $warn_after__need or defined $v[$idx]
$idx >= $warn_after__need defined $v[$idx]
Truth table0%0/3
A or B
A= $idx >= $warn_after__needB= defined $v[$idx]
ABresult
1X1
011
000
10665 unless $idx >= $warn_after__need or defined $v[$idx];
10666 # warn "Translating for dia=<$dia>: idx=$idx <$which> -> <$v[$idx]> of <@v>" if defined $v[$idx];
10667 0 return $v[$idx];
10668 }
10669
10670 0 ▶sub diacritic2self ($$$$$$$$$) {
Subroutine diacritic2self: not called CC=59 SCAR=81.7
Pod undocumented
10671 0 my ($self, $dia, $c, $face, $layer_N, $space, $c_base, $c_noalt, $seen_before) = (shift, shift, shift, shift, shift, shift, shift, shift, shift);
10672 # warn("Translating for dia=<$dia>: got undef"),
10673 0 ▶ return $c unless defined $c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
10674 # $c = $c->[0] if 'ARRAY' eq ref $c; # Prefix keys behave as usual keys
10675 # return undef if
10676 0 ▶ my $is_prefix = (ref $c and $c->[2]); # Ignore deadkeys (unless we act on $c_base or $c_noalt - UNIMPLEMENTED);
Condition0%0/3
ref $c && $c->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $c && $c->[2]
ref $c $c->[2]
Truth table0%0/3
A && B
A= ref $cB= $c->[2]
ABresult
0X0
100
111
10677 0 ▶ $_ and 'ARRAY' eq ref $_ and $_ = $_->[0] for $c, $c_base, $c_noalt; # Prefix keys behave as usual keys
Branch: 1 branch
BranchTrueFalseTotal
$_ and "ARRAY" eq ref $_ and $_ = $_->[0] 0 0 0
Condition0%0/3
$_ and "ARRAY" eq ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and "ARRAY" eq ref $_
$_ "ARRAY" eq ref $_
Truth table0%0/3
A and B
A= $_B= "ARRAY" eq ref $_
ABresult
0X0
100
111
10678 #warn " Translating for dia=<$dia>: got <$c>";
10679 0 ▶ die "` $dia ' not a known diacritic" unless my $name = $self->{'[map2diac]'}{$dia};
Branch: 1 branch
BranchTrueFalseTotal
unless my $name = $self->{"[map2diac]"}{$dia} 0 0 0
10680 0 ▶ my $v = $self->{'[diacritics]'}{$name} or die "Panic!";
Branch: 1 branch
BranchTrueFalseTotal
my $v = $self->{"[diacritics]"}{$name} or die "Panic!" 0 0 0
10681 0 ▶ my ($first) = grep 0x80 <= ord, @{$v->[0]} or die "diacritic ` $dia ' does not define any non-7bit modifier";
Branch: 1 branch
BranchTrueFalseTotal
my($first) = grep((128 <= ord $_), @{$$v[0];}) or die "diacritic ` $dia ' does not define any non-7bit modifier" 0 0 0
10682 0 ▶ return $first if $c eq ' ';
Branch: 1 branch
BranchTrueFalseTotal
if $c eq " " 0 0 0
10683 0 my $spaces = keys %$space;
10684 0 my $flip_AltGr = $self->{faces}{$face}{'[Flip_AltGr_Key]'};
10685 0 ▶ $flip_AltGr = $self->charhex2key($flip_AltGr) if defined $flip_AltGr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr 0 0 0
10686 0 ▶ $flip_AltGr = 'n/a' unless defined $flip_AltGr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $flip_AltGr 0 0 0
10687 0 ▶ my $is_flip_AltGr = (defined $flip_AltGr and $is_prefix and $c eq $flip_AltGr);
Condition0%0/6
defined $flip_AltGr && $is_prefix && $c eq $flip_AltGr
!ll&&!rl&&r
000
defined $flip_AltGr and $is_prefix
!ll&&!rl&&r
000
MC/DC0%0/3
defined $flip_AltGr && $is_prefix && $c eq $flip_AltGr
defined $flip_AltGr $is_prefix $c eq $flip_AltGr
Truth table0%0/4
A and B && C
A= defined $flip_AltGrB= $is_prefixC= $c eq $flip_AltGr
ABCresult
0XX0
10X0
1100
1111
10688 0 ▶ if ($c eq $dia and $is_prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c eq $dia and $is_prefix) 0 0 0
Condition0%0/3
$c eq $dia and $is_prefix
!ll&&!rl&&r
000
MC/DC0%0/2
$c eq $dia and $is_prefix
$c eq $dia $is_prefix
Truth table0%0/3
A and B
A= $c eq $diaB= $is_prefix
ABresult
0X0
100
111
10689 #warn "Translating2combining dia=<$dia>: got <$c> --> <$v->[4][0]>";
10690 # This happens with caron which reaches breve as the first:
10691 # warn "The diacritic ` $dia ' differs from the first non-7bit entry ` $first ' in its list" unless $dia eq $first;
10692 0 ▶ die "diacritic ` $dia ' has no default combining char assigned" unless defined $v->[4][0];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v->[4][0] 0 0 0
10693 0 return $v->[4][0];
10694 }
10695 0 ▶ my $limits = $self->{Diacritics_Limits}{ALL} || [(0) x 7];
Condition0%0/2
$self->{'Diacritics_Limits'}{'ALL'} || [(0) x 7]
l!l
00
MC/DC0%0/1
$self->{'Diacritics_Limits'}{'ALL'} || [(0) x 7]
$self->{'Diacritics_Limits'}{'ALL'}
Truth table0%0/2
A
A= $self->{'Diacritics_Limits'}{'ALL'}
Aresult
11
00
10696 0 ▶ if ($space->{$c}) { # index on the SPACE key (0-based, but SPACE is handled above — we assume it is on index 0)
Branch: 3 branches
BranchTrueFalseTotal
if ($space->{$c}) { } 0 0 0
elsif (0 <= (my $off = index("\r\t\n\e\035\034\cH\177\036\037\000", $c)) and not $is_prefix) { } 0 0 0
elsif (not $spaces and $c =~ /^\p{Blank}$/ and not $is_prefix) { } 0 0 0
10697 # ~ and ^ have only 3 spacing variants; one of them must be on ' ' - and we omit the first 2 of the non-principal block...
10698 0 return $self->extract_diacritic($dia, $space->{$c}, 'spacing variant', $limits->[0], 'skip2', @$v[0..3]);
10699 ▶ } elsif (0 <= (my $off = index "\r\t\n\x1b\x1d\x1c\b\x7f\x1e\x1f\x00", $c)
Condition0%0/3
0 <= (my $off = index("\r\t\n\e\35\34\b\177\36\37\0", $c)) and not $is_prefix
!ll&&!rl&&r
000
MC/DC0%0/2
0 <= (my $off = index("\r\t\n\e\35\34\b\177\36\37\0", $c)) and not $is_prefix
0 <= (my $off = index("\r\t\n\e\35\34\b\177\36\37\0", $c)) not $is_prefix
Truth table0%0/3
A and not(B)
A= 0 <= (my $off = index("\r\t\n\e\35\34\b\177\36\37\0", $c))B= not $is_prefix
ABresult
0X0
100
111
10700 and not $is_prefix) { # Enter, Tab, C-Enter, C-[, C-], C-\, Bspc, C-Bspc, C-^, C-_, C-@
10701 # ~ and ^ have only 3 spacing variants; one of them must be on ' '
10702 0 return $self->extract_diacritic($dia, $spaces + $off, 'spacing variant', $limits->[0], 'skip2', @$v[0..3]);
10703 ▶ } elsif (!$spaces and $c =~ /^\p{Blank}$/ and not $is_prefix) { # NBSP and, (eg) Thin space 2007 -> second/third modifier
Condition0%0/6
not $spaces and $c =~ /^\p{Blank}$/ and not $is_prefix
!ll&&!rl&&r
000
not $spaces and $c =~ /^\p{Blank}$/
!ll&&!rl&&r
000
MC/DC0%0/3
not $spaces and $c =~ /^\p{Blank}$/ and not $is_prefix
not $spaces $c =~ /^\p{Blank}$/ not $is_prefix
Truth table0%0/4
not(A) and B and not(C)
A= not $spacesB= $c =~ /^\p{Blank}$/C= not $is_prefix
ABCresult
0XX0
10X0
1100
1111
10704 # ~ and ^ have only 3 spacing variants; one of them must be on ' '
10705 0 my @pre = grep /^\p{Blank}$/, keys %$seen_before; # no prefix keys in $seen_before
10706 0 ▶ push @pre, 'something' unless $seen_before->{' '}; # there is no sense to address slot number 0
Branch: 1 branch
BranchTrueFalseTotal
unless $seen_before->{" "} 0 0 0
10707 0 return $self->extract_diacritic($dia, scalar @pre, 'spacing variant', $limits->[0], 'skip2', @$v[0..3]);
10708 }
10709 0 ▶ if ($c eq "|" or $c eq "\\" and not $is_prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c eq "|" or $c eq "\\" and not $is_prefix) 0 0 0
Condition0%0/6
$c eq "|" or $c eq "\\" and not $is_prefix
l!l&&r!l&&!r
000
$c eq "\\" and not $is_prefix
!ll&&!rl&&r
000
MC/DC0%0/3
$c eq "|" or $c eq "\\" and not $is_prefix
$c eq "|" $c eq "\\" not $is_prefix
Truth table0%0/4
A or B and not(C)
A= $c eq "|"B= $c eq "\\"C= not $is_prefix
ABCresult
1XX1
0111
00X0
0100
10710 #warn "Translating2vertical dia=<$dia>: got <$c> --> <$v->[4][0]>"; # Skip2 would hurt, since macron+\ is defined:
10711 0 return $self->extract_diacritic($dia, ($c eq "|"), 'vertical+etc spacing variant', $limits->[2], !'skip2', @$v[2..3]);
10712 }
10713 0 ▶ if ($layer_N == 1 and $c_noalt and ($c_noalt eq "|" or $c_noalt eq "\\")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($layer_N == 1 and $c_noalt and $c_noalt eq "|" || $c_noalt eq "\\") 0 0 0
Condition0%0/9
$layer_N == 1 and $c_noalt and $c_noalt eq "|" || $c_noalt eq "\\"
!ll&&!rl&&r
000
$layer_N == 1 and $c_noalt
!ll&&!rl&&r
000
$c_noalt eq "|" or $c_noalt eq "\\"
l!l&&r!l&&!r
000
MC/DC0%0/4
$layer_N == 1 and $c_noalt and $c_noalt eq "|" || $c_noalt eq "\\"
$layer_N == 1 $c_noalt $c_noalt eq "|" $c_noalt eq "\\"
Truth table0%0/5
A and B and C or D
A= $layer_N == 1B= $c_noaltC= $c_noalt eq "|"D= $c_noalt eq "\\"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
10714 #warn "Translating2vertical dia=<$dia>: got <$c> --> <$v->[4][0]>";
10715 0 return $self->extract_diacritic($dia, ($c_noalt eq "|"), 'vertical+dotlike combining', $limits->[6], 'skip2', @$v[6,7,4,5]);
10716 }
10717 0 ▶ if ($c eq "/" or $c eq "?" and not $is_prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c eq "/" or $c eq "?" and not $is_prefix) 0 0 0
Condition0%0/6
$c eq "/" or $c eq "?" and not $is_prefix
l!l&&r!l&&!r
000
$c eq "?" and not $is_prefix
!ll&&!rl&&r
000
MC/DC0%0/3
$c eq "/" or $c eq "?" and not $is_prefix
$c eq "/" $c eq "?" not $is_prefix
Truth table0%0/4
A or B and not(C)
A= $c eq "/"B= $c eq "?"C= not $is_prefix
ABCresult
1XX1
0111
00X0
0100
10718 0 return $self->extract_diacritic($dia, ($c eq "?"), 'prime-like+etc spacing variant', $limits->[3], 'skip2', @$v[3]);
10719 }
10720 0 ▶ if ($c_noalt and ($c_noalt eq "'" or $c_noalt eq '"')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c_noalt and $c_noalt eq "'" || $c_noalt eq "\"") 0 0 0
Condition0%0/6
$c_noalt and $c_noalt eq "'" || $c_noalt eq "\""
!ll&&!rl&&r
000
$c_noalt eq "'" or $c_noalt eq "\""
l!l&&r!l&&!r
000
MC/DC0%0/3
$c_noalt and $c_noalt eq "'" || $c_noalt eq "\""
$c_noalt $c_noalt eq "'" $c_noalt eq "\""
Truth table0%0/4
A and B or C
A= $c_noaltB= $c_noalt eq "'"C= $c_noalt eq "\""
ABCresult
0XX0
1000
11X1
1011
10721 0 return $self->extract_diacritic($dia, 1 + ($c_noalt eq '"') + 2*$layer_N, 'combining', $limits->[4], 'skip2', @$v[4..7]); # 1 for double-prefix
10722 }
10723 0 ▶ if ($c eq "_" or $c eq "-" and not $is_prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c eq "_" or $c eq "-" and not $is_prefix) 0 0 0
Condition0%0/6
$c eq "_" or $c eq "-" and not $is_prefix
l!l&&r!l&&!r
000
$c eq "-" and not $is_prefix
!ll&&!rl&&r
000
MC/DC0%0/3
$c eq "_" or $c eq "-" and not $is_prefix
$c eq "_" $c eq "-" not $is_prefix
Truth table0%0/4
A or B and not(C)
A= $c eq "_"B= $c eq "-"C= not $is_prefix
ABCresult
1XX1
0111
00X0
0100
10724 0 return $self->extract_diacritic($dia, ($c eq "_"), 'lowered+etc spacing variant', $limits->[1], 'skip2', @$v[1..3]);
10725 }
10726 0 ▶ if ($layer_N == 1 and $c_noalt and ($c_noalt eq "_" or $c_noalt eq "-")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($layer_N == 1 and $c_noalt and $c_noalt eq "_" || $c_noalt eq "-") 0 0 0
Condition0%0/9
$layer_N == 1 and $c_noalt and $c_noalt eq "_" || $c_noalt eq "-"
!ll&&!rl&&r
000
$layer_N == 1 and $c_noalt
!ll&&!rl&&r
000
$c_noalt eq "_" or $c_noalt eq "-"
l!l&&r!l&&!r
000
MC/DC0%0/4
$layer_N == 1 and $c_noalt and $c_noalt eq "_" || $c_noalt eq "-"
$layer_N == 1 $c_noalt $c_noalt eq "_" $c_noalt eq "-"
Truth table0%0/5
A and B and C or D
A= $layer_N == 1B= $c_noaltC= $c_noalt eq "_"D= $c_noalt eq "-"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
10727 0 return $self->extract_diacritic($dia, ($c_noalt eq "_"), 'lowered combining', $limits->[5], 'skip2', @$v[5..7,4]);
10728 }
10729 0 ▶ if ($layer_N == 1 and $c_noalt and ($c_noalt eq ";" or $c_noalt eq ":")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($layer_N == 1 and $c_noalt and $c_noalt eq ";" || $c_noalt eq ":") 0 0 0
Condition0%0/9
$layer_N == 1 and $c_noalt and $c_noalt eq ";" || $c_noalt eq ":"
!ll&&!rl&&r
000
$layer_N == 1 and $c_noalt
!ll&&!rl&&r
000
$c_noalt eq ";" or $c_noalt eq ":"
l!l&&r!l&&!r
000
MC/DC0%0/4
$layer_N == 1 and $c_noalt and $c_noalt eq ";" || $c_noalt eq ":"
$layer_N == 1 $c_noalt $c_noalt eq ";" $c_noalt eq ":"
Truth table0%0/5
A and B and C or D
A= $layer_N == 1B= $c_noaltC= $c_noalt eq ";"D= $c_noalt eq ":"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
10730 0 return $self->extract_diacritic($dia, ($c_noalt eq ":"), 'combining for symbols', $limits->[7], 'skip2', @$v[7,4..6]);
10731 }
10732 0 ▶ if ($layer_N == 1 and defined $c_base and 0 <= (my $ind = index "`1234567890=[],.'", $c_base)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($layer_N == 1 and defined $c_base and 0 <= (my $ind = index("`1234567890=[],.'", $c_base))) 0 0 0
Condition0%0/6
$layer_N == 1 and defined $c_base and 0 <= (my $ind = index("`1234567890=[],.'", $c_base))
!ll&&!rl&&r
000
$layer_N == 1 and defined $c_base
!ll&&!rl&&r
000
MC/DC0%0/3
$layer_N == 1 and defined $c_base and 0 <= (my $ind = index("`1234567890=[],.'", $c_base))
$layer_N == 1 defined $c_base 0 <= (my $ind = index("`1234567890=[],.'", $c_base))
Truth table0%0/4
A and B and C
A= $layer_N == 1B= defined $c_baseC= 0 <= (my $ind = index("`1234567890=[],.'", $c_base))
ABCresult
0XX0
10X0
1100
1111
10733 0 return $self->extract_diacritic($dia, 2 + $ind, 'combining', $limits->[4], 'skip2-include0', @$v[4..7]); # -1 for `, 1+2 for double-prefix and AltGr-/?
10734 }
10735 0 ▶ if ($layer_N == 0 and 0 <= (my $ind = index "[{]}", $c) and not $is_prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($layer_N == 0 and 0 <= (my $ind = index("[{]}", $c)) and not $is_prefix) 0 0 0
Condition0%0/6
$layer_N == 0 and 0 <= (my $ind = index("[{]}", $c)) and not $is_prefix
!ll&&!rl&&r
000
$layer_N == 0 and 0 <= (my $ind = index("[{]}", $c))
!ll&&!rl&&r
000
MC/DC0%0/3
$layer_N == 0 and 0 <= (my $ind = index("[{]}", $c)) and not $is_prefix
$layer_N == 0 0 <= (my $ind = index("[{]}", $c)) not $is_prefix
Truth table0%0/4
A and B and not(C)
A= $layer_N == 0B= 0 <= (my $ind = index("[{]}", $c))C= not $is_prefix
ABCresult
0XX0
10X0
1100
1111
10736 0 return $self->extract_diacritic($dia, 2 + $ind, 'combining for symbols', $limits->[7], 'skip2-include0', @$v[7,4..6]);
10737 }
10738 0 ▶ if ($layer_N == 1 and $c_noalt and ($c_noalt eq "/" or $c_noalt eq "?")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($layer_N == 1 and $c_noalt and $c_noalt eq "/" || $c_noalt eq "?") 0 0 0
Condition0%0/9
$layer_N == 1 and $c_noalt and $c_noalt eq "/" || $c_noalt eq "?"
!ll&&!rl&&r
000
$layer_N == 1 and $c_noalt
!ll&&!rl&&r
000
$c_noalt eq "/" or $c_noalt eq "?"
l!l&&r!l&&!r
000
MC/DC0%0/4
$layer_N == 1 and $c_noalt and $c_noalt eq "/" || $c_noalt eq "?"
$layer_N == 1 $c_noalt $c_noalt eq "/" $c_noalt eq "?"
Truth table0%0/5
A and B and C or D
A= $layer_N == 1B= $c_noaltC= $c_noalt eq "/"D= $c_noalt eq "?"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
10739 0 return $self->extract_diacritic($dia, 6 + ($c_noalt eq "?"), 'combining for symbols', $limits->[7], 'skip2-include0', @$v[7,4..6]);
10740 }
10741 0 return undef;
10742 }
10743
10744 0 ▶sub diacritic2self_2 ($$$$$$) { # Takes a key: array of arrays [lc,uc]
Subroutine diacritic2self_2: not called CC=6 SCAR=37.4
Pod undocumented
10745 0 my ($self, $dia, $c, $face, $space, @out, %seen) = (shift, shift, shift, shift, shift);
10746 0 my $c0 = $c->[0][0]; # Base character
10747 0 for my $N (0..$#$c) {
10748 0 my($c1, @res) = $c->[$N];
10749 0 for my $shift (0..$#$c1) {
10750 0 my($c2, $pref) = $c1->[$shift];
10751 0 push @res, $self->diacritic2self($dia, $c2, $face, $N, $space, $c0, $c->[0][$shift], \%seen);
10752 0 ▶ $pref = $c2->[2], $c2 = $c2->[0] if ref $c2;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c2 0 0 0
10753 0 ▶ $seen{$c2}++ if defined $c2 and not $pref;
Branch: 1 branch
BranchTrueFalseTotal
if defined $c2 and not $pref 0 0 0
Condition0%0/3
defined $c2 and not $pref
!ll&&!rl&&r
000
MC/DC0%0/2
defined $c2 and not $pref
defined $c2 not $pref
Truth table0%0/3
A and not(B)
A= defined $c2B= not $pref
ABresult
0X0
100
111
10754 }
10755 0 push @out, \@res;
10756 }
10757 @out
10758 0 }
10759
10760 # Combining stuff:
10761 # perl -C31 -MUnicode::UCD=charinfo -le 'sub n($) {(charinfo(ord shift) || {})->{name}} for (0x20..0x10ffff) {next unless (my $c = chr) =~ /\p{NonspacingMark}/; (my $n = n($c)) =~ /^COMBINING\b/ or next; printf qq(%04x\t%s\t%s\n), $_, $c, $n}' >cc
10762 # perl -C31 -MUnicode::UCD=charinfo -le 'sub n($) {(charinfo(ord shift) || {})->{name}} for (0x20..0x10ffff) {next unless (my $c = chr) =~ /\p{NonspacingMark}/; (my $n = n($c)) =~ /^COMBINING\b/ and next; printf qq(%04x\t%s\t%s\n), $_, $c, $n}' >cc
10763
10764 0 ▶sub cache_dialist ($@) { # downstream, it is crucial that a case pair comes from "one conversion"
Subroutine cache_dialist: not called CC=16 SCAR=56.1
Pod undocumented
10765 0 my ($self, %seen, %caseseen, @out) = (shift);
10766 0 warn("caching dia: [@_]") if warnCACHECOMP;
10767 0 for my $d (@_) {
10768 0 ▶ next unless my $h = $self->{Compositions}{$d};
Branch: 1 branch
BranchTrueFalseTotal
unless my $h = $self->{"Compositions"}{$d} 0 0 0
10769 0 $seen{$_}++ for keys %$h;
10770 }
10771 0 for my $c (keys %seen) {
10772 0 ▶ next if $caseseen{$c};
Branch: 1 branch
BranchTrueFalseTotal
if $caseseen{$c} 0 0 0
10773 # uc may include a wrong guy: uc(ſ) is S, and this may break the pair s/S if ſ comes before s, and S gets a separate binding;
10774 # so be very conservative with which case pair we include...
10775 0 ▶ my @case = grep { $_ ne $c and $seen{$_} and lc $_ eq lc $c } lc $c, uc $c or next;
Branch: 1 branch
BranchTrueFalseTotal
my(@case) = grep({$_ ne $c and $seen{$_} and &UI::KeyboardLayout::lc($_) eq &UI::KeyboardLayout::lc($c);} &UI::KeyboardLayout::lc($c), &UI::KeyboardLayout::uc($c)) or next 0 0 0
Condition0%0/6
$_ ne $c && $seen{$_} && &UI::KeyboardLayout::lc($_) eq &UI::KeyboardLayout::lc($c)
!ll&&!rl&&r
000
$_ ne $c and $seen{$_}
!ll&&!rl&&r
000
MC/DC0%0/3
$_ ne $c && $seen{$_} && &UI::KeyboardLayout::lc($_) eq &UI::KeyboardLayout::lc($c)
$_ ne $c $seen{$_} &UI::KeyboardLayout::lc($_) eq &UI::KeyboardLayout::lc($c)
Truth table0%0/4
A and B && C
A= $_ ne $cB= $seen{$_}C= &UI::KeyboardLayout::lc($_) eq &UI::KeyboardLayout::lc($c)
ABCresult
0XX0
10X0
1100
1111
10776 0 push @case, $c;
10777 0 $caseseen{$_} = \@case, delete $seen{$_} for @case;
10778 } # Currently (?), downstream does not distinguish case pairs from Shift-pairs...
10779 0 for my $cases ( values %caseseen, map [$_], keys %seen ) { # To avoid pairing symbols, keep them in separate slots too
10780 0 my (@dia, $to);
10781 0 for my $dia (@_) {
10782 0 ▶ push @dia, $dia if grep $self->{Compositions}{$dia}{$_}, @$cases;
Branch: 1 branch
BranchTrueFalseTotal
if grep $self->{"Compositions"}{$dia}{$_}, @$cases 0 0 0
10783 }
10784 0 for my $diaN (0..$#dia) {
10785 $to = $self->{Compositions}{$dia[$diaN]}{$_} and
10786 (warnCACHECOMP and warn("cache dia; c=`$_' of `@$cases'; dia=[$dia[$diaN]]")),
10787 0 ▶ $out[$diaN]{$_} = $to for @$cases;
Branch: 1 branch
BranchTrueFalseTotal
$to = $self->{"Compositions"}{$dia[$diaN]}{$_} and '???', $out[$diaN]{$_} = $to 0 0 0
10788 }
10789 }
10790 #warn("caching dia --> ", scalar @out);
10791 @out
10792 0 }
10793
10794 1 my %cached_aggregate_Compositions;
10795 0 ▶sub dia2list ($$) {
Subroutine dia2list: not called CC=27 SCAR=66.3
Pod undocumented
10796 0 my ($self, $dia, @dia) = (shift, shift);
10797 #warn "Split dia `$dia'";
10798 0 ▶ if ((my ($pre, $mid, $post) = split /(\+|--)/, $dia, 2) > 1) { # $mid is not counted in that "2"
Branch: 1 branch
BranchTrueFalseTotal
if ((() = split(/(\+|--)/, $dia, 2)) > 1) 0 0 0
10799 0 for my $p ($self->dia2list($pre)) {
10800 0 push @dia, map "$p$mid$_", $self->dia2list($post);
10801 }
10802 # warn "Split dia to `@dia'";
10803 0 return @dia;
10804 }
10805 0 ▶ return $dia if $dia =~ /^!?\\/; # (De)Penalization lists
Branch: 1 branch
BranchTrueFalseTotal
if $dia =~ /^!?\\/ 0 0 0
10806 0 $dia = $self->charhex2key($dia);
10807 0 ▶ unless ($dia =~ /^-?(\p{NonspacingMark}|<(?:font=)?[-\w!]+>|(maybe_)?[ul]c(first)?|dectrl)$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dia =~ /^-?(\p{NonspacingMark}|<(?:font=)?[-\w!]+>|(maybe_)?[ul]c(first)?|dectrl)$/) 0 0 0
10808 0 ▶ die "` $dia ' not a known diacritic" unless my $name = $self->{'[map2diac]'}{$dia};
Branch: 1 branch
BranchTrueFalseTotal
unless my $name = $self->{"[map2diac]"}{$dia} 0 0 0
10809 0 ▶ my $v = $self->{'[diacritics]'}{$name} or die "A spacing character <$dia> was requested to be treated as a composition one, but we do not know translation";
Branch: 1 branch
BranchTrueFalseTotal
my $v = $self->{"[diacritics]"}{$name} or die "A spacing character <$dia> was requested to be treated as a composition one, but we do not know translation" 0 0 0
10810 0 ▶ die "Panic!" unless defined ($dia = $v->[4][0]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined($dia = $v->[4][0]) 0 0 0
10811 }
10812 0 ▶ if ($dia =~ /^(-)?<(reverse-)?any(1)?-(other-)?\b([-\w]+?)\b((?:-![-\w]+\b)*)>$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dia =~ /^(-)?<(reverse-)?any(1)?-(other-)?\b([-\w]+?)\b((?:-![-\w]+\b)*)>$/) { } 0 0 0
10813 0 ▶ my($neg, $rev, $one, $other, $match, $rx, $except, @except)
Condition0%0/2
$1 || ''
l!l
00
MC/DC0%0/1
$1 || ''
$1
Truth table0%0/2
A
A= $1
Aresult
11
00
10814 = ($1||'', $2, $3, $4, $5, "(?:(?<!<)|(?=font=))\\b$5\\b", qr((?!)), split /-!/, "$6"); # Allow only `font´ at start
10815 0 my $cached;
10816 0 (my $dia_raw = $dia) =~ s/^-//;
10817 0 ▶ $cached = $cached_aggregate_Compositions{$dia_raw} and return map "$neg$_", @$cached;
Branch: 1 branch
BranchTrueFalseTotal
$cached = $cached_aggregate_Compositions{$dia_raw} and return map("$neg$_", @$cached) 0 0 0
10818
10819 0 @except = map { s/^(?=\w)/\\b/; s/(?<=\w)$/\\b/; $_} @except;
10820 0 ▶ $except = join('|', @except[1..$#except]), $except = qr($except) if @except;
Branch: 1 branch
BranchTrueFalseTotal
if @except 0 0 0
10821 #warn "Exceptions: $except" if @except;
10822 0 $rx =~ s/-/\\b\\W+\\b/g;
10823 0 my ($A, $B, $AA, $BB);
10824 0 my @out = keys %{$self->{Compositions}};
10825 0 @out = grep !/^Cached\d+=</, @out;
10826 0 ▶ @out = grep {length > 1 ? /$rx/ : (lc $self->UName($_) || '') =~ /$rx/ } @out;
Branch: 1 branch
BranchTrueFalseTotal
length $_ > 1 ? : 0 0 0
Condition0%0/2
&UI::KeyboardLayout::lc(scalar $self->UName($_)) || ''
l!l
00
MC/DC0%0/1
&UI::KeyboardLayout::lc(scalar $self->UName($_)) || ''
&UI::KeyboardLayout::lc(scalar $self->UName($_))
Truth table0%0/2
A
A= &UI::KeyboardLayout::lc(scalar $self->UName($_))
Aresult
11
00
10827 0 ▶ @out = grep {length > 1 ? !/$except/ : (lc $self->UName($_) || '') !~ /$except/ } @out;
Branch: 1 branch
BranchTrueFalseTotal
length $_ > 1 ? : 0 0 0
Condition0%0/2
&UI::KeyboardLayout::lc(scalar $self->UName($_)) || ''
l!l
00
MC/DC0%0/1
&UI::KeyboardLayout::lc(scalar $self->UName($_)) || ''
&UI::KeyboardLayout::lc(scalar $self->UName($_))
Truth table0%0/2
A
A= &UI::KeyboardLayout::lc(scalar $self->UName($_))
Aresult
11
00
10828 # make <a> before <a-b>; penalize those with and/over inside
10829 0 @out = sort {($A=$a) =~ s/>/\cA/g, ($B=$b) =~ s/>/\cA/g; ($AA=$a) =~ s/\w+\W*/a/g, ($BB=$b) =~ s/\w+\W*/a/g; # Number of words
10830 0 ▶ /.\b(and|over)\b./ and s/^/~/ for $A,$B; $AA cmp $BB or $A cmp $B or $a cmp $b} @out;
Branch: 1 branch
BranchTrueFalseTotal
/.\b(and|over)\b./ and s/^/~/ 0 0 0
Condition0%0/6
$AA cmp $BB || $A cmp $B || $a cmp $b
l!l&&r!l&&!r
000
$AA cmp $BB or $A cmp $B
l!l&&r!l&&!r
000
MC/DC0%0/3
$AA cmp $BB || $A cmp $B || $a cmp $b
$AA cmp $BB $A cmp $B $a cmp $b
Truth table0%0/4
A or B || C
A= $AA cmp $BBB= $A cmp $BC= $a cmp $b
ABCresult
1XX1
01X1
0011
0000
10831 0 ▶ @out = grep length($match) != length, @out if $other;
Branch: 1 branch
BranchTrueFalseTotal
if $other 0 0 0
10832 0 ▶ @out = grep !/\bAND\s/, @out if $one;
Branch: 1 branch
BranchTrueFalseTotal
if $one 0 0 0
10833 0 ▶ @out = reverse @out if $rev; # xor $reverse;
Branch: 1 branch
BranchTrueFalseTotal
if $rev 0 0 0
10834 0 ▶ if (!dontCOMPOSE_CACHE and @out > 1 and not $neg) { # Optional caching; will modify composition tables
Branch: 1 branch
BranchTrueFalseTotal
if (@out > 1 and not $neg) 0 0 0
Condition0%0/3
@out > 1 and not $neg
!ll&&!rl&&r
000
MC/DC0%0/2
@out > 1 and not $neg
@out > 1 not $neg
Truth table0%0/3
A and not(B)
A= @out > 1B= not $neg
ABresult
0X0
100
111
10835 0 my @cached = $self->cache_dialist(@out); # but not decomposition ones, hence `not $neg'
10836 0 @out = map "Cached$_=$dia_raw", 0..$#cached;
10837 0 $self->{Compositions}{$out[$_]} = $cached[$_] for 0..$#cached;
10838 0 $cached_aggregate_Compositions{$dia} = \@out;
10839 }
10840 0 ▶ @out = map "-$_", @out if $neg;
Branch: 1 branch
BranchTrueFalseTotal
if $neg 0 0 0
10841 0 return @out;
10842 } else { # <pseudo-curl> <super> etc
10843 #warn "Dia=`$dia'";
10844 0 return $dia;
10845 }
10846 }
10847
10848 0 ▶sub flatten_arrays ($$) {
Subroutine flatten_arrays: not called CC=4 SCAR=30.0
Pod undocumented
10849 0 my ($self, $a) = (shift, shift);
10850 0 ▶ warn "method flatten_arrays() takes one argument" if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
10851 0 ▶ return $a unless ref($a || '') eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref($a || "") eq "ARRAY" 0 0 0
Condition0%0/2
$a || ''
l!l
00
MC/DC0%0/1
$a || ''
$a
Truth table0%0/2
A
A= $a
Aresult
11
00
10852 0 map $self->flatten_arrays($_), @$a;
10853 }
10854
10855 0 ▶sub array2string ($$) {
Subroutine array2string: not called CC=5 SCAR=34.0
Pod undocumented
10856 0 my ($self, $a) = (shift, shift);
10857 0 ▶ warn "method array2string() takes one argument" if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
10858 0 ▶ return '(undef)' unless defined $a;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $a 0 0 0
10859 0 ▶ return "<$a>" unless ref($a || '') eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref($a || "") eq "ARRAY" 0 0 0
Condition0%0/2
$a || ''
l!l
00
MC/DC0%0/1
$a || ''
$a
Truth table0%0/2
A
A= $a
Aresult
11
00
10860 0 '[ ' . join(', ', map $self->array2string($_), @$a) . ' ]';
10861 }
10862
10863 0 ▶sub dialist2lists ($$) {
Subroutine dialist2lists: not called CC=3 SCAR=24.8
Pod undocumented
10864 0 my ($self, $Dia, @groups) = (shift, shift);
10865 0 for my $group (split /\|/, $Dia, -1) {
10866 0 my @dia;
10867 0 for my $dia (split /,/, $group) {
10868 0 push @dia, $self->dia2list($dia);
10869 }
10870 0 push @groups, \@dia; # Do not omit empty groups
10871 } # Now get all the chars, and precompile results for them
10872 @groups
10873 0 }
10874
10875 0 ▶sub document_char ($$$;$) {
Subroutine document_char: not called CC=8 SCAR=42.8
Pod undocumented
10876 0 my ($self, $c, $doc, $old) = (shift, shift, shift, shift);
10877 0 ▶ return $c if not defined $c or not defined $doc;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c and defined $doc 0 0 0
Condition0%0/3
defined $c and defined $doc
!ll&&!rl&&r
000
MC/DC0%0/2
defined $c and defined $doc
defined $c defined $doc
Truth table0%0/3
A and B
A= defined $cB= defined $doc
ABresult
0X0
100
111
10878 0 ▶ $doc = "$old->[3] ⇒ $doc" if $old and ref $old and defined $old->[3];
Branch: 1 branch
BranchTrueFalseTotal
if $old and ref $old and defined $old->[3] 0 0 0
Condition0%0/6
$old and ref $old and defined $old->[3]
!ll&&!rl&&r
000
$old and ref $old
!ll&&!rl&&r
000
MC/DC0%0/3
$old and ref $old and defined $old->[3]
$old ref $old defined $old->[3]
Truth table0%0/4
A and B and C
A= $oldB= ref $oldC= defined $old->[3]
ABCresult
0XX0
10X0
1100
1111
10879 0 ▶ $c = [$c] unless ref $c;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $c 0 0 0
10880 0 ▶ $c->[3] = $doc if defined $doc;
Branch: 1 branch
BranchTrueFalseTotal
if defined $doc 0 0 0
10881 0 $c
10882 }
10883
10884 0 ▶sub document_chars_on_key ($$$;$) { # Usable with all_layers
Subroutine document_chars_on_key: not called CC=2 SCAR=17.9
Pod undocumented
10885 0 my ($self, $c, $doc, $old, @o) = (shift, shift, shift, shift);
10886 0 for my $layer (@$c) {
10887 0 push @o, [ map {$self->document_char($_, $doc, $old)} @$layer ];
10888 }
10889 @o
10890 0 }
10891
10892 #use Dumpvalue;
10893 0 ▶my %translators = ( Id => sub ($) {shift}, Empty => sub ($) { return undef },
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
10894 0 ▶ dectrl => sub ($) {defined (my $c = shift) or return undef; $c = $c->[0] if 'ARRAY' eq ref $c;
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 2 branches
BranchTrueFalseTotal
defined(my $c = shift()) or return undef 0 0 0
if "ARRAY" eq ref $c 0 0 0
10895 0 ▶ return undef if 0x20 <= ord $c; chr(0x40 + ord $c)},
Branch: 1 branch
BranchTrueFalseTotal
if 32 <= ord $c 0 0 0
10896 0 ▶ maybe_ucfirst => sub ($) {defined (my $c = shift) or return undef; $c = $c->[0] if 'ARRAY' eq ref $c; ucfirst $c},
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
defined(my $c = shift()) or return undef 0 0 0
if "ARRAY" eq ref $c 0 0 0
10897 0 ▶ maybe_lc => sub ($) {defined (my $c = shift) or return undef; $c = $c->[0] if 'ARRAY' eq ref $c; lc $c},
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
defined(my $c = shift()) or return undef 0 0 0
if "ARRAY" eq ref $c 0 0 0
10898 0 ▶ maybe_uc => sub ($) {defined (my $c = shift) or return undef; $c = $c->[0] if 'ARRAY' eq ref $c; uc $c},
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
defined(my $c = shift()) or return undef 0 0 0
if "ARRAY" eq ref $c 0 0 0
10899 0 ▶ ucfirst => sub ($) {defined (my $c = shift) or return undef; $c = $c->[0] if 'ARRAY' eq ref $c;
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 2 branches
BranchTrueFalseTotal
defined(my $c = shift()) or return undef 0 0 0
if "ARRAY" eq ref $c 0 0 0
10900 0 ▶ my $c1 = ucfirst $c; return undef if $c1 eq $c; $c1},
Branch: 1 branch
BranchTrueFalseTotal
if $c1 eq $c 0 0 0
10901 0 ▶ lc => sub ($) {defined (my $c = shift) or return undef; $c = $c->[0] if 'ARRAY' eq ref $c;
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 2 branches
BranchTrueFalseTotal
defined(my $c = shift()) or return undef 0 0 0
if "ARRAY" eq ref $c 0 0 0
10902 0 ▶ my $c1 = lc $c; return undef if $c1 eq $c; $c1},
Branch: 1 branch
BranchTrueFalseTotal
if $c1 eq $c 0 0 0
10903 0 ▶ uc => sub ($) {defined (my $c = shift) or return undef; $c = $c->[0] if 'ARRAY' eq ref $c;
Subroutine __ANON__: not called CC=4 SCAR=27.9
Branch: 2 branches
BranchTrueFalseTotal
defined(my $c = shift()) or return undef 0 0 0
if "ARRAY" eq ref $c 0 0 0
10904 0 ▶ my $c1 = uc $c; return undef if $c1 eq $c; $c1} );
Branch: 1 branch
BranchTrueFalseTotal
if $c1 eq $c 0 0 0
10905 0 ▶sub make_translator ($$$$$) { # translator may take some values from "environment"
Subroutine make_translator: not called CC=117 SCAR=95.3
Pod undocumented
10906 # (such as which deadkey is processed), so caching is tricky: if does -> $used_deadkey reflects this
10907 # The translator should return exactly one value (possibly undef) so that map TRANSLATOR, list works intuitively.
10908 # Exception: translator with all_layers: takes a ref to a key (array of arrays of chars); returns array of arrays.
10909 # There is a possibility to redirect the translation to another key; see $cvt (usually combined with 'all_layers').
10910 0 ▶ my ($self, $name, $deadkey, $face, $N, $used_deadkey) = (shift, shift, shift || 0, shift, shift, ''); # $deadkey used eg for diagnostics
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
10911 0 ▶ die "Undefined recipe in a translator for face `$face', layer $N on deadkey `$deadkey'" unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
10912 0 ▶ if ($name =~ /^Imported\[([\/\w]+)(?:,([\da-fA-F]{4,}))?\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ m(^Imported\[([/\w]+)(?:,([\da-fA-F]{4,}))?\]$)) 0 0 0
10913 0 ▶ my($d, @sec) = (($2 ? "$2" : undef), split m(/), "$1");
Branch: 1 branch
BranchTrueFalseTotal
$2 ? : 0 0 0
10914 0 ▶ $d = $deadkey, $used_deadkey ="/$deadkey" unless defined $d;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $d 0 0 0
10915 0 ▶ my $fromKBDD = $self->get_deep($self, 'DEADKEYS', @sec, lc $d, 'map') # DEADKEYS/bepo with 00A4 ---> DEADKEYS/bepo/00a4
Branch: 1 branch
BranchTrueFalseTotal
my $fromKBDD = $self->get_deep($self, "DEADKEYS", @sec, &UI::KeyboardLayout::lc($d), "map") or die "DEADKEYS section for `${d}' with parts `@{sec}' not found" 0 0 0
10916 or die "DEADKEYS section for `$d' with parts `@sec' not found";
10917 # indexed by lc hex
10918 0 ▶ return sub { my $cc=my $c=shift; return $c unless defined $c; $c = $c->[0] if 'ARRAY' eq ref $c; defined($c = $fromKBDD->{$self->key2hex($c)}) or return $c; $self->document_char(chr hex $c, $name, $cc) }, '';
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 3 branches
BranchTrueFalseTotal
unless defined $c 0 0 0
if "ARRAY" eq ref $c 0 0 0
defined($c = $$fromKBDD{$self->key2hex($c)}) or return $c 0 0 0
10919 }
10920 0 ▶ die "unrecognized Imported argument: `$1'" if $name =~ /^Imported(\[.*)/s;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^Imported(\[.*)/s 0 0 0
10921 0 ▶ return $translators{$name}, '' if $translators{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $translators{$name} 0 0 0
10922 0 ▶ if ($name =~ /^PrefixDocs\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^PrefixDocs\[(.+)\]$/) 0 0 0
10923 0 $self->{faces}{$face}{'[prefixDocs]'}{$deadkey} = $1;
10924 0 return $translators{Empty}, '';
10925 }
10926 0 ▶ if ($name =~ /^X11symbol\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^X11symbol\[(.+)\]$/) 0 0 0
10927 0 $self->{faces}{$face}{'[dead_X11symbol]'}{$deadkey} = $1;
10928 0 return $translators{Empty}, '';
10929 }
10930 0 ▶ if ($name =~ /^Show\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^Show\[(.+)\]$/) 0 0 0
10931 0 $self->{faces}{$face}{'[Show]'}{$deadkey} = $self->stringHEX2string($1);
10932 0 return $translators{Empty}, '';
10933 }
10934 0 ▶ if ($name =~ /^HTML_classes\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^HTML_classes\[(.+)\]$/) 0 0 0
10935 0 ▶ (my @c = split /,/, "$1") % 3 and die "HTML_classes[] for key `$deadkey' not come in triples";
Branch: 1 branch
BranchTrueFalseTotal
(my @c = split(/,/, "$1", 0)) % 3 and die "HTML_classes[] for key `${deadkey}' not come in triples" 0 0 0
10936 0 ▶ my $C = ( $self->{faces}{$face}{'[HTML_classes]'}{$deadkey || ''} ||= {} ); # Above, deadkey is ||= 0
Condition0%0/4
$self->{"faces"}{$face}{"[HTML_classes]"}{$deadkey or ""} ||= {}
l!l
00
$deadkey || ''
l!l
00
MC/DC0%0/1
$self->{"faces"}{$face}{"[HTML_classes]"}{$deadkey or ""} ||= {}
$self->{"faces"}{$face}{"[HTML_classes]"}{$deadkey or ""}
MC/DC0%0/1
$deadkey || ''
$deadkey
Truth table0%0/2
A
A= $self->{"faces"}{$face}{"[HTML_classes]"}{$deadkey or ""}
Aresult
11
00
Truth table0%0/2
A
A= $deadkey
Aresult
11
00
10937 # warn "I create HTML_classes for face=$face, prefix=`$deadkey'";
10938 0 ▶ while (@c) {
Branch: 1 branch
BranchTrueFalseTotal
if (@c) 0 0 0
10939 0 my ($where, $class, $chars) = splice @c, 0, 3;
10940 0 ( $chars = $self->stringHEX2string($chars) ) =~ s/\p{Blank}(?=\p{NonspacingMark})//g;
10941 0 push @{ $C->{$where}{$_} }, $class for split //, $chars;
10942 }
10943 0 return $translators{Empty}, '';
10944 }
10945 0 ▶ if ($name =~ /^Space(Self)?2Id(?:\[(.+)\])?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^Space(Self)?2Id(?:\[(.+)\])?$/) 0 0 0
10946 0 ▶ my $dia = $self->charhex2key((defined $2) ? $2 : do {$used_deadkey = "/$deadkey"; $deadkey}); # XXXX `do' is needed, comma does not work
Branch: 1 branch
BranchTrueFalseTotal
defined $2 ? : 0 0 0
10947 0 ▶ my $self_OK = $1 ? $dia : 'n/a';
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
10948 0 ▶ return sub ($) { my $c = (shift() || '[none]'); $c = $c->[0] if 'ARRAY' eq ref $c; # Prefix key as usual letter
Subroutine __ANON__: not called CC=6 SCAR=37.4
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $c 0 0 0
Condition0%0/2
shift() || '[none]'
l!l
00
MC/DC0%0/1
shift() || '[none]'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
10949 0 ▶ ($c eq ' ' or $c eq $self_OK and defined $dia) ? $self->document_char($dia, $name) : undef }, $used_deadkey;
Branch: 1 branch
BranchTrueFalseTotal
$c eq ' ' || $c eq $self_OK && defined $dia ? : 0 0 0
Condition0%0/6
$c eq " " or $c eq $self_OK and defined $dia
l!l&&r!l&&!r
000
$c eq $self_OK and defined $dia
!ll&&!rl&&r
000
MC/DC0%0/3
$c eq " " or $c eq $self_OK and defined $dia
$c eq " " $c eq $self_OK defined $dia
Truth table0%0/4
A or B and C
A= $c eq " "B= $c eq $self_OKC= defined $dia
ABCresult
1XX1
0111
00X0
0100
10950 }
10951 0 ▶ if ($name =~ /^ShiftFromTo\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^ShiftFromTo\[(.+)\]$/) 0 0 0
10952 0 my ($f,$t) = split /,/, "$1";
10953 0 $_ = hex $self->key2hex($self->charhex2key($_)) for $f, $t;
10954 0 $t -= $f; # Treat prefix keys as usual keys:
10955 0 ▶ return sub ($) { my $cc=my $c=shift; return $c unless defined $c; $c = $c->[0] if 'ARRAY' eq ref $c; $self->document_char(chr($t + ord $c), $name, $cc) }, '';
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
unless defined $c 0 0 0
if "ARRAY" eq ref $c 0 0 0
10956 }
10957 0 ▶ if ($name =~ /^SelectRX\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^SelectRX\[(.+)\]$/) 0 0 0
10958 0 my ($rx) = qr/$1/; # Treat prefix keys as usual keys:
10959 0 ▶ return sub ($) { my $cc = my $c=shift; defined $c or return $c; $c = $c->[0] if 'ARRAY' eq ref $c; return undef unless $c =~ $rx; $cc }, '';
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 3 branches
BranchTrueFalseTotal
defined $c or return $c 0 0 0
if "ARRAY" eq ref $c 0 0 0
unless $c =~ /$rx/ 0 0 0
10960 }
10961 0 ▶ if ($name =~ /^FlipShift$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^FlipShift$/) 0 0 0
10962 0 ▶ return sub ($) { my $c = shift; defined $c or return $c; map [@$_[1,0]], @$c }, '', 'all_layers';
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $c or return $c 0 0 0
10963 }
10964 0 ▶ if ($name =~ /^AssignTo\[(\w+),(\d+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^AssignTo\[(\w+),(\d+)\]$/) 0 0 0
10965 0 my ($sec, $cnt) = ($1, $2);
10966 0 ▶ $cnt = 0, warn "Unrecognized section `$sec' in AssignTo" unless my $S = $start_SEC{$sec};
Branch: 1 branch
BranchTrueFalseTotal
unless my $S = $start_SEC{$sec} 0 0 0
10967 0 ▶ warn("Too many keys ($cnt) put into section `$sec', max=$S->[1]"), $cnt = $S->[1] if $cnt > $S->[1];
Branch: 1 branch
BranchTrueFalseTotal
if $cnt > $S->[1] 0 0 0
10968 0 ▶ my $toTarget = sub { my $slot = shift; return unless $slot < $cnt; $slot + $S->[0] };
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
unless $slot < $cnt 0 0 0
10969 0 ▶ return sub ($) { @{shift()} }, '', ['all_layers', $toTarget];
Subroutine __ANON__: not called CC=1 SCAR=6.9
10970 }
10971 0 ▶ if ($name =~ /^FromTo(FlipShift)?\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^FromTo(FlipShift)?\[(.+)\]$/) 0 0 0
10972 0 my $flip = $1;
10973 0 my ($f,$t) = split /,/, "$2", 2;
10974 exists $self->{layers}{$_} or (debug_stacking_ord and warn " mk_tr_lyrs 2"),
10975 $_ = ($self->make_translated_layers($_, $face, [$N], $deadkey))->[0]
10976 0 ▶ for $f, $t; # Be conservative for caching...
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{"layers"}{$_} or '???', $_ = $self->make_translated_layers($_, $face, [$N], $deadkey)->[0] 0 0 0
10977 0 my $B = "~~~{$f>>>$t}";
10978 0 $_ = $self->{layers}{$_} for $f, $t;
10979 0 my (%h, $kk);
10980 0 for my $k (0..$#$f) {
10981 0 ▶ my @fr = map {($_ and ref) ? $_->[0] : $_} @{$f->[$k]};
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
10982 0 ▶ my @to = map {($_ and ref) ? $_->[0] : $_} @{$t->[$k]};
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
10983 0 ▶ if ($flip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flip) { } 0 0 0
10984 0 ▶ $h{defined($kk = $fr[$_]) ? $kk : ''} = $to[1-$_] for 0,1;
Branch: 1 branch
BranchTrueFalseTotal
defined($kk = $fr[$_]) ? : 0 0 0
10985 } else {
10986 0 ▶ $h{defined($kk = $fr[$_]) ? $kk : ''} = $to[$_] for 0,1;
Branch: 1 branch
BranchTrueFalseTotal
defined($kk = $fr[$_]) ? : 0 0 0
10987 }#
10988 } # Treat prefix keys as usual keys:
10989 0 ▶ return sub ($) { my $cc = my $c = shift; defined $c or return $c; $c = $c->[0] if 'ARRAY' eq ref $c; $self->document_char($h{$c}, $name, $cc) }, $B;
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
defined $c or return $c 0 0 0
if "ARRAY" eq ref $c 0 0 0
10990 }
10991 0 ▶ if ($name =~ /^InheritPrefixKeys\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^InheritPrefixKeys\[(.+)\]$/) 0 0 0
10992 0 my $base = $1;
10993 exists $self->{layers}{$_} or (debug_stacking_ord and warn " mk_tr_lyrs 3"),
10994 $_= ($self->make_translated_layers($_, $face, [$N], $deadkey))->[0]
10995 0 ▶ for $base;
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{"layers"}{$_} or '???', $_ = $self->make_translated_layers($_, $face, [$N], $deadkey)->[0] 0 0 0
10996 0 my $baseL = $self->{layers}{$base};
10997 0 my (%h);
10998 0 for my $k (0..$#$baseL) {
10999 0 for my $shift (0..1) {
11000 0 ▶ my $C = $baseL->[$k][$shift] or next;
Branch: 1 branch
BranchTrueFalseTotal
my $C = $baseL->[$k][$shift] or next 0 0 0
11001 0 ▶ next unless ref $C and $C->[2]; # prefix
Branch: 1 branch
BranchTrueFalseTotal
unless ref $C and $C->[2] 0 0 0
Condition0%0/3
ref $C and $C->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $C and $C->[2]
ref $C $C->[2]
Truth table0%0/3
A and B
A= ref $CB= $C->[2]
ABresult
0X0
100
111
11002 0 $h{"$N $k $shift $C->[0]"} = $C;
11003 }
11004 } # Treat prefix keys as usual keys:
11005 0 ▶ return sub ($) { my $c = shift; defined $c or return $c; return $c if 'ARRAY' eq ref $c and $c->[2]; $h{"@_ $c"} or $c }, $base;
Subroutine __ANON__: not called CC=5 SCAR=34.0
Branch: 3 branches
BranchTrueFalseTotal
defined $c or return $c 0 0 0
if "ARRAY" eq ref $c and $c->[2] 0 0 0
$h{"@_ $c"} or $c 0 0 0
Condition0%0/3
"ARRAY" eq ref $c and $c->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
"ARRAY" eq ref $c and $c->[2]
"ARRAY" eq ref $c $c->[2]
Truth table0%0/3
A and B
A= "ARRAY" eq ref $cB= $c->[2]
ABresult
0X0
100
111
11006 }
11007 0 ▶ if ($name =~ /^ByColumns\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^ByColumns\[(.+)\]$/) 0 0 0
11008 0 ▶ my @chars = map {length() ? $self->charhex2key($_) : undef} split /,/, "$1";
Branch: 1 branch
BranchTrueFalseTotal
length $_ ? : 0 0 0
11009 0 ▶ my $g = $self->{faces}{$face}{'[geometry]'}
Branch: 1 branch
BranchTrueFalseTotal
my $g = $self->{"faces"}{$face}{"[geometry]"} or die "Face `${face}' has no associated layer with geometry info; did you set geometry_via_layer?" 0 0 0
11010 or die "Face `$face' has no associated layer with geometry info; did you set geometry_via_layer?";
11011 0 ▶ my $o = ($self->{faces}{$face}{'[g_offsets]'} or [(0) x @$g]);
Condition0%0/2
$self->{'faces'}{$face}{'[g_offsets]'} || [(0) x @$g]
l!l
00
MC/DC0%0/1
$self->{'faces'}{$face}{'[g_offsets]'} || [(0) x @$g]
$self->{'faces'}{$face}{'[g_offsets]'}
Truth table0%0/2
A
A= $self->{'faces'}{$face}{'[g_offsets]'}
Aresult
11
00
11012 0 $o = [@$o]; # deep copy
11013 0 my ($tot, %c) = 0;
11014 # warn "geometry: [@$g] [@$o]";
11015 0 for my $r (@$g) {
11016 0 my $off = shift @$o;
11017 0 $c{$tot + $_} = $_ + $off for 0..($r-1);
11018 0 $tot += $r;
11019 }
11020 0 ▶ return sub ($$$$) { (undef, my ($L, $k, $shift)) = @_; return undef if $L or $shift or $k >= $tot; $self->document_char($chars[$c{$k}], "ByColumn[$c{$k}]") }, '';
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 1 branch
BranchTrueFalseTotal
if $L or $shift or $k >= $tot 0 0 0
Condition0%0/6
$L or $shift or $k >= $tot
l!l&&r!l&&!r
000
$L or $shift
l!l&&r!l&&!r
000
MC/DC0%0/3
$L or $shift or $k >= $tot
$L $shift $k >= $tot
Truth table0%0/4
A or B or C
A= $LB= $shiftC= $k >= $tot
ABCresult
1XX1
01X1
0011
0000
11021 }
11022 0 ▶ if ($name =~ /^ByRows\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^ByRows\[(.+)\]$/) 0 0 0
11023 0 s(^\s+(?!\s|///\s+))(), s((?<!\s)(?<!\s///)\s+$)() for my $recipes = $1;
11024 0 my (@recipes, @subs) = split m(\s+///\s+), $recipes;
11025 0 my $LL = $#{ $self->{faces}{$face}{layers} }; # Since all_layers, we are called only for layer 0; subrecipes may need more
11026 0 for my $rec (@recipes) {
11027 0 ▶ push(@subs, sub {return undef}), next unless length $rec;
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless length $rec 0 0 0
11028 #warn "recipe=`$rec'; face=`$face'; N=$N; deadkey=`$deadkey'; last_layer=$LL";
11029 0 my ($tr) = $self->make_translator_for_layers( $rec, $deadkey, $face, [0..$LL] );
11030 #warn " done";
11031 0 push @subs, $tr;
11032 }
11033 0 ▶ my $g = $self->{faces}{$face}{'[geometry]'}
Branch: 1 branch
BranchTrueFalseTotal
my $g = $self->{"faces"}{$face}{"[geometry]"} or die "Face `${face}' has no associated layer with geometry info; did you set geometry_via_layer?" 0 0 0
11034 or die "Face `$face' has no associated layer with geometry info; did you set geometry_via_layer?";
11035 0 my ($tot, $row, %r) = (0, 0);
11036 # warn "geometry: [@$g] [@$o]";
11037 0 for my $r (@$g) {
11038 0 $r{$tot + $_} = $row for 0..($r-1);
11039 0 $tot += $r;
11040 0 $row++;
11041 }
11042 # return sub ($$$$) { (undef, undef, my $k) = @_; return undef if $k >= $tot; return undef if $#recipes < (my $r = $r{$k});
11043 # die "Undefined recipe: row=$row; face=`$face'; N=$N; deadkey=`$deadkey'; ARGV=(@_)" unless $subs[$r];
11044 # goto &{$subs[$r]} }, '';
11045 0 ▶ return sub ($$) { (undef, my $k) = @_; return [] if $k >= $tot or $#recipes < (my $r = $r{$k});
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 1 branch
BranchTrueFalseTotal
if $k >= $tot or $#recipes < (my $r = $r{$k}) 0 0 0
Condition0%0/3
$k >= $tot or $#recipes < (my $r = $r{$k})
l!l&&r!l&&!r
000
MC/DC0%0/2
$k >= $tot or $#recipes < (my $r = $r{$k})
$k >= $tot $#recipes < (my $r = $r{$k})
Truth table0%0/3
A or B
A= $k >= $totB= $#recipes < (my $r = $r{$k})
ABresult
1X1
011
000
11046 0 ▶ die "Undefined recipe: row=$row; face=`$face'; N=$N; deadkey=`$deadkey'; ARGV=(@_)" unless $subs[$r];
Branch: 1 branch
BranchTrueFalseTotal
unless $subs[$r] 0 0 0
11047 0 goto &{$subs[$r]} }, '', 'all_layers';
11048 }
11049 0 ▶ if ($name =~ /^(?:Diacritic|Mutate)(SpaceOK)?(Hack)?(2Self)?(DupsOK)?(32OK)?(?:\[(.+)\])?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^(?:Diacritic|Mutate)(SpaceOK)?(Hack)?(2Self)?(DupsOK)?(32OK)?(?:\[(.+)\])?$/) 0 0 0
11050 0 my ($spaceOK, $hack, $toSelf, $dupsOK, $w32OK) = ($1, $2, $3, $4, $5);
11051 0 ▶ my $Dia = ((defined $6) ? $6 : do {$used_deadkey ="/$deadkey"; $deadkey}); # XXXX `do' is needed, comma does not work
Branch: 1 branch
BranchTrueFalseTotal
defined $6 ? : 0 0 0
11052 0 ▶ if ($toSelf) {
Branch: 1 branch
BranchTrueFalseTotal
if ($toSelf) 0 0 0
11053 0 ▶ die "Mutate2Self does not make sense with SpaceOK/Hack/DupsOK/32OK" if grep $_, $hack, $spaceOK, $dupsOK, $w32OK;
Branch: 1 branch
BranchTrueFalseTotal
if grep $_, $hack, $spaceOK, $dupsOK, $w32OK 0 0 0
11054 0 $Dia = $self->charhex2key($Dia);
11055 0 ▶ my(@sp, %sp) = map {(my $in = $_) =~ s/(?<=.)\@$//s; $in} @{ ($self->get_VK($face))->{SPACE} || [] };
Condition0%0/2
$self->get_VK($face)->{'SPACE'} || []
l!l
00
MC/DC0%0/1
$self->get_VK($face)->{'SPACE'} || []
$self->get_VK($face)->{'SPACE'}
Truth table0%0/2
A
A= $self->get_VK($face)->{'SPACE'}
Aresult
11
00
11056 0 @sp = map $self->charhex2key($_), @sp;
11057 0 my $flip_AltGr = $self->{faces}{$face}{'[Flip_AltGr_Key]'};
11058 0 ▶ $flip_AltGr = $self->charhex2key($flip_AltGr) if defined $flip_AltGr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr 0 0 0
11059 0 ▶ @sp = grep $flip_AltGr ne $_, @sp if defined $flip_AltGr; # It has a different function...
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr 0 0 0
11060 0 @sp{@sp[1..$#sp]} = (0..$#sp); # The leading elt is the scancode
11061 # warn "SPACE on $Dia: <", join('> <', %sp), '>';
11062 0 ▶ return sub ($) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
11063 0 $self->document_chars_on_key([$self->diacritic2self_2($Dia, shift, $face, \%sp)], $name)
11064 0 }, $used_deadkey, 'all_layers';
11065 }
11066
11067 0 my $isPrimary;
11068 0 ▶ $Dia =~ s/^\+// and $isPrimary++; # Wait until <NAMED-*> are expanded
Branch: 1 branch
BranchTrueFalseTotal
$Dia =~ s/^\+// and ++$isPrimary 0 0 0
11069
11070 0 my $f = $self->get_NamesList;
11071 0 ▶ $self->load_compositions($f) if defined $f;
Branch: 1 branch
BranchTrueFalseTotal
if defined $f 0 0 0
11072
11073 0 $f = $self->get_AgeList;
11074 0 ▶ $self->load_uniage($f) if defined $f and not $self->{Age};
Branch: 1 branch
BranchTrueFalseTotal
if defined $f and not $self->{"Age"} 0 0 0
Condition0%0/3
defined $f and not $self->{"Age"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and not $self->{"Age"}
defined $f not $self->{"Age"}
Truth table0%0/3
A and not(B)
A= defined $fB= not $self->{"Age"}
ABresult
0X0
100
111
11075 # New processing: - = strip 1 from end; -3/ = strip 1 from the last 3
11076 #warn "Doing `$Dia'";
11077 #print "Doing `$Dia'\n";
11078 #warn "Age of <à> is <$self->{Age}{à}>";
11079 0 $Dia =~ s(<NAMED-([-\w]+)>){ (my $R = $1) =~ s/-/_/g;
11080 0 ▶ die "Named recipe `$1' unknown" unless exists $self->{faces}{$face}{"Named_DIA_Recipe__$R"};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"faces"}{$face}{"Named_DIA_Recipe__$R"} 0 0 0
11081 # (my $r = $self->{faces}{$face}{"Named_DIA_Recipe__$R"}) =~ s/^\s+//;
11082 0 $self->recipe2str($self->{faces}{$face}{"Named_DIA_Recipe__$R"}) }ge;
11083 0 ▶ $Dia =~ s/\|{3,4}/|/g if $isPrimary;
Branch: 1 branch
BranchTrueFalseTotal
if $isPrimary 0 0 0
11084 0 my($skip, $limit, @groups, @groups2, @groups3) = (0);
11085 0 my($have4, @Dia) = (1, split /\|\|\|\|/, $Dia, -1);
11086 0 ▶ $have4 = 0, @Dia = split /\|\|\|/, $Dia, -1 if 1 == @Dia;
Branch: 1 branch
BranchTrueFalseTotal
if 1 == @Dia 0 0 0
11087 0 ▶ if (1 < @Dia) {
Branch: 1 branch
BranchTrueFalseTotal
if (1 < @Dia) { } 0 0 0
11088 0 ▶ die "Too many |||- or ||||-sections in <$Dia>" if @Dia > 3;
Branch: 1 branch
BranchTrueFalseTotal
if @Dia > 3 0 0 0
11089 0 my @Dia2 = split /\|\|\|/, $Dia[1], -1;
11090 0 ▶ die "Too many |||-sections in the second ||||-section in <$Dia>" if @Dia2 > 2;
Branch: 1 branch
BranchTrueFalseTotal
if @Dia2 > 2 0 0 0
11091 # splice @Dia, 1, 1, @Dia2;
11092 0 ▶ @Dia2 = @Dia, shift @Dia2 unless $have4;
Branch: 1 branch
BranchTrueFalseTotal
unless $have4 0 0 0
11093 0 ▶ $skip = (@Dia2 > 1 ? 1 + ($Dia2[0] =~ tr/|/|/) : 0);
Branch: 1 branch
BranchTrueFalseTotal
@Dia2 > 1 ? : 0 0 0
11094 0 ▶ $Dia[1] .= "|$Dia[2]", pop @Dia if not $have4 and @Dia == 3;
Branch: 1 branch
BranchTrueFalseTotal
if not $have4 and @Dia == 3 0 0 0
Condition0%0/3
not $have4 and @Dia == 3
!ll&&!rl&&r
000
MC/DC0%0/2
not $have4 and @Dia == 3
not $have4 @Dia == 3
Truth table0%0/3
not(A) and B
A= not $have4B= @Dia == 3
ABresult
0X0
100
111
11095 # $limit = 1 + ($Dia[-1] =~ tr/|/|/) + $skip;
11096 0 $limit = 0; # Not needed with the current logic...
11097 0 my @G = map [$self->dialist2lists($_)], @Dia; # will reverse when merging many into one cached...
11098 0 @groups = @{shift @G};
11099 0 ▶ @groups2 = @{shift @G} if @G;
Branch: 1 branch
BranchTrueFalseTotal
if @G 0 0 0
11100 0 ▶ @groups3 = @{shift @G} if @G;
Branch: 1 branch
BranchTrueFalseTotal
if @G 0 0 0
11101 } else {
11102 0 @groups = $self->dialist2lists($Dia);
11103 }
11104 #warn "Dia `$Dia' -> ", $self->array2string([$limit, $skip, @groups]);
11105 0 my $L = $self->{faces}{$face}{layers};
11106 0 my @L = map $self->{layers}{$_}, @$L;
11107 0 ▶ my $Sub = $self->{faces}{$face}{'[AltSubstitutions]'} || {};
Condition0%0/2
$self->{'faces'}{$face}{'[AltSubstitutions]'} || {}
l!l
00
MC/DC0%0/1
$self->{'faces'}{$face}{'[AltSubstitutions]'} || {}
$self->{'faces'}{$face}{'[AltSubstitutions]'}
Truth table0%0/2
A
A= $self->{'faces'}{$face}{'[AltSubstitutions]'}
Aresult
11
00
11108 # warn "got AltSubstitutions: <",join('> <', %$Sub),'>' if $Sub;
11109 0 ▶ return sub {
Subroutine __ANON__: not called CC=49 SCAR=78.0
11110 0 my $K = shift; # bindings of the key
11111 0 ▶ return ([]) x @$K unless grep defined, $self->flatten_arrays($K); # E.g, ByPairs and SelectRX produce many empty entries...
Branch: 1 branch
BranchTrueFalseTotal
unless grep defined($_), $self->flatten_arrays($K) 0 0 0
11112 #warn "Undefined base key for diacritic <$Dia>: <", join('> <', map {defined() ? $_ : '[undef]'} $self->flatten_arrays($K)), '>' unless defined $K->[0][0];
11113 #warn "Input for <$Dia>: <", join('> <', map {defined() ? $_ : '[undef]'} $self->flatten_arrays($K)), '>';
11114 0 my $base = $K->[0][0];
11115 0 ▶ $base = '<?>' unless defined $base;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $base 0 0 0
11116 0 ▶ $base = $base->[0] if ref $base;
Branch: 1 branch
BranchTrueFalseTotal
if ref $base 0 0 0
11117 0 ▶ return ([]) x @$K if not $spaceOK and $base eq ' '; # Ignore possiblity that SPACE is a deadKey
Branch: 1 branch
BranchTrueFalseTotal
if not $spaceOK and $base eq " " 0 0 0
Condition0%0/3
not $spaceOK and $base eq " "
!ll&&!rl&&r
000
MC/DC0%0/2
not $spaceOK and $base eq " "
not $spaceOK $base eq " "
Truth table0%0/3
not(A) and B
A= not $spaceOKB= $base eq " "
ABresult
0X0
100
111
11118 0 my $sorted = $self->sort_compositions(\@groups, $K, $Sub, $dupsOK, $w32OK);
11119 0 my ($sorted2, $sorted3, @idx_sorted3);
11120 0 ▶ $sorted2 = $self->sort_compositions(\@groups2, $K, $Sub, $dupsOK, $w32OK) if @groups2;
Branch: 1 branch
BranchTrueFalseTotal
if @groups2 0 0 0
11121 0 ▶ $sorted3 = $self->sort_compositions(\@groups3, $K, $Sub, $dupsOK, $w32OK) if @groups3;
Branch: 1 branch
BranchTrueFalseTotal
if @groups3 0 0 0
11122 0 ▶ @idx_sorted3 = @$sorted + (@groups2 ? @$sorted2 : 0) if @groups3; # used for warnings only
Branch: 2 branches
BranchTrueFalseTotal
if @groups3 0 0 0
@groups2 ? : 0 0 0
11123 $self->{faces}{$face}{'[in_dia_chains]'}{$_}++
11124 0 ▶ for grep defined, ($hack ? () : map {($_ and ref) ? $_->[0] : $_}
Branch: 2 branches
BranchTrueFalseTotal
$hack ? : 0 0 0
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
11125 # index as $res->[group][penalty_N][double_occ][layer][NN][shift]
11126 0 ▶ map {$_ ? @$_ : ()} map {$_ ? @$_ : ()} map {$_ ? @$_ : ()} map {$_ ? @$_ : ()} map {$_ ? @$_ : ()}
Branch: 5 branches
BranchTrueFalseTotal
$_ ? : 0 0 0
$_ ? : 0 0 0
$_ ? : 0 0 0
$_ ? : 0 0 0
$_ ? : 0 0 0
11127 0 ▶ @$sorted, @{$sorted2 || []}, @{$sorted3 || []});
Condition0%0/4
$sorted2 || []
l!l
00
$sorted3 || []
l!l
00
MC/DC0%0/1
$sorted2 || []
$sorted2
MC/DC0%0/1
$sorted3 || []
$sorted3
Truth table0%0/2
A
A= $sorted2
Aresult
11
00
Truth table0%0/2
A
A= $sorted3
Aresult
11
00
11128 # map {($_ and ref) ? $_->[0] : $_} map @{$_||[]}, @out
11129 0 require Dumpvalue if printSORTEDLISTS;
11130 0 Dumpvalue->new()->dumpValue(["Key $base", $sorted]) if printSORTEDLISTS;
11131 0 warn $self->report_sorted_l($base, [@$sorted, @{$sorted2 || []}, @{$sorted3 || []}], [scalar @$sorted, $skip + scalar @{$sorted || []}, @idx_sorted3])
11132 if warnSORTEDLISTS;
11133 0 my $LLL = '';
11134 0 ▶ if ($sorted2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sorted2) 0 0 0
11135 0 my (@slots, @LL);
11136 0 for my $l (0..$#L) {
11137 0 push @slots, $self->shift_pop_compositions($sorted2, $l, !'from end', !'omit', $limit, $skip, my $ll = []);
11138 0 push @LL, $ll;
11139 0 print 'From Layers <', join('> <', map {defined() ? $_ : 'undef'} @$ll), ">\n" if printSORTEDLISTS;
11140 0 $LLL .= ' | ' . join(' ', map {defined() ? $_ : 'undef'} @$ll) if warnSORTEDLISTS;
11141 }
11142 0 print 'TMP Extracted ', $self->array2string($slots[0]), "\n" if printSORTEDLISTS;
11143 0 print 'TMP Extracted ', $self->array2string([@slots[1..$#slots]]), " deadKey=$deadkey\n" if printSORTEDLISTS;
11144 0 ▶ my $appended = $self->append_keys($sorted3 || $sorted2, \@slots, \@LL, !$sorted3 && 'prepend');
Condition0%0/5
$sorted3 || $sorted2
l!l&&r!l&&!r
000
!$sorted3 && 'prepend'
!ll
00
MC/DC0%0/2
$sorted3 || $sorted2
$sorted3 $sorted2
MC/DC0%0/1
!$sorted3 && 'prepend'
!$sorted3
Truth table0%0/3
A || B
A= $sorted3B= $sorted2
ABresult
1X1
011
000
Truth table0%0/2
not(A)
A= !$sorted3
Aresult
00
11
11145 0 Dumpvalue->new()->dumpValue(["Key $base; II", $sorted2]) if printSORTEDLISTS;
11146 0 if (warnSORTEDLISTS) {
11147 $LLL =~ s/^[ |]+//;
11148 $_++ for @idx_sorted3; # empty or 1 elt
11149 warn "TMP Extracted: ", $self->array2string(\@slots), " from layers $LLL\n"; # 1 is for what is prepended by append_keys()
11150 warn $self->report_sorted_l($base, [@$sorted, @$sorted2, @{$sorted3 || []}], # Where to put bold/dotted-bold separators:
11151 [scalar @$sorted, !!$appended + $skip + scalar @$sorted, @idx_sorted3], ($appended ? [1 + scalar @$sorted] : ()));
11152 }
11153 }
11154 0 my(@out, %seen);
11155 0 for my $Ln (0..$#L) {
11156 0 $out[$Ln] = $self->shift_pop_compositions($sorted, $Ln);
11157 0 ▶ $seen{$_}++ for grep defined, map {($_ and ref) ? $_->[0] : $_} @{$out[$Ln]};
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
11158 }
11159 0 for my $L (@out) { # $L is an array indexed by shift state
11160 0 ▶ $L = [map {(not $_ or ref $_) ? $_ : [$_,undef,undef,'Diacritic operator']} @$L];
Branch: 1 branch
BranchTrueFalseTotal
!$_ || ref $_ ? : 0 0 0
Condition0%0/3
not $_ or ref $_
l!l&&r!l&&!r
000
MC/DC0%0/2
not $_ or ref $_
not $_ ref $_
Truth table0%0/3
not(A) or B
A= not $_B= ref $_
ABresult
1X1
011
000
11161 }
11162 # Insert non-yet-inserted characters from $sorted2, $sorted3
11163 0 for my $extra (['from end', $sorted2, 2], [0, $sorted3, 3]) {
11164 0 ▶ next unless $extra->[1];
Branch: 1 branch
BranchTrueFalseTotal
unless $extra->[1] 0 0 0
11165 0 $self->deep_undef_by_hash(\%seen, $extra->[1]);
11166 0 for my $Ln (0..$#L) {
11167 0 my $o = $out[$Ln];
11168 0 ▶ unless (defined $o->[0] and defined $o->[1]) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $o->[0] and defined $o->[1]) 0 0 0
Condition0%0/3
defined $o->[0] and defined $o->[1]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $o->[0] and defined $o->[1]
defined $o->[0] defined $o->[1]
Truth table0%0/3
A and B
A= defined $o->[0]B= defined $o->[1]
ABresult
0X0
100
111
11169 0 my $o2 = $self->shift_pop_compositions($extra->[1], $Ln, $extra->[0], !'omit', !'limit', 0, undef, defined $o->[0], defined $o->[1]);
11170 0 ▶ $o2 = [map {(!defined $_ or ref) ? $_ : [$_,undef,undef,"Diacritic operator (choice $extra->[2])"]} @$o2];
Branch: 1 branch
BranchTrueFalseTotal
!defined($_) || ref $_ ? : 0 0 0
Condition0%0/3
not defined $_ or ref $_
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $_ or ref $_
not defined $_ ref $_
Truth table0%0/3
not(A) or B
A= not defined $_B= ref $_
ABresult
1X1
011
000
11171 0 ▶ defined $o->[$_] or $o->[$_] = $o2->[$_] for 0,1;
Branch: 1 branch
BranchTrueFalseTotal
defined $o->[$_] or $o->[$_] = $o2->[$_] 0 0 0
11172 0 ▶ $seen{$_}++ for grep defined, map {($_ and ref) ? $_->[0] : $_} @$o;
Branch: 1 branch
BranchTrueFalseTotal
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
11173 }
11174 }
11175 }
11176 0 print 'Extracted ', $self->array2string(\@out), " deadKey=$deadkey\n" if printSORTEDLISTS;
11177 0 warn 'Extracted ', $self->array2string(\@out), " deadKey=$deadkey\n" if warnSORTEDLISTS;
11178 $self->{faces}{$face}{'[from_dia_chains]'}{$_}++
11179 0 ▶ for grep defined, ($hack ? () : map {($_ and ref) ? $_->[0] : $_} map @{$_||[]}, @out);
Branch: 2 branches
BranchTrueFalseTotal
$hack ? : 0 0 0
$_ && ref $_ ? : 0 0 0
Condition0%0/5
$_ and ref $_
!ll&&!rl&&r
000
$_ || []
l!l
00
MC/DC0%0/2
$_ and ref $_
$_ ref $_
MC/DC0%0/1
$_ || []
$_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
Truth table0%0/2
A
A= $_
Aresult
11
00
11180 #warn "Age of <à> is <$self->{Age}{à}>";
11181 #warn "Output: <", join('> <', map {defined() ? $_ : '[undef]'} $self->flatten_arrays(\@out)), '>';
11182 0 return @out;
11183 0 }, $used_deadkey, 'all_layers';
11184 }
11185 0 ▶ if ($name =~ /^DefinedTo\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^DefinedTo\[(.+)\]$/) 0 0 0
11186 0 ▶ my $to = ($1 eq 'undef' ? [] : $self->charhex2key($1));
Branch: 1 branch
BranchTrueFalseTotal
$1 eq 'undef' ? : 0 0 0
11187 0 ▶ return sub ($) { my $c = shift; defined $c or return $c; $self->document_char($to, 'DefinedTo', $c) }, '';
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $c or return $c 0 0 0
11188 }
11189 0 ▶ if ($name =~ /^ByPairs(Inv)?(Prefix)?(Flat)?(Apple)?\[(.+)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^ByPairs(Inv)?(Prefix)?(Flat)?(Apple)?\[(.+)\]$/) 0 0 0
11190 0 my ($invert, $prefix, $flat, $Apple, $in, @Pairs, %Map) = ($1, $2, $3, $4, $5);
11191 0 ▶ die "Inversion is tested only with flat maps or a prefix key: <<<$in>>> in `$face´" if $invert and not ($flat or $prefix);
Branch: 1 branch
BranchTrueFalseTotal
if $invert and not $flat || $prefix 0 0 0
Condition0%0/6
$invert and not $flat || $prefix
!ll&&!rl&&r
000
$flat || $prefix
l!l&&r!l&&!r
000
MC/DC0%0/3
$invert and not $flat || $prefix
$invert $flat $prefix
Truth table0%0/4
A and not(B || C)
A= $invertB= $flatC= $prefix
ABCresult
0XX0
11X0
1010
1001
11192 0 $in =~ s/^\s+//;
11193 0 @Pairs = split /\s+(?!\p{NonspacingMark})/, $in;
11194 0 for my $p (@Pairs) {
11195 0 ▶ while (length $p) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $p) 0 0 0
11196 0 ▶ die "Odd number of characters in a ByPairs map <$in>"
Branch: 1 branch
BranchTrueFalseTotal
unless $p =~ s/^((?:\p{Blank}\p{NonspacingMark}|(?:\b\.)?[0-9a-f]{4,}\b(?:\.\b)?|.){2})//i 0 0 0
11197 unless $p =~ s/^((?:\p{Blank}\p{NonspacingMark}|(?:\b\.)?[0-9a-f]{4,}\b(?:\.\b)?|.){2})//i;
11198 0 (my $Pair = $1) =~ s/\p{Blank}//g;
11199 #warn "Pair = <$Pair>";
11200 # Cannot do it earlier, since HEX can introduce new blanks
11201 0 $Pair =~ s/(?<=[0-9a-f]{4})\.$//i; # Remove . which was on \b before extracting substring
11202 0 $Pair = $self->stringHEX2string($Pair);
11203 #warn " --> <$Pair>";
11204 0 ▶ die "Can't split ByPairs rule into a pair: I see <$Pair>" unless 2 == scalar (my @c = split //, $Pair);
Branch: 1 branch
BranchTrueFalseTotal
unless 2 == scalar(my @c = split(//, $Pair, 0)) 0 0 0
11205 die qq("From" character <$c[0] duplicated in a ByPairs map <$in>)
11206 0 ▶ if exists $Map{$c[0]};
Branch: 1 branch
BranchTrueFalseTotal
if exists $Map{$c[0]} 0 0 0
11207 0 ▶ $Map{$c[0]} = ($prefix ? [$c[1], undef, ($invert ? 3 : 1)<<3] : $c[1]); # massage_imported2 makes >> 3
Branch: 2 branches
BranchTrueFalseTotal
$prefix ? : 0 0 0
$invert ? : 0 0 0
11208 }
11209 }
11210 0 ▶ die "Empty ByPairs map <$in>" unless %Map; # Treat prefix keys as usual keys:
Branch: 1 branch
BranchTrueFalseTotal
unless %Map 0 0 0
11211 0 ▶ if ($Apple) { # XXXX ???? This does not work! Do we store $deadkey anywhere?
Branch: 1 branch
BranchTrueFalseTotal
if ($Apple) 0 0 0
11212 0 $self->{faces}{$face}{'[AppleMap]'}[$N]{$_} = $Map{$_} for keys %Map;
11213 0 return $translators{Empty}, '';
11214 }
11215 0 ▶ if ($flat and not $N) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flat and not $N) 0 0 0
Condition0%0/3
$flat and not $N
!ll&&!rl&&r
000
MC/DC0%0/2
$flat and not $N
$flat not $N
Truth table0%0/3
A and not(B)
A= $flatB= not $N
ABresult
0X0
100
111
11216 0 ▶ die "<<<Flat>>> makes sense only in toplevel descriptions of satellite faces: <<<$in>>> in `$face´" unless $deadkey;
Branch: 1 branch
BranchTrueFalseTotal
unless $deadkey 0 0 0
11217 0 ▶ my $inv = $invert ? 'Inv' : '';
Branch: 1 branch
BranchTrueFalseTotal
$invert ? : 0 0 0
11218 $self->{faces}{$face}{"[FlatPrefixMap$inv]"}{$deadkey}{$self->key2hex($_)}
11219 0 = $self->document_char($Map{$_}, 'explicit flat tuneup') for keys %Map;
11220 0 $used_deadkey = "/$deadkey";
11221 }
11222 0 ▶ return sub ($) { my $c = shift; defined $c or return $c; $c = $c->[0] if 'ARRAY' eq ref $c; $self->document_char($Map{$c}, 'explicit tuneup') }, $used_deadkey;
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
defined $c or return $c 0 0 0
if "ARRAY" eq ref $c 0 0 0
11223 }
11224 0 my $map = $self->get_deep($self, 'DEADKEYS', split m(/), $name);
11225 0 ▶ die "Can't resolve character map `$name'" unless defined $map;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $map 0 0 0
11226 0 ▶ unless (exists $map->{map}) {{
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $map->{"map"}) 0 0 0
11227 0 my($k1) = keys %$map;
11228 0 ▶ die "Character map `$name' does not contain HEX: `$k1'" if %$map and not $k1 =~ /^[0-9a-f]{4,}$/;
Branch: 1 branch
BranchTrueFalseTotal
if %$map and not $k1 =~ /^[0-9a-f]{4,}$/ 0 0 0
Condition0%0/3
%$map and not $k1 =~ /^[0-9a-f]{4,}$/
!ll&&!rl&&r
000
MC/DC0%0/2
%$map and not $k1 =~ /^[0-9a-f]{4,}$/
%$map not $k1 =~ /^[0-9a-f]{4,}$/
Truth table0%0/3
A and not(B)
A= %$mapB= not $k1 =~ /^[0-9a-f]{4,}$/
ABresult
0X0
100
111
11229 0 ▶ die "Character map is a parent-type map, but no deadkey to use specified" unless defined $deadkey;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $deadkey 0 0 0
11230 0 my $Map = { map +(chr hex $_, $map->{$_}), keys %$map };
11231 die "Character map `$name' does not contain `$deadkey', contains <", (join '> <', keys %$map), ">"
11232 0 ▶ unless exists $Map->{chr hex $deadkey};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $$Map{&UI::KeyboardLayout::chr(hex $deadkey)} 0 0 0
11233 0 ▶ $map = $Map->{chr hex $deadkey}, $used_deadkey = "/$deadkey" if %$Map;
Branch: 1 branch
BranchTrueFalseTotal
if %$Map 0 0 0
11234 0 ▶ $map = {map => {}}, warn "Character map for `$name' empty" unless %$map;
Branch: 1 branch
BranchTrueFalseTotal
unless %$map 0 0 0
11235 }}
11236 0 ▶ die "Can't resolve character map `$name' `map': <", (join '> <', %$map), ">" unless defined $map->{map};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $map->{"map"} 0 0 0
11237 0 $map = $map->{map};
11238 0 my $Map = { map +(chr hex $_, chr hex($map->{$_})), keys %$map }; # hex form is not unique
11239 0 ▶ ( sub ($) { # Treat prefix keys as usual keys:
Subroutine __ANON__: not called CC=3 SCAR=24.8
11240 0 ▶ my $c = shift; defined $c or return $c; $c = $c->[0] if 'ARRAY' eq ref $c; $self->document_char($Map->{$c}, "DEADKEYS=$name")
Branch: 2 branches
BranchTrueFalseTotal
defined $c or return $c 0 0 0
if "ARRAY" eq ref $c 0 0 0
11241 0 }, $used_deadkey )
11242 }
11243
11244 0 ▶sub depth1_A_translator($$) { # takes a ref to an array of chars
Subroutine depth1_A_translator: not called CC=1 SCAR=6.9
Pod undocumented
11245 0 my ($self, $tr) = (shift, shift);
11246 0 ▶ return sub ($) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
11247 0 my $in = shift;
11248 0 [map $tr->($_), @$in]
11249 }
11250 0 }
11251
11252 0 ▶sub depth2_translator($$) { # takes a ref to an array of arrays of chars
Subroutine depth2_translator: not called CC=1 SCAR=6.9
Pod undocumented
11253 0 my ($self, $tr) = (shift, shift);
11254 0 ▶ return sub ($$) {
Subroutine __ANON__: not called CC=3 SCAR=24.8
11255 0 my ($in, $k, @out) = (shift, shift);
11256 0 for my $L (0..$#$in) {
11257 0 my $Tr = $tr->[$L];
11258 0 ▶ die "Undefined translator for layer=$L; total=", scalar @$tr unless defined $Tr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Tr 0 0 0
11259 0 push @out, [map $Tr->($in->[$L][$_], $L, $k, $_), 0..$#{$in->[$L]}]
11260 }
11261 @out
11262 0 }
11263 0 }
11264
11265 0 ▶sub make_translator_for_layers ($$$$$) { # translator may take some values from "environment"
Subroutine make_translator_for_layers: not called CC=4 SCAR=30.0
Pod undocumented
11266 # (such as which deadkey is processed), so caching is tricky: if does -> $used_deadkey reflects this
11267 # The translator should return exactly one value (possibly undef) so that map TRANSLATOR, list works intuitively.
11268 0 ▶ my ($self, $name, $deadkey, $face, $NN) = (shift, shift, shift || 0, shift, shift); # $deadkey used eg for diagnostics
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
11269 0 my ($Tr, $used, $for_layers) = $self->make_translator( $name, $deadkey, $face, $NN->[0] );
11270 0 ▶ ($for_layers, my $cvt) = (ref $for_layers ? @$for_layers : $for_layers);
Branch: 1 branch
BranchTrueFalseTotal
ref $for_layers ? : 0 0 0
11271 0 ▶ return $Tr, [map "$used![$_]", @$NN], $cvt if $for_layers;
Branch: 1 branch
BranchTrueFalseTotal
if $for_layers 0 0 0
11272 0 my @Tr = map [$self->make_translator($name, $deadkey, $face, $_)], @$NN;
11273 0 $self->depth2_translator([map $_->[0], @Tr]), [map $_->[1], @Tr], $cvt;
11274 }
11275
11276 0 ▶sub make_translated_layers_tr ($$$$$$$) { # Apply translation map
Subroutine make_translated_layers_tr: not called CC=9 SCAR=45.0
Pod undocumented
11277 0 my ($self, $layers, $tr, $append, $deadkey, $face, $NN) = (shift, shift, shift, shift, shift, shift, shift);
11278 0 my ($Tr, $used, $cvt) = $self->make_translator_for_layers($tr, $deadkey, $face, $NN);
11279 #warn " tr=<$tr>, key=<$deadkey>, used=<$used>";
11280 0 ▶ my @new_names = map "$tr$used->[$_]($layers->[$_])$append" . ($append and $NN->[$_]), 0..$#$NN;
Condition0%0/3
$append && $NN->[$_]
!ll&&!rl&&r
000
MC/DC0%0/2
$append && $NN->[$_]
$append $NN->[$_]
Truth table0%0/3
A && B
A= $appendB= $NN->[$_]
ABresult
0X0
100
111
11281 0 ▶ return @new_names unless grep {not exists $self->{layers}{$_}} @new_names;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {not exists $self->{"layers"}{$_};} @new_names 0 0 0
11282 # warn "Translating via `$tr' from layer [$layer]: <", join('> <', map "@$_", @{$self->{layers}{$layer}}), '>';
11283 0 my (@L, @LL) = map $self->{layers}{$_}, @$layers;
11284 0 for my $n (0..$#{$L[0]}) { # key number
11285 0 my @C = $Tr->( [ map $L[$_][$n], 0..$#L ], $n ); # rearrange one key into $X[$Layer][$shift]
11286 0 ▶ if ($cvt) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cvt) { } 0 0 0
11287 0 ▶ defined $cvt->($n) and $LL[$_][$cvt->($n)] = $C[$_] for 0..$#L;
Branch: 1 branch
BranchTrueFalseTotal
defined &$cvt($n) and $LL[$_][&$cvt($n)] = $C[$_] 0 0 0
11288 } else {
11289 0 push @{$LL[$_]}, $C[$_] for 0..$#L;
11290 }
11291 }
11292 0 $self->{layers}{$new_names[$_]} = $LL[$_] for 0..$#L;
11293 @new_names
11294 0 }
11295
11296 0 ▶sub key2string ($$) {
Subroutine key2string: not called CC=7 SCAR=40.3
Pod undocumented
11297 0 my ($self, $key, @o) = (shift, shift);
11298 0 ▶ return '<>' unless defined $key;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 0 0
11299 0 ▶ return '[]' unless grep defined, @$key;
Branch: 1 branch
BranchTrueFalseTotal
unless grep defined($_), @$key 0 0 0
11300 0 for my $k (@$key) {
11301 0 ▶ push(@o, 'undef'), next unless defined $k;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k 0 0 0
11302 0 ▶ push @o, ((ref $k) ? (defined $k->[0] ? $k->[0] : '<undef>') : $k);
Branch: 2 branches
BranchTrueFalseTotal
ref $k ? : 0 0 0
defined $k->[0] ? : 0 0 0
11303 }
11304 "[@o]"
11305 0 }
11306
11307 0 ▶sub layer2string ($$) {
Subroutine layer2string: not called CC=4 SCAR=30.0
Pod undocumented
11308 0 my ($self, $layer, $last, $rest) = (shift, shift, -1, '');
11309 0 my @o = map $self->key2string($_), @$layer;
11310 0 ▶ 2 < length $o[$_] and $last = $_ for 0..$#o;
Branch: 1 branch
BranchTrueFalseTotal
2 < length $o[$_] and $last = $_ 0 0 0
11311 0 ▶ $rest = '...' if $last != $#o;
Branch: 1 branch
BranchTrueFalseTotal
if $last != $#o 0 0 0
11312 0 (join ' ', @o[0..$last]) . $rest
11313 }
11314
11315 0 ▶sub make_translated_layers_stack ($$@) { # Stacking
Subroutine make_translated_layers_stack: not called CC=13 SCAR=52.0
Pod undocumented
11316 0 my ($self, @out, $ref) = (shift);
11317 0 my $c = @{$_[0]};
11318 @$_ == $c or die "Stacking: number of layers ", scalar(@$_), " != number of layers $c of the first elt"
11319 0 ▶ for @_;
Branch: 1 branch
BranchTrueFalseTotal
@$_ == $c or die "Stacking: number of layers ", scalar @$_, " != number of layers $c of the first elt" 0 0 0
11320 0 for my $lN (0..$c-1) { # layer Number
11321 0 my @layers = map $_->[$lN], @_;
11322 0 push @out, "@layers";
11323 0 if (debug_stacking) {
11324 warn "Stack in-layer $lN `$_': ", $self->layer2string($self->{layers}{$_}), "\n" for @layers;
11325 }
11326 0 ▶ next if exists $self->{layers}{"@layers"};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"layers"}{join $", @layers} 0 0 0
11327 0 my (@L, @keys) = map $self->{layers}{$_}, @layers;
11328 0 for my $lI (reverse 0..$#L) {
11329 0 my($l, $to) = $L[$lI];
11330 # warn "... Layer$lN: `$layers[$lI]'..." if debug_stacking;
11331 0 for my $k (0..$#$l) {
11332 0 for my $kk (0..$#{$l->[$k]}) {
11333 0 if (debug_STACKING and defined( my $cc = $l->[$k][$kk] )) {
11334 $cc = $cc->[0] if ref $cc;
11335 warn "...... On $k/$kk (${lI}th lN=$lN): I see `$cc': ", !defined $keys[$k][$kk], "\n" ;
11336 }
11337 0 ▶ if (defined($to = $l->[$k][$kk])) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($to = $l->[$k][$kk])) 0 0 0
11338 0 ▶ undef $to if $to and ref $to and not defined $to->[0]; # allow undef'ing
Branch: 1 branch
BranchTrueFalseTotal
if $to and ref $to and not defined $to->[0] 0 0 0
Condition0%0/6
$to and ref $to and not defined $to->[0]
!ll&&!rl&&r
000
$to and ref $to
!ll&&!rl&&r
000
MC/DC0%0/3
$to and ref $to and not defined $to->[0]
$to ref $to not defined $to->[0]
Truth table0%0/4
A and B and not(C)
A= $toB= ref $toC= not defined $to->[0]
ABCresult
0XX0
10X0
1100
1111
11339 0 $keys[$k][$kk] = $to;
11340 }
11341 }
11342 0 ▶ $keys[$k] ||= [];
Condition0%0/2
$keys[$k] ||= []
l!l
00
MC/DC0%0/1
$keys[$k] ||= []
$keys[$k]
Truth table0%0/2
A
A= $keys[$k]
Aresult
11
00
11343 }
11344 }
11345 0 $self->{layers}{"@layers"} = \@keys;
11346 0 warn "Stack out-layer $lN `@layers':\n\t", $self->layer2string(\@keys), "\n" if debug_stacking;
11347 }
11348 0 warn 'Stack out-layers:', (join "\n\t", '', @out), "\n" if debug_stacking;
11349 0 @out;
11350 }
11351
11352 0 ▶sub make_translated_layers_noid ($$$@) { # Stacking
Subroutine make_translated_layers_noid: not called CC=27 SCAR=66.3
Pod undocumented
11353 0 my ($self, $whole, $refr, @out, $ref, @seen) = (shift, shift, shift);
11354 0 my $c = @$refr;
11355 #warn "noid: join ", scalar @_, " faces of $c layers; ref=[@$refr] first=[@{$_[0]}]";
11356 @$_ == $c or die "Stacking: number of layers ", scalar(@$_), " != number of layers $c of the reference face"
11357 0 ▶ for @_;
Branch: 1 branch
BranchTrueFalseTotal
@$_ == $c or die "Stacking: number of layers ", scalar @$_, " != number of layers $c of the reference face" 0 0 0
11358 0 my @R = map $self->{layers}{$_}, @$refr;
11359 0 my $dbg = debug_noid; # && ((join ' ', map @$_, @_) =~ /US_Base_Compose/ and "@$refr" =~ /Greek/);
11360 0 ▶ if ($whole) {
Branch: 1 branch
BranchTrueFalseTotal
if ($whole) 0 0 0
11361 0 my $last = $#{$R[0]};
11362 0 for my $key (0..$last) {
11363 0 for my $l (@R) {
11364 0 ▶ $seen[$key]{$_}++ for map {ref() ? (!!$_->[2]||0) . $_->[0] : "0$_"} grep defined, @{ $l->[$key] };
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
Condition0%0/2
!!$_->[2] || 0
l!l
00
MC/DC0%0/1
!!$_->[2] || 0
!!$_->[2]
Truth table0%0/2
A
A= !!$_->[2]
Aresult
11
00
11365 #warn "$key of $last: keys=", join(',',keys %{$seen[$key]});
11366 }
11367 }
11368 }
11369 # my $name = 'NOID([' . join('], [', map {join ' +++ ', @$_} @_) . '])';
11370 0 for my $l (0..$c-1) {
11371 0 my (@layers,$rel) = map $_->[$l], @_;
11372 0 ▶ if ($whole) {
Branch: 1 branch
BranchTrueFalseTotal
if ($whole) { } 0 0 0
11373 0 $rel = "*\[$whole]";
11374 # $name .= "'" # Keep names of layers distinct, but since they are all interdependent, do not construct basing on layer names
11375 # $name = "NOID*[$whole](" . (join ' +++ ', @layers) . ')'
11376 } else {
11377 0 $rel = "[$refr->[$l]]";
11378 }
11379 0 my $name = "NOID$rel(" . (join ' =||= ', @layers) . ')';
11380 0 push @out, $name;
11381 #warn ". Doing layer number $l, name=`$name'...";
11382 0 warn "Do layerN=$l\n" if debug_noid and $dbg;
11383 0 ▶ (debug_noid and warn "layer exists: $name\n"), next if exists $self->{layers}{$name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"layers"}{$name} 0 0 0
11384 0 my (undef, @L, @keys) = map $self->{layers}{$_}, $refr->[$l], @layers;
11385 0 for my $llN (0..$#L) {
11386 0 warn "Do part:layerN=${llN}:$l\n" if debug_noid and $dbg;
11387 0 my $ll = $L[$llN];
11388 #warn "... Another layer for $l...";
11389 0 for my $k (0..$#$ll) {
11390 0 for my $kk (0..$#{$ll->[$k]}) {
11391 0 my $ch = $ll->[$k][$kk];
11392 0 my $rch = $R[$l][$k][$kk];
11393 0 ▶ $ch = (ref $ch ? (!!$ch->[2]||0) . $ch->[0] : "0$ch") if defined $ch;
Branch: 2 branches
BranchTrueFalseTotal
if defined $ch 0 0 0
ref $ch ? : 0 0 0
Condition0%0/2
!!$ch->[2] || 0
l!l
00
MC/DC0%0/1
!!$ch->[2] || 0
!!$ch->[2]
Truth table0%0/2
A
A= !!$ch->[2]
Aresult
11
00
11394 0 ▶ $rch = (ref $rch ? (!!$rch->[2]||0) . $rch->[0] : "0$rch") if defined $rch;
Branch: 2 branches
BranchTrueFalseTotal
if defined $rch 0 0 0
ref $rch ? : 0 0 0
Condition0%0/2
!!$rch->[2] || 0
l!l
00
MC/DC0%0/1
!!$rch->[2] || 0
!!$rch->[2]
Truth table0%0/2
A
A= !!$rch->[2]
Aresult
11
00
11395 0 warn "...... On $llN:$l $k/$kk: I see `$ch'; seen=`",($seen[$k]{$ch} || 'N/A'), "'; keys=", join(',',sort keys %{$seen[$k]})
11396 if debug_noid and defined $ll->[$k][$kk];
11397 ### (debug_noid and warn " ... Use it\n"),
11398 $keys[$k][$kk] = $ll->[$k][$kk] # Deep copy
11399 if defined $ch and not defined $keys[$k][$kk]
11400 0 ▶ and ($whole ? !$seen[$k]{$ch} : $ch ne ( defined $rch ? $rch : '' ));
Branch: 3 branches
BranchTrueFalseTotal
if defined $ch and not defined $keys[$k][$kk] and $whole ? !$seen[$k]{$ch} : $ch ne (defined $rch ? $rch : "") 0 0 0
$whole ? : 0 0 0
defined $rch ? : 0 0 0
Condition0%0/6
defined $ch and not defined $keys[$k][$kk] and $whole ? !$seen[$k]{$ch} : $ch ne (defined $rch ? $rch : "")
!ll&&!rl&&r
000
defined $ch and not defined $keys[$k][$kk]
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ch and not defined $keys[$k][$kk] and $whole ? !$seen[$k]{$ch} : $ch ne (defined $rch ? $rch : "")
defined $ch not defined $keys[$k][$kk] $whole ? !$seen[$k]{$ch} : $ch ne (defined $rch ? $rch : "")
Truth table0%0/4
A and not(B) and C
A= defined $chB= not defined $keys[$k][$kk]C= $whole ? !$seen[$k]{$ch} : $ch ne (defined $rch ? $rch : "")
ABCresult
0XX0
10X0
1100
1111
11401 }
11402 0 ▶ $keys[$k] ||= [];
Condition0%0/2
$keys[$k] ||= []
l!l
00
MC/DC0%0/1
$keys[$k] ||= []
$keys[$k]
Truth table0%0/2
A
A= $keys[$k]
Aresult
11
00
11403 }
11404 }
11405 0 $self->{layers}{$name} = \@keys;
11406 }
11407 0 warn "NOID --> <@out>\n" if debug_noid;
11408 0 @out;
11409 }
11410
11411 0 ▶sub paren_match_q ($$) {
Subroutine paren_match_q: not called CC=1 SCAR=6.9
Pod undocumented
11412 0 my ($self, $s) = (shift, shift);
11413 0 ($s =~ tr/(/(/) == ($s =~ tr/)/)/)
11414 }
11415
11416 0 ▶sub brackets_match_q ($$) {
Subroutine brackets_match_q: not called CC=1 SCAR=6.9
Pod undocumented
11417 0 my ($self, $s) = (shift, shift);
11418 0 ($s =~ tr/[/[/) == ($s =~ tr/]/]/)
11419 }
11420
11421 0 ▶sub join_min_paren_brackets_matched ($$@) {
Subroutine join_min_paren_brackets_matched: not called CC=6 SCAR=37.4
Pod undocumented
11422 0 my ($self, $join, @out) = (shift, shift, shift);
11423 #warn 'joining <', join('> <', @out, @_),'>';
11424 0 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
11425 0 ▶ while (@_ and not ($self->paren_match_q($out[-1]) and $self->brackets_match_q($out[-1]))) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and not $self->paren_match_q($out[-1]) && $self->brackets_match_q($out[-1])) 0 0 0
Condition0%0/6
@_ and not $self->paren_match_q($out[-1]) && $self->brackets_match_q($out[-1])
!ll&&!rl&&r
000
$self->paren_match_q($out[-1]) && $self->brackets_match_q($out[-1])
!ll&&!rl&&r
000
MC/DC0%0/3
@_ and not $self->paren_match_q($out[-1]) && $self->brackets_match_q($out[-1])
@_ $self->paren_match_q($out[-1]) $self->brackets_match_q($out[-1])
Truth table0%0/4
A and not(B && C)
A= @_B= $self->paren_match_q($out[-1])C= $self->brackets_match_q($out[-1])
ABCresult
0XX0
1110
10X1
1101
11426 0 $out[-1] .= $join . shift;
11427 }
11428 0 ▶ push @out, shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
11429 }
11430 @out
11431 0 }
11432
11433 0 ▶sub face_by_face_recipe ($$$) {
Subroutine face_by_face_recipe: not called CC=4 SCAR=30.0
Pod undocumented
11434 0 my($self, $f, $base) = (shift, shift, shift);
11435 0 ▶ return if $self->{faces}{$f}{layers};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"faces"}{$f}{"layers"} 0 0 0
11436 0 ▶ return unless $self->{face_recipes}{$f};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"face_recipes"}{$f} 0 0 0
11437 die "Can't determine number of layers in face `$f': face_recipe exists, but not numLayers"
11438 0 ▶ unless defined (my $n = $self->{faces}{$base}{numLayers});
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $n = $self->{"faces"}{$base}{"numLayers"}) 0 0 0
11439 0 warn "Massaging face `$f': use face_recipes...\n" if debug_face_layout_recipes;
11440 0 $self->{faces}{$f}{layers} = [('Empty') x $n]; # Preliminary (so know the length???)
11441 0 $self->{faces}{$f}{layers} = $self->layers_by_face_recipe($f, $base);
11442 }
11443
11444 0 ▶sub layers_by_face_recipe ($$$;$) {
Subroutine layers_by_face_recipe: not called CC=8 SCAR=42.8
Pod undocumented
11445 0 my ($self, $face, $base, $r) = (shift, shift, shift, shift);
11446 0 my $R = $self->{face_recipes}{$face};
11447 0 ▶ unless (defined $r or defined $R) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $r or defined $R) 0 0 0
Condition0%0/3
defined $r or defined $R
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $r or defined $R
defined $r defined $R
Truth table0%0/3
A or B
A= defined $rB= defined $R
ABresult
1X1
011
000
11448 0 ▶ if ($face =~ /^(\w+)(?:(⁴)|₄)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($face =~ /^(\w+)(?:(\x{2074})|\x{2084})$/) 0 0 0
11449 0 ▶ $R = ($2 ? "Layers($1²+$1²⁺)" : "Layers($1²+$1₂)");
Branch: 1 branch
BranchTrueFalseTotal
$2 ? : 0 0 0
11450 }
11451 }
11452 0 ▶ die "No face recipe for `$face' found" unless $R or defined $r;
Branch: 1 branch
BranchTrueFalseTotal
unless $R or defined $r 0 0 0
Condition0%0/3
$R or defined $r
l!l&&r!l&&!r
000
MC/DC0%0/2
$R or defined $r
$R defined $r
Truth table0%0/3
A or B
A= $RB= defined $r
ABresult
1X1
011
000
11453 0 ▶ $r = $R if $R;
Branch: 1 branch
BranchTrueFalseTotal
if $R 0 0 0
11454 0 $r = $self->recipe2str($r);
11455 #print "face recipe `$face'\n";
11456 0 my $LL = $self->{faces}{$base}{layers};
11457 0 warn "Using face_recipes for `$face', base=$base ==> `$r'\n" if debug_face_layout_recipes;
11458 0 (debug_stacking_ord and warn " mk_tr_lyrs 4 (b=$base;;; f=$face)");
11459 0 my $L = $self->{faces}{$face}{layers} = $self->make_translated_layers($r, $base, [0..$#$LL]);
11460 #print "face recipe `$face' -> ", $self->array2string($L), "\n";
11461 # warn "Using face_recipes `$face' -> ", $self->array2string($L) if debug_face_layout_recipes;
11462 0 warn "Massaged face `$face' ->", (join "\n\t", '', @$L), "\n" if debug_face_layout_recipes;
11463 #warn "face recipe `$face' --> ", $self->array2string([map $self->{layers}{$_}, @$L]);
11464 0 $L;
11465 }
11466
11467 0 ▶sub export_layers ($$$;$) {
Subroutine export_layers: not called CC=5 SCAR=34.0
Pod undocumented
11468 0 my ($self, $face, $base, $full) = (shift, shift, shift, shift);
11469 # warn "Doing FullFace on <$face>, base=<$base>\n" if $full;
11470 ($full ? undef : $self->{faces}{$face}{'[ini_layers_prefix]'} || $self->{faces}{$face}{'[ini_layers]'}) ||
11471 $self->{faces}{$face}{layers}
11472 0 ▶ || $self->layers_by_face_recipe($face, $base)
Branch: 2 branches
BranchTrueFalseTotal
$full ? undef : $self->{"faces"}{$face}{"[ini_layers_prefix]"} || $self->{"faces"}{$face}{"[ini_layers]"} or $self->{"faces"}{$face}{"layers"} or $self->layers_by_face_recipe($face, $base) 0 0 0
$full ? : 0 0 0
Condition0%0/6
$full ? undef : $self->{"faces"}{$face}{"[ini_layers_prefix]"} || $self->{"faces"}{$face}{"[ini_layers]"} or $self->{"faces"}{$face}{"layers"}
l!l&&r!l&&!r
000
$self->{"faces"}{$face}{"[ini_layers_prefix]"} or $self->{"faces"}{$face}{"[ini_layers]"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$full ? undef : $self->{"faces"}{$face}{"[ini_layers_prefix]"} || $self->{"faces"}{$face}{"[ini_layers]"} or $self->{"faces"}{$face}{"layers"}
$full ? undef : $self->{"faces"}{$face}{"[ini_layers_prefix]"} || $self->{"faces"}{$face}{"[ini_layers]"} $self->{"faces"}{$face}{"layers"}
MC/DC0%0/2
$self->{"faces"}{$face}{"[ini_layers_prefix]"} or $self->{"faces"}{$face}{"[ini_layers]"}
$self->{"faces"}{$face}{"[ini_layers_prefix]"} $self->{"faces"}{$face}{"[ini_layers]"}
Truth table0%0/3
A or B
A= $full ? undef : $self->{"faces"}{$face}{"[ini_layers_prefix]"} || $self->{"faces"}{$face}{"[ini_layers]"}B= $self->{"faces"}{$face}{"layers"}
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= $self->{"faces"}{$face}{"[ini_layers_prefix]"}B= $self->{"faces"}{$face}{"[ini_layers]"}
ABresult
1X1
011
000
11473 }
11474
11475 0 ▶sub pseudo_layer ($$$$;$) {
Subroutine pseudo_layer: not called CC=3 SCAR=24.8
Pod undocumented
11476 0 my ($self, $recipe, $face, $N, $deadkey) = (shift, shift, shift, shift, shift);
11477 0 my $ll = my $l = $self->pseudo_layer0($recipe, $face, $N);
11478 # warn "Pseudo-layer recipe `$recipe', face=`$face', N=$N ->\n\t$l\n" if $recipe =~ /Greek__/;
11479 #warn("layer recipe: `$l'"),
11480 0 ▶ ($l = $self->layer_recipe($l)) =~ s/^\s+// if exists $self->{layer_recipes}{$ll};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"layer_recipes"}{$ll} 0 0 0
11481 0 warn "pseudo_layer(`$recipe'): Using layout_recipe `$l' for layer '$ll'\n" if debug_face_layout_recipes and exists $self->{layer_recipes}{$ll};
11482 0 ▶ return $l if $self->{layers}{$l};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"layers"}{$l} 0 0 0
11483 0 (debug_stacking_ord and warn " mk_tr_lyrs 5");
11484 0 ($self->make_translated_layers($l, $face, [$N]))->[0]
11485 # die "Component `$l' of a pseudo-layer cannot be resolved"
11486 }
11487
11488 0 ▶sub pseudo_layer0 ($$$$) {
Subroutine pseudo_layer0: not called CC=42 SCAR=75.0
Pod undocumented
11489 0 my ($self, $recipe, $face, $N) = (shift, shift, shift, shift);
11490 0 ▶ if ($recipe eq 'LinkFace') {
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe eq "LinkFace") 0 0 0
11491 0 ▶ my $L = $self->{faces}{$face}{LinkFace} or die "Face `$face' has no LinkFace";
Branch: 1 branch
BranchTrueFalseTotal
my $L = $self->{"faces"}{$face}{"LinkFace"} or die "Face `${face}' has no LinkFace" 0 0 0
11492 0 return ($self->export_layers($L, $face))->[$N];
11493 }
11494 0 ▶ return ($self->export_layers($face, $face))->[$N] if $recipe eq 'Self';
Branch: 1 branch
BranchTrueFalseTotal
if $recipe eq "Self" 0 0 0
11495 0 ▶ if ($recipe =~ /^Layers\((.*\+.*)\)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe =~ /^Layers\((.*\+.*)\)$/) 0 0 0
11496 0 my @L = split /\+/, "$1";
11497 0 return $L[$N];
11498 }
11499 0 my $N1 = $self->flip_layer_N($N, $#{ $self->{faces}{$face}{layers} });
11500 0 ▶ if ($recipe eq 'FlipLayersLinkFace') {
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe eq "FlipLayersLinkFace") 0 0 0
11501 0 ▶ my $L = $self->{faces}{$face}{LinkFace} or die "Face `$face' has no LinkFace";
Branch: 1 branch
BranchTrueFalseTotal
my $L = $self->{"faces"}{$face}{"LinkFace"} or die "Face `${face}' has no LinkFace" 0 0 0
11502 0 return ($self->export_layers($L, $face))->[$N1];
11503 }
11504 #warn "Doing flip/face via `$recipe', N=$N, N1=$N1, face=`$face'";
11505 0 ▶ return ($self->export_layers($face, $face))->[$N1] if $recipe eq 'FlipLayers';
Branch: 1 branch
BranchTrueFalseTotal
if $recipe eq "FlipLayers" 0 0 0
11506 # my $gr_debug = ($recipe =~ /Greek__/);
11507 0 if (debug_PERL_dollar1_scoping) {
11508 return ($self->export_layers("$3", $face, !!$1))->[$2 ? $N : $N1]
11509 if $recipe =~ /^(Full)?(?:(Face)|FlipLayers)\((.*)\)$/;
11510 } else {
11511 0 my $m1; # Apparently, in perl5.10, if replace $m1 by $1 below, $1 loses its TRUE value between match and evaluation of $1
11512 # ($gr_debug and warn "Pseudo-layer `$recipe', face=`$face', N=$N, N1=$N1\n"),
11513 0 ▶ return ($self->export_layers("$3", $face, !!$1))->[$m1 ? $N : $N1]
Branch: 2 branches
BranchTrueFalseTotal
if $recipe =~ /^(Full)?(?:(Face)|FlipLayers)\((.*)\)$/ and $m1 = $2, 1 0 0 0
$m1 ? : 0 0 0
Condition0%0/3
$recipe =~ /^(Full)?(?:(Face)|FlipLayers)\((.*)\)$/ and $m1 = $2, 1
!ll&&!rl&&r
000
MC/DC0%0/2
$recipe =~ /^(Full)?(?:(Face)|FlipLayers)\((.*)\)$/ and $m1 = $2, 1
$recipe =~ /^(Full)?(?:(Face)|FlipLayers)\((.*)\)$/ $m1 = $2, 1
Truth table0%0/3
A and B
A= $recipe =~ /^(Full)?(?:(Face)|FlipLayers)\((.*)\)$/B= $m1 = $2, 1
ABresult
0X0
100
111
11514 if $recipe =~ /^(Full)?(?:(Face)|FlipLayers)\((.*)\)$/ and ($m1 = $2, 1);
11515 }
11516 0 ▶ if ($recipe =~ /^prefix(NOTSAME(case)?)?=(.+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe =~ /^prefix(NOTSAME(case)?)?=(.+)$/) 0 0 0
11517 # Analogue of NOID with the principal layers as reference, and layers of DeadKey as sources
11518 0 my($notsame, $case) = ($1,$2);
11519 0 my $hexPrefix = $self->key2hex($self->charhex2key($3));
11520 0 warn " mk_tr_lyrs pre-7 e_D_M" if debug_stacking_ord;
11521 0 $self->ensure_DeadKey_Map($face, $hexPrefix);
11522 0 ▶ my $layers = $self->{faces}{$face}{'[deadkeyLayers]'}{$hexPrefix} or die "Unknown prefix character `$hexPrefix´ in layers-from-prefix-key";
Branch: 1 branch
BranchTrueFalseTotal
my $layers = $self->{"faces"}{$face}{"[deadkeyLayers]"}{$hexPrefix} or die "Unknown prefix character `$hexPrefix\264 in layers-from-prefix-key" 0 0 0
11523 0 ▶ return $layers->[$N] if $N or not $notsame; # After this $N==0 and $notsame
Branch: 1 branch
BranchTrueFalseTotal
if $N or not $notsame 0 0 0
Condition0%0/3
$N or not $notsame
l!l&&r!l&&!r
000
MC/DC0%0/2
$N or not $notsame
$N not $notsame
Truth table0%0/3
A or not(B)
A= $NB= not $notsame
ABresult
1X1
011
000
11524 0 my $name = "NOTSAME[$face]$layers->[$N]";
11525 0 ▶ return $self->{layers}{$name} if $self->{layers}{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"layers"}{$name} 0 0 0
11526 0 my @LL = map $self->{layers}{$_}, @$layers;
11527 0 my $L0 = $self->{faces}{$face}{layers};
11528 0 my @L0 = map $self->{layers}{$_}, @$L0;
11529 0 my @OUT;
11530 0 for my $charN (0..$face->{'[non_VK]'}-1) {
11531 0 my (@L, %seen_baseface) = map $_->[$charN], @LL; # %seen_baseface: chars present in the base face in this position
11532 0 for my $layers0 (map $_->[$charN], @$L0) {
11533 0 for my $sh (@$layers0) {
11534 0 ▶ $seen_baseface{ref($sh) ? $sh->[0] : $sh}++ if defined $sh;
Branch: 2 branches
BranchTrueFalseTotal
if defined $sh 0 0 0
ref $sh ? : 0 0 0
11535 }
11536 }
11537 0 my(@CC, @pp, @OK); # Inspect this position in Layer 0 (or all if $notsame and emitting layer 0: this hold automatically!???):
11538 0 ▶ for my $l (@L[0 .. (($notsame && !$N) ? @{ $self->{faces}{$face}{layers} } - 1 : 0)]) {
Branch: 1 branch
BranchTrueFalseTotal
$notsame && !$N ? : 0 0 0
Condition0%0/3
$notsame and not $N
!ll&&!rl&&r
000
MC/DC0%0/2
$notsame and not $N
$notsame not $N
Truth table0%0/3
A and not(B)
A= $notsameB= not $N
ABresult
0X0
100
111
11539 0 my(%s1, @was, @out);
11540 0 for my $sh (0..$#$l) { # $self->dead_with_inversion(!'hex', $_, $face, $self->{faces}{$face})
11541 0 ▶ my @C = map {defined() ? (ref() ? $_->[0] : $_) : $_} $l->[$sh];
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
ref $_ ? : 0 0 0
11542 0 ▶ my @p = map {defined() ? (ref() ? $_->[2] : 0 ) : 0 } $l->[$sh];
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
ref $_ ? : 0 0 0
11543 0 ▶ ($CC[$sh], $pp[$sh]) = ($C[0], $p[0]) if not defined $CC[$sh] and defined $C[0]; # fallback: merge to L=0 even if dup
Branch: 1 branch
BranchTrueFalseTotal
if not defined $CC[$sh] and defined $C[0] 0 0 0
Condition0%0/3
not defined $CC[$sh] and defined $C[0]
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $CC[$sh] and defined $C[0]
not defined $CC[$sh] defined $C[0]
Truth table0%0/3
not(A) and B
A= not defined $CC[$sh]B= defined $C[0]
ABresult
0X0
100
111
11544 0 ▶ ($CC[$sh], $pp[$sh], $OK[$sh], $s1{$C[0]}) = ($C[0], $p[0], 1,1) if !$OK[$sh] and defined $C[0] and not $seen_baseface{$C[0]};
Branch: 1 branch
BranchTrueFalseTotal
if not $OK[$sh] and defined $C[0] and not $seen_baseface{$C[0]} 0 0 0
Condition0%0/6
not $OK[$sh] and defined $C[0] and not $seen_baseface{$C[0]}
!ll&&!rl&&r
000
not $OK[$sh] and defined $C[0]
!ll&&!rl&&r
000
MC/DC0%0/3
not $OK[$sh] and defined $C[0] and not $seen_baseface{$C[0]}
not $OK[$sh] defined $C[0] not $seen_baseface{$C[0]}
Truth table0%0/4
not(A) and B and not(C)
A= not $OK[$sh]B= defined $C[0]C= not $seen_baseface{$C[0]}
ABCresult
0XX0
10X0
1100
1111
11545 ($CC[$sh], $pp[$sh], $OK[$sh], $s1{$was[0]}) = (@was, 1,1) # Do layer>0 !Shift ⇝ Shift-layer0 if not dup and not used yet
11546 if !$case and $sh and !$OK[$sh] and defined $C[0] and defined $was[0]
11547 0 ▶ and not $seen_baseface{$was[0]} and not $s1{$was[0]};
Branch: 1 branch
BranchTrueFalseTotal
if not $case and $sh and not $OK[$sh] and defined $C[0] and defined $was[0] and not $seen_baseface{$was[0]} and not $s1{$was[0]} 0 0 0
Condition0%0/18
not $case and $sh and not $OK[$sh] and defined $C[0] and defined $was[0] and not $seen_baseface{$was[0]} and not $s1{$was[0]}
!ll&&!rl&&r
000
not $case and $sh and not $OK[$sh] and defined $C[0] and defined $was[0] and not $seen_baseface{$was[0]}
!ll&&!rl&&r
000
not $case and $sh and not $OK[$sh] and defined $C[0] and defined $was[0]
!ll&&!rl&&r
000
not $case and $sh and not $OK[$sh] and defined $C[0]
!ll&&!rl&&r
000
not $case and $sh and not $OK[$sh]
!ll&&!rl&&r
000
not $case and $sh
!ll&&!rl&&r
000
MC/DC0%0/7
not $case and $sh and not $OK[$sh] and defined $C[0] and defined $was[0] and not $seen_baseface{$was[0]} and not $s1{$was[0]}
not $case $sh not $OK[$sh] defined $C[0] defined $was[0] not $seen_baseface{$was[0]} not $s1{$was[0]}
Truth table0%0/8
not(A) and B and not(C) and D and E and not(F) and not(G)
A= not $caseB= $shC= not $OK[$sh]D= defined $C[0]E= defined $was[0]F= not $seen_baseface{$was[0]}G= not $s1{$was[0]}
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
11548 0 ▶ @was = ($C[0], $p[0]) unless $sh; # may omit `unless´
Branch: 1 branch
BranchTrueFalseTotal
unless $sh 0 0 0
11549 # $cnt++ if defined $CC[$sh];
11550 }
11551 }
11552 0 push @OUT, \@CC;
11553 }
11554 0 $self->{layers}{$name} = \@OUT;
11555 0 return $name;
11556 }
11557 0 die "Unrecognized Face recipe `$recipe'"
11558 }
11559
11560 # my @LL = map $self->{layers}{'[ini_copy1]'}{$_} || $self->{layers}{'[ini_copy]'}{$_} || $self->{layers}{$_}, @$LL;
11561
11562 # A stand-alone word is either LinkFace, or is interpreted as a name of
11563 # translation function applied to the current face.
11564 # A name which is an argument to a function is allowed to be a layer name
11565 # (but note that then both layers of the face will be mapped to that same
11566 # layer - unless one restricts the recipe to a particular layer 0/1 of the
11567 # face).
11568 # In particular: to specify a layer, use Id(LayerName).
11569 #use Dumpvalue;
11570 0 ▶sub make_translated_layers ($$$$;$$) { # support Self/FlipLayers/LinkFace/FlipShift, stacking and maps
Subroutine make_translated_layers: not called CC=23 SCAR=63.1
Pod undocumented
11571 0 my ($self, $recipe, $face, $NN, $deadkey, $noid, $append, $ARG) = (shift, shift, shift, shift, shift, shift, '');
11572 # XXX We can't cache created layer by name, since it depends on $recipe and $N too???
11573 # return $recipe if exists $self->{layers}{$recipe};
11574 # my $FACE = $recipe . join '===', '', @$NN, '';
11575 # return $self->{faces}{$FACE}{layers} if exists $self->{faces}{$FACE}{layers};
11576 0 ▶ while ($recipe =~ /^Shortcut\(([^()]+)\)$/) { # Same as Face(), but does not disable $deadkey; no caching...
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe =~ /^Shortcut\(([^()]+)\)$/) 0 0 0
11577 0 ▶ die "No face recipe for `$1' found" unless my $r = $self->{face_recipes}{$1};
Branch: 1 branch
BranchTrueFalseTotal
unless my $r = $self->{"face_recipes"}{$1} 0 0 0
11578 0 $recipe = $self->recipe2str($r);
11579 0 warn "Using face_recipes for `$1', base=$face ==> `$recipe'\n" if debug_face_layout_recipes;
11580 }
11581 0 ▶ my @parts = grep /\S/, $self->join_min_paren_brackets_matched('', split /(\s+)/, $recipe)
Branch: 1 branch
BranchTrueFalseTotal
my(@parts) = grep(/\S/, $self->join_min_paren_brackets_matched("", split(/(\s+)/, $recipe, 0))) or die "Whitespace face recipe `${recipe}'?!" 0 0 0
11582 or die "Whitespace face recipe `$recipe'?!";
11583 0 ▶ if (@parts > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@parts > 1) 0 0 0
11584 #warn "parts of the translation spec: <", join('> <', @parts), '>';
11585 0 my @layers = map $self->make_translated_layers($_, $face, $NN, $deadkey), @parts;
11586 0 warn "Stacking/NOID for layers `@parts'", (join "\n\t", '', map {join ' &&& ', @$_} @layers), "\n"
11587 if debug_noid and $noid or debug_stacking;
11588 #print "Stacking for `$recipe'\n" if $DEBUG;
11589 #Dumpvalue->new()->dumpValue(\@layers) if $DEBUG;
11590 0 ▶ return [$self->make_translated_layers_noid($noid eq 'NotSameKey' && " $parts[0] ", @layers)]
Branch: 1 branch
BranchTrueFalseTotal
if $noid 0 0 0
Condition0%0/2
$noid eq 'NotSameKey' && " $parts[0] "
!ll
00
MC/DC0%0/1
$noid eq 'NotSameKey' && " $parts[0] "
$noid eq 'NotSameKey'
Truth table0%0/2
A
A= $noid eq 'NotSameKey'
Aresult
00
11
11591 if $noid;
11592 0 return [$self->make_translated_layers_stack(@layers)];
11593 }
11594 0 ▶ return [map $self->pseudo_layer($recipe, $face, $_), @$NN]
Branch: 1 branch
BranchTrueFalseTotal
if $recipe =~ /^(prefix(?:NOTSAME(?:case)?)?=.*|(FlipLayers)?LinkFace|FlipLayers|Self|((Full)?(Face|FlipLayers)|Layers)\([^()]+\))$/ 0 0 0
11595 if $recipe =~ /^(prefix(?:NOTSAME(?:case)?)?=.*|(FlipLayers)?LinkFace|FlipLayers|Self|((Full)?(Face|FlipLayers)|Layers)\([^()]+\))$/;
11596 0 $recipe =~ s/^(FlipShift)$/$1(Self)/;
11597 0 ▶ if ( $recipe =~ /\)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe =~ /\)$/) { } 0 0 0
11598 0 ▶ if ( $recipe =~ /^[^(]*\[/ ) { # Tricky: allow () inside Func[](args)
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe =~ /^[^(]*\[/) { } 0 0 0
11599 0 my $pos;
11600 0 ▶ while ( $recipe =~ /(?=\]\()/g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe =~ /(?=\]\()/g) 0 0 0
11601 0 ▶ $pos = 1 + pos $recipe, last if $self->brackets_match_q(substr $recipe, 0, 1 + pos $recipe)
Branch: 1 branch
BranchTrueFalseTotal
if $self->brackets_match_q(substr($recipe, 0, 1 + pos($recipe))) 0 0 0
11602 }
11603 0 ▶ die "Can't parse `$recipe' as Func[Arg1](Arg2)" unless $pos;
Branch: 1 branch
BranchTrueFalseTotal
unless $pos 0 0 0
11604 0 $ARG = substr $recipe, $pos + 1, length($recipe) - $pos - 2;
11605 0 $recipe = substr $recipe, 0, $pos;
11606 } else {
11607 0 my $o = $recipe;
11608 0 ▶ ($recipe, $ARG) = ($recipe =~ /^(.*?)\((.*)\)$/s) or warn "Can't parse recipe `$o'";
Branch: 1 branch
BranchTrueFalseTotal
($recipe, $ARG) = $recipe =~ /^(.*?)\((.*)\)$/s or warn "Can't parse recipe `${o}'" 0 0 0
11609 }
11610 } else {
11611 0 $ARG = '';
11612 }
11613 #warn "Translation sub-spec: recipe = <$recipe>, ARG=<$ARG>";
11614 0 ▶ if ($recipe =~ /^If(Not)?Prefix\[(.*)\]$/s) { # No embedded \\]
Branch: 1 branch
BranchTrueFalseTotal
if ($recipe =~ /^If(Not)?Prefix\[(.*)\]$/s) 0 0 0
11615 0 my $neg = $1;
11616 0 my @prefix = map $self->key2hex($self->charhex2key($_)), split /,/, "$2";
11617 ### warn "dk=<$deadkey> prefix=<@prefix>" if defined $deadkey;
11618 0 ▶ return $self->make_translated_layers($ARG, $face, $NN, $deadkey, $noid)
Branch: 1 branch
BranchTrueFalseTotal
if defined $deadkey and $neg ^^ grep(($_ eq $deadkey), @prefix) 0 0 0
Condition0%0/7
defined $deadkey and $neg ^^ grep(($_ eq $deadkey), @prefix)
!ll&&!rl&&r
000
$neg xor grep(($_ eq $deadkey), @prefix)
l&&rl&&!r!l&&r!l&&!r
0000
MC/DC0%0/3
defined $deadkey and $neg ^^ grep(($_ eq $deadkey), @prefix)
defined $deadkey $neg grep(($_ eq $deadkey), @prefix)
Truth table0%0/5
A and B xor C
A= defined $deadkeyB= $negC= grep(($_ eq $deadkey), @prefix)
ABCresult
0XX0
1110
1000
1101
1011
11619 if defined($deadkey) and ($neg xor grep $_ eq $deadkey, @prefix);
11620 0 ($recipe, $ARG) = ('Empty', [('Empty') x @$NN]);
11621 }
11622 0 ▶ if (length $ARG) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $ARG) { } 0 0 0
11623 0 ▶ if (exists $self->{layers}{$ARG}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'layers'}{$ARG}) { } 0 0 0
elsif (not ref $ARG) { } 0 0 0
11624 0 $ARG = [($ARG) x @$NN];
11625 } elsif (!ref $ARG) {
11626 0 ▶ ($ARG = $self->layer_recipe($ARG)) =~ s/^\s+// if exists $self->{layer_recipes}{my $a = $ARG};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"layer_recipes"}{my $a = $ARG} 0 0 0
11627 0 warn "make_translated_layers: Using layout_recipe `$ARG' for layer '$a'\n" if debug_face_layout_recipes and exists $self->{layer_recipes}{$a};
11628 0 ($noid) = ($recipe =~ /^(NotId|NotSameKey)$/);
11629 0 $ARG = $self->make_translated_layers($ARG, $face, $NN, $deadkey, $noid);
11630 0 ▶ return $ARG if $noid;
Branch: 1 branch
BranchTrueFalseTotal
if $noid 0 0 0
11631 }
11632 } else {
11633 0 $ARG = [map $self->{faces}{$face}{layers}[$_], @$NN];
11634 0 $append = "#$face#";
11635 }
11636 0 [$self->make_translated_layers_tr($ARG, $recipe, $append, $deadkey, $face, $NN)]; # Either we saw (), or $recipe is not a face recipe!
11637 }
11638
11639 0 ▶sub massage_translated_layers ($$$$;$) {
Subroutine massage_translated_layers: not called CC=2 SCAR=17.9
Pod undocumented
11640 0 my ($self, $in, $face, $NN, $deadkey) = (shift, shift, shift, shift, shift, '');
11641 #warn "Massaging `$deadkey' for `$face':$N";
11642 0 ▶ return $in unless my $r = $self->get_deep($self, 'faces', (my @p = split m(/), $face), '[Diacritic_if_undef]');
Branch: 1 branch
BranchTrueFalseTotal
unless my $r = $self->get_deep($self, "faces", my @p = split(m[/], $face, 0), "[Diacritic_if_undef]") 0 0 0
11643 0 $r =~ s/^\s+//;
11644 #warn " -> end recipe `$r'";
11645 0 warn " mk_tr_lyrs 6" if debug_stacking_ord;
11646 0 my $post = $self->make_translated_layers($r, $face, $NN, $deadkey);
11647 0 warn " mk_tr_lyrs_st 1" if debug_stacking_ord;
11648 0 return [$self->make_translated_layers_stack($in, $post)];
11649 }
11650
11651 0 ▶sub default_char ($$) {
Subroutine default_char: not called CC=2 SCAR=17.9
Pod undocumented
11652 0 my ($self, $F) = (shift, shift);
11653 0 my $default = $self->get_deep($self, 'faces', $F, '[DeadChar_DefaultTranslation]');
11654 0 ▶ $default =~ s/^\s+//, $default = $self->charhex2key($default) if defined $default;
Branch: 1 branch
BranchTrueFalseTotal
if defined $default 0 0 0
11655 0 $default;
11656 }
11657
11658 0 ▶sub create_inverted_face ($$$$$) {
Subroutine create_inverted_face: not called CC=9 SCAR=45.0
Pod undocumented
11659 0 my ($self, $F, $KK, $chain, $flip_AltGr) = (shift, shift, shift, shift, shift);
11660 0 my $H = $self->{faces}{$F};
11661 0 my $auto_chr = $H->{'[deadkeyInvAltGrKey]'}{$KK};
11662 0 my $new_facename = $H->{'[deadkeyFaceInvAltGr]'}{$auto_chr};
11663 0 my ($LL, %Map) = $H->{'[deadkeyLayers]'}{$KK};
11664 0 ▶ $LL = $H->{layers} if $KK eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $KK eq "" 0 0 0
11665 %Map = ($flip_AltGr, [$chain->{$KK and $self->charhex2key($KK)}, undef, 1, 'AltGrInv-faces-chain'])
11666 0 ▶ if defined $flip_AltGr and defined $chain->{$KK and $self->charhex2key($KK)};
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr and defined $$chain{$KK and $self->charhex2key($KK)} 0 0 0
Condition0%0/9
defined $flip_AltGr and defined $$chain{$KK and $self->charhex2key($KK)}
!ll&&!rl&&r
000
$KK && $self->charhex2key($KK)
!ll&&!rl&&r
000
$KK && $self->charhex2key($KK)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $flip_AltGr and defined $$chain{$KK and $self->charhex2key($KK)}
defined $flip_AltGr defined $$chain{$KK and $self->charhex2key($KK)}
MC/DC0%0/2
$KK && $self->charhex2key($KK)
$KK $self->charhex2key($KK)
MC/DC0%0/2
$KK && $self->charhex2key($KK)
$KK $self->charhex2key($KK)
Truth table0%0/3
A and B
A= defined $flip_AltGrB= defined $$chain{$KK and $self->charhex2key($KK)}
ABresult
0X0
100
111
Truth table0%0/3
A && B
A= $KKB= $self->charhex2key($KK)
ABresult
0X0
100
111
Truth table0%0/3
A && B
A= $KKB= $self->charhex2key($KK)
ABresult
0X0
100
111
11667 0 warn " patch_face 0 f=$F k=$KK" if debug_stacking_ord;
11668 0 $self->patch_face($LL, $new_facename, $H->{"[InvdeadkeyLayers]"}{$KK}, $KK, \%Map, $F, 'invert');
11669
11670 # warn "Joining <$F>, <$new_facename>";
11671 0 $self->link_layers($F, $new_facename, 'skipfix', 'no-slot-warn');
11672 0 ▶ if ($KK eq '' and defined $flip_AltGr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($KK eq "" and defined $flip_AltGr) 0 0 0
Condition0%0/3
$KK eq "" and defined $flip_AltGr
!ll&&!rl&&r
000
MC/DC0%0/2
$KK eq "" and defined $flip_AltGr
$KK eq "" defined $flip_AltGr
Truth table0%0/3
A and B
A= $KK eq ""B= defined $flip_AltGr
ABresult
0X0
100
111
11673 0 $H->{'[deadkeyFace]'}{$self->key2hex($flip_AltGr)} = $H->{'[deadkeyFaceInvAltGr]'}{$auto_chr};
11674 }
11675 0 ▶ if ($H->{"[InvdeadkeyLayers]"}{$KK}) { # There are overrides for the inverted face. Make a map for them...
Branch: 1 branch
BranchTrueFalseTotal
if ($H->{"[InvdeadkeyLayers]"}{$KK}) 0 0 0
11676 #warn "Overriding face for inverted `$KK' in face $F; new_facename=$new_facename";
11677 0 $H->{'[InvAltGrFace]'}{$KK} = "$new_facename\@override";
11678 0 $self->{faces}{"$new_facename\@override"}{layers} = $H->{"[InvdeadkeyLayers]"}{$KK};
11679 0 $self->link_layers($F, "$new_facename\@override", 'skipfix', 'no-slot-warn');
11680 }
11681 0 $new_facename;
11682 }
11683
11684 0 ▶sub auto_dead_can_wrap ($$) { # Call after all the manually set prefix key are already established, so one can avoid them
Subroutine auto_dead_can_wrap: not called CC=1 SCAR=6.9
Pod undocumented
11685 0 my ($self, $F) = (shift, shift);
11686 0 $self->{faces}{$F}{'[ad_can_wrap]'}++
11687 }
11688
11689 0 ▶sub next_auto_dead ($$) {
Subroutine next_auto_dead: not called CC=11 SCAR=48.8
Pod undocumented
11690 0 my ($self, $H, $o) = (shift, shift);
11691 0 ▶ unless ($H->{'[autodead_wrapped]'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($H->{"[autodead_wrapped]"}) 0 0 0
11692 0 ▶ 1 while $H->{'[auto_dead]'}{ $o = $H->{'[first_auto_dead]'}++ }++ and ($o < 0x1000 or not $H->{'[ad_can_wrap]'}); # Bug in kbdutool
Branch: 1 branch
BranchTrueFalseTotal
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ and $o < 4096 || !$H->{"[ad_can_wrap]"} and do { '???' } 0 0 0
Condition0%0/6
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ and $o < 4096 || !$H->{"[ad_can_wrap]"}
!ll&&!rl&&r
000
$o < 4096 or not $H->{"[ad_can_wrap]"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ and $o < 4096 || !$H->{"[ad_can_wrap]"}
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ $o < 4096 not $H->{"[ad_can_wrap]"}
Truth table0%0/4
A and B or not(C)
A= $H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++B= $o < 4096C= not $H->{"[ad_can_wrap]"}
ABCresult
0XX0
1000
11X1
1011
11693 0 ▶ $H->{'[first_auto_dead]'} = 0xa0 if $o >= 0x1000 and $H->{'[ad_can_wrap]'} and not $H->{'[autodead_wrapped]'}++;
Branch: 1 branch
BranchTrueFalseTotal
if $o >= 4096 and $H->{"[ad_can_wrap]"} and not $H->{"[autodead_wrapped]"}++ 0 0 0
Condition0%0/6
$o >= 4096 and $H->{"[ad_can_wrap]"} and not $H->{"[autodead_wrapped]"}++
!ll&&!rl&&r
000
$o >= 4096 and $H->{"[ad_can_wrap]"}
!ll&&!rl&&r
000
MC/DC0%0/3
$o >= 4096 and $H->{"[ad_can_wrap]"} and not $H->{"[autodead_wrapped]"}++
$o >= 4096 $H->{"[ad_can_wrap]"} not $H->{"[autodead_wrapped]"}++
Truth table0%0/4
A and B and not(C)
A= $o >= 4096B= $H->{"[ad_can_wrap]"}C= not $H->{"[autodead_wrapped]"}++
ABCresult
0XX0
10X0
1100
1111
11694 }
11695 0 ▶ if ($H->{'[autodead_wrapped]'}) { # This does not deal with manual assignment of inverted prefixes??? Inv_AltGr???
Branch: 1 branch
BranchTrueFalseTotal
if ($H->{"[autodead_wrapped]"}) 0 0 0
11696 0 ▶ 1 while $H->{'[auto_dead]'}{ $o = $H->{'[first_auto_dead]'}++ }++ or $H->{'[deadkeyFaceHexMap]'}{$self->key2hex(chr $o)};
Branch: 1 branch
BranchTrueFalseTotal
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ || $H->{"[deadkeyFaceHexMap]"}{$self->key2hex(&UI::KeyboardLayout::chr($o))} and do { '???' } 0 0 0
Condition0%0/3
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ or $H->{"[deadkeyFaceHexMap]"}{$self->key2hex(&UI::KeyboardLayout::chr($o))}
l!l&&r!l&&!r
000
MC/DC0%0/2
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ or $H->{"[deadkeyFaceHexMap]"}{$self->key2hex(&UI::KeyboardLayout::chr($o))}
$H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++ $H->{"[deadkeyFaceHexMap]"}{$self->key2hex(&UI::KeyboardLayout::chr($o))}
Truth table0%0/3
A or B
A= $H->{"[auto_dead]"}{$o = $H->{"[first_auto_dead]"}++}++B= $H->{"[deadkeyFaceHexMap]"}{$self->key2hex(&UI::KeyboardLayout::chr($o))}
ABresult
1X1
011
000
11697 # if ($o == 0x00a3) {
11698 # warn "$o: Keys HexMap: ", join ', ', sort keys %{$H->{'[deadkeyFaceHexMap]'}};
11699 # }
11700 }
11701 0 chr $o;
11702 }
11703
11704 0 ▶sub recipe2str ($$) {
Subroutine recipe2str: not called CC=4 SCAR=30.0
Pod undocumented
11705 0 (undef, my $recipe) = (shift, shift);
11706 0 ▶ if ('ARRAY' eq ref $recipe) {
Branch: 1 branch
BranchTrueFalseTotal
if ("ARRAY" eq ref $recipe) 0 0 0
11707 0 $recipe = [@$recipe]; # deep copy
11708 0 s/\s+$//, s/^\s+// for @$recipe;
11709 0 s/(?<![|,])$/ / for @$recipe[0..($#$recipe - 1)]; # Join by spaces unless after comma or |
11710 0 $recipe = join '', @$recipe;
11711 }
11712 0 $recipe =~ s/^\s+//;
11713 0 $recipe
11714 }
11715
11716 0 ▶sub scan_for_DeadKey_Maps ($) { # Makes a direct-access synonym, scan for DeadKey_Maps* keys
Subroutine scan_for_DeadKey_Maps: not called CC=16 SCAR=56.1
Pod undocumented
11717 0 my ($self, %h, $expl) = (shift);
11718 #Dumpvalue->new()->dumpValue($self);
11719 0 my @F = grep m(^faces(/.*)?$), @{$self->{'[keys]'}};
11720 0 for my $FF (@F) {
11721 0 (my $F = $FF) =~ s(^faces/?)();
11722 0 my(@FF, @HH) = split m(/), $FF;
11723 0 ▶ next if @FF == 1 or $FF[-1] eq 'VK';
Branch: 1 branch
BranchTrueFalseTotal
if @FF == 1 or $FF[-1] eq "VK" 0 0 0
Condition0%0/3
@FF == 1 or $FF[-1] eq "VK"
l!l&&r!l&&!r
000
MC/DC0%0/2
@FF == 1 or $FF[-1] eq "VK"
@FF == 1 $FF[-1] eq "VK"
Truth table0%0/3
A or B
A= @FF == 1B= $FF[-1] eq "VK"
ABresult
1X1
011
000
11724 0 my @FF1 = @FF;
11725 0 ▶ push(@HH, $self->get_deep($self, @FF1)), pop @FF1 while @FF1; # All the parents
Branch: 1 branch
BranchTrueFalseTotal
@FF1 and do { push(@HH, $self->get_deep($self, @FF1)), pop @FF1 } 0 0 0
11726 0 my $H = $HH[0];
11727 0 ▶ next if $H->{PartialFace};
Branch: 1 branch
BranchTrueFalseTotal
if $H->{"PartialFace"} 0 0 0
11728 0 ▶ $self->{faces}{$F} = $H if $F =~ m(/) and exists $H->{layers}; # Make a direct-access copy
Branch: 1 branch
BranchTrueFalseTotal
if $F =~ m[/] and exists $H->{"layers"} 0 0 0
Condition0%0/3
$F =~ m[/] and exists $H->{"layers"}
!ll&&!rl&&r
000
MC/DC0%0/2
$F =~ m[/] and exists $H->{"layers"}
$F =~ m[/] exists $H->{"layers"}
Truth table0%0/3
A and B
A= $F =~ m[/]B= exists $H->{"layers"}
ABresult
0X0
100
111
11729 #warn "Face section `${FF}'s parents: ", scalar @HH;
11730 #warn "Mismatch of hashes for `$FF'" unless $self->{faces}{$F} == $H;
11731
11732 # warn "compositing: faces `$F'; -> <", (join '> <', %$H), ">";
11733 0 for my $HH (@HH) {
11734 0 for my $k ( keys %$HH ) {
11735 # warn "\t`$k' -> `$HH->{$k}'";
11736 0 ▶ next unless $k =~ m(^DeadKey_(Inv|Add)?Map([0-9a-f]{4,})?(?:_(\d+))?$)i;
Branch: 1 branch
BranchTrueFalseTotal
unless $k =~ /^DeadKey_(Inv|Add)?Map([0-9a-f]{4,})?(?:_(\d+))?$/i 0 0 0
11737 #warn "\t`$k' -> `$HH->{$k}'";
11738 0 ▶ my($inv, $key, $layers) = ($1 || '', $2, $3);
Condition0%0/2
$1 || ''
l!l
00
MC/DC0%0/1
$1 || ''
$1
Truth table0%0/2
A
A= $1
Aresult
11
00
11739 0 ▶ $key = $self->key2hex($self->charhex2key($key)) if defined $key; # get rid of uc/lc hex problem
Branch: 1 branch
BranchTrueFalseTotal
if defined $key 0 0 0
11740 # XXXX The problem is that the parent may define layers in different ways (_0,_1 or no); ignore it for now...
11741 0 ▶ $H->{'[DeadKey__Maps]'}{$key || ''}{$inv}{(defined $layers) ? $layers : 'All'} ||= $HH->{$k};
Branch: 1 branch
BranchTrueFalseTotal
defined $layers ? : 0 0 0
Condition0%0/5
$H->{"[DeadKey__Maps]"}{$key or ""}{$inv}{defined $layers ? $layers : "All"} ||= $HH->{$k}
l!l&&r!l&&!r
000
$key || ''
l!l
00
MC/DC0%0/2
$H->{"[DeadKey__Maps]"}{$key or ""}{$inv}{defined $layers ? $layers : "All"} ||= $HH->{$k}
$H->{"[DeadKey__Maps]"}{$key or ""}{$inv}{defined $layers ? $layers : "All"} $HH->{$k}
MC/DC0%0/1
$key || ''
$key
Truth table0%0/3
A ||= B
A= $H->{"[DeadKey__Maps]"}{$key or ""}{$inv}{defined $layers ? $layers : "All"}B= $HH->{$k}
ABresult
1X1
011
000
Truth table0%0/2
A
A= $key
Aresult
11
00
11742 }
11743 }
11744 }
11745 }
11746
11747 #use Dumpvalue;
11748 0 ▶sub ensure_DeadKey_Map_by_recipe ($$$$;$$) {
Subroutine ensure_DeadKey_Map_by_recipe: not called CC=8 SCAR=42.8
Pod undocumented
11749 0 ▶ my ($self, $F, $hexPrefix, $recipe, $layers, $inv) = (shift, shift, shift, shift, shift, shift || '');
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
11750 0 my $H = $self->{faces}{$F};
11751 0 ▶ return if $H->{"[${inv}deadkeyLayersCreated]"}{$hexPrefix}{$layers and "@$layers"}++;
Branch: 1 branch
BranchTrueFalseTotal
if $$H{"[${inv}deadkeyLayersCreated]"}{$hexPrefix}{$layers and join $", @$layers}++ 0 0 0
Condition0%0/3
$layers && join($", @$layers)
!ll&&!rl&&r
000
MC/DC0%0/2
$layers && join($", @$layers)
$layers join($", @$layers)
Truth table0%0/3
A && B
A= $layersB= join($", @$layers)
ABresult
0X0
100
111
11752 #Dumpvalue->new()->dumpValue($self);
11753 0 my $massage = !($recipe =~ s/\s+NoDefaultTranslation$//);
11754 0 ▶ $layers ||= [ 0 .. $#{$self->{faces}{$F}{layers}} ];
Condition0%0/2
$layers ||= [0 .. $#{$$self{"faces"}{$F}{"layers"};}]
l!l
00
MC/DC0%0/1
$layers ||= [0 .. $#{$$self{"faces"}{$F}{"layers"};}]
$layers
Truth table0%0/2
A
A= $layers
Aresult
11
00
11755 #warn "Doing key `$hexPrefix' inv=`$inv' face=`$F', recipe=`$recipe'";
11756 0 warn " mk_tr_lyrs 7 (F=$F, p=$hexPrefix)" if debug_stacking_ord;
11757 0 my $new = $self->make_translated_layers($recipe, $F, $layers, $hexPrefix);
11758 0 ▶ $new = $self->massage_translated_layers($new, $F, $layers, $hexPrefix) if $massage and not $inv;
Branch: 1 branch
BranchTrueFalseTotal
if $massage and not $inv 0 0 0
Condition0%0/3
$massage and not $inv
!ll&&!rl&&r
000
MC/DC0%0/2
$massage and not $inv
$massage not $inv
Truth table0%0/3
A and not(B)
A= $massageB= not $inv
ABresult
0X0
100
111
11759 0 for my $NN (0..$#$layers) { # Create a layer according to the spec
11760 #warn "DeadKey Layer for face=$F; layer=$layer, k=$k:\n\t$HH->{$k}, key=`", ($hexPrefix||''),"'\n\t\t";
11761 #$DEBUG = $hexPrefix eq '0192';
11762 #print "Doing key `$hexPrefix' face=$F layer=`$layer' recipe=`$recipe'\n" if $DEBUG;
11763 #Dumpvalue->new()->dumpValue($self->{layers}{$new}) if $DEBUG;
11764 #warn "new=<<<", join('>>> <<<', @$new),'>>>';
11765 0 $H->{"[${inv}deadkeyLayers]"}{$hexPrefix}[$layers->[$NN]] = $new->[$NN];
11766 #warn "Face `$F', layer=$layer key=$hexPrefix\t=> `$new'" if $H->{layers}[$layer] =~ /00a9/i;
11767 #Dumpvalue->new()->dumpValue($self->{layers}{$new}) if $self->charhex2key($hexPrefix) eq chr 0x00a9;
11768 }
11769 }
11770
11771 0 ▶sub ensure_DeadKey_Map ($$$;$) {
Subroutine ensure_DeadKey_Map: not called CC=7 SCAR=40.3
Pod undocumented
11772 0 my ($self, $F, $hexPrefix, $hexPrefixWas, %h, $expl) = (shift, shift, shift, shift);
11773 0 ▶ $hexPrefixWas = $hexPrefix unless defined $hexPrefixWas;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $hexPrefixWas 0 0 0
11774 0 my $H = $self->{faces}{$F};
11775 0 my $v0 = $H->{'[DeadKey__Maps]'}{$hexPrefixWas};
11776 0 for my $inv (sort keys %$v0) {
11777 0 my $v1 = $v0->{$inv};
11778 0 ▶ my $K = (($inv and "$inv $hexPrefix" eq "Inv 0000") ? '' : $hexPrefix);
Branch: 1 branch
BranchTrueFalseTotal
$inv && "$inv $hexPrefix" eq 'Inv 0000' ? : 0 0 0
Condition0%0/3
$inv and "$inv $hexPrefix" eq "Inv 0000"
!ll&&!rl&&r
000
MC/DC0%0/2
$inv and "$inv $hexPrefix" eq "Inv 0000"
$inv "$inv $hexPrefix" eq "Inv 0000"
Truth table0%0/3
A and B
A= $invB= "$inv $hexPrefix" eq "Inv 0000"
ABresult
0X0
100
111
11779 0 for my $layers (sort keys %$v1) {
11780 0 my $recipe = $self->recipe2str($v1->{$layers});
11781 0 ▶ $layers = ($layers eq 'All' ? '' : [$layers]);
Branch: 1 branch
BranchTrueFalseTotal
$layers eq 'All' ? : 0 0 0
11782 0 $self->ensure_DeadKey_Map_by_recipe($F, $K, $recipe, $layers, $inv);
11783 }
11784 }
11785 }
11786
11787 0 ▶sub create_DeadKey_Maps ($) {
Subroutine create_DeadKey_Maps: not called CC=9 SCAR=45.0
Pod undocumented
11788 0 my ($self, %h, $expl) = (shift);
11789 #Dumpvalue->new()->dumpValue($self);
11790 0 for my $F ($self->order_faces_4_massage) {
11791 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
11792 0 my $H = $self->{faces}{$F};
11793 0 my $flip_AltGr = $H->{'[Flip_AltGr_Key]'};
11794 0 ▶ $flip_AltGr = (defined $flip_AltGr) ? $self->charhex2key($flip_AltGr) : 'N/A';
Branch: 1 branch
BranchTrueFalseTotal
defined $flip_AltGr ? : 0 0 0
11795 # Treat first the specific maps (for one deadkey) then the deadkeys which were not seen via the universal map
11796 0 for my $key (sort keys %{$H->{'[DeadKey__Maps]'}}) {
11797 ### my $v0 = $H->{'[DeadKey__Maps]'}{$key};
11798 my @keys = (($key ne '')
11799 ? $key
11800 0 ▶ : (grep {not $H->{'[DeadKey__Maps]'}{$_} and not $H->{'[ComposeKeys]'}{$_}}
Condition0%0/3
$H->{'[DeadKey__Maps]'}{$_} || $H->{'[ComposeKeys]'}{$_}
l!l&&r!l&&!r
000
MC/DC0%0/2
$H->{'[DeadKey__Maps]'}{$_} || $H->{'[ComposeKeys]'}{$_}
$H->{'[DeadKey__Maps]'}{$_} $H->{'[ComposeKeys]'}{$_}
Truth table0%0/3
A || B
A= $H->{'[DeadKey__Maps]'}{$_}B= $H->{'[ComposeKeys]'}{$_}
ABresult
1X1
011
000
11801 0 ▶ map $self->key2hex($_), grep $_ ne $flip_AltGr, sort keys %{ $H->{'[DEAD]'} }));
Branch: 1 branch
BranchTrueFalseTotal
$key ne '' ? : 0 0 0
11802 0 $self->ensure_DeadKey_Map($F, $_, $key) for @keys;
11803 }
11804 }
11805 }
11806
11807 #use Dumpvalue;
11808 0 ▶sub create_composite_layers ($) {
Subroutine create_composite_layers: not called CC=11 SCAR=48.8
Pod undocumented
11809 0 my ($self, %h, $expl) = (shift);
11810 #Dumpvalue->new()->dumpValue($self);
11811 0 for my $F (keys %{ $self->{faces} }) {
11812 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
11813 0 my $H = $self->{faces}{$F};
11814 0 ▶ next if $H->{PartialFace};
Branch: 1 branch
BranchTrueFalseTotal
if $H->{"PartialFace"} 0 0 0
11815 0 ▶ next unless $H->{'[deadkeyLayers]'}; # Are we in a no-nonsense Face-hash with defined deadkeys?
Branch: 1 branch
BranchTrueFalseTotal
unless $H->{"[deadkeyLayers]"} 0 0 0
11816 #warn "Face: <", join( '> <', %$H), ">";
11817 0 my $layerL = @{ $self->{layers}{ $H->{layers}[0] } }; # number of keys in the face (in the principal layer)
11818 0 my $first_auto_dead = $H->{'[Auto_Diacritic_Start]'};
11819 0 ▶ $H->{'[first_auto_dead]'} = ord $self->charhex2key($first_auto_dead) if defined $first_auto_dead;
Branch: 1 branch
BranchTrueFalseTotal
if defined $first_auto_dead 0 0 0
11820 0 for my $KK (sort keys %{$H->{'[deadkeyLayers]'}}) { # Given a deadkey: join layers into a face, and link to it
11821 0 for my $layer ( 0 .. $#{ $H->{layers} } ) {
11822 #warn "Checking for empty layers, Face `$face', layer=$layer key=$KK";
11823 $self->{layers}{"[empty$layerL]"} ||= [map[], 1..$layerL], $H->{'[deadkeyLayers]'}{$KK}[$layer] = "[empty$layerL]"
11824 0 ▶ unless defined $H->{'[deadkeyLayers]'}{$KK}[$layer]
Branch: 1 branch
BranchTrueFalseTotal
unless defined $H->{"[deadkeyLayers]"}{$KK}[$layer] 0 0 0
Condition0%0/2
$self->{"layers"}{"[empty$layerL]"} ||= [map([], 1 .. $layerL)]
l!l
00
MC/DC0%0/1
$self->{"layers"}{"[empty$layerL]"} ||= [map([], 1 .. $layerL)]
$self->{"layers"}{"[empty$layerL]"}
Truth table0%0/2
A
A= $self->{"layers"}{"[empty$layerL]"}
Aresult
11
00
11825 }
11826 # Join the syntetic layers (now well-formed) into a new synthetic face:
11827 0 my $new_facename = "$F###$KK";
11828 0 $self->{faces}{$new_facename}{layers} = $H->{'[deadkeyLayers]'}{$KK};
11829 0 $H->{'[deadkeyFace]'}{$KK} = $new_facename;
11830 #warn "Joining <$F>, <$new_facename>";
11831 # $self->link_layers($F, $new_facename, 'skipfix', 'no-slot-warn'); # Now moved to link_composite_layers
11832 }
11833 }
11834 $self
11835 0 }
11836
11837 0 ▶sub create_prefix_chains ($) {
Subroutine create_prefix_chains: not called CC=15 SCAR=54.8
Pod undocumented
11838 0 my ($self, %h, $expl) = (shift);
11839 0 my @F = grep m(^faces(/.*)?$), @{$self->{'[keys]'}};
11840 0 for my $FF (@F) {
11841 0 (my $F = $FF) =~ s(^faces/?)();
11842 0 my(@FF, @HH) = split m(/), $FF;
11843 0 ▶ next if @FF == 1 or $FF[-1] eq 'VK';
Branch: 1 branch
BranchTrueFalseTotal
if @FF == 1 or $FF[-1] eq "VK" 0 0 0
Condition0%0/3
@FF == 1 or $FF[-1] eq "VK"
l!l&&r!l&&!r
000
MC/DC0%0/2
@FF == 1 or $FF[-1] eq "VK"
@FF == 1 $FF[-1] eq "VK"
Truth table0%0/3
A or B
A= @FF == 1B= $FF[-1] eq "VK"
ABresult
1X1
011
000
11844 0 ▶ push(@HH, $self->get_deep($self, @FF)), pop @FF while @FF;
Branch: 1 branch
BranchTrueFalseTotal
@FF and do { push(@HH, $self->get_deep($self, @FF)), pop @FF } 0 0 0
11845 0 my($H, %KK) = $HH[0];
11846 0 ▶ for my $chain ( @{ $H->{'[PrefixChains]'} || [] } ) {
Condition0%0/2
$H->{'[PrefixChains]'} || []
l!l
00
MC/DC0%0/1
$H->{'[PrefixChains]'} || []
$H->{'[PrefixChains]'}
Truth table0%0/2
A
A= $H->{'[PrefixChains]'}
Aresult
11
00
11847 0 (my $c = $chain) =~ s/^\s+//;
11848 0 ▶ my @prefix = map { $_ and $self->charhex2key($_) } split /,/, $c, -1; # trailing empty means all are prefixes
Condition0%0/3
$_ && $self->charhex2key($_)
!ll&&!rl&&r
000
MC/DC0%0/2
$_ && $self->charhex2key($_)
$_ $self->charhex2key($_)
Truth table0%0/3
A && B
A= $_B= $self->charhex2key($_)
ABresult
0X0
100
111
11849 0 ▶ length(my $trail_nonprefix = $prefix[-1]) or pop @prefix;
Branch: 1 branch
BranchTrueFalseTotal
length(my $trail_nonprefix = $prefix[-1]) or pop @prefix 0 0 0
11850 0 my $start = shift @prefix;
11851 0 ▶ warn "PrefixChain for `$start' in font `$F' is empty" unless @prefix > 1;
Branch: 1 branch
BranchTrueFalseTotal
unless @prefix > 1 0 0 0
11852 0 for my $Kn (1..$#prefix) {
11853 0 my($from, $to) = @prefix[$Kn-1, $Kn];
11854 0 ▶ $KK{$from}{$start} = [$to, undef, $Kn != $#prefix || !$trail_nonprefix, 'PrefixChains'];
Condition0%0/3
$Kn != $#prefix || !$trail_nonprefix
l!l&&r!l&&!r
000
MC/DC0%0/2
$Kn != $#prefix || !$trail_nonprefix
$Kn != $#prefix !$trail_nonprefix
Truth table0%0/3
A || not(B)
A= $Kn != $#prefixB= !$trail_nonprefix
ABresult
1X1
011
000
11855 }
11856 }
11857 0 ▶ warn "... PrefixChains from(to1,to2) <$F>: ", join '|', map {$_ . '(' . join(',', sort keys %{$KK{$_}}) . ')'} sort keys %KK if keys %KK;
Branch: 1 branch
BranchTrueFalseTotal
if keys %KK 0 0 0
11858 0 for my $K (sort keys %KK) {
11859 0 my $KK = $self->key2hex($K);
11860 0 ▶ die "Key `$KK=$K' in PrefixChain for font=`$F' is not a prefix" unless my $KF = $H->{'[deadkeyFace]'}{$KK};
Branch: 1 branch
BranchTrueFalseTotal
unless my $KF = $H->{"[deadkeyFace]"}{$KK} 0 0 0
11861 0 my $new_facename = "$F*==>*Chain*$KK";
11862 0 my $LL = $H->{'[deadkeyLayers]'}{$KK};
11863 0 warn " patch_face 1" if debug_stacking_ord;
11864 0 $self->patch_face($LL, $new_facename, undef, "chain-in-$KK", $KK{$K}, $F, !'invert');
11865 0 $H->{'[deadkeyFace]'}{$KK} = $new_facename;
11866 0 $H->{'[deadkeyLayers]'}{$KK} = $self->{faces}{$new_facename}{layers};
11867 0 $self->coverage_face0($new_facename, 'after import');
11868 }
11869 }
11870 $self
11871 0 }
11872
11873 0 ▶sub link_composite_layers ($) { # as above, but finish
Subroutine link_composite_layers: not called CC=6 SCAR=37.4
Pod undocumented
11874 0 my ($self, %h, $expl) = (shift);
11875 0 my @F = grep m(^faces(/.*)?$), @{$self->{'[keys]'}};
11876 0 for my $FF (@F) {
11877 0 (my $F = $FF) =~ s(^faces/?)();
11878 0 my(@FF, @HH) = split m(/), $FF;
11879 0 ▶ next if @FF == 1 or $FF[-1] eq 'VK';
Branch: 1 branch
BranchTrueFalseTotal
if @FF == 1 or $FF[-1] eq "VK" 0 0 0
Condition0%0/3
@FF == 1 or $FF[-1] eq "VK"
l!l&&r!l&&!r
000
MC/DC0%0/2
@FF == 1 or $FF[-1] eq "VK"
@FF == 1 $FF[-1] eq "VK"
Truth table0%0/3
A or B
A= @FF == 1B= $FF[-1] eq "VK"
ABresult
1X1
011
000
11880 0 ▶ push(@HH, $self->get_deep($self, @FF)), pop @FF while @FF;
Branch: 1 branch
BranchTrueFalseTotal
@FF and do { push(@HH, $self->get_deep($self, @FF)), pop @FF } 0 0 0
11881 0 my $H = $HH[0];
11882 0 for my $new_facename (sort values %{$H->{'[deadkeyFace]'}}) {
11883 #warn "Joining <$F>, <$new_facename>";
11884 0 $self->link_layers($F, $new_facename, 'skipfix', 'no-slot-warn');
11885 }
11886 }
11887 $self
11888 0 }
11889
11890 0 ▶sub create_inverted_faces ($) {
Subroutine create_inverted_faces: not called CC=19 SCAR=59.4
Pod undocumented
11891 0 my ($self) = (shift);
11892 #Dumpvalue->new()->dumpValue($self);
11893 0 for my $F (sort keys %{$self->{faces} }) {
11894 0 ▶ next if 'HASH' ne ref $self->{faces}{$F} or $F =~ /\bVK$/; # "parent" taking keys for a child
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/ 0 0 0
Condition0%0/3
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
l!l&&r!l&&!r
000
MC/DC0%0/2
"HASH" ne ref $self->{"faces"}{$F} or $F =~ /\bVK$/
"HASH" ne ref $self->{"faces"}{$F} $F =~ /\bVK$/
Truth table0%0/3
A or B
A= "HASH" ne ref $self->{"faces"}{$F}B= $F =~ /\bVK$/
ABresult
1X1
011
000
11895 0 my $H = $self->{faces}{$F};
11896 0 ▶ next unless $H->{'[deadkeyLayers]'}; # Are we in a no-nonsense Face-hash with defined deadkeys?
Branch: 1 branch
BranchTrueFalseTotal
unless $H->{"[deadkeyLayers]"} 0 0 0
11897 0 ▶ my $expl = $H->{'[Explicit_AltGr_Invert]'} || [];
Condition0%0/2
$H->{'[Explicit_AltGr_Invert]'} || []
l!l
00
MC/DC0%0/1
$H->{'[Explicit_AltGr_Invert]'} || []
$H->{'[Explicit_AltGr_Invert]'}
Truth table0%0/2
A
A= $H->{'[Explicit_AltGr_Invert]'}
Aresult
11
00
11898 0 ▶ $expl = [], warn "Odd number of elements of Explicit_AltGr_Invert in face $F, ignore" if @$expl % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @$expl % 2 0 0 0
11899 0 $expl = {map $self->charhex2key($_), @$expl};
11900
11901 #warn "Face: <", join( '> <', %$H), ">";
11902 0 my $layerL = @{ $self->{layers}{ $H->{layers}[0] } }; # number of keys in the face (in the principal layer)
11903 0 for my $KK (sort keys %{$H->{'[deadkeyLayers]'}}) { # Create AltGr-inverted face if there is at least one key in the AltGr face:
11904 0 my $LL = $H->{'[deadkeyLayers]'}{$KK};
11905 # To check that a key is defined, we do not care about whether a shift-state is encoded as a string, or as an array:
11906 0 ▶ next unless defined $H->{'[first_auto_dead]'} and grep defined, map $self->flatten_arrays($_), map $self->{layers}{$_}, @$LL[1..$#$LL];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $H->{"[first_auto_dead]"} and grep defined($_), map($self->flatten_arrays($_), map($self->{"layers"}{$_}, @$LL[1 .. $LL->$#*])) 0 0 0
Condition0%0/3
defined $H->{"[first_auto_dead]"} and grep defined($_), map($self->flatten_arrays($_), map($self->{"layers"}{$_}, @$LL[1 .. $LL->$#*]))
!ll&&!rl&&r
000
MC/DC0%0/2
defined $H->{"[first_auto_dead]"} and grep defined($_), map($self->flatten_arrays($_), map($self->{"layers"}{$_}, @$LL[1 .. $LL->$#*]))
defined $H->{"[first_auto_dead]"} grep defined($_), map($self->flatten_arrays($_), map($self->{"layers"}{$_}, @$LL[1 .. $LL->$#*]))
Truth table0%0/3
A and B
A= defined $H->{"[first_auto_dead]"}B= grep defined($_), map($self->flatten_arrays($_), map($self->{"layers"}{$_}, @$LL[1 .. $LL->$#*]))
ABresult
0X0
100
111
11907 0 ▶ $H->{'[deadkeyInvAltGrKey]'}{''} = $self->next_auto_dead($H) unless exists $H->{'[deadkeyInvAltGrKey]'}{''}; # Prefix key for principal invertred face
Branch: 1 branch
BranchTrueFalseTotal
unless exists $H->{"[deadkeyInvAltGrKey]"}{""} 0 0 0
11908 my $auto_chr = $H->{'[deadkeyInvAltGrKey]'}{$KK} =
11909 0 ▶ ((exists $expl->{$self->charhex2key($KK)}) ? $expl->{$self->charhex2key($KK)} : $self->next_auto_dead($H));
Branch: 1 branch
BranchTrueFalseTotal
exists $$expl{$self->charhex2key($KK)} ? : 0 0 0
11910 0 $H->{'[deadkeyFaceInvAltGr]'}{$auto_chr} = "$F##Inv#$KK";
11911 0 $self->{faces}{ $H->{'[deadkeyFace]'}{$KK} }{'[invAltGr_Accessor]'} = $auto_chr;
11912 }
11913 0 ▶ next unless defined (my $flip_AltGr = $H->{'[Flip_AltGr_Key]'});
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $flip_AltGr = $H->{"[Flip_AltGr_Key]"}) 0 0 0
11914 0 $flip_AltGr = $self->charhex2key($flip_AltGr);
11915 0 ▶ $H->{'[deadkeyFaceInvAltGr]'}{ $H->{'[deadkeyInvAltGrKey]'}{''} } = "$F##Inv#" if exists $H->{'[deadkeyInvAltGrKey]'}{''};
Branch: 1 branch
BranchTrueFalseTotal
if exists $H->{"[deadkeyInvAltGrKey]"}{""} 0 0 0
11916 0 my ($prev, %chain) = '';
11917 0 ▶ for my $k ( @{ $H->{chainAltGr} || [] }) {
Condition0%0/2
$H->{'chainAltGr'} || []
l!l
00
MC/DC0%0/1
$H->{'chainAltGr'} || []
$H->{'chainAltGr'}
Truth table0%0/2
A
A= $H->{'chainAltGr'}
Aresult
11
00
11918 0 my $K = $self->charhex2key($k);
11919 0 my $KK = $self->key2hex($K);
11920 warn("Deadkey ` $K ' of face $F has no associated AltGr-inverted face"), next
11921 0 ▶ unless exists $H->{'[deadkeyInvAltGrKey]'}{$KK};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $H->{"[deadkeyInvAltGrKey]"}{$KK} 0 0 0
11922 0 $chain{$prev} = $H->{'[deadkeyInvAltGrKey]'}{$KK};
11923 #warn "chain `$prev' --> `$K' => $H->{'[deadkeyInvAltGrKey]'}{$KK}";
11924 # $H->{'[dead2_AltGr_chain]'}{(length $prev) ? $self->key2hex($prev) : ''}++;
11925 0 $prev = $K;
11926 }
11927 0 ▶ $H->{'[have_AltGr_chain]'} = 1 if length $prev;
Branch: 1 branch
BranchTrueFalseTotal
if length $prev 0 0 0
11928 0 for my $KK (sort keys %{$H->{'[deadkeyInvAltGrKey]'}}) { # Now know which deadkeys take inversion, and via what prefix
11929 0 my $new = $self->create_inverted_face($F, $KK, \%chain, $flip_AltGr);
11930 0 $self->coverage_face0($new);
11931 }
11932 # We do not link the AltGr-inverted faces to the "parent" faces here. Currently, it should be done when
11933 # outputting a kbd description...
11934 }
11935 $self
11936 0 }
11937
11938 0 ▶sub massage_flat_maps_extra_keys ($) {
Subroutine massage_flat_maps_extra_keys: not called CC=14 SCAR=53.5
Pod undocumented
11939 0 my $self = shift;
11940 0 my @F = grep m(^faces(/.*)?$), @{$self->{'[keys]'}};
11941 0 my (@Fok, @Fok0, @Fnok);
11942 0 for my $FF (@F) {
11943 0 (my $F = $FF) =~ s(^faces/?)();
11944 0 my(@FF, @HH, @FokF) = split m(/), $FF;
11945 0 ▶ next if @FF == 1 or $FF[-1] eq 'VK';
Branch: 1 branch
BranchTrueFalseTotal
if @FF == 1 or $FF[-1] eq "VK" 0 0 0
Condition0%0/3
@FF == 1 or $FF[-1] eq "VK"
l!l&&r!l&&!r
000
MC/DC0%0/2
@FF == 1 or $FF[-1] eq "VK"
@FF == 1 $FF[-1] eq "VK"
Truth table0%0/3
A or B
A= @FF == 1B= $FF[-1] eq "VK"
ABresult
1X1
011
000
11946 0 push @Fok, $F; # Assumed base faces
11947 0 my($H) = $self->get_deep($self, @FF);
11948 0 my $Cov = $H->{'[coverageExtraInclPrefix]'};
11949 ## warn join ',', sort keys %$Cov;
11950 0 for my $inv ('', 'Inv') {
11951 0 for my $dead (sort keys %{$H->{"[FlatPrefixMap$inv]"}}) {
11952 0 my($sk, @c) = ('');
11953 0 for my $cHex (sort keys %{$H->{"[FlatPrefixMap$inv]"}{$dead}}) {
11954 0 my $chr = $self->charhex2key($cHex);
11955 0 my $to = $H->{"[FlatPrefixMap$inv]"}{$dead}{$cHex}; # key (documented)
11956 0 my @to0 = @$to;
11957 0 $to0[0] = $self->key2hex($to->[0]); # hex
11958 0 ▶ $sk .= ",$cHex⇒$to0[0]", next unless $Cov->{$chr};
Branch: 1 branch
BranchTrueFalseTotal
unless $Cov->{$chr} 0 0 0
11959 0 $H->{"[FlatPrefixMapFiltered$inv]"}{$dead}{$cHex} = \@to0;
11960 0 push @c, "$cHex⇒$to0[0]";
11961 0 $H->{"[FlatPrefixMapAccessibleHex]"}{$dead}{$to0[0]} = 1;
11962 }
11963 0 ▶ push @FokF, "$dead$inv⇝ " . join ',', @c if @c;
Branch: 1 branch
BranchTrueFalseTotal
if @c 0 0 0
11964 0 ▶ push @Fnok, "$F→$dead$inv$sk" if length $sk;
Branch: 1 branch
BranchTrueFalseTotal
if length $sk 0 0 0
11965 }
11966 }
11967 0 ▶ push @Fok0, "\t... Flatmap $F:\t@FokF\n" if @FokF;
Branch: 1 branch
BranchTrueFalseTotal
if @FokF 0 0 0
11968 }
11969 0 ▶ warn join '', "\tBase Faces: @Fok\n", @Fok0 if @Fok0 or @Fnok;
Branch: 1 branch
BranchTrueFalseTotal
if @Fok0 or @Fnok 0 0 0
Condition0%0/3
@Fok0 or @Fnok
l!l&&r!l&&!r
000
MC/DC0%0/2
@Fok0 or @Fnok
@Fok0 @Fnok
Truth table0%0/3
A or B
A= @Fok0B= @Fnok
ABresult
1X1
011
000
11970 0 ▶ warn "\t... Flatmaps with no basekey: @Fnok\n" if @Fnok;
Branch: 1 branch
BranchTrueFalseTotal
if @Fnok 0 0 0
11971 0 $self
11972 }
11973
11974 #use Dumpvalue;
11975 0 ▶sub patch_face ($$$$$$$;$) { # flip layers paying attention to linked AltGr-inverted faces, and overrides
Subroutine patch_face: not called CC=19 SCAR=59.4
Pod undocumented
11976 0 my ($self, $LL, $newname, $prefix, $mapId, $Map, $face, $inv, @K) = (shift, shift, shift, shift, shift, shift, shift, shift);
11977 0 ▶ if (%$Map) { # Borrow from make_translated_layer_tr()
Branch: 1 branch
BranchTrueFalseTotal
if (%$Map) 0 0 0
11978 0 ▶ my $Tr = sub ($) { my $c = shift; defined $c or return $c; $c = $c->[0] if ref $c; my $o = $Map->{$c} ;
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
BranchTrueFalseTotal
defined $c or return $c 0 0 0
if ref $c 0 0 0
11979 #warn "Tr: `$c' --> `$o'" if defined $o;
11980 #$o
11981 0 };
11982 0 $Tr = $self->depth1_A_translator($Tr);
11983 0 my $LLL = $self->{faces}{$face}{layers};
11984 0 ▶ my $mod_name = ($inv ? 'AltGr' : '');
Branch: 1 branch
BranchTrueFalseTotal
$inv ? : 0 0 0
11985 0 for my $n (0..$#$LL) { # Layer number
11986 0 my $new_Name = "$face##Chain$mod_name#$n.." . $mapId;
11987 #warn "AltGr-chaining: name=$new_Name; `$chainKey' => `$nextL'";
11988 0 ▶ $self->{layers}{$new_Name} ||= [ map $Tr->($_), @{ $self->{layers}{ $LLL->[$n] } }];
Condition0%0/2
$self->{"layers"}{$new_Name} ||= [map(&$Tr($_), @{$self->{"layers"}{$LLL->[$n]};})]
l!l
00
MC/DC0%0/1
$self->{"layers"}{$new_Name} ||= [map(&$Tr($_), @{$self->{"layers"}{$LLL->[$n]};})]
$self->{"layers"}{$new_Name}
Truth table0%0/2
A
A= $self->{"layers"}{$new_Name}
Aresult
11
00
11989 0 push @K, $new_Name;
11990 }
11991 }
11992 0 ▶ my @prefix = $prefix ? $prefix : ();
Branch: 1 branch
BranchTrueFalseTotal
$prefix ? : 0 0 0
11993 0 my @n1 = (0..$#$LL);
11994 0 ▶ @n1 = map $self->flip_layer_N($_, $#$LL), @n1 if $inv;
Branch: 1 branch
BranchTrueFalseTotal
if $inv 0 0 0
11995 0 my @invLL = @$LL[@n1];
11996 0 ▶ push @prefix, \@K if @K;
Branch: 1 branch
BranchTrueFalseTotal
if @K 0 0 0
11997 0 ▶ if (not $mapId and $inv) { # remove unreachable stuff (as early as possible) to simplify inspection of coverage
Branch: 1 branch
BranchTrueFalseTotal
if (not $mapId and $inv) 0 0 0
Condition0%0/3
not $mapId and $inv
!ll&&!rl&&r
000
MC/DC0%0/2
not $mapId and $inv
not $mapId $inv
Truth table0%0/3
not(A) and B
A= not $mapIdB= $inv
ABresult
0X0
100
111
11998 0 my @oNames = @invLL; @invLL = ();
11999 0 for my $li (0..$#oNames) {
12000 0 my $oname = $oNames[$li];
12001 0 my $nname = "$face##InvStrict$li#" . $oname;
12002 0 $self->{layers}{$nname} = $self->deep_copy($self->{layers}{$oname});
12003 0 push @invLL, $nname;
12004 }
12005 0 my @LLL = map $self->{layers}{$_}, @invLL;
12006 0 for my $k (0..$#{$LLL[0]}) {
12007 0 ▶ if (defined $LLL[0][$k] and defined $LLL[1][$k]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $LLL[0][$k] and defined $LLL[1][$k]) { } 0 0 0
Condition0%0/3
defined $LLL[0][$k] and defined $LLL[1][$k]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $LLL[0][$k] and defined $LLL[1][$k]
defined $LLL[0][$k] defined $LLL[1][$k]
Truth table0%0/3
A and B
A= defined $LLL[0][$k]B= defined $LLL[1][$k]
ABresult
0X0
100
111
12008 0 for my $shft (0, 1) {
12009 0 ▶ unless (defined $LLL[0][$k][$shft] and defined $LLL[1][$k][$shft]) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $LLL[0][$k][$shft] and defined $LLL[1][$k][$shft]) 0 0 0
Condition0%0/3
defined $LLL[0][$k][$shft] and defined $LLL[1][$k][$shft]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $LLL[0][$k][$shft] and defined $LLL[1][$k][$shft]
defined $LLL[0][$k][$shft] defined $LLL[1][$k][$shft]
Truth table0%0/3
A and B
A= defined $LLL[0][$k][$shft]B= defined $LLL[1][$k][$shft]
ABresult
0X0
100
111
12010 0 undef $LLL[$_][$k][$shft] for 0, 1;
12011 }
12012 }
12013 } else {
12014 0 $LLL[$_][$k] = [] for 0, 1;
12015 }
12016 }
12017 }
12018 0 my @p;
12019 0 (@p = map "<@$_>", @prefix), warn " mk_tr_lyrs_st 2 (((@p)))\t[[[@invLL]]]" if debug_stacking_ord;
12020 0 $self->{faces}{$newname}{layers} = [$self->make_translated_layers_stack(@prefix, \@invLL)];
12021 }
12022
12023 # use Dumpvalue;
12024 1 my %subst_Shift = qw( -- - -S S t- t tS T ); # There is no space for 8 MODs, so we contract tS into T
12025 0 ▶sub fmt_bitmap_mods ($$$;$) {
Subroutine fmt_bitmap_mods: not called CC=6 SCAR=37.4
Pod undocumented
12026 0 my ($self, $b, $col, $short, @b) = (shift, shift, shift, shift, qw(Shift Ctrl Alt Kana Roya Loya Z t));
12027 0 ▶ my ($j, $empty, @ind) = ($short ? ('', '-', 1..$#b, 0) : ("\t", '', 0..$#b)); # better have Shift at end (Ctrl-Alt-Shift)...
Branch: 1 branch
BranchTrueFalseTotal
$short ? : 0 0 0
12028 0 ▶ my $O = join $j, map {($b & (1<<$_)) ? ($short ? substr $b[$_], 0, 1 : $b[$_]) : $empty} @ind;
Branch: 2 branches
BranchTrueFalseTotal
$b & 1 << $_ ? : 0 0 0
$short ? : 0 0 0
12029 0 ▶ $O =~ s/(..)$/$subst_Shift{$1}/ if $short;
Branch: 1 branch
BranchTrueFalseTotal
if $short 0 0 0
12030 0 $O =~ s/\t+$//;
12031 0 ▶ $O = 'Invalid' if $col == 15;
Branch: 1 branch
BranchTrueFalseTotal
if $col == 15 0 0 0
12032 0 $O
12033 }
12034
12035 0 ▶sub Base_VK_names ($$) { # returns array of VK_-names: default names (based on BaseLayer), f-key names, or those from .../VK
Subroutine Base_VK_names: not called CC=21 SCAR=61.4
Pod undocumented
12036 0 my($self, $K) = (shift, shift); # name is undef if this is a “fake” position
12037 0 my $F = $self->get_deep($self, @$K); # Presumably a face hash, as in $K = [qw(faces US)]
12038 0 ▶ return $F->{baseKeysWin} if $F->{baseKeysWin};
Branch: 1 branch
BranchTrueFalseTotal
if $F->{"baseKeysWin"} 0 0 0
12039 0 my $cnt = $F->{'[non_VK]'};
12040 0 my $b = $F->{BaseLayer};
12041 0 my $layers = $F->{layers};
12042 0 warn " mk_tr_lyrs 8" if debug_stacking_ord;
12043 0 ▶ $b = $self->make_translated_layers($b, $K->[-1], [0])->[0] if defined $b and not $self->{layers}{$b};
Branch: 1 branch
BranchTrueFalseTotal
if defined $b and not $self->{"layers"}{$b} 0 0 0
Condition0%0/3
defined $b and not $self->{"layers"}{$b}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $b and not $self->{"layers"}{$b}
defined $b not $self->{"layers"}{$b}
Truth table0%0/3
A and not(B)
A= defined $bB= not $self->{"layers"}{$b}
ABresult
0X0
100
111
12044 0 ▶ my $basesub = [((defined $b) ? $b : ()), $F->{layers}[0]];
Branch: 1 branch
BranchTrueFalseTotal
defined $b ? : 0 0 0
12045 0 my $max = -1;
12046 0 ▶ $max < $#{$self->{layers}{$_}} and $max = $#{$self->{layers}{$_}} for @$basesub;
Branch: 1 branch
BranchTrueFalseTotal
$max < $#{$$self{"layers"}{$_};} and $max = $#{$$self{"layers"}{$_};} 0 0 0
12047 0 ▶ $max < $_->[0] + $_->[1] - 1 and $max = $_->[0] + $_->[1] - 1 for values %start_SEC;
Branch: 1 branch
BranchTrueFalseTotal
$max < $_->[0] + $_->[1] - 1 and $max = $_->[0] + $_->[1] - 1 0 0 0
12048 0 ▶ $max >= $LAST_SEC and $max = $LAST_SEC - 1; # Avoid fake keys
Branch: 1 branch
BranchTrueFalseTotal
$max >= $LAST_SEC and $max = $LAST_SEC - 1 0 0 0
12049 # warn "Basekeys: max=$max; cnt=$cnt";
12050 0 my(@o, @oo);
12051 #
12052 # warn("base: max=$max cnt=$cnt");
12053 0 for my $u (0..$max) {
12054 0 my $c = $self->base_unit($basesub, $u, $u >= $cnt); # [0 || 1 (!in_main_island), VK, raw]
12055 0 my($k, $kk) = ($c->[1], $c->[2]); # uc(With appended #), orig (or undef if not array)
12056 0 ▶ if (!$c->[0]) { # Main island of keyboard
Branch: 1 branch
BranchTrueFalseTotal
if (not $c->[0]) { } 0 0 0
12057 0 ▶ $k = $oem_keys{$k} or warn("Can't find a key with VKEY `[@$c]', unit=$u, lim=$cnt", (defined $k and " k=<<$k>>")), return
Branch: 1 branch
BranchTrueFalseTotal
unless $k =~ /^[A-Z0-9]$/ 0 0 0
Condition0%0/8
$k =~ /^[A-Z0-9]$/ || (($k = $oem_keys{$k}) || (warn("Can't find a key with VKEY `[@$c]', unit=$u, lim=$cnt", defined $k && " k=<<$k>>"), return))
l!l&&r!l&&!r
000
$k = $oem_keys{$k} or warn("Can't find a key with VKEY `[@$c]', unit=$u, lim=$cnt", defined $k && " k=<<$k>>"), return
l!l&&r!l&&!r
000
defined $k && " k=<<$k>>"
!ll
00
MC/DC0%0/3
$k =~ /^[A-Z0-9]$/ || (($k = $oem_keys{$k}) || (warn("Can't find a key with VKEY `[@$c]', unit=$u, lim=$cnt", defined $k && " k=<<$k>>"), return))
$k =~ /^[A-Z0-9]$/ $k = $oem_keys{$k} warn("Can't find a key with VKEY `[@$c]', unit=$u, lim=$cnt", defined $k && " k=<<$k>>"), return
MC/DC0%0/1
defined $k && " k=<<$k>>"
defined $k
Truth table0%0/4
A || B or C
A= $k =~ /^[A-Z0-9]$/B= $k = $oem_keys{$k}C= warn("Can't find a key with VKEY `[@$c]', unit=$u, lim=$cnt", defined $k && " k=<<$k>>"), return
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/2
A
A= defined $k
Aresult
00
11
12058 unless $k =~ /^[A-Z0-9]$/;
12059 } else {
12060 0 my $U = [map $self->{layers}{$_}[$u], @$layers];
12061 0 my $keys = grep defined, map $self->flatten_arrays($_->[$u]), @$U;
12062 0 ▶ $keys and warn "Can't find the range of keys to which unit `$u' belongs (max=$max; cnt=$cnt)" unless defined $k;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k 0 0 0
Condition0%0/5
defined $k || $keys && warn("Can't find the range of keys to which unit `${u}' belongs (max=$max; cnt=$cnt)")
l!l&&r!l&&!r
000
$keys and warn "Can't find the range of keys to which unit `${u}' belongs (max=$max; cnt=$cnt)"
!ll
00
MC/DC0%0/2
defined $k || $keys && warn("Can't find the range of keys to which unit `${u}' belongs (max=$max; cnt=$cnt)")
defined $k $keys
Truth table0%0/3
A || B
A= defined $kB= $keys
ABresult
1X1
011
000
12063 0 $kk = $k;
12064 }
12065 0 push @o, $k;
12066 0 push @oo, $kk;
12067 }
12068 0 my $o = $F->{'[VK_off]'};
12069 0 for my $b (\@o, \@oo) { # Fill the VK names assigned in “layoutName”/VK section
12070 0 for my $vk (keys %$o) {
12071 0 ▶ warn "[@$K]: $vk defined on \@$o->{$vk} as $b->[$o->{$vk}]" if defined $b->[$o->{$vk}];
Branch: 1 branch
BranchTrueFalseTotal
if defined $$b[$o->{$vk}] 0 0 0
12072 0 ▶ $b->[$o->{$vk}] = $vk unless defined $b->[$o->{$vk}];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$b[$o->{$vk}] 0 0 0
12073 # warn "[@$K]: $vk \@ $o->{$vk}"; # SPACE @ 116 (on izKeys)
12074 }
12075 }
12076 # warn "BaseKeys: @o";
12077 0 $F->{baseKeysRaw} = \@oo;
12078 0 $F->{baseKeysWin} = \@o;
12079 }
12080
12081
12082 0 ▶sub fill_win_template ($$$;$$) {
Subroutine fill_win_template: not called CC=54 SCAR=80.0
Pod undocumented
12083 0 my @K = qw( COMPANYNAME LAYOUTNAME COPYR_YEARS LOCALE_NAME LOCALE_ID DLLNAME SORT_ORDER_ID_ LANGUAGE_NAME );
12084 0 my ($self, $t, $k, $dummy, $dummyDscr, %h) = (shift, shift, shift, shift, shift);
12085 0 $self->reset_units;
12086 0 my $B = $self->Base_VK_names($k);
12087 # Dumpvalue->new()->dumpValue($self);
12088 0 my $idx = $self->get_deep($self, @$k, 'MetaData_Index');
12089 0 $h{$_} = $self->get_deep_via_parents($self, $idx, @$k, $_) for @K;
12090 0 ▶ $h{LAYOUTNAME} = "KBD Layout $h{DLLNAME}" if $dummyDscr; # error "the required resource DATABASE is missing" from setup.exe
Branch: 1 branch
BranchTrueFalseTotal
if $dummyDscr 0 0 0
12091 0 my $LLL = length($h{LAYOUTNAME}) + grep ord >= 0x10000, split //, $h{LAYOUTNAME};
12092 0 ▶ warn "The DESCRIPTION of the layout [@$k] is longer than 63 chars;\n the name shown in LanguageBar/Settings may be empty"
Branch: 1 branch
BranchTrueFalseTotal
if $LLL > 63 0 0 0
12093 if $LLL > 63;
12094 0 $h{LAYOUTNAME} =~ s/([\\""])/\\$1/g; # C-like syntax (directly copied to resource files???)
12095 # warn "Translate: ", %h;
12096 0 my $F = $self->get_deep($self, @$k); # Presumably a face hash, as in $k = [qw(faces US)]
12097 0 $F->{'[dead-used]'} = [map {}, @{$F->{layers}}]; # Which of deadkeys are reachable on the keyboard
12098 0 my $cnt = $F->{'[non_VK]'};
12099 0 ▶ if (grep $F->{"[$_]"}, qw(LRM_RLM ALTGR SHIFTLOCK NOALTGR)) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep $$F{"[$_]"}, ('LRM_RLM', 'ALTGR', 'SHIFTLOCK', 'NOALTGR')) { } 0 0 0
12100 0 $h{ATTRIBS} = (join "\n ", "\nATTRIBUTES", grep $F->{"[$_]"}, qw(LRM_RLM ALTGR SHIFTLOCK NOALTGR)) . "\n" ;
12101 } else {
12102 0 $h{ATTRIBS} = ''; # default
12103 }
12104 0 ▶ if ($dummy) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dummy) { } 0 0 0
12105 0 @h{qw(DO_LIGA COL_HEADERS COL_EXPL KEYNAMES_DEAD DEADKEYS MODIFIERS)} = ('') x 6;
12106 0 @h{qw(LAYOUT_KEYS BITS_TEMPLATE)} = (<<EOT, <<EOT);
12107 10 Q 0 q -1 -1 // LATIN SMALL LETTER Q, <none>, <none>
12108 EOT
12109 0 // Column 4 :
12110 1 // Column 5 : Shift
12111 2 // Column 6 : Ctrl
12112 3 // Column 7 : Shift Ctrl
12113 6 // Column 12 : Ctrl Alt t
12114 7 // Column 13 : Shift Ctrl Alt t
12115 EOT
12116 } else {
12117 0 $h{LAYOUT_KEYS} = join '', $self->output_layout_win($k->[-1], $F->{layers}, $F->{'[dead]'}, $F->{'[dead-used]'}, $cnt, $B);
12118 # $h{LAYOUT_KEYS} .= join '', $self->output_VK_win($k->[-1], $F->{'[dead-used]'});
12119 0 $h{LAYOUT_KEYS} .= join '', $self->output_added_units();
12120
12121 0 $h{DO_LIGA} = join '', $self->output_ligatures();
12122 0 ▶ $h{DO_LIGA} = <<EOPREF . "$h{DO_LIGA}\n" if $h{DO_LIGA};
Branch: 1 branch
BranchTrueFalseTotal
if $h{"DO_LIGA"} 0 0 0
12123
12124 LIGATURE
12125
12126 // VK_ ModCol# Char0 Char1 Char2 Char3
12127 // --------- ------- ----- ----- ----- -----
12128
12129
12130 EOPREF
12131
12132 ### Deadkeys??? need_extra_keys_to_access???
12133 0 my ($OUT, $OUT_NAMES) = ('', "KEYNAME_DEAD\n\n");
12134
12135 0 my $f = $self->get_AgeList;
12136 0 ▶ $self->load_uniage($f) if defined $f and not $self->{Age};
Branch: 1 branch
BranchTrueFalseTotal
if defined $f and not $self->{"Age"} 0 0 0
Condition0%0/3
defined $f and not $self->{"Age"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $f and not $self->{"Age"}
defined $f not $self->{"Age"}
Truth table0%0/3
A and not(B)
A= defined $fB= not $self->{"Age"}
ABresult
0X0
100
111
12137
12138 0 my($flip_AltGr_hex, %nn) = $F->{'[Flip_AltGr_Key]'};
12139 0 ▶ $flip_AltGr_hex = $self->key2hex($self->charhex2key($flip_AltGr_hex)) if defined $flip_AltGr_hex;
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr_hex 0 0 0
12140 0 for my $deadKey ( sort keys %{ $F->{'[deadkeyFaceHexMap]'} } ) {
12141 0 ▶ next if $F->{'[only_extra]'}{$self->charhex2key($deadKey)};
Branch: 1 branch
BranchTrueFalseTotal
if $F->{"[only_extra]"}{$self->charhex2key($deadKey)} 0 0 0
12142 0 my $auto_inv_AltGr = $F->{'[deadkeyInvAltGrKey]'}{$deadKey};
12143 0 ▶ $auto_inv_AltGr = $self->key2hex($auto_inv_AltGr) if defined $auto_inv_AltGr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $auto_inv_AltGr 0 0 0
12144 #warn "flipkey=$flip_AltGr_hex, dead=$deadKey" if defined $flip_AltGr_hex;
12145 0 (my $nonempty, my $MAP) = $self->output_deadkeys($k->[-1], $deadKey, $F->{'[dead2]'}, $flip_AltGr_hex, $auto_inv_AltGr);
12146 0 $OUT .= "$MAP\n";
12147 0 ▶ my @K = ($deadKey, ($auto_inv_AltGr ? $auto_inv_AltGr : ()));
Branch: 1 branch
BranchTrueFalseTotal
$auto_inv_AltGr ? : 0 0 0
12148 0 ▶ my @N = map $self->{DEADKEYS}{$_} || $self->{'[seen_knames]'}{chr hex $_} || $F->{'[prefixDocs]'}{$_} || $self->UName($_), @K;
Condition0%0/9
$self->{'DEADKEYS'}{$_} || $self->{'[seen_knames]'}{&UI::KeyboardLayout::chr(hex $_)} || $F->{'[prefixDocs]'}{$_} || $self->UName($_)
l!l&&r!l&&!r
000
$self->{"DEADKEYS"}{$_} or $self->{"[seen_knames]"}{&UI::KeyboardLayout::chr(hex $_)} or $F->{"[prefixDocs]"}{$_}
l!l&&r!l&&!r
000
$self->{"DEADKEYS"}{$_} or $self->{"[seen_knames]"}{&UI::KeyboardLayout::chr(hex $_)}
l!l&&r!l&&!r
000
MC/DC0%0/4
$self->{'DEADKEYS'}{$_} || $self->{'[seen_knames]'}{&UI::KeyboardLayout::chr(hex $_)} || $F->{'[prefixDocs]'}{$_} || $self->UName($_)
$self->{"DEADKEYS"}{$_} $self->{"[seen_knames]"}{&UI::KeyboardLayout::chr(hex $_)} $F->{"[prefixDocs]"}{$_} $self->UName($_)
Truth table0%0/5
A or B or C || D
A= $self->{"DEADKEYS"}{$_}B= $self->{"[seen_knames]"}{&UI::KeyboardLayout::chr(hex $_)}C= $F->{"[prefixDocs]"}{$_}D= $self->UName($_)
ABCDresult
1XXX1
01XX1
001X1
00011
00000
12149 0 s/(?=[""\\])/\\/g for @N;
12150 # if (defined $N and length $N) {
12151 0 $nn{$K[$_]} = $N[$_] for 0..$#K;
12152 # }# else { warn "DeadKey `$deadKey' for face `@$k' has no name associated" }
12153 }
12154 # Apparently, if the DLL is too large (e.g., name table is too long), the keyboard is not activatable (installs OK on Win7_64,
12155 # is in Settings' list, but is not in the panel's list). Omit the multiple-Compose entries as a workaround...
12156 0 my $emitREX = $F->{'[WindowsEmitDeadkeyDescrREX]'};
12157 # warn "!!! emitREX=<<<$emitREX>>>\n" if $emitREX;
12158 0 ▶ defined $emitREX or $emitREX = ''; # Default: always emit
Branch: 1 branch
BranchTrueFalseTotal
defined $emitREX or $emitREX = "" 0 0 0
12159 0 $emitREX = qr($emitREX);
12160 0 ▶ $nn{$_} =~ $emitREX and $OUT_NAMES .= qq($_\t"$nn{$_}"\n) for sort keys %nn;
Branch: 1 branch
BranchTrueFalseTotal
$nn{$_} =~ /$emitREX/ and $OUT_NAMES .= qq[$_\t"$nn{$_}"\n] 0 0 0
12161 #warn "Translate: ", %h;
12162 0 $h{DEADKEYS} = $OUT;
12163 0 $h{KEYNAMES_DEAD} = $OUT_NAMES;
12164 0 my %modsF = qw( SHIFT 1 CTRL 2 ALT 4 KANA 8 X 16 Y 32 Z 64 T 128 U 256 V 512 W 1024 ROYA 16 LOYA 32 GRPSELTAP 128 );
12165 0 my %mods = map {(substr($_,0, 1), $modsF{$_})} keys %modsF;
12166 0 ▶ my(%mfFULL, $mks) = map {(substr($_,0, 1), length > 1 ? $_ : "_$_")} keys %modsF;
Branch: 1 branch
BranchTrueFalseTotal
length $_ > 1 ? : 0 0 0
12167 0 ▶ if (@{ $mks = $F->{'[mods_keys_KBD]'} }) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$mks = $F->{"[mods_keys_KBD]"};}) 0 0 0
12168 0 my($cmmnt, %mks) = ('', @$mks);
12169 0 ▶ if ($mks{lC} and $mks{rA} and not $F->{"[NOALTGR]"}) { # Strip common-with-lC bits from rA
Branch: 1 branch
BranchTrueFalseTotal
if ($mks{"lC"} and $mks{"rA"} and not $F->{"[NOALTGR]"}) 0 0 0
Condition0%0/6
$mks{"lC"} and $mks{"rA"} and not $F->{"[NOALTGR]"}
!ll&&!rl&&r
000
$mks{"lC"} and $mks{"rA"}
!ll&&!rl&&r
000
MC/DC0%0/3
$mks{"lC"} and $mks{"rA"} and not $F->{"[NOALTGR]"}
$mks{"lC"} $mks{"rA"} not $F->{"[NOALTGR]"}
Truth table0%0/4
A and B and not(C)
A= $mks{"lC"}B= $mks{"rA"}C= not $F->{"[NOALTGR]"}
ABCresult
0XX0
10X0
1100
1111
12170 0 if (1) { # See the section: Windows combines modifier bitmaps for C<lCtrl>, C<Alt> and C<rAlt> on C<AltGr>
12171 0 $cmmnt = "\t// With KLLF_ALTGR, this is combined not only with MENU, but also with LCONTROL and CONTROL"; # if $out ne $mks{rA};
12172 } else {
12173 my %seen = map {($_, 1)} split //, $mks{lC};
12174 my $out = join '', grep !$seen{$_}, split //, $mks{rA};
12175 $cmmnt = "\t// With KLLF_ALTGR, this is combined with LCONTROL and CONTROL; stripped $mks{rA} -> $out" if $out ne $mks{rA};
12176 $mks{rA} = $out;
12177 }
12178 }
12179 0 $h{MODIFIERS} = "MODIFIERS\n";
12180 0 ▶ my %vk = (qw(S SHIFT C CONTROL A MENU), @{$F->{'[modkeys_vk]'} || []});
Condition0%0/2
$F->{'[modkeys_vk]'} || []
l!l
00
MC/DC0%0/1
$F->{'[modkeys_vk]'} || []
$F->{'[modkeys_vk]'}
Truth table0%0/2
A
A= $F->{'[modkeys_vk]'}
Aresult
11
00
12181 0 ▶ (my $vkRX = join '', keys %vk) =~ /\W/ and die 'Non-letter in @modkeys_vk = (' . join(" ", sort keys %vk) . ')'; # XXX Needed???
Branch: 1 branch
BranchTrueFalseTotal
(my $vkRX = join("", keys %vk)) =~ /\W/ and die 'Non-letter in @modkeys_vk = (' . join(" ", sort(keys %vk)) . ')' 0 0 0
12182 0 for my $K (sort keys %mks) { # ??? Need to take into account @modkeys_vk XXX
12183 0 ▶ my($preK, $KK, $c) = ($K =~ /^([lr]?)([$vkRX])$/) or die "Unexpected key <<<$K>>> of mods_keys_KBD"; # [ACKLR-Z]
Branch: 1 branch
BranchTrueFalseTotal
() = $K =~ /^([lr]?)([$vkRX])$/ or die "Unexpected key <<<$K>>> of mods_keys_KBD" 0 0 0
12184 0 ▶ $c = $cmmnt if $K eq 'rA';
Branch: 1 branch
BranchTrueFalseTotal
if $K eq "rA" 0 0 0
12185 0 ▶ $c ||= '';
Condition0%0/2
$c ||= ""
l!l
00
MC/DC0%0/1
$c ||= ""
$c
Truth table0%0/2
A
A= $c
Aresult
11
00
12186 0 ▶ $h{MODIFIERS} .= " \U$preK\E$vk{$KK}\tKBD" . join(' | KBD', map "$mfFULL{$_}", split //, $mks{$K}) . ($c || '') . "\n";
Condition0%0/2
$c || ''
l!l
00
MC/DC0%0/1
$c || ''
$c
Truth table0%0/2
A
A= $c
Aresult
11
00
12187 }
12188 0 $h{MODIFIERS} .= "\n" ;
12189 }
12190 0 $_ += 0 for values %mods; # Convert to numbers, so | works as expected
12191 0 my @cols;
12192 0 ▶ my %tr_mods_keys = ( @{ $F->{'[mods_keys_KBD]'} || (@{$F->{layers}} > 1 ? [qw(rA CA)] : [] ) } );
Branch: 1 branch
BranchTrueFalseTotal
@{$F->{'layers'};} > 1 ? : 0 0 0
Condition0%0/3
$F->{'[mods_keys_KBD]'} || (@{$F->{'layers'};} > 1 ? ['rA', 'CA'] : [])
l!l&&r!l&&!r
000
MC/DC0%0/2
$F->{'[mods_keys_KBD]'} || (@{$F->{'layers'};} > 1 ? ['rA', 'CA'] : [])
$F->{'[mods_keys_KBD]'} (@{$F->{'layers'};} > 1 ? ['rA', 'CA'] : [])
Truth table0%0/3
A || B
A= $F->{'[mods_keys_KBD]'}B= (@{$F->{'layers'};} > 1 ? ['rA', 'CA'] : [])
ABresult
1X1
011
000
12193 0 ▶ my $mods_keys = $F->{'[layers_mods_keys]'} || (@{$F->{layers}} > 1 ? ['', 'rA'] : ['']);
Branch: 1 branch
BranchTrueFalseTotal
@{$F->{'layers'};} > 1 ? : 0 0 0
Condition0%0/3
$F->{'[layers_mods_keys]'} || (@{$F->{'layers'};} > 1 ? ['', 'rA'] : [''])
l!l&&r!l&&!r
000
MC/DC0%0/2
$F->{'[layers_mods_keys]'} || (@{$F->{'layers'};} > 1 ? ['', 'rA'] : [''])
$F->{'[layers_mods_keys]'} (@{$F->{'layers'};} > 1 ? ['', 'rA'] : [''])
Truth table0%0/3
A || B
A= $F->{'[layers_mods_keys]'}B= (@{$F->{'layers'};} > 1 ? ['', 'rA'] : [''])
ABresult
1X1
011
000
12194 0 ▶ my $mods = $F->{'[layers_modifiers]'} || []; # || ['', 'CA']; # Plain, and Control-Alt (Obsolete variant)
Condition0%0/2
$F->{'[layers_modifiers]'} || []
l!l
00
MC/DC0%0/1
$F->{'[layers_modifiers]'} || []
$F->{'[layers_modifiers]'}
Truth table0%0/2
A
A= $F->{'[layers_modifiers]'}
Aresult
11
00
12195 0 my @hCols = map {my $in = $_; $in =~ s/rC/Ⓒ/; $in =~ s/rA/Ⓐ/; $in =~ s/l(?=CA)//g; $in } @$mods_keys; # human-readable ⒸⒶ ⇒ right
12196 0 ▶ $#$mods = $#$mods_keys if $#$mods < $#$mods_keys;
Branch: 1 branch
BranchTrueFalseTotal
if $mods->$#* < $mods_keys->$#* 0 0 0
12197 0 for my $MOD ( @$mods ) {
12198 0 my $mask = 0;
12199 0 ▶ my $mod = ((defined $MOD) ? $MOD : ''); # Copy
Branch: 1 branch
BranchTrueFalseTotal
defined $MOD ? : 0 0 0
12200 0 ▶ unless ($mod =~ /\S/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mod =~ /\S/) 0 0 0
12201 0 my @K = grep /./, split /(?<=[A-Z])(?=[rl]?[A-Z])/, $mods_keys->[scalar @cols];
12202 #warn "cols=(@cols), K=(@K)\n";
12203 0 $mod = join '', map $tr_mods_keys{$_}, @K;
12204 }
12205 0 $mask |= $mods{$_} for split //, $mod;
12206 0 push @cols, $mask;
12207 }
12208 0 @cols = map {($_, $_ | $mods{S})} @cols; # Add shift
12209 0 @hCols = map {($_, "${_}S")} @hCols; # Add shift
12210
12211 0 ▶ my($ctrl_f,$ctrl_F) = ($mods{C}, $tr_mods_keys{lC} || $tr_mods_keys{C} || $tr_mods_keys{rC} || 'C'); # Prefer left-Ctrl
Condition0%0/8
$tr_mods_keys{'lC'} || $tr_mods_keys{'C'} || $tr_mods_keys{'rC'} || 'C'
l!l
00
$tr_mods_keys{"lC"} or $tr_mods_keys{"C"} or $tr_mods_keys{"rC"}
l!l&&r!l&&!r
000
$tr_mods_keys{"lC"} or $tr_mods_keys{"C"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$tr_mods_keys{'lC'} || $tr_mods_keys{'C'} || $tr_mods_keys{'rC'} || 'C'
$tr_mods_keys{"lC"} $tr_mods_keys{"C"} $tr_mods_keys{"rC"}
Truth table0%0/4
A or B or C
A= $tr_mods_keys{"lC"}B= $tr_mods_keys{"C"}C= $tr_mods_keys{"rC"}
ABCresult
1XX1
01X1
0011
0000
12212 # $ctrl_f |= $mods{$_} for split //, $ctrl_F; # kbdutool complains if there is no column for 'C'
12213
12214 0 my $pre_ctrl = $self->get_deep($self, @$k, '[ctrl_after_modcol]');
12215 0 ▶ $pre_ctrl = 2*$ctrl_after unless defined $pre_ctrl;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pre_ctrl 0 0 0
12216 0 my $create_a_c = $self->get_deep($self, @$k, '[create_alpha_ctrl]');
12217 0 ▶ $create_a_c = $create_alpha_ctrl unless defined $create_a_c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $create_a_c 0 0 0
12218 0 ▶ splice @cols, $pre_ctrl, 0, $ctrl_f, ($create_a_c>1 ? $ctrl_f|$mods{S} : ()); # Control (and maybe Control-Shift)
Branch: 1 branch
BranchTrueFalseTotal
$create_a_c > 1 ? : 0 0 0
12219 0 ▶ splice @hCols, $pre_ctrl, 0, "C", ($create_a_c>1 ? "CS" : ()); # Control (and maybe Control-Shift)
Branch: 1 branch
BranchTrueFalseTotal
$create_a_c > 1 ? : 0 0 0
12220 0 ▶ splice @cols, 15, 0, $mods{A} if @cols >= 16; # col=15 is the fake one; assigning it to Alt is the best palliative to fixing MSKLC
Branch: 1 branch
BranchTrueFalseTotal
if @cols >= 16 0 0 0
12221 0 ▶ splice @hCols, 15, 0, 'Invalid' if @cols >= 16; # due to KBDALT stripping, the column for Alt is not reachable anyway
Branch: 1 branch
BranchTrueFalseTotal
if @cols >= 16 0 0 0
12222 0 $h{COL_HEADERS} = join "\t", map sprintf('%-3d[%d]', $cols[$_], $_), 0..$#cols;
12223 0 $h{COL_EXPL} = join "\t", map $self->fmt_bitmap_mods($cols[$_], $_, 'short'), 0..$#cols;
12224 0 $h{COL_HUMAN} = join "\t", map $hCols[$_], 0..$#cols;
12225 0 $h{BITS_TEMPLATE} = join "\n", map { "$cols[$_]\t// Column " . (4+$_) . " :\t" . $self->fmt_bitmap_mods($cols[$_], $_) } 0..$#cols;
12226 # $h{BITS_TEMPLATE} =~ s(^(?=.*\bInvalid$))(#)m; # XXX Actually, MSKLC is not ignoring the leading #
12227 0 $h{UIKL_VERSION} = $VERSION;
12228 }
12229 0 $self->massage_template($template_win, \%h);
12230 }
12231
12232 sub AppleMap_i_j ($$$$$;$$$$);
12233 sub AppleMap_prefix ($$;$$$$$$);
12234
12235 # https://developer.apple.com/library/mac/technotes/tn2056/_index.html
12236 0 ▶sub fill_osx_template ($$) {
Subroutine fill_osx_template: not called CC=24 SCAR=64.0
Pod undocumented
12237 0 my @K = qw( OSX_LAYOUTNAME LAYOUTNAME OSX_ID OSX_ADD_VERSION OSX_DUP_KEYS COPYR_YEARS COMPANYNAME );
12238 0 my ($self, $k, %h, %ids) = (shift, shift);
12239 0 $self->reset_units;
12240 0 my $B = $self->Base_VK_names($k);
12241 # Dumpvalue->new()->dumpValue($self);
12242 0 my $idx = $self->get_deep($self, @$k, 'MetaData_Index');
12243 0 $h{$_} = $self->get_deep_via_parents($self, $idx, @$k, $_) for @K;
12244
12245 0 ▶ $h{OSX_LAYOUTNAME} ||= $h{LAYOUTNAME};
Condition0%0/3
$h{"OSX_LAYOUTNAME"} ||= $h{"LAYOUTNAME"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$h{"OSX_LAYOUTNAME"} ||= $h{"LAYOUTNAME"}
$h{"OSX_LAYOUTNAME"} $h{"LAYOUTNAME"}
Truth table0%0/3
A ||= B
A= $h{"OSX_LAYOUTNAME"}B= $h{"LAYOUTNAME"}
ABresult
1X1
011
000
12246 0 delete $h{LAYOUTNAME};
12247 0 ▶ $h{OSX_ID} = -17 unless defined $h{OSX_ID}; # (Arbitrary) Negative number
Branch: 1 branch
BranchTrueFalseTotal
unless defined $h{"OSX_ID"} 0 0 0
12248 0 my $v = $self->{VERSION};
12249 0 ▶ if (defined $v and defined $h{OSX_ADD_VERSION}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $v and defined $h{"OSX_ADD_VERSION"}) 0 0 0
Condition0%0/3
defined $v and defined $h{"OSX_ADD_VERSION"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $v and defined $h{"OSX_ADD_VERSION"}
defined $v defined $h{"OSX_ADD_VERSION"}
Truth table0%0/3
A and B
A= defined $vB= defined $h{"OSX_ADD_VERSION"}
ABresult
0X0
100
111
12250 0 ▶ if ($h{OSX_ADD_VERSION} > 0) {
Branch: 3 branches
BranchTrueFalseTotal
if ($h{'OSX_ADD_VERSION'} > 0) { } 0 0 0
elsif ($h{'OSX_ADD_VERSION'} < -1) { } 0 0 0
elsif ($h{'OSX_ADD_VERSION'} == -1) { } 0 0 0
12251 0 my $c = $h{OSX_ADD_VERSION} - 1;
12252 0 $h{OSX_LAYOUTNAME} =~ s/^(\s*(\S+($|\s+)){$c}\S+)(?!\S)/$1 v$v/;
12253 } elsif ($h{OSX_ADD_VERSION} < -1) {
12254 0 my $c = -$h{OSX_ADD_VERSION} - 2;
12255 0 $h{OSX_LAYOUTNAME} =~ s/((?<!\S)\S+((^|\s+)\S+){$c}\s*)\z/v$v $1/;
12256 } elsif ($h{OSX_ADD_VERSION} == -1) {
12257 0 $h{OSX_LAYOUTNAME} =~ s/\z/ v$v/;
12258 } else {
12259 0 $h{OSX_LAYOUTNAME} =~ s/^/v$v /;
12260 }
12261 }
12262 0 delete $h{OSX_ADD_VERSION};
12263 0 my $dupk = delete $h{OSX_DUP_KEYS};
12264 0 ▶ $dupk = {@$dupk} if $dupk;
Branch: 1 branch
BranchTrueFalseTotal
if $dupk 0 0 0
12265
12266 # OSX_CREATOR version OSX_CREATOR_VERSION on OSX_EDIT_DATE
12267 0 my $file = $self->{'[file]'};
12268 0 ▶ my $app = (defined $file and @$file > 1 and 's');
Condition0%0/5
defined $file && @$file > 1 && 's'
!ll
00
defined $file and @$file > 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $file && @$file > 1 && 's'
defined $file @$file > 1
Truth table0%0/3
A and B
A= defined $fileB= @$file > 1
ABresult
0X0
100
111
12269 0 ▶ $file = (defined $file) ? "keyboard layout file$app @$file" : 'string descriptor';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 0 0 0
12270 0 ▶ $file .= " version $v" if defined $v;
Branch: 1 branch
BranchTrueFalseTotal
if defined $v 0 0 0
12271 0 ▶ $file .= " Unicode tables version $self->{uniVersion}" if defined $self->{uniVersion};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"uniVersion"} 0 0 0
12272 0 $h{OSX_CREATOR} = "UI::KeyboardLayout";
12273 0 $h{OSX_CREATOR_VERSION} = "$UI::KeyboardLayout::VERSION with $file";
12274 0 my @t = (gmtime)[5,4,3,2,1,0];
12275 0 $t[0] += 1900; $t[1]++;
12276 0 $h{OSX_EDIT_DATE} = sprintf '%d-%02d-%02d at %d:%02d:%02d GMT', @t;
12277
12278 0 my $F = $self->get_deep($self, @$k);
12279 0 my($flip_AltGr_hex, %nn) = $F->{'[Flip_AltGr_Key]'};
12280 0 ▶ $flip_AltGr_hex = $self->key2hex($self->charhex2key($flip_AltGr_hex)) if defined $flip_AltGr_hex;
Branch: 1 branch
BranchTrueFalseTotal
if defined $flip_AltGr_hex 0 0 0
12281 0 my %map; # Indexed by hex (??? What about UTF-16???)
12282 0 for my $deadKey ( sort keys %{ $F->{'[deadkeyFaceHexMap]'} } ) {
12283 0 ▶ next if $F->{'[only_extra]'}{$self->charhex2key($deadKey)};
Branch: 1 branch
BranchTrueFalseTotal
if $F->{"[only_extra]"}{$self->charhex2key($deadKey)} 0 0 0
12284 0 my $auto_inv_AltGr = $F->{'[deadkeyInvAltGrKey]'}{$deadKey};
12285 0 ▶ $auto_inv_AltGr = $self->key2hex($auto_inv_AltGr) if defined $auto_inv_AltGr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $auto_inv_AltGr 0 0 0
12286 #warn "flipkey=$flip_AltGr_hex, dead=$deadKey" if defined $flip_AltGr_hex;
12287 0 $self->output_deadkeys($k->[-1], $deadKey, $F->{'[dead2]'}, $flip_AltGr_hex, $auto_inv_AltGr, \%map);
12288 }
12289
12290 0 my %how = qw( OSX_KEYMAP_0_AND_COMMAND 0;0;0
12291 OSX_KEYMAP_SHIFT 0;1;0
12292 OSX_KEYMAP_CAPS 0;0;1
12293 OSX_KEYMAP_OPTION 1;0;0
12294 OSX_KEYMAP_OPTION_SHIFT 1;1;0
12295 OSX_KEYMAP_OPTION_CAPS 1;0;1
12296 OSX_KEYMAP_OPTION_COMMAND 1;0;0
12297 OSX_KEYMAP_CTRL 0;0;0;-1
12298 OSX_KEYMAP_COMMAND 0;0;0;1
12299 ); # In US Extended, OPT-CMD is the same as OPT
12300 # OSX_KEYMAP_COMMAND_AS_BASE 0;0;0;0
12301 0 ▶ my($OVERR, $ov) = $F->{'[Apple_Override]'} || [];
Condition0%0/2
$F->{'[Apple_Override]'} || []
l!l
00
MC/DC0%0/1
$F->{'[Apple_Override]'} || []
$F->{'[Apple_Override]'}
Truth table0%0/2
A
A= $F->{'[Apple_Override]'}
Aresult
11
00
12302 0 for my $o (@$OVERR) {
12303 0 my($K, $dead, $out) = split /,/, $o, 3;
12304 0 ▶ if ($out =~ /^hex[46]\z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($out =~ /^hex[46]\z/) { } 0 0 0
12305 0 $out = ['lit', $out]
12306 } else {
12307 0 $out = [0, $self->stringHEX2string($out)]
12308 }
12309 0 $ov->{$K} = [$out->[1], undef, $dead, $out->[0]];
12310 }
12311 0 ▶ my $DUP = $F->{'[Apple_Duplicate]'} || [0x6e, 10, 0x47, 10, 0x66, 49, 0x68, 49]; # Mnu => ISO, KP_Clear => ISO, L/R-SPace => Space
Condition0%0/2
$F->{'[Apple_Duplicate]'} || [110, 10, 71, 10, 102, 49, 104, 49]
l!l
00
MC/DC0%0/1
$F->{'[Apple_Duplicate]'} || [110, 10, 71, 10, 102, 49, 104, 49]
$F->{'[Apple_Duplicate]'}
Truth table0%0/2
A
A= $F->{'[Apple_Duplicate]'}
Aresult
11
00
12312 0 $ov->{dup} = {@$DUP};
12313 0 $ov->{extra_actions} = {};
12314 0 for my $m (keys %how) {
12315 0 my($l, $shift, $capsl, $use_base) = split /;/, $how{$m};
12316 0 $h{$m} = $self->AppleMap_i_j ($k, $l, $shift, $capsl, $use_base, \%ids, \%map, $ov);
12317 }
12318 # warn "Need separate OSX_KEYMAP_COMMAND for k=$k\n" unless $h{OSX_KEYMAP_COMMAND} eq $h{OSX_KEYMAP_0_AND_COMMAND};
12319 # my $vbell = $self->get_deep_via_parents($self, undef, @$k, '[DeadChar_DefaultTranslation]');
12320 # $vbell =~ s/^\s+(?=.)//, $vbell = $self->charhex2key($vbell) if defined $vbell;
12321 # undef $vbell; # Terminators are used as visual feedback when prefix is pressed!
12322 0 my($S, %act) = $F->{'[Show]'};
12323 0 @h{qw(OSX_ACTIONS_BASE OSX_ACTIONS OSX_TERMINATORS_BASE OSX_TERMINATORS2)}
12324 = map +($self->AppleMap_prefix(\%ids, 'do_initiating', $_, \%map, $S, $ov, \%act),
12325 $self->AppleMap_prefix(\%ids, !'do_initiating', $_, \%map, $S, $ov, \%act)), '', 'term';
12326
12327 0 $self->massage_template($template_osx, \%h);
12328 }
12329
12330 1 my $unused = <<'EOR';
12331 # extract compositions, add <upgrade> to char downgrades; -> composition, => compatibility composition
12332 perl -wlne "$k=$1, next if /^([\da-f]+)/i; undef $a; $a = qq($k -> $1) if /^\s+:\s*([0-9A-F]+(?:\s+[0-9A-F]+)*)/; $a = qq($k => $2 $1) if /^\s+#\s*((?:<.*?>\s+)?)([0-9A-F]+(?:\s+[0-9A-F]+)*)/; next unless $a; $a =~ s/\s*$/ <upgrade>/ unless $a =~ />\s+\S.*\s\S/; print $a" NamesList.txt >compose2b-NamesList.txt
12333 # expand recursively
12334 perl -wlne "/^(.+?)\s+([-=])>\s+(.+?)\s*$/ or die; $t{$1} = $3; $h{$1}=$2; sub t($); sub t($) {my $i=shift; return $n{$i} if exists $n{$i}; return $i unless $t{$i}; $t{$i} =~ /^(\S+)(.*)/ or die $i; return t($1).$2} END{print qq($_\t:$h{$_} ), join q( ), sort split /\s+/, t($_) for sort {hex $a <=> hex $b} keys %t}" compose2b-NamesList.txt >compose3c-NamesList.txt
12335
12336 #### perl -wlne "($k,$r)=/^(\S+)\s+:[-=]\s+(.*?)\s*$/ or die; $k{$r} = $k; $r{$k}=$r; END { for my $k (sort {hex $a <=> hex $b} keys %r) { my @r = split /\s+/, $r{$k}; for my $o (1..$#r) {my @rr = @r; splice @rr, $o, 1; my ($rr,$kk) = join q( ), @rr; print qq($k\t<= $kk ), $r[$o] if $kk = $k{$rr}} } }" compose3c-NamesList.txt >compose4-NamesList.txt
12337 perl -wlne "($k,$h,$r)=/^(\S+)\s+:([-=])\s+(.*?)\s*$/ or die; $k{$r} = $k; $r{$k}=$r; $hk{$k}=$hr{$r}= ($h eq q(=)); END { for my $k (sort {hex $a <=> hex $b} keys %r) { my $h = $hk{$k}; my @r = split /\s+/, $r{$k}; print qq($k\t:$h $r{$k}) and next if @r == 2; for my $o (1..$#r) {my @rr = @r; splice @rr, $o, 1; my ($rr,$kk) = join q( ), @rr; print qq($k\t<= $kk ), $r[$o] if $kk = $k{$rr}} } }" compose3c-NamesList.txt >compose4-NamesList.txt
12338
12339
12340 # Recursively decompose; :- composition, := compatibility composition
12341 perl -wlne "/^(.+?)\s+([-=])>\s+(.+?)\s*$/ or die; $t{$1} = $3; $h{$1}=$2 if $2 eq q(=); sub t($); sub t($) {my $i=shift; return $n{$i} if exists $n{$i}; return $i unless $t{$i}; $t{$i} =~ /^(\S+)(.*)/ or die $i; my @rr = t($1); return $rr[0].$2, $h{$i} || $rr[1]} END{my(@rr, $h); @rr=t($_), $h = $rr[1] || q(-), (@i = split /\s+/, $rr[0]), print qq($_\t:$h ), join q( ), $i[0], sort @i[1..$#i] for sort {hex $a <=> hex $b} keys %t}" compose2b-NamesList.txt >compose3e-NamesList.txt
12342 # Recompose parts to get "merge 2" decompositions; <- and <= if involve composition, :- and := otherwise
12343 perl -wlne "($k,$h,$r)=/^(\S+)\s+:([-=])\s+(.*?)\s*$/ or die; $k{$r} = $k; $r{$k}=$r; $hk{$k}=$hr{$r}= ($h eq q(=) ? q(=) : undef); END { for my $k (sort {hex $a <=> hex $b} keys %r) { my $h = $hk{$k} || q(-); my @r = split /\s+/, $r{$k}; print qq($k\t:$h $r{$k}) and next if @r == 2; my %s; for my $o (1..$#r) {my @rr = @r; next if $s{$rr[$o]}++; splice @rr, $o, 1; my ($rr,$kk) = join q( ), @rr; print qq($k\t<), $hk{$k} || $hr{$kk} || q(-), qq( $kk ), $r[$o] if $kk = $k{$rr}} } }" compose3e-NamesList.txt >compose4b-NamesList.txt
12344 # List of possible modifiers for each char, introduced by -->, separated by //
12345 perl -C31 -wlne "sub f($) {my $i=shift; return $i unless $i=~/^\w/; qq($i ).chr hex $i} sub ff($) {join q( ), map f($_), split /\s+/, shift} my($c,$B,$m) = /^(\S+)\s+[:<][-=]\s+(\S+)\s+(\S+)\s*$/ or die; push @{$c{$B}}, ff qq($m $c); END { for my $k (sort {hex $a <=> hex $b} keys %c) { print f($k), qq(\t--> ), join q( // ), sort @{$c{$k}} } }" compose4b-NamesList.txt >compose5d-NamesList.txt
12346 # Find what appears as modifiers:
12347 perl -F"\s+//\s+|\s+-->\s+" -wlane "s/\s+[0-9A-F]{4,}(\s\S+)?\s*$//, print for @F[1..$#F]" ! | sort -u >!-words
12348
12349 Duplicate: 0296 <== [ 003F <pseudo-calculated-inverted> <pseudo-phonetized> ] ==> <1 0295> (prefered)
12350 <ʖ> LATIN LETTER INVERTED GLOTTAL STOP
12351 <ʕ> LATIN LETTER PHARYNGEAL VOICED FRICATIVE at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12352 Duplicate: 0384 <== [ 0020 0301 ] ==> <1 00B4> (prefered)
12353 <΄> GREEK TONOS
12354 <´> ACUTE ACCENT at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12355 Duplicate: 1D43 <== [ 0061 <super> ] ==> <1 00AA> (prefered)
12356 <ᵃ> MODIFIER LETTER SMALL A
12357 <ª> FEMININE ORDINAL INDICATOR at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12358 Duplicate: 1D52 <== [ 006F <super> ] ==> <1 00BA> (prefered)
12359 <ᵒ> MODIFIER LETTER SMALL O
12360 <º> MASCULINE ORDINAL INDICATOR at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12361 Duplicate: 1D9F <== [ 0065 <pseudo-calculated-open> <pseudo-calculated-reversed> <super> ] ==> <1 1D4C> (prefered)
12362 <ᶟ> MODIFIER LETTER SMALL REVERSED OPEN E
12363 <ᵌ> MODIFIER LETTER SMALL TURNED OPEN E at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12364 Duplicate: 1E7A <== [ 0055 0304 0308 ] ==> <0 01D5> (prefered)
12365 <Ṻ> LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS
12366 <Ǖ> LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12367 Duplicate: 1E7B <== [ 0075 0304 0308 ] ==> <0 01D6> (prefered)
12368 <ṻ> LATIN SMALL LETTER U WITH MACRON AND DIAERESIS
12369 <ǖ> LATIN SMALL LETTER U WITH DIAERESIS AND MACRON at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12370 Duplicate: 1FBF <== [ 0020 0313 ] ==> <1 1FBD> (prefered)
12371 <᾿> GREEK PSILI
12372 <᾽> GREEK KORONIS at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12373 Duplicate: 2007 <== [ 0020 <noBreak> ] ==> <1 00A0> (prefered)
12374 < > FIGURE SPACE
12375 < > NO-BREAK SPACE at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12376 Duplicate: 202F <== [ 0020 <noBreak> ] ==> <1 00A0> (prefered)
12377 < > NARROW NO-BREAK SPACE
12378 < > NO-BREAK SPACE at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12379 Duplicate: 2113 <== [ 006C <font=script> ] ==> <1 1D4C1> (prefered)
12380 <ℓ> SCRIPT SMALL L
12381 <퓁> MATHEMATICAL SCRIPT SMALL L at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12382 Duplicate: 24B8 <== [ 0043 <circle> ] ==> <1 1F12B> (prefered)
12383 <Ⓒ> CIRCLED LATIN CAPITAL LETTER C
12384 <> CIRCLED ITALIC LATIN CAPITAL LETTER C at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12385 Duplicate: 24C7 <== [ 0052 <circle> ] ==> <1 1F12C> (prefered)
12386 <Ⓡ> CIRCLED LATIN CAPITAL LETTER R
12387 <> CIRCLED ITALIC LATIN CAPITAL LETTER R at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12388 Duplicate: 2E1E <== [ 007E <pseudo-dot-above> ] ==> <1 2A6A> (prefered)
12389 <⸞> TILDE WITH DOT ABOVE
12390 <⩪> TILDE OPERATOR WITH DOT ABOVE at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12391 Duplicate: 33B9 <== [ 004D <square> 0056 ] ==> <1 1F14B> (prefered)
12392 <㎹> SQUARE MV MEGA
12393 <> SQUARED MV at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12394 Duplicate: FC03 <== [ 064A <isolated> 0649 0654 ] ==> <1 FBF9> (prefered)
12395 <ﰃ> ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM
12396 <ﯹ> ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12397 Duplicate: FC68 <== [ 064A <final> 0649 0654 ] ==> <1 FBFA> (prefered)
12398 <ﱨ> ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM
12399 <ﯺ> ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12400 Duplicate: FD55 <== [ 062A <initial> 062C 0645 ] ==> <1 FD50> (prefered)
12401 <ﵕ> ARABIC LIGATURE TEH WITH MEEM WITH JEEM INITIAL FORM
12402 <ﵐ> ARABIC LIGATURE TEH WITH JEEM WITH MEEM INITIAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12403 Duplicate: FD56 <== [ 062A <initial> 062D 0645 ] ==> <1 FD53> (prefered)
12404 <ﵖ> ARABIC LIGATURE TEH WITH MEEM WITH HAH INITIAL FORM
12405 <ﵓ> ARABIC LIGATURE TEH WITH HAH WITH MEEM INITIAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12406 Duplicate: FD57 <== [ 062A <initial> 062E 0645 ] ==> <1 FD54> (prefered)
12407 <ﵗ> ARABIC LIGATURE TEH WITH MEEM WITH KHAH INITIAL FORM
12408 <ﵔ> ARABIC LIGATURE TEH WITH KHAH WITH MEEM INITIAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12409 Duplicate: FD5D <== [ 0633 <initial> 062C 062D ] ==> <1 FD5C> (prefered)
12410 <ﵝ> ARABIC LIGATURE SEEN WITH JEEM WITH HAH INITIAL FORM
12411 <ﵜ> ARABIC LIGATURE SEEN WITH HAH WITH JEEM INITIAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12412 Duplicate: FD87 <== [ 0644 <final> 062D 0645 ] ==> <1 FD80> (prefered)
12413 <ﶇ> ARABIC LIGATURE LAM WITH MEEM WITH HAH FINAL FORM
12414 <ﶀ> ARABIC LIGATURE LAM WITH HAH WITH MEEM FINAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12415 Duplicate: FD8C <== [ 0645 <initial> 062C 062D ] ==> <1 FD89> (prefered)
12416 <ﶌ> ARABIC LIGATURE MEEM WITH JEEM WITH HAH INITIAL FORM
12417 <ﶉ> ARABIC LIGATURE MEEM WITH HAH WITH JEEM INITIAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12418 Duplicate: FD92 <== [ 0645 <initial> 062C 062E ] ==> <1 FD8E> (prefered)
12419 <ﶒ> ARABIC LIGATURE MEEM WITH JEEM WITH KHAH INITIAL FORM
12420 <ﶎ> ARABIC LIGATURE MEEM WITH KHAH WITH JEEM INITIAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12421 Duplicate: FDB5 <== [ 0644 <initial> 062D 0645 ] ==> <1 FD88> (prefered)
12422 <ﶵ> ARABIC LIGATURE LAM WITH HAH WITH MEEM INITIAL FORM
12423 <ﶈ> ARABIC LIGATURE LAM WITH MEEM WITH HAH INITIAL FORM at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12424 Duplicate: FE34 <== [ 005F <vertical> ] ==> <1 FE33> (prefered)
12425 <︴> PRESENTATION FORM FOR VERTICAL WAVY LOW LINE
12426 <︳> PRESENTATION FORM FOR VERTICAL LOW LINE at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 4224, <$f> line 38879.
12427
12428 Duplicate: 0273 <== [ 006E <pseudo-manual-phonetized> ] ==> <1 014B> (prefered)
12429 <ɳ> LATIN SMALL LETTER N WITH RETROFLEX HOOK
12430 <ŋ> LATIN SMALL LETTER ENG at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12431 Duplicate: 1DAF <== [ 006E <pseudo-manual-phonetized> <super> ] ==> <1 1D51> (prefered)
12432 <ᶯ> MODIFIER LETTER SMALL N WITH RETROFLEX HOOK
12433 <ᵑ> MODIFIER LETTER SMALL ENG at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12434 Duplicate: 2040 <== [ 007E <pseudo-manual-quasisynon> ] ==> <1 203F> (prefered)
12435 <⁀> CHARACTER TIE
12436 <‿> UNDERTIE at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12437 Duplicate: 207F <== [ 004E <pseudo-manual-phonetized> ] ==> <1 014A> (prefered)
12438 <ⁿ> SUPERSCRIPT LATIN SMALL LETTER N
12439 <Ŋ> LATIN CAPITAL LETTER ENG at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12440 Duplicate: 224B <== [ 007E <pseudo-manual-addtilde> ] ==> <1 2248> (prefered)
12441 <≋> TRIPLE TILDE
12442 <≈> ALMOST EQUAL TO at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12443 Duplicate: 2256 <== [ 003D <pseudo-manual-round> ] ==> <1 224D> (prefered)
12444 <≖> RING IN EQUAL TO
12445 <≍> EQUIVALENT TO at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12446 Duplicate: 2257 <== [ 003D <pseudo-manual-round> ] ==> <1 224D> (prefered)
12447 <≗> RING EQUAL TO
12448 <≍> EQUIVALENT TO at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12449 Duplicate: 225E <== [ 225F <pseudo-manual-quasisynon> ] ==> <1 225C> (prefered)
12450 <≞> MEASURED BY
12451 <≜> DELTA EQUAL TO at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12452 Duplicate: 2263 <== [ 003D <pseudo-manual-addhline> ] ==> <1 2261> (prefered)
12453 <≣> STRICTLY EQUIVALENT TO
12454 <≡> IDENTICAL TO at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12455 Duplicate: 2277 <== [ 003D <pseudo-manual-quasisynon> 0338 ] ==> <1 2276> (prefered)
12456 <≷> GREATER-THAN OR LESS-THAN
12457 <≶> LESS-THAN OR GREATER-THAN at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12458 Duplicate: 2279 <== [ 003D <pseudo-manual-quasisynon> ] ==> <1 2278> (prefered)
12459 <≹> NEITHER GREATER-THAN NOR LESS-THAN
12460 <≸> NEITHER LESS-THAN NOR GREATER-THAN at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12461 Duplicate: 2279 <== [ 003D <pseudo-manual-quasisynon> 0338 0338 ] ==> <1 2278> (prefered)
12462 <≹> NEITHER GREATER-THAN NOR LESS-THAN
12463 <≸> NEITHER LESS-THAN NOR GREATER-THAN at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12464 Duplicate: 2982 <== [ 003A <pseudo-manual-amplify> ] ==> <1 2236> (prefered)
12465 <⦂> Z NOTATION TYPE COLON
12466 <∶> RATIO at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12467 Duplicate: 2993 <== [ 0028 <pseudo-manual-round> ] ==> <1 2985> (prefered)
12468 <⦓> LEFT ARC LESS-THAN BRACKET
12469 <⦅> LEFT WHITE PARENTHESIS at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12470 Duplicate: 2994 <== [ 0029 <pseudo-manual-round> ] ==> <1 2986> (prefered)
12471 <⦔> RIGHT ARC GREATER-THAN BRACKET
12472 <⦆> RIGHT WHITE PARENTHESIS at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12473 Duplicate: 2995 <== [ 0029 <pseudo-manual-round> ] ==> <1 2986> (prefered)
12474 <⦕> DOUBLE LEFT ARC GREATER-THAN BRACKET
12475 <⦆> RIGHT WHITE PARENTHESIS at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12476 Duplicate: 2996 <== [ 0028 <pseudo-manual-round> ] ==> <1 2985> (prefered)
12477 <⦖> DOUBLE RIGHT ARC LESS-THAN BRACKET
12478 <⦅> LEFT WHITE PARENTHESIS at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12479 Duplicate: 29BC <== [ 0025 <pseudo-manual-round> ] ==> <1 2030> (prefered)
12480 <⦼> CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN
12481 <‰> PER MILLE SIGN at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12482 Duplicate: 2A17 <== [ 222B <pseudo-manual-addleft> ] ==> <1 2A10> (prefered)
12483 <⨗> INTEGRAL WITH LEFTWARDS ARROW WITH HOOK
12484 <⨐> CIRCULATION FUNCTION at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12485 Duplicate: 2A34 <== [ 00D7 <pseudo-manual-addleft> ] ==> <1 22C9> (prefered)
12486 <⨴> MULTIPLICATION SIGN IN LEFT HALF CIRCLE
12487 <⋉> LEFT NORMAL FACTOR SEMIDIRECT PRODUCT at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12488 Duplicate: 2A35 <== [ 00D7 <pseudo-manual-addright> ] ==> <1 22CA> (prefered)
12489 <⨵> MULTIPLICATION SIGN IN RIGHT HALF CIRCLE
12490 <⋊> RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12491 Duplicate: 2A36 <== [ 00D7 <pseudo-manual-amplify> ] ==> <1 2A2F> (prefered)
12492 <⨶> CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT
12493 <⨯> VECTOR OR CROSS PRODUCT at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12494 Duplicate: 2A50 <== [ 00D7 <pseudo-manual-addline> ] ==> <1 2A33> (prefered)
12495 <⩐> CLOSED UNION WITH SERIFS AND SMASH PRODUCT
12496 <⨳> SMASH PRODUCT at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12497 Duplicate: 2ACF <== [ 25C1 <pseudo-manual-amplify> <pseudo-manual-amplify> ] ==> <1 2A1E> (prefered)
12498 <⫏> CLOSED SUBSET
12499 <⨞> LARGE LEFT TRIANGLE OPERATOR at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12500 Duplicate: 2AFB <== [ 2223 <pseudo-manual-amplify> <pseudo-manual-amplify> ] ==> <1 2AF4> (prefered)
12501 <⫻> TRIPLE SOLIDUS BINARY RELATION
12502 <⫴> TRIPLE VERTICAL BAR BINARY RELATION at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12503 Duplicate: 2AFB <== [ 007C <pseudo-manual-addvline> <pseudo-manual-amplify> <pseudo-manual-quasisynon> ] ==> <1 2AF4> (prefered)
12504 <⫻> TRIPLE SOLIDUS BINARY RELATION
12505 <⫴> TRIPLE VERTICAL BAR BINARY RELATION at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12506 Duplicate: 2AFD <== [ 002F <pseudo-manual-amplify> ] ==> <1 2215> (prefered)
12507 <⫽> DOUBLE SOLIDUS OPERATOR
12508 <∕> DIVISION SLASH at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12509 Duplicate: 2AFF <== [ 007C <pseudo-manual-whiten> ] ==> <1 2AFE> (prefered)
12510 <⫿> N-ARY WHITE VERTICAL BAR
12511 <⫾> WHITE VERTICAL BAR at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12512 Duplicate: 3018 <== [ 0028 <pseudo-manual-unsharpen> ] ==> <1 27EE> (prefered)
12513 <〘> LEFT WHITE TORTOISE SHELL BRACKET
12514 <⟮> MATHEMATICAL LEFT FLATTENED PARENTHESIS at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12515 Duplicate: 3019 <== [ 0029 <pseudo-manual-unsharpen> ] ==> <1 27EF> (prefered)
12516 <〙> RIGHT WHITE TORTOISE SHELL BRACKET
12517 <⟯> MATHEMATICAL RIGHT FLATTENED PARENTHESIS at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12518 Duplicate: A760 <== [ 0059 <pseudo-fake-paleocontraction-by-last> ] ==> <1 A73C> (prefered)
12519 <Ꝡ> LATIN CAPITAL LETTER VY
12520 <Ꜽ> LATIN CAPITAL LETTER AY at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12521 Duplicate: A761 <== [ 0079 <pseudo-fake-paleocontraction-by-last> ] ==> <1 A73D> (prefered)
12522 <ꝡ> LATIN SMALL LETTER VY
12523 <ꜽ> LATIN SMALL LETTER AY at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12524 Duplicate: 1D4C1 <== [ 006C <font=script> ] ==> <1 2113> (prefered)
12525 <𝓁> MATHEMATICAL SCRIPT SMALL L
12526 <ℓ> SCRIPT SMALL L at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12527 Duplicate: 1F12B <== [ 0043 <circle> ] ==> <1 24B8> (prefered)
12528 <🄫> CIRCLED ITALIC LATIN CAPITAL LETTER C
12529 <Ⓒ> CIRCLED LATIN CAPITAL LETTER C at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12530 Duplicate: 1F12C <== [ 0052 <circle> ] ==> <1 24C7> (prefered)
12531 <🄬> CIRCLED ITALIC LATIN CAPITAL LETTER R
12532 <Ⓡ> CIRCLED LATIN CAPITAL LETTER R at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12533 Duplicate: 1F14B <== [ 004D <square> 0056 ] ==> <1 33B9> (prefered)
12534 <🅋> SQUARED MV
12535 <㎹> SQUARE MV MEGA at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 5263, <$f> line 38876.
12536 Duplicate: A789 <== [ 003A <pseudo-fake-super> ] ==> <1 02F8> (prefered)
12537 <꞉> MODIFIER LETTER COLON
12538 <˸> MODIFIER LETTER RAISED COLON at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 8032, <$f> line 39278.
12539 Duplicate: 02EF <== [ 0020 <pseudo-manual-subize> 0306 ] ==> <1 02EC> (prefered)
12540 <˯> 02EF MODIFIER LETTER LOW DOWN ARROWHEAD
12541 <ˬ> 02EC MODIFIER LETTER VOICING at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 8634, <$f> line 39278.
12542 Duplicate: 2B95 <== [ 2192 <pseudo-fake-black> ] ==> <1 27A1> (prefered)
12543 <⮕> 2B95 RIGHTWARDS BLACK ARROW
12544 <➡> 27A1 BLACK RIGHTWARDS ARROW at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 9828, <$f> line 43944.
12545 Duplicate: 1F7C6 <== [ 2727 <pseudo-fake-black> ] ==> <1 2726> (prefered)
12546 <🟆> 1F7C6 FOUR POINTED BLACK STAR
12547 <✦> 2726 BLACK FOUR POINTED STAR at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 9828, <$f> line 43944.
12548 Duplicate: 27C2 <== [ 005F <pseudo-manual-addvline> ] ==> <1 221F> (prefered)
12549 <⟂> 27C2 PERPENDICULAR
12550 <∟> 221F RIGHT ANGLE at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 10537, <$f> line 43944.
12551 Duplicate: 2ADB <== [ 0028 <pseudo-manual-addhline> <pseudo-manual-turnaround> ] ==> <1 220B> (prefered)
12552 <⫛> 2ADB TRANSVERSAL INTERSECTION
12553 <∋> 220B CONTAINS AS MEMBER at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 10537, <$f> line 43944.
12554 Duplicate: 1F5A4 <== [ 2661 <pseudo-fake-black> ] ==> <1 2665> (prefered)
12555 <🖤> 1F5A4 BLACK HEART
12556 <♥> 2665 BLACK HEART SUIT at UI-KeyboardLayout/lib/UI/KeyboardLayout.pm line 10488, <$f> line 48770.
12557 EOR
12558
12559 1 my (%known_dups) = map +($_,1), # As of Unicode 9.0 (questionable: 2982 2ACF 2ADB)
12560 qw(0296 0384 1D43 1D52 1D9F 1E7A 1E7B 1FBF 2007
12561 202F 2113 24B8 24C7 2E1E 33B9 FC03 FC68 FD55 FD56 FD57 FD5D FD87 FD8C
12562 FD92 FDB5 FE34 2B95 1F7C6 27C2 2ADB 1F5A4
12563 0273 1DAF 2040 207F 224B 2256 2257 225E 2263 2277 2279 2982 2993 2994 2995 2996 29BC
12564 2A17 2A34 2A35 2A36 2A50 2ACF 2AFB 2AFD 2AFF 3018 3019 A760 A761 1D4C1 1F12B 1F12C 1F14B A789 02EF);
12565
12566 sub decompose_r($$$$); # recursive
12567 0 ▶sub decompose_r($$$$) { # returns array ref, elts are [$compat, @expand]
Subroutine decompose_r: not called CC=8 SCAR=42.8
Pod undocumented
12568 0 my ($self, $t, $i, $cache, @expand) = (shift, shift, shift, shift);
12569 0 ▶ return $cache->{$i} if $cache->{$i};
Branch: 1 branch
BranchTrueFalseTotal
if $cache->{$i} 0 0 0
12570 0 ▶ return $cache->{$i} = [[0, $i]] unless my $In = $t->{$i};
Branch: 1 branch
BranchTrueFalseTotal
unless my $In = $t->{$i} 0 0 0
12571 0 for my $in (@$In) {
12572 0 my $compat = $in->[0];
12573 #warn "i=<$i>, compat=<$compat>, rest=<$in->[1]>";
12574 0 my $expand_in = $self->decompose_r($t, $in->[1], $cache);
12575 0 $expand_in = $self->deep_copy($expand_in);
12576 #warn "Got: $in->[1] -> <@$expand> from $i = <@$in>";
12577 0 for my $expand (@$expand_in) {
12578 0 ▶ warn "Expansion funny: <@$expand>" if @$expand < 2 or $expand->[0] !~ /^[01]$/;
Branch: 1 branch
BranchTrueFalseTotal
if @$expand < 2 or not $expand->[0] =~ /^[01]$/ 0 0 0
Condition0%0/3
@$expand < 2 or not $expand->[0] =~ /^[01]$/
l!l&&r!l&&!r
000
MC/DC0%0/2
@$expand < 2 or not $expand->[0] =~ /^[01]$/
@$expand < 2 not $expand->[0] =~ /^[01]$/
Truth table0%0/3
A or not(B)
A= @$expand < 2B= not $expand->[0] =~ /^[01]$/
ABresult
1X1
011
000
12579 0 $compat = ( shift(@$expand) | $compat);
12580 0 ▶ warn "!Malformed: $i -> $compat <@$expand>" if $expand->[0] =~ /^[01]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $expand->[0] =~ /^[01]$/ 0 0 0
12581 0 push @expand, [ $compat, @$expand, @$in[2..$#$in] ];
12582 }
12583 }
12584 0 return $cache->{$i} = \@expand;
12585 }
12586
12587 0 ▶sub fromHEX ($) { my $i = shift; $i =~ /^\w/ and hex $i}
Subroutine fromHEX: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$i =~ /^\w/ and hex $i 0 0 0
12588
12589 1 my %operators = (DOT => ['MIDDLE DOT', 'FULL STOP'], RING => ['DEGREE SIGN'], DIAMOND => ['WHITE DIAMOND'],
12590 'DOUBLE SOLIDUS' => ['PARALLEL TO'], MINUS => ['HYPHEN-MINUS']);
12591
12592 # THIS IS A MULTIMAP (later entry for a TARGER wins)! ■□ ◼◻ ◾◽ ◇◆◈⟐⟡⟢⟣⌺ △▲▵▴▽▼▿▾⟁⧊⧋
12593 1 my %uni_manual = (phonetized => [qw( 0 ə s ʃ z ʒ j ɟ v ⱱ n ɳ N ⁿ n ŋ V ɤ ! ǃ ? ʔ ¿ ʕ | ǀ f ʄ F ǂ x ʘ X ǁ
12594 g ʛ m ɰ h ɧ d ᶑ C ʗ)], # z ɮ (C ʗ is "extras")
12595 phonetize2 => [qw( e ɘ E ɞ i ɻ I ɺ)], # Use some capitalized sources (no uc variants)...
12596 phonetize3 => [qw( a ɒ A Ɒ e ɜ E ɝ)], # Use some capitalized sources (no uc variants)...
12597 phonetize0 => [qw( e ə)],
12598 paleo => [qw( & ⁊ W Ƿ w ƿ h ƕ H Ƕ G Ȝ g ȝ )],
12599 # cut&paste from http://en.wikipedia.org/wiki/Coptic_alphabet
12600 # perl -C31 -wne "chomp; ($uc,$lc,undef,undef,$gr) = split /\t/;($ug,$lg)=split /,\s+/, $gr; print qq( $lg $lc $ug $uc)" coptic2 >coptic-tr
12601 # Fix stigma, koppa; p/P are actually 900; a/A are for AKHMIMIC KHEI (variant of KHEI on h/H);
12602 # 2e17 ⸗ double hyphen; sampi's are duplicated in both places
12603 greek2coptic => [qw(
12604 α ⲁ Α Ⲁ β ⲃ Β Ⲃ γ ⲅ Γ Ⲅ δ ⲇ Δ Ⲇ ε ⲉ Ε Ⲉ ϛ ⲋ Ϛ Ⲋ ζ ⲍ Ζ Ⲍ η ⲏ Η Ⲏ ϙ ϭ Ϙ Ϭ ϡ ⳁ Ϡ Ⳁ
12605 θ ⲑ Θ Ⲑ ι ⲓ Ι Ⲓ κ ⲕ Κ Ⲕ λ ⲗ Λ Ⲗ μ ⲙ Μ Ⲙ ν ⲛ Ν Ⲛ ξ ⲝ Ξ Ⲝ ο ⲟ Ο Ⲟ
12606 π ⲡ Π Ⲡ ρ ⲣ Ρ Ⲣ σ ⲥ Σ Ⲥ τ ⲧ Τ Ⲧ υ ⲩ Υ Ⲩ φ ⲫ Φ Ⲫ χ ⲭ Χ Ⲭ ψ ⲯ Ψ Ⲯ ω ⲱ Ω Ⲱ )],
12607 latin2extracoptic => [qw( - ⸗
12608 s ϣ S Ϣ f ϥ F Ϥ x ϧ X Ϧ h ϩ H Ϩ j ϫ J Ϫ t ϯ T Ϯ p ⳁ P Ⳁ a ⳉ A Ⳉ )],
12609 addline => [qw( 0 ∅ ∅ ⦱ + ∦ ∫ ⨏ • ⊝ / ⫽ ⫽ ⫻ ∮ ⨔ × ⨳ × ⩐ ⊊ ⊈ ⊋ ⊉ ⫋ ⫅ ⫌ ⫆
12610 ⪇ ⪙ ⪈ ⪚ ≦ ≨ ≧ ≩)], # ∮ ⨔ a cheat
12611 addhline => [qw( = ≣ = ≡ ≡ ≣ † ‡ + ∦ / ∠ | ∟ . ∸ ∨ ⊻ ∧ ⊼ ◁ ⩤ * ⩮
12612 ⊨ ⫢ ⊦ ⊧ ⊤ ⫧ ⊥ ⫨ ⊣ ⫤ ⊳ ⩥ ⊲ ⩤ ⋄ ⟠ ∫ ⨍ ⨍ ⨎ • ⦵ ( ∈ ) ∋
12613 ∪ ⩌ ∩ ⩍ ≃ ≅ ⨯ ⨲ < ⪕ ≤ ⪛ ⪇ ⩽ ≦ ⫹ > ⪖ ≥ ⪜ ⪈ ⩾ ≧ ⫺ )], # conflict with modifiers: qw( _ ‗ ); ( ∈ ) ∋ not very useful - but logical - with ∈∋ as bluekeys... 2 ƻ destructive
12614 addvline => [qw( ⊢ ⊩ ⊣ ⫣ ⊤ ⫪ ⊥ ⫫ □ ⎅ | ‖ ‖ ⦀ ∫ ⨒ ≢ ⩨ ⩨ ⩩ • ⦶
12615 \ ⫮ ° ⫯ . ⫰ ⫲ ⫵ ∞ ⧞ = ⧧ ⧺ ⧻ + ⧺ ∩ ⨙ ∪ ⨚ 0 ⦽ _ ⟂ _ ∟ )], # + ⫲
12616 addtilde => [qw( 0 ∝ / ∡ \ ∢ ∫ ∱ ∮ ⨑ : ∻ - ≂ ≠ ≆ ~ ≋ ~ ≈ ∼ ≈ ≃ ≊ ≈ ≋ = ≌ ⪇ ⋦ ≦ ≴ ⪈ ⋧ ≧ ≵
12617 ≐ ≏ ( ⟅ ) ⟆ ∧ ⩄ ∨ ⩅ ∩ ⩆ ∪ ⩇ ≤ ⪍ ≥ ⪎ ⊊ ≴ ⊋ ≵ ⫋ ⋦ ⫌ ⋧)], # not on 2A**
12618 adddot => [qw( : ⫶ " ∵ ∫ ⨓ ∮ ⨕ □ ⊡ ◇ ⟐ ( ⦑ ) ⦒ ≟ ≗ ≐ ≑
12619 - ┄ — ┄ ─ ┈ ━ ┅ ═ ┉ | ┆ │ ┊ ┃ ┇ ║ ┋ )], # ⫶ is tricolon, not vert. … "; (m-)dash/bar, (b)[h/v]draw, bold/dbl
12620 adddottop => [qw( + ∔ )],
12621 addleft => [qw( = ≔ × ⨴ × ⋉ \ ⋋ + ⨭ → ⧴ ∫ ⨐ ∫ ⨗ ∮ ∳ ⊂ ⟈ ⊃ ⫐ ⊳ ⧐ ⊢ ⊩ ⊩ ⊪ ⊣ ⟞
12622 ◇ ⟢ ▽ ⧨ ≡ ⫢ • ⥀ ⋈ ⧑ ≟ ⩻ ≐ ≓ | ⩘ ≔ ⩴ ⊲ ⫷)], # × ⨴ is hidden
12623 addright => [qw( = ≕ × ⨵ × ⋊ / ⋌ + ⨮ - ∹ ∫ ⨔ ∮ ∲ ⊂ ⫏ ⊃ ⟉ ⊲ ⧏ ⊢ ⟝ ⊣ ⫣
12624 ◇ ⟣ △ ⧩ • ⥁ ⋈ ⧒ ≟ ⩼ ≐ ≒ | ⩗ ⊳ ⫸ : ⧴)], # × ⨵ is hidden
12625 sharpen => [qw( < ≺ > ≻ { ⊰ } ⊱ ( ⟨ ) ⟩ ∧ ⋏ ∨ ⋎ . ⋄ ⟨ ⧼ ⟩ ⧽ ∫ ⨘
12626 ⊤ ⩚ ⊥ ⩛ ◇ ⟡ ▽ ⧍ • ⏣ ≟ ≙ + ⧾ - ⧿ ⊊ ⪱ ⊋ ⪲ ⪇ ⪱ ⪈ ⪲ ⫋ ⪵ ⫌ ⪶ ≦ ⪳ ≧ ⪴ )], # ⋆ ⪇≦ ⪈≧
12627 unsharpen => [qw( < ⊏ > ⊐ ( ⟮ ) ⟯ ∩ ⊓ ∪ ⊔ ∧ ⊓ ∨ ⊔ . ∷ ∫ ⨒ ∮ ⨖ { ⦉ } ⦊
12628 / ⧄ \ ⧅ ° ⧇ ◇ ⌺ • ⌼ ≟ ≚ ≐ ∺ ( 〘 ) 〙 ⊊ ⋤ ⊋ ⋥ ⪇ ⋤ ⪈ ⋥ ⫋ ⋢ ⫌ ⋣ ≦ ⋢ ≧ ⋣ )], # + ⊞ - ⊟ * ⊠ . ⊡ × ⊠, ( ⦗ ) ⦘ ( 〔 ) 〕
12629 whiten => [qw( [ ⟦ ] ⟧ ( ⟬ ) ⟭ { ⦃ } ⦄ ⊤ ⫪ ⊥ ⫫ ; ⨟ ⊢ ⊫ ⊣ ⫥ ⊔ ⩏ ⊓ ⩎ ∧ ⩓ ∨ ⩔ _ ‗ = ≣
12630 : ⦂ | ⫾ | ⫿ • ○ < ⪡ > ⪢ ⊓ ⩎ ⊔ ⩏ )], # or blacken □ ■ ◻ ◼ ◽ ◾ ◇ ◆ △ ▲ ▵ ▴ ▽ ▼ ▿ ▾
12631 quasisynon => [qw( ∈ ∊ ∋ ∍ ≠ ≶ ≠ ≷ = ≸ = ≹ ≼ ⊁ ≽ ⊀ ≺ ⋡ ≻ ⋠ < ≨ > ≩ Δ ∆
12632 ≤ ⪕ ≥ ⪖ ⊆ ⊅ ⊇ ⊄ ⊂ ⊉ ⊃ ⊈ ⊏ ⋣ ⊐ ⋢ ⊳ ⋬ ⊲ ⋭ … ⋯ / ⟋ \ ⟍
12633 ( ⦇ ) ⦈ [ ⨽ ] ⨼ ∅ ⌀
12634 ⊤ ⫟ ⊥ ⫠ ⟂ ⫛ □ ∎ ▽ ∀ ‖ ∥ ≟ ≞ ≟ ≜ ~ ‿ ~ ⁀ ■ ▬ )], # ( ⟬ ) ⟭ < ≱ > ≰ ≤ ≯ ≥ ≮ * ⋆
12635 amplify => [qw( < ≪ > ≫ ≪ ⋘ ≫ ⋙ ∩ ⋒ ∪ ⋓ ⊂ ⋐ ⊃ ⋑ ( ⟪ ) ⟫ ∼ ∿ = ≝ ∣ ∥ . ⋮ ⪇ ⪉ ≦ ⪅ ⪈ ⪊ ≧ ⪆
12636 ∈ ∊ ∋ ∍ - − / ∕ \ ∖ √ ∛ ∛ ∜ ∫ ∬ ∬ ∭ ∭ ⨌ ∮ ∯ ∯ ∰ : ⦂ ` ⎖
12637 : ∶ ≈ ≋ ≏ ≎ ≡ ≣ × ⨯ + ∑ Π ∏ Σ ∑ ρ ∐ ∐ ⨿ ⊥ ⟘ ⊤ ⟙ ⟂ ⫡ ; ⨾ □ ⧈ ◇ ◈
12638 ⊲ ⨞ ⊢ ⊦ △ ⟁ ∥ ⫴ ⫴ ⫼ / ⫽ ⫽ ⫻ • ● ⊔ ⩏ ⊓ ⩎ ∧ ⩕ ∨ ⩖ ▷ ⊳ ◁ ⊲
12639 ⋉ ⧔ ⋊ ⧕ ⋈ ⧓ ⪡ ⫷ ⪢ ⫸ ≟ ≛ ≐ ≎ ⊳ ⫐ ⊲ ⫏ { ❴ } ❵ × ⨶ )], # ` ⋆ ☆ ⋆ ★ ; ˆ ∧ conflicts with combining-ˆ; * ∏ stops propagation *->×->⋈, : ⦂ hidden; ∥ ⫴; × ⋈ not needed; ∰ ⨌ - ???; ≃ ≌ not useful
12640 turnaround => [qw( ∧ ∨ ∩ ∪ ∕ ∖ ⋏ ⋎ ∼ ≀ ⋯ ⋮ … ⋮ ⋰ ⋱ _ ‾
12641 8 ∞ ∆ ∇ Α ∀ Ε ∃ ∴ ∵ ≃ ≂ ˆ ˯
12642 ∈ ⫛ ∈ ∋ ∋ ⫙ ∉ ∌ ∊ ∍ ∏ ∐ ± ∓ ⊓ ⊔ ≶ ≷ ≸ ≹
12643 ⋀ ⋁ ⋂ ⋃ ⋉ ⋊ ⋋ ⋌ ⋚ ⋛ ≤ ⋜ ≥ ⋝ ≼ ⋞ ≽ ⋟ )], # XXXX Can't do both directions
12644 superize => [qw( h ʱ ' ʹ < ˂ > ˃ ^ ˑ ( ˓ ) ˒ ⊢ ˫ 0 ᵊ * ˟ × ˟ ~ ﹋ ≈ ﹌ ─ ‾
12645 □ ⸋ . ⸳ @ ♭), '#' => '♯'], # ' Additions to <super>!
12646 subize => [qw( < ˱ > ˲ _ ˍ ' ˏ " ˶ ˵ ˵ . ˳ ° ˳ ˘ ˯ ˘ ˬ ( ˓ ) ˒ 0 ₔ ~ ﹏ ═ ‗), ',' => '¸'], # '
12647 subize2 => [qw( < ˂ > ˃ )], # these are in older Unicode, so would override if in subize
12648 # Most of these are for I/O on very ancient systems (only ∘ and ∅ are not auto-detected on quadapl):
12649 aplbox => [qw( | ⌷ = ⌸ ÷ ⌹ ◇ ⌺ ∘ ⌻ ○ ⌼ / ⍁ \ ⍂ < ⍃ > ⍄ ← ⍇ → ⍈ ∨ ⍌ Δ ⍍ ↑ ⍐ ∧ ⍓ ∇ ⍔ ↓ ⍗ ' ⍞ : ⍠ ≠ ⍯ ? ⍰ ∅ ⎕ )], #'
12650 round => [qw( < ⊂ > ⊃ = ≖ = ≗ = ≍ ∫ ∮ ∬ ∯ ∭ ∰ ∼ ∾ - ⊸ □ ▢ □ ∷ ∥ ≬ ‖ ≬ • ⦁
12651 … ∴ ≡ ≋ ⊂ ⟃ ⊃ ⟄ ⊤ ⫙ ⊥ ⟒ ( ⦖ ) ⦕ ( ⦓ ) ⦔ ( ⦅ ) ⦆ ⊳ ⪧ ⊲ ⪦ ≟ ≘ ≐ ≖ . ∘
12652 [ ⟬ ] ⟭ { ⧼ } ⧽ % ⦼ % ‰ × ⦻ ⨯ ⨷ ∧ ∩ ∨ ∪ )], # = ≈
12653 hattify => [qw(⊊ ⋨ ⊋ ⋩ ⫋ ⪹ ⫌ ⪺)]);
12654
12655 0 ▶sub parse_NameList ($$) {
Subroutine parse_NameList: not called CC=150 SCAR=100.3
Pod undocumented
12656 0 my ($self, $f, $k, $kk, $name, $_c, %basic, %cached_full, %compose, $version,
12657 %into2, %ordered, %candidates, %N, %comp2, %NM, %BL, $BL, %G, %NS) = (shift, shift);
12658 0 binmode $f; # NameList.txt is in Latin-1, not unicode
12659 0 ▶ while (my $s = <$f>) { # extract compositions, add <upgrade> to char downgrades; -> composition, => compatibility composition
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $s = readline $f)) 0 0 0
12660 0 ▶ if ($s =~ /^\@\@\@\s+The\s+Unicode\s+Standard\s+(.*?)\s*$/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s =~ /^\@\@\@\s+The\s+Unicode\s+Standard\s+(.*?)\s*$/i) 0 0 0
12661 0 $version = $1;
12662 }
12663 0 ▶ if ($s =~ /^([\da-f]+)\b\s*(.*?)\s*$/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s =~ /^([\da-f]+)\b\s*(.*?)\s*$/i) 0 0 0
12664 0 my ($K, $Name, $C, $t) = ($1, $2, $self->charhex2key("$1"));
12665 0 $N{$Name} = $K;
12666 0 $NM{$C} = $Name; # Not needed for compositions, but handy for user-visible output
12667 0 $BL{$C} = $self->charhex2key($BL); # Used for sorting
12668 # Finish processing of preceding text
12669 0 ▶ if (defined $kk) { # Did not see (official) decomposition
Branch: 1 branch
BranchTrueFalseTotal
if (defined $kk) 0 0 0
12670 # warn("see combining: $K $C $Name"),
12671 0 ▶ $NS{$_c}++ if $name =~ /\bCOMBINING\b/ and not ($_c =~ /\p{NonSpacingMark}/);
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /\bCOMBINING\b/ and not $_c =~ /\p{NonSpacingMark}/ 0 0 0
Condition0%0/3
$name =~ /\bCOMBINING\b/ and not $_c =~ /\p{NonSpacingMark}/
!ll&&!rl&&r
000
MC/DC0%0/2
$name =~ /\bCOMBINING\b/ and not $_c =~ /\p{NonSpacingMark}/
$name =~ /\bCOMBINING\b/ not $_c =~ /\p{NonSpacingMark}/
Truth table0%0/3
A and not(B)
A= $name =~ /\bCOMBINING\b/B= not $_c =~ /\p{NonSpacingMark}/
ABresult
0X0
100
111
12672 0 ▶ if ($name =~ /^(.*?)\s+(?:(WITH)\s+|(?=(?:OVER|ABOVE|PRECEDED\s+BY|BELOW(?=\s+LONG\s+DASH))\s+\b(?!WITH\b|AND\b)))(.*?)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^(.*?)\s+(?:(WITH)\s+|(?=(?:OVER|ABOVE|PRECEDED\s+BY|BELOW(?=\s+LONG\s+DASH))\s+\b(?!WITH\b|AND\b)))(.*?)\s*$/) 0 0 0
12673 0 push @{$candidates{$k}}, [$1, $3];
12674 0 my ($b, $with, $ext) = ($1, $2, $3);
12675 0 my @ext = split /\s+AND\s+/, $ext;
12676 0 ▶ if ($with and @ext > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($with and @ext > 1) 0 0 0
Condition0%0/3
$with and @ext > 1
!ll&&!rl&&r
000
MC/DC0%0/2
$with and @ext > 1
$with @ext > 1
Truth table0%0/3
A and B
A= $withB= @ext > 1
ABresult
0X0
100
111
12677 0 for my $i (0..$#ext) {
12678 0 my @ext1 = @ext;
12679 0 splice @ext1, $i, 1;
12680 0 push @{$candidates{$k}}, ["$b WITH ". (join ' AND ', @ext1), $ext[$i]];
12681 }
12682 }
12683 }
12684 0 ▶ if ($name =~ /^(.*)\s+(?=OR\s)(.*?)\s*$/) { # Find the latest possible...
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^(.*)\s+(?=OR\s)(.*?)\s*$/) 0 0 0
12685 0 push @{$candidates{$k}}, [$1, $2];
12686 }
12687 0 ▶ if (($t = $name) =~ s/\b(COMBINING(?=\s+CYRILLIC\s+LETTER)|BARRED|SLANTED|APPROXIMATELY|ASYMPTOTICALLY|(?<!\bLETTER\s)SMALL(?!\s+LETTER\b)|ALMOST|^(?:SQUARED|BIG|N-ARY|LARGE)|LUNATE|SIDEWAYS(?:\s+(?:DIAERESIZED|OPEN))?|INVERTED|ARCHAIC|SCRIPT|LONG|MATHEMATICAL|AFRICAN|INSULAR|VISIGOTHIC|MIDDLE-WELSH|BROKEN|TURNED(?:\s+(?:INSULAR|SANS-SERIF))?|REVERSED|OPEN|CLOSED|DOTLESS|TAILLESS|FINAL)\s+|\s+(BAR|SYMBOL|OPERATOR|SIGN|ROTUNDA|LONGA|IN\s+TRIANGLE)$//) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/\b(COMBINING(?=\s+CYRILLIC\s+LETTER)|BARRED|SLANTED|APPROXIMATELY|ASYMPTOTICALLY|(?<!\bLETTER\s)SMALL(?!\s+LETTER\b)|ALMOST|^(?:SQUARED|BIG|N-ARY|LARGE)|LUNATE|SIDEWAYS(?:\s+(?:DIAERESIZED|OPEN))?|INVERTED|ARCHAIC|SCRIPT|LONG|MATHEMATICAL|AFRICAN|INSULAR|VISIGOTHIC|MIDDLE-WELSH|BROKEN|TURNED(?:\s+(?:INSULAR|SANS-SERIF))?|REVERSED|OPEN|CLOSED|DOTLESS|TAILLESS|FINAL)\s+|\s+(BAR|SYMBOL|OPERATOR|SIGN|ROTUNDA|LONGA|IN\s+TRIANGLE)$//) 0 0 0
12688 0 push @{$candidates{$k}}, [$t, "calculated-$+"];
12689 0 ▶ $candidates{$k}[-1][1] .= '-epigraphic' if $t =~ /\bEPIGRAPHIC\b/; # will be massaged away from $t later
Branch: 1 branch
BranchTrueFalseTotal
if $t =~ /\bEPIGRAPHIC\b/ 0 0 0
12690 $candidates{$k}[-1][0] =~ s/\s+SYMBOL$// and $candidates{$k}[-1][1] .= '-symbol'
12691 0 ▶ if $candidates{$k}[-1][1] =~ /\bLUNATE\b/;
Branch: 1 branch
BranchTrueFalseTotal
if $candidates{$k}[-1][1] =~ /\bLUNATE\b/ 0 0 0
Condition0%0/5
$candidates{$k}[-1][1] =~ /\bLUNATE\b/ && ($candidates{$k}[-1][0] =~ s/\s+SYMBOL$// && ($candidates{$k}[-1][1] .= '-symbol'))
!ll&&!rl&&r
000
$candidates{$k}[-1][0] =~ s/\s+SYMBOL$// and $candidates{$k}[-1][1] .= '-symbol'
!ll
00
MC/DC0%0/2
$candidates{$k}[-1][1] =~ /\bLUNATE\b/ && ($candidates{$k}[-1][0] =~ s/\s+SYMBOL$// && ($candidates{$k}[-1][1] .= '-symbol'))
$candidates{$k}[-1][1] =~ /\bLUNATE\b/ $candidates{$k}[-1][0] =~ s/\s+SYMBOL$//
Truth table0%0/3
A && B
A= $candidates{$k}[-1][1] =~ /\bLUNATE\b/B= $candidates{$k}[-1][0] =~ s/\s+SYMBOL$//
ABresult
0X0
100
111
12692 # warn("smallcapital $name"),
12693 0 ▶ $candidates{$k}[-1][1] .= '-smallcaps' if $t =~ /\bSMALL\s+CAPITAL\b/; # will be massaged away from $t later
Branch: 1 branch
BranchTrueFalseTotal
if $t =~ /\bSMALL\s+CAPITAL\b/ 0 0 0
12694 # warn "Candidates: <$candidates{$k}[0]>; <$candidates{$k}[1]>";
12695 }
12696 0 ▶ if (($t = $name) =~ s/\b(WHITE|BLACK|CIRCLED)\s+//) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/\b(WHITE|BLACK|CIRCLED)\s+//) 0 0 0
12697 0 push @{$candidates{$k}}, [$t, "fake-$1"];
12698 }
12699 0 ▶ if (($t = $name) =~ s/\bBLACK\b/WHITE/) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/\bBLACK\b/WHITE/) 0 0 0
12700 0 push @{$candidates{$k}}, [$t, "fake-black"];
12701 }
12702 0 ▶ if (($t = $name) =~ s/^(?:RAISED|MODIFIER\s+LETTER(?:\s+RAISED)?(\s+LOW)?)\s+//) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/^(?:RAISED|MODIFIER\s+LETTER(?:\s+RAISED)?(\s+LOW)?)\s+//) 0 0 0
12703 0 ▶ push @{$candidates{$k}}, [$t, $1 ? "fake-sub" : "fake-super"];
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
12704 }
12705 0 ▶ if (($t = $name) =~ s/\bBUT\s+NOT\b/OR/) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/\bBUT\s+NOT\b/OR/) 0 0 0
12706 0 push @{$candidates{$k}}, [$t, "fake-but-not"];
12707 }
12708 0 ▶ if (($t = $name) =~ s/(^LATIN\b.*\b\w)UM((?:\s+ROTUNDA)?)$/$1$2/) { # Paleo-latin
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/(^LATIN\b.*\b\w)UM((?:\s+ROTUNDA)?)$/$1$2/) 0 0 0
12709 0 push @{$candidates{$k}}, [$t, "fake-umify"];
12710 }
12711 0 ▶ if ((0xa7 == ((hex $k)>>8)) and ($t = $name) =~ s/\b(\w|CO|VEN)(?!\1)(\w)$/$2/) { # Paleo-latin (CON/VEND + digraph)
Branch: 1 branch
BranchTrueFalseTotal
if (167 == hex($k) >> 8 and ($t = $name) =~ s/\b(\w|CO|VEN)(?!\1)(\w)$/$2/) 0 0 0
Condition0%0/3
167 == hex($k) >> 8 and ($t = $name) =~ s/\b(\w|CO|VEN)(?!\1)(\w)$/$2/
!ll&&!rl&&r
000
MC/DC0%0/2
167 == hex($k) >> 8 and ($t = $name) =~ s/\b(\w|CO|VEN)(?!\1)(\w)$/$2/
167 == hex($k) >> 8 ($t = $name) =~ s/\b(\w|CO|VEN)(?!\1)(\w)$/$2/
Truth table0%0/3
A and B
A= 167 == hex($k) >> 8B= ($t = $name) =~ s/\b(\w|CO|VEN)(?!\1)(\w)$/$2/
ABresult
0X0
100
111
12712 0 push @{$candidates{$k}}, [$t, "fake-paleocontraction-by-last"];
12713 }
12714 0 ▶ if (($t = $name) =~ s/(?:(\bMIDDLE-WELSH)\s+)?\b(\w)(?=\2$)//) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/(?:(\bMIDDLE-WELSH)\s+)?\b(\w)(?=\2$)//) 0 0 0
12715 0 ▶ push @{$candidates{$k}}, [$t, "fake-doubleletter" . ($1 ? "-$1" : '')];
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
12716 }
12717 0 ▶ if (($t = $name) =~ s/\b(APL\s+FUNCTIONAL\s+SYMBOL)\s+\b(.*?)\b\s*\b((?:UNDERBAR|TILDE|DIAERESIS|VANE|STILE|JOT|OVERBAR|BAR)(?!$))\b\s*/$2/) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/\b(APL\s+FUNCTIONAL\s+SYMBOL)\s+\b(.*?)\b\s*\b((?:UNDERBAR|TILDE|DIAERESIS|VANE|STILE|JOT|OVERBAR|BAR)(?!$))\b\s*/$2/) 0 0 0
12718 #warn "APL: $k ($name) --> <$t>; <$1> <$3>";
12719 0 push @{$candidates{$k}}, [$t, "calculated-$1-$3apl"];
12720 0 my %s = qw(UP DOWN DOWN UP); # misprint in the official name???
12721 0 $candidates{$k}[-1][0] =~ s/\b(UP|DOWN)(?=\s+TACK\b)/$s{$1}/;
12722 }
12723 # Allow QUAD at end only if $2 is not-empty
12724 0 ▶ if (($t = $name) =~ s/\b(APL\s+FUNCTIONAL\s+SYMBOL)\s+\b(.*?)\b\s*\b(QUAD(?:(?!$)|(?!\2))|(?:UNDERBAR|TILDE|DIAERESIS|VANE|STILE|JOT|OVERBAR|BAR)$)\b\s*/$2/) {
Branch: 2 branches
BranchTrueFalseTotal
if (($t = $name) =~ s/\b(APL\s+FUNCTIONAL\s+SYMBOL)\s+\b(.*?)\b\s*\b(QUAD(?:(?!$)|(?!\2))|(?:UNDERBAR|TILDE|DIAERESIS|VANE|STILE|JOT|OVERBAR|BAR)$)\b\s*/$2/) { } 0 0 0
elsif (($t = $name) =~ s/\b(APL\s+FUNCTIONAL\s+SYMBOL)\s+//) { } 0 0 0
12725 #warn "APL: $k ($name) --> <$t>; <$1> <$3>";
12726 0 push @{$candidates{$k}}, [$t, "calculated-$1-$3apl"];
12727 0 my %s = qw(UP DOWN DOWN UP); # misprint in the official name???
12728 0 $candidates{$k}[-1][0] =~ s/\b(UP|DOWN)(?=\s+TACK\b)/$s{$1}/;
12729 } elsif (($t = $name) =~ s/\b(APL\s+FUNCTIONAL\s+SYMBOL)\s+//) {
12730 #warn "APL: $k ($name) --> <$t>; <$1> <$3>";
12731 0 push @{$candidates{$k}}, [$t, "calculated-$1"];
12732 0 my %s = qw(UP DOWN DOWN UP); # misprint in the official name???
12733 0 $candidates{$k}[-1][0] =~ s/\b(UP|DOWN)(?=\s+TACK\b)/$s{$1}/;
12734 }
12735 0 ▶ if (($t = $name) =~ s/\b(LETTER\s+SMALL\s+CAPITAL)/CAPITAL LETTER/) {
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/\b(LETTER\s+SMALL\s+CAPITAL)/CAPITAL LETTER/) 0 0 0
12736 0 push @{$candidates{$k}}, [$t, "smallcaps"];
12737 }
12738 0 ▶ if (($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/ # esh/eng/ezh
Branch: 1 branch
BranchTrueFalseTotal
if (($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/ or ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$// or ($t = $name) =~ s/\bDOTLESS\s+J\s+WITH\s+STROKE$/J/ or $name eq "LATIN SMALL LETTER SCHWA" and $t = "DIGIT ZERO") 0 0 0
Condition0%0/11
($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/ or ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$// or ($t = $name) =~ s/\bDOTLESS\s+J\s+WITH\s+STROKE$/J/ or $name eq "LATIN SMALL LETTER SCHWA" and $t = "DIGIT ZERO"
l!l&&r!l&&!r
000
($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/ or ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$// or ($t = $name) =~ s/\bDOTLESS\s+J\s+WITH\s+STROKE$/J/
l!l&&r!l&&!r
000
($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/ or ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$//
l!l&&r!l&&!r
000
$name eq "LATIN SMALL LETTER SCHWA" and $t = "DIGIT ZERO"
!ll
00
MC/DC0%0/4
($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/ or ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$// or ($t = $name) =~ s/\bDOTLESS\s+J\s+WITH\s+STROKE$/J/ or $name eq "LATIN SMALL LETTER SCHWA" and $t = "DIGIT ZERO"
($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/ ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$// ($t = $name) =~ s/\bDOTLESS\s+J\s+WITH\s+STROKE$/J/ $name eq "LATIN SMALL LETTER SCHWA"
Truth table0%0/5
A or B or C or D
A= ($t = $name) =~ s/\b(LETTER\s+)E([SZN])[HG]$/$1$2/B= ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$//C= ($t = $name) =~ s/\bDOTLESS\s+J\s+WITH\s+STROKE$/J/D= $name eq "LATIN SMALL LETTER SCHWA"
ABCDresult
1XXX1
01XX1
001X1
00011
00000
12739 # next two not triggered since this is actually decomposed:
12740 or ($t = $name) =~ s/(?<=\bLETTER\sV\s)WITH\s+RIGHT\s+HOOK$//
12741 or ($t = $name) =~ s/\bDOTLESS\s+J\s+WITH\s+STROKE$/J/
12742 or $name eq 'LATIN SMALL LETTER SCHWA' and $t = 'DIGIT ZERO') {
12743 0 push @{$candidates{$k}}, [$t, "phonetized"] if 0;
12744 }
12745 }
12746 0 ($k, $name, $_c) = ($K, $Name, $C);
12747 0 ▶ $G{$k} = $name if $name =~ /^GREEK\s/; # Indexed by hex
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^GREEK\s/ 0 0 0
12748 0 $kk = $k;
12749 0 next;
12750 }
12751 0 ▶ if ($s =~ /^\@\@\s+([\da-f]+)\b/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s =~ /^\@\@\s+([\da-f]+)\b/i) 0 0 0
12752 0 ▶ die unless $s =~ /^\@\@\s+([\da-f]+)\s.*\s([\da-f]+)\s*$/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $s =~ /^\@\@\s+([\da-f]+)\s.*\s([\da-f]+)\s*$/i 0 0 0
12753 0 $BL = $1;
12754 }
12755 0 my $a; # compatibility_p, composed, decomposition string
12756 0 ▶ $a = [0, split /\s+/, "$1"] if $s =~ /^\s+:\s*([0-9A-F]+(?:\s+[0-9A-F]+)*)/;
Branch: 1 branch
BranchTrueFalseTotal
if $s =~ /^\s+:\s*([0-9A-F]+(?:\s+[0-9A-F]+)*)/ 0 0 0
12757 0 ▶ $a = [1, split /\s+/, "$2"], ($1 and push @$a, $1)
Branch: 1 branch
BranchTrueFalseTotal
if $s =~ /^\s+#\s*(?:(<.*?>)\s+)?([0-9A-F]+(?:\s+[0-9A-F]+)*)/ 0 0 0
Condition0%0/3
$1 and push @$a, $1
!ll&&!rl&&r
000
MC/DC0%0/2
$1 and push @$a, $1
$1 push @$a, $1
Truth table0%0/3
A and B
A= $1B= push @$a, $1
ABresult
0X0
100
111
12758 if $s =~ /^\s+#\s*(?:(<.*?>)\s+)?([0-9A-F]+(?:\s+[0-9A-F]+)*)/; # Put <compat> at end
12759 0 ▶ next unless $a;
Branch: 1 branch
BranchTrueFalseTotal
unless $a 0 0 0
12760 0 ▶ if ($a->[-1] eq '<font>') {{ # Clarify
Branch: 1 branch
BranchTrueFalseTotal
if ($a->[-1] eq "<font>") 0 0 0
12761 0 my ($math, $type) = ('', '');
12762 # warn("Unexpected name with <font>: <$name>"), unless $name =~ s/^MATHEMATICAL\s+// and $math = "math-";
12763 0 ▶ warn("Unexpected name with <font>: $k <$name>"), last # In BMP, MATHEMATICAL is omited
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/ or $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/ or $name =~ /^(ARABIC\s+MATHEMATICAL(?:\s+(?:INITIAL|DOTLESS|STRETCHED|LOOPED|TAILED|DOUBLE-STRUCK))?)\b/ or $name =~ /^(PLANCK|INFORMATION)/ 0 0 0
Condition0%0/9
$name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/ or $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/ or $name =~ /^(ARABIC\s+MATHEMATICAL(?:\s+(?:INITIAL|DOTLESS|STRETCHED|LOOPED|TAILED|DOUBLE-STRUCK))?)\b/ or $name =~ /^(PLANCK|INFORMATION)/
l!l&&r!l&&!r
000
$name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/ or $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/ or $name =~ /^(ARABIC\s+MATHEMATICAL(?:\s+(?:INITIAL|DOTLESS|STRETCHED|LOOPED|TAILED|DOUBLE-STRUCK))?)\b/
l!l&&r!l&&!r
000
$name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/ or $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/
l!l&&r!l&&!r
000
MC/DC0%0/4
$name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/ or $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/ or $name =~ /^(ARABIC\s+MATHEMATICAL(?:\s+(?:INITIAL|DOTLESS|STRETCHED|LOOPED|TAILED|DOUBLE-STRUCK))?)\b/ or $name =~ /^(PLANCK|INFORMATION)/
$name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/ $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/ $name =~ /^(ARABIC\s+MATHEMATICAL(?:\s+(?:INITIAL|DOTLESS|STRETCHED|LOOPED|TAILED|DOUBLE-STRUCK))?)\b/ $name =~ /^(PLANCK|INFORMATION)/
Truth table0%0/5
A or B or C or D
A= $name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/B= $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/C= $name =~ /^(ARABIC\s+MATHEMATICAL(?:\s+(?:INITIAL|DOTLESS|STRETCHED|LOOPED|TAILED|DOUBLE-STRUCK))?)\b/D= $name =~ /^(PLANCK|INFORMATION)/
ABCDresult
1XXX1
01XX1
001X1
00011
00000
12764 unless $name =~ /^(?:MATHEMATICAL\s+)?((?:(?:BLACK-LETTER|FRAKTUR|BOLD|ITALIC|SANS-SERIF|DOUBLE-STRUCK|MONOSPACE|SCRIPT)\b\s*?)+)(?=\s+(?:SMALL|CAPITAL|DIGIT|NABLA|PARTIAL|N-ARY|\w+\s+SYMBOL)\b)/
12765 or $name =~ /^HEBREW\s+LETTER\s+(WIDE|ALTERNATIVE)\b/
12766 or $name =~ /^(ARABIC\s+MATHEMATICAL(?:\s+(?:INITIAL|DOTLESS|STRETCHED|LOOPED|TAILED|DOUBLE-STRUCK))?)\b/
12767 or $name =~ /^(PLANCK|INFORMATION)/; # information source
12768 0 ▶ $type = $1 if $1;
Branch: 1 branch
BranchTrueFalseTotal
if $1 0 0 0
12769 0 $type =~ s/BLACK-LETTER/FRAKTUR/; # http://en.wikipedia.org/wiki/Black-letter#Unicode
12770 0 $type =~ s/INFORMATION/Letterlike/; # http://en.wikipedia.org/wiki/Letterlike_Symbols_%28Unicode_block%29
12771 0 ▶ $type = '=' . join '-', map lc($_), split /\s+/, $type if $type;
Branch: 1 branch
BranchTrueFalseTotal
if $type 0 0 0
12772 0 $a->[-1] = "<font$type>";
12773 }}
12774 0 ▶ push @$a, '<pseudo-upgrade>' unless @$a > 2;
Branch: 1 branch
BranchTrueFalseTotal
unless @$a > 2 0 0 0
12775 0 push @{$basic{$k}}, $a; # <fraction> 1 2044 --\
12776 0 ▶ undef $kk unless $a->[-1] eq '<pseudo-upgrade>' # Disable guesswork processing
Branch: 1 branch
BranchTrueFalseTotal
unless $a->[-1] eq "<pseudo-upgrade>" or @$a == 3 and &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/ and not $a->[-1] =~ /^</ and &UI::KeyboardLayout::chr(hex $a->[-1]) =~ /\w/ 0 0 0
Condition0%0/12
$a->[-1] eq "<pseudo-upgrade>" or @$a == 3 and &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/ and not $a->[-1] =~ /^</ and &UI::KeyboardLayout::chr(hex $a->[-1]) =~ /\w/
l!l&&r!l&&!r
000
@$a == 3 and &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/ and not $a->[-1] =~ /^</ and &UI::KeyboardLayout::chr(hex $a->[-1]) =~ /\w/
!ll&&!rl&&r
000
@$a == 3 and &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/ and not $a->[-1] =~ /^</
!ll&&!rl&&r
000
@$a == 3 and &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/
!ll&&!rl&&r
000
MC/DC0%0/5
$a->[-1] eq "<pseudo-upgrade>" or @$a == 3 and &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/ and not $a->[-1] =~ /^</ and &UI::KeyboardLayout::chr(hex $a->[-1]) =~ /\w/
$a->[-1] eq "<pseudo-upgrade>" @$a == 3 &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/ not $a->[-1] =~ /^</ &UI::KeyboardLayout::chr(hex $a->[-1]) =~ /\w/
Truth table0%0/6
A or B and C and not(D) and E
A= $a->[-1] eq "<pseudo-upgrade>"B= @$a == 3C= &UI::KeyboardLayout::chr(hex $a->[-2]) =~ /\W|\p{Lm}/D= not $a->[-1] =~ /^</E= &UI::KeyboardLayout::chr(hex $a->[-1]) =~ /\w/
ABCDEresult
1XXXX1
011111
00XXX0
010XX0
0110X0
011100
12777 or @$a == 3 and (chr hex $a->[-2]) =~ /\W|\p{Lm}/ and $a->[-1] !~ /^</ and (chr hex $a->[-1]) =~ /\w/;
12778 # print "@$a";
12779 }
12780 # $candidates{'014A'} = ['LATIN CAPITAL LETTER N', 'faked-HOOK']; # Pretend on ENG...
12781 # $candidates{'014B'} = ['LATIN SMALL LETTER N', 'faked-HOOK']; # Pretend on ENG...
12782 # XXXX Better have this together with pseudo-upgrade???
12783 0 push @{$candidates{'00b5'}}, ['GREEK SMALL LETTER MU', 'faked-calculated-SYMBOL']; # Pretend on MICRO SIGN...
12784 # $candidates{'00b5'} = ['GREEK SMALL LETTER MU', 'calculated-SYMBOL']; # Pretend on MICRO SIGN...
12785 0 for my $k (keys %basic) { # hex
12786 0 for my $exp (@{$basic{$k}}) {
12787 0 my $base = $exp->[1]; # hex
12788 0 my $name = $NM{$self->charhex2key($base)};
12789 0 ▶ next if not $name and ($k =~ /^[12]?F[89A]..$/ or hex $base >= 0x4E00 and hex $base <= 0x9FCC); # ideographs; there is also 3400 region...
Branch: 1 branch
BranchTrueFalseTotal
if not $name and $k =~ /^[12]?F[89A]..$/ || hex $base >= 19968 && hex $base <= 40908 0 0 0
Condition0%0/9
not $name and $k =~ /^[12]?F[89A]..$/ || hex $base >= 19968 && hex $base <= 40908
!ll&&!rl&&r
000
$k =~ /^[12]?F[89A]..$/ or hex $base >= 19968 and hex $base <= 40908
l!l&&r!l&&!r
000
hex $base >= 19968 and hex $base <= 40908
!ll&&!rl&&r
000
MC/DC0%0/4
not $name and $k =~ /^[12]?F[89A]..$/ || hex $base >= 19968 && hex $base <= 40908
not $name $k =~ /^[12]?F[89A]..$/ hex $base >= 19968 hex $base <= 40908
Truth table0%0/5
not(A) and B or C and D
A= not $nameB= $k =~ /^[12]?F[89A]..$/C= hex $base >= 19968D= hex $base <= 40908
ABCDresult
0XXX0
100X0
10100
11XX1
10111
12790 0 ▶ warn "Basic: `$k' --> `@$exp', base=`$base' --> `",$self->charhex2key($base),"'" unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
12791 0 ▶ if ((my $NN = $name) =~ s/\s+OPERATOR$//) {
Branch: 1 branch
BranchTrueFalseTotal
if ((my $NN = $name) =~ s/\s+OPERATOR$//) 0 0 0
12792 #warn "operator: `$k' --> <$NN>, `@$exp', base=`$base' --> `",$self->charhex2key($base),"'";
12793 0 ▶ push @{$candidates{$k}}, [$_, @$exp[2..$#$exp]] for $NN, @{ $operators{$NN} || []};
Condition0%0/2
$operators{$NN} || []
l!l
00
MC/DC0%0/1
$operators{$NN} || []
$operators{$NN}
Truth table0%0/2
A
A= $operators{$NN}
Aresult
11
00
12794 }
12795 }
12796 }
12797 0 for my $how (keys %uni_manual) { # Some stuff is easier to describe in terms of char, not names
12798 0 my $map = $uni_manual{$how};
12799 0 ▶ die "manual translation map for $how has an odd number of entries" if @$map % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @$map % 2 0 0 0
12800 # for my $from (keys %$map) {
12801 0 ▶ while (@$map) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$map) 0 0 0
12802 0 my $to = pop @$map; # Give precedence to later entries
12803 0 my $from = pop @$map;
12804 0 for my $shift (0,1) {
12805 0 ▶ if ($shift) {
Branch: 1 branch
BranchTrueFalseTotal
if ($shift) 0 0 0
12806 0 my ($F, $T) = (uc $from, uc $to);
12807 0 ▶ next unless $F ne $from and $T ne $to;
Branch: 1 branch
BranchTrueFalseTotal
unless $F ne $from and $T ne $to 0 0 0
Condition0%0/3
$F ne $from and $T ne $to
!ll&&!rl&&r
000
MC/DC0%0/2
$F ne $from and $T ne $to
$F ne $from $T ne $to
Truth table0%0/3
A and B
A= $F ne $fromB= $T ne $to
ABresult
0X0
100
111
12808 0 ($from, $to) = ($F, $T);
12809 }
12810 0 push @{$candidates{uc $self->key2hex($to)}}, [$NM{$from}, "manual-$how"];
12811 }
12812 }
12813 }
12814 0 for my $g (keys %G) {
12815 0 ▶ (my $l = my $name = $G{$g}) =~ s/^GREEK\b/LATIN/ or die "Panic";
Branch: 1 branch
BranchTrueFalseTotal
(my $l = my $name = $G{$g}) =~ s/^GREEK\b/LATIN/ or die "Panic" 0 0 0
12816 0 ▶ next unless my $L = $N{$l}; # is HEX
Branch: 1 branch
BranchTrueFalseTotal
unless my $L = $N{$l} 0 0 0
12817 #warn "latinize: $L\t$l";
12818 0 push @{$candidates{$L}}, [$name, 'faked-latinize'];
12819 0 ▶ next unless my ($lat, $first, $rest, $add) = ($l =~ /^(LATIN\s+(?:SMALL|CAPITAL)\s+LETTER\s+(\w))(\w+)(?:\s+(\S.*))?$/);
Branch: 1 branch
BranchTrueFalseTotal
unless () = $l =~ /^(LATIN\s+(?:SMALL|CAPITAL)\s+LETTER\s+(\w))(\w+)(?:\s+(\S.*))?$/ 0 0 0
12820 0 ▶ $lat =~ s/P$/F/, $first = 'F' if "$first$rest" eq 'PHI';
Branch: 1 branch
BranchTrueFalseTotal
if "$first$rest" eq "PHI" 0 0 0
12821 0 ▶ die unless my $LL = $N{$lat};
Branch: 1 branch
BranchTrueFalseTotal
unless my $LL = $N{$lat} 0 0 0
12822 0 ▶ $add = (defined $add ? "-$add" : ''); # None of 6.1; only iIuUaAgGdf present of 6.1
Branch: 1 branch
BranchTrueFalseTotal
defined $add ? : 0 0 0
12823 0 push @{$candidates{$L}}, [$lat, "faked-greekize$add"];
12824 #warn "latinize++: $L\t$l;\t`$add'\t$lat";
12825 }
12826 0 my %iu_TR = qw(INTERSECTION CAP UNION CUP);
12827 0 my %_TR = map { (my $in = $_) =~ s/_/ /g; $in } qw(SMALL_VEE LOGICAL_OR
12828 UNION_OPERATOR_WITH_DOT MULTISET_MULTIPLICATION
12829 UNION_OPERATOR_WITH_PLUS MULTISET_UNION
12830 DEL NABLA
12831 QUOTE APOSTROPHE
12832 SQUISH VERTICAL_LINE
12833 SLASH SOLIDUS
12834 BACKSLASH REVERSE_SOLIDUS
12835 DIVIDE DIVISION_SIGN
12836 QUESTION QUESTION_MARK
12837 UP_CARET LOGICAL_AND
12838 DOWN_CARET LOGICAL_OR
12839 JOT DEGREE_SIGN);
12840 0 my($_TR_rx) = map qr/$_/, join '|', keys %_TR;
12841 0 for my $c (keys %candidates) { # Done after all the names are known; hex of the char
12842 0 my ($CAND, $app, $t, $base, $b) = ($candidates{$c}, '');
12843 0 for my $Cand (@$CAND) { # (all keys in hex) [MAYBE_CHAR_NAME, how_obtained]
12844 #warn "candidates: $c <$Cand->[0]>, <@$Cand[1..$#$Cand]>";
12845 # An experiment shows that the FORMS are properly marked as non-canonical decompositions; so they are not needed here
12846 0 ▶ (my $with = my $raw = $Cand->[1]) =~ s/\s+(SIGN|SYMBOL|(?:FINAL|ISOLATED|INITIAL|MEDIAL)\s+FORM)$//
Branch: 1 branch
BranchTrueFalseTotal
(my $with = my $raw = $Cand->[1]) =~ s/\s+(SIGN|SYMBOL|(?:FINAL|ISOLATED|INITIAL|MEDIAL)\s+FORM)$// and $app = " $1" 0 0 0
12847 and $app = " $1"; # $app is just a candidate; actually, not useful at all
12848 0 for my $Mod ( (map ['', $_], $app, '', ' SIGN', ' SYMBOL', ' OF', ' AS MEMBER', ' TO'), # `SUBSET OF', `CONTAINS AS MEMBER', `PARALLEL TO'
12849 (map [$_, ''], 'WHITE ', 'WHITE UP-POINTING ', 'N-ARY '), ['WHITE ', ' SUIT'] ) {
12850 0 my ($prepend, $append) = @$Mod;
12851 0 ▶ next if $raw =~ /-SYMBOL$/ and 0 <= index($append, "SYMBOL"); # <calculated-SYMBOL>
Branch: 1 branch
BranchTrueFalseTotal
if $raw =~ /-SYMBOL$/ and index($append, "SYMBOL") != -1 0 0 0
Condition0%0/3
$raw =~ /-SYMBOL$/ and index($append, "SYMBOL") != -1
!ll&&!rl&&r
000
MC/DC0%0/2
$raw =~ /-SYMBOL$/ and index($append, "SYMBOL") != -1
$raw =~ /-SYMBOL$/ index($append, "SYMBOL") != -1
Truth table0%0/3
A and B
A= $raw =~ /-SYMBOL$/B= index($append, "SYMBOL") != -1
ABresult
0X0
100
111
12852 0 warn "raw=`$raw', prepend=<$prepend>, append=<$append>, base=$Cand->[0]\n" if debug_GUESS_MASSAGE;
12853 0 $t++;
12854 0 ▶ warn "cand1=`$Cand->[1]' c=`$c'" unless defined $Cand->[0];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Cand->[0] 0 0 0
12855 0 $b = "$prepend$Cand->[0]$append";
12856 0 ▶ $b =~ s/\bTWO-HEADED\b/TWO HEADED/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12857 0 ▶ $b =~ s/\bTIMES\b/MULTIPLICATION SIGN/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12858 0 ▶ $b =~ s/(?:(?<=\bLEFT)|(?<=RIGHT))(?=\s+ARROW\b)/WARDS/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12859 0 ▶ $b =~ s/\bLINE\s+INTEGRATION\b/CONTOUR INTEGRAL/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12860 0 ▶ $b =~ s/\bINTEGRAL\s+AVERAGE\b/INTEGRAL/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12861 0 ▶ $b =~ s/\s+(?:SHAPE|OPERATOR|NEGATED)$// unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12862 0 ▶ $b =~ s/\bCIRCLED\s+MULTIPLICATION\s+SIGN\b/CIRCLED TIMES/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12863 0 ▶ $b =~ s/^(CAPITAL|SMALL)\b/LATIN $1 LETTER/ unless $N{$b}; # TURNED SMALL F
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12864 0 ▶ $b =~ s/\b(CAPITAL\s+LETTER)\s+SMALL\b/$1/ unless $N{$b}; # Q WITH HOOK TAIL
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12865 0 ▶ $b =~ s/\bEPIGRAPHIC\b/CAPITAL/ unless $N{$b}; # XXXX is it actually capital?
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12866 $b =~ s/^LATIN\s+LETTER\s+SMALL\s+CAPITAL\b/LATIN CAPITAL LETTER/ # and warn "smallcapital -> <$b>"
12867 0 ▶ if not $N{$b} or $with=~ /smallcaps/; # XXXX is it actually capital?
Branch: 1 branch
BranchTrueFalseTotal
if not $N{$b} or $with =~ /smallcaps/ 0 0 0
Condition0%0/3
not $N{$b} or $with =~ /smallcaps/
l!l&&r!l&&!r
000
MC/DC0%0/2
not $N{$b} or $with =~ /smallcaps/
not $N{$b} $with =~ /smallcaps/
Truth table0%0/3
not(A) or B
A= not $N{$b}B= $with =~ /smallcaps/
ABresult
1X1
011
000
12868 0 ▶ $b =~ s/^GREEK\s+CAPITAL\b(?!=\s+LETTER)/GREEK CAPITAL LETTER/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12869 0 ▶ $b =~ s/^GREEK\b(?!\s+(?:CAPITAL|SMALL)\s+LETTER)/GREEK SMALL LETTER/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12870 0 ▶ $b =~ s/^CYRILLIC\b(?!\s+(?:CAPITAL|SMALL)\s+LETTER)(?=\s+LETTER\b)/CYRILLIC SMALL/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12871 0 ▶ $b =~ s/\bEQUAL(\s+TO\s+SIGN\b)?/EQUALS SIGN/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12872 0 ▶ $b =~ s/\bMINUS\b/HYPHEN-MINUS/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12873 0 ▶ $b =~ s/\b(SQUARE\s+)(INTERSECTION|UNION)(?:\s+OPERATOR)?\b/$1$iu_TR{$2}/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12874 0 ▶ $b =~ s/(?<=WARDS)$/ ARROW/ unless $N{$b}; # APL VANE
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12875 # warn "_TR: <$1> in $b; <<rx=$_TR_rx>>" if $b =~ /\b($_TR_rx)\b/ and not $_TR{$1};
12876 0 ▶ $b =~ s/\b($_TR_rx)\b/$_TR{$1}/ unless $N{$b};
Branch: 1 branch
BranchTrueFalseTotal
unless $N{$b} 0 0 0
12877 $b = "GREEK SMALL LETTER $b" and ($b =~ /\bDELTA\b/ and $b =~ s/\bSMALL\b/CAPITAL/)
12878 0 ▶ if not $N{$b} and $N{"GREEK SMALL LETTER $b"};
Branch: 1 branch
BranchTrueFalseTotal
if not $N{$b} and $N{"GREEK SMALL LETTER $b"} 0 0 0
Condition0%0/12
!$N{$b} && $N{"GREEK SMALL LETTER $b"} && (($b = "GREEK SMALL LETTER $b") && ($b =~ /\bDELTA\b/ && $b =~ s/\bSMALL\b/CAPITAL/))
!ll&&!rl&&r
000
not $N{$b} and $N{"GREEK SMALL LETTER $b"}
!ll&&!rl&&r
000
$b = "GREEK SMALL LETTER $b" and ($b =~ /\bDELTA\b/ and $b =~ s/\bSMALL\b/CAPITAL/)
!ll&&!rl&&r
000
$b =~ /\bDELTA\b/ and $b =~ s/\bSMALL\b/CAPITAL/
!ll&&!rl&&r
000
MC/DC0%0/5
!$N{$b} && $N{"GREEK SMALL LETTER $b"} && (($b = "GREEK SMALL LETTER $b") && ($b =~ /\bDELTA\b/ && $b =~ s/\bSMALL\b/CAPITAL/))
not $N{$b} $N{"GREEK SMALL LETTER $b"} $b = "GREEK SMALL LETTER $b" $b =~ /\bDELTA\b/ $b =~ s/\bSMALL\b/CAPITAL/
Truth table0%0/6
not(A) and B && C and D and E
A= not $N{$b}B= $N{"GREEK SMALL LETTER $b"}C= $b = "GREEK SMALL LETTER $b"D= $b =~ /\bDELTA\b/E= $b =~ s/\bSMALL\b/CAPITAL/
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
12879 # $b =~ s/\bDOT\b/FULL STOP/ unless $N{$b};
12880 # $b =~ s/^MICRO$/GREEK SMALL LETTER MU/ unless $N{$b};
12881
12882 0 warn " b =`$b', prepend=<$prepend>, append=<$append>, base=$Cand->[0]\n" if debug_GUESS_MASSAGE;
12883 0 ▶ if (defined ($base = $N{$b})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($base = $N{$b})) 0 0 0
12884 0 ▶ undef $base, next if $base eq $c;
Branch: 1 branch
BranchTrueFalseTotal
if $base eq $c 0 0 0
12885 0 ▶ $with = $raw if $t;
Branch: 1 branch
BranchTrueFalseTotal
if $t 0 0 0
12886 0 warn "<$Cand->[0]> WITH <$Cand->[1]> resolved via SIGN/SYMBOL/.* FORM: strip=<$app> add=<$prepend/$append>\n"
12887 if debug_GUESS_MASSAGE and ($append or $app or $prepend);
12888 last
12889 0 }
12890 }
12891 0 ▶ if (defined $base) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $base) { } 0 0 0
elsif ($raw =~ /\bOPERATOR$/) { } 0 0 0
12892 0 $base = [$base];
12893 } elsif ($raw =~ /\bOPERATOR$/) {
12894 0 ▶ $base = [map $N{$_}, @{ $operators{$Cand->[0]} }] if exists $operators{$Cand->[0]};
Branch: 1 branch
BranchTrueFalseTotal
if exists $operators{$Cand->[0]} 0 0 0
12895 }
12896 0 ▶ (warnUNRES and warn("Unresolved: <$Cand->[0]> WITH <$Cand->[1]>")), next unless defined $base;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $base 0 0 0
12897 0 my @modifiers = split /\s+AND\s+/, $with;
12898 0 ▶ @modifiers = map { s/\s+/-/g; /^[\da-f]{4,}$/i ? $_ : "<pseudo-\L$_>" } @modifiers;
Branch: 1 branch
BranchTrueFalseTotal
/^[\da-f]{4,}$/i ? : 0 0 0
12899 #warn " $c --> <@$base>; <@modifiers>...\t$b <- $NM{chr hex $c}" ;
12900 0 unshift @{$basic{$c}}, [1, $_, @modifiers] for @$base;
12901 0 ▶ if ($b =~ s/\s+(OPERATOR|SIGN)$//) { # ASTERISK (note that RING is a valid name, but has no relation to RING OPERATOR
Branch: 1 branch
BranchTrueFalseTotal
if ($b =~ s/\s+(OPERATOR|SIGN)$//) 0 0 0
12902 0 ▶ unshift @{$basic{$c}}, [1, $base, @modifiers] if defined ($base = $N{$b}); # ASTERISK
Branch: 1 branch
BranchTrueFalseTotal
if defined($base = $N{$b}) 0 0 0
12903 #$base = '[undef]' unless defined $base;
12904 #warn("operator via <$b>, <$c> => `$base'");
12905 (debug_OPERATOR and warn "operator: `$c' ==> `$_', <@modifiers> via <$b>\n"),
12906 0 ▶ unshift @{$basic{$c}}, [1, $_, @modifiers] for map $N{$_}, @{ $operators{$b} || [] }; # ASTERISK
Condition0%0/2
$operators{$b} || []
l!l
00
MC/DC0%0/1
$operators{$b} || []
$operators{$b}
Truth table0%0/2
A
A= $operators{$b}
Aresult
11
00
12907 }
12908 # push @{$candidates{$k}}, [$_, @$exp[2..$#$exp]] for $NN, @{ $operators{$NN} || []};
12909 # $basic{$c} = [ [1, $base, @modifiers ] ]
12910 }
12911 }
12912 0 $self->decompose_r(\%basic, $_, \%cached_full) for keys %basic; # Now %cached_full is fully expanded - has trivial expansions too
12913 0 ▶ for my $c (sort {fromHEX $a <=> fromHEX $b or $a cmp $b} keys %cached_full) { # order of chars in Unicode matters (all keys in hex)
Condition0%0/3
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
&fromHEX($a) <=> &fromHEX($b) $a cmp $b
Truth table0%0/3
A || B
A= &fromHEX($a) <=> &fromHEX($b)B= $a cmp $b
ABresult
1X1
011
000
12914 0 my %seen_compose;
12915 0 for my $exp (@{ $cached_full{$c} }) {
12916 0 my @exp = @$exp; # deep copy
12917 0 ▶ die "Expansion too short: <@exp>" if @exp < 2;
Branch: 1 branch
BranchTrueFalseTotal
if @exp < 2 0 0 0
12918 0 ▶ next if @exp < 3; # Skip trivial decompositions
Branch: 1 branch
BranchTrueFalseTotal
if @exp < 3 0 0 0
12919 0 my $compat = shift @exp;
12920 0 my @PRE = @exp;
12921 0 my $base = shift @exp;
12922 0 ▶ @exp = ($base, sort {fromHEX $a <=> fromHEX $b or $a cmp $b} @exp); # Any order will do; do not care about Unicode rules
Condition0%0/3
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
&fromHEX($a) <=> &fromHEX($b) $a cmp $b
Truth table0%0/3
A || B
A= &fromHEX($a) <=> &fromHEX($b)B= $a cmp $b
ABresult
1X1
011
000
12923 #warn "Malformed: [@exp]" if "@exp" =~ /^</ or $compat !~ /^[01]$/;
12924 0 ▶ next if $seen_compose{"$compat; @exp"}++; # E.g., WHITE may be added in several ways...
Branch: 1 branch
BranchTrueFalseTotal
if $seen_compose{"$compat; @exp"}++ 0 0 0
12925 0 ▶ push @{$ordered{$c}}, [$compat, @exp > 3 ? @exp : @PRE]; # with 2 modifiers order does not matter for the algo below, but we catch U"¯ vs U¯".
Branch: 1 branch
BranchTrueFalseTotal
@exp > 3 ? : 0 0 0
12926 0 warn qq(Duplicate: $c <== [ @exp ] ==> <@{$compose{"@exp"}[0]}> (prefered)\n\t<), chr hex $c,
12927 qq(>\t$c\t$NM{chr hex $c}\n\t<), chr hex $compose{"@exp"}[0][1], qq(>\t$compose{"@exp"}[0][1]\t$NM{chr hex $compose{"@exp"}[0][1]})
12928 0 ▶ if $compose{"@exp"} and "@exp" !~ /<(font|pseudo-upgrade)>/ and $c ne $compose{"@exp"}[0][1] and not $known_dups{$c};
Branch: 1 branch
BranchTrueFalseTotal
if $compose{join $", @exp} and not join($", @exp) =~ /<(font|pseudo-upgrade)>/ and $c ne $compose{join $", @exp}[0][1] and not $known_dups{$c} 0 0 0
Condition0%0/9
$compose{join $", @exp} and not join($", @exp) =~ /<(font|pseudo-upgrade)>/ and $c ne $compose{join $", @exp}[0][1] and not $known_dups{$c}
!ll&&!rl&&r
000
$compose{join $", @exp} and not join($", @exp) =~ /<(font|pseudo-upgrade)>/ and $c ne $compose{join $", @exp}[0][1]
!ll&&!rl&&r
000
$compose{join $", @exp} and not join($", @exp) =~ /<(font|pseudo-upgrade)>/
!ll&&!rl&&r
000
MC/DC0%0/4
$compose{join $", @exp} and not join($", @exp) =~ /<(font|pseudo-upgrade)>/ and $c ne $compose{join $", @exp}[0][1] and not $known_dups{$c}
$compose{join $", @exp} not join($", @exp) =~ /<(font|pseudo-upgrade)>/ $c ne $compose{join $", @exp}[0][1] not $known_dups{$c}
Truth table0%0/5
A and not(B) and C and not(D)
A= $compose{join $", @exp}B= not join($", @exp) =~ /<(font|pseudo-upgrade)>/C= $c ne $compose{join $", @exp}[0][1]D= not $known_dups{$c}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
12929 #warn "Compose rule: `@exp' ==> $compat, `$c'";
12930 0 push @{$compose{"@exp"}}, [$compat, $c];
12931 }
12932 } # compose mapping done
12933 0 ▶ for my $c (sort {fromHEX $a <=> fromHEX $b or $a cmp $b} keys %ordered) { # all nontrivial! Order of chars in Unicode matters...
Condition0%0/3
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
&fromHEX($a) <=> &fromHEX($b) $a cmp $b
Truth table0%0/3
A || B
A= &fromHEX($a) <=> &fromHEX($b)B= $a cmp $b
ABresult
1X1
011
000
12934 0 my(%seen_compose, %seen_contract) = ();
12935 0 for my $v (@{ $ordered{$c} }) { ## When (FOO and FOO OPERATOR) + tilde are both remapped to X: X+operator == X
12936 0 my %seen;
12937 0 for my $off (reverse(2..$#$v)) {
12938 # next if $seen{$v->[$off]}++; # chain of compat, or 2A76 -> ?2A75 003D < = = = >
12939 0 my @r = @$v; # deep copy
12940 0 splice @r, $off, 1;
12941 0 my $compat = shift @r;
12942 #warn "comp: $compat, $c; $off [@$v] -> $v->[$off] + [@r]";
12943 0 ▶ next if $seen_compose{"$compat; $v->[$off]; @r"}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen_compose{"$compat; $v->[$off]; @r"}++ 0 0 0
12944 # next unless my $contracted = $compose{"@r"}; # This omits trivial compositions
12945 0 ▶ my $contracted = [@{$compose{"@r"} || []}]; # Deep copy
Condition0%0/2
$compose{join $", @r} || []
l!l
00
MC/DC0%0/1
$compose{join $", @r} || []
$compose{join $", @r}
Truth table0%0/2
A
A= $compose{join $", @r}
Aresult
11
00
12946 # warn "Panic $c" if @$contracted and @r == 1;
12947 0 ▶ push @$contracted, [0, @r] if @r == 1; # Not in %compose
Branch: 1 branch
BranchTrueFalseTotal
if @r == 1 0 0 0
12948 # QUAD-INT: may be INT INT INT INT, may be INT amp INT INT etc; may lead to same compositions...
12949 #warn "contraction: $_->[0]; $compat; $c; $v->[$off]; $_->[1]" for @$contracted;
12950 0 ▶ @$contracted = grep {$_->[1] ne $c and not $seen_contract{"$_->[0]; $compat; $v->[$off]; $_->[1]"}++} @$contracted;
Condition0%0/3
$_->[1] ne $c && !$seen_contract{"$_->[0]; $compat; $v->[$off]; $_->[1]"}++
!ll&&!rl&&r
000
MC/DC0%0/2
$_->[1] ne $c && !$seen_contract{"$_->[0]; $compat; $v->[$off]; $_->[1]"}++
$_->[1] ne $c !$seen_contract{"$_->[0]; $compat; $v->[$off]; $_->[1]"}++
Truth table0%0/3
A && not(B)
A= $_->[1] ne $cB= !$seen_contract{"$_->[0]; $compat; $v->[$off]; $_->[1]"}++
ABresult
0X0
100
111
12951 #warn " contraction: $_->[0]; $compat; $c; $v->[$off]; $_->[1]" for @$contracted;
12952 0 for my $contr (@$contracted) { # May be empty: Eg, fractions decompose into 2 3 <fraction> and cannot be composed in 2 steps
12953 0 ▶ my $calculated = $contr->[0] || $off != $#$v;
Condition0%0/3
$contr->[0] || $off != $v->$#*
l!l&&r!l&&!r
000
MC/DC0%0/2
$contr->[0] || $off != $v->$#*
$contr->[0] $off != $v->$#*
Truth table0%0/3
A || B
A= $contr->[0]B= $off != $v->$#*
ABresult
1X1
011
000
12954 0 push @{ $into2{$self->charhex2key($c)} }, [(($compat | $contr->[0])<<1)|$calculated, $self->charhex2key($contr->[1]), $self->charhex2key($v->[$off])]; # each: compat, char, combine
12955 0 push @{ $comp2{$v->[$off]}{$contr->[1]} }, [ (($compat | $contr->[0])<<1)|$calculated, $c]; # each: compat, char
12956 }
12957 }
12958 }
12959 } # (de)compose-into-2 mapping done
12960 0 for my $h2 (values %comp2) { # Massage into the natural order - prefer canonical (de)compositions
12961 0 for my $h (values %$h2) { # RValues!!! [compat, charHEX] each
12962 # my @a = sort { "@$a" cmp "@$b" } @$h;
12963 0 ▶ my @a = sort { $a->[0] <=> $b->[0] or $self->charhex2key($a->[1]) cmp $self->charhex2key($b->[1]) } @$h;
Condition0%0/3
$UI::KeyboardLayout::a->[0] <=> $UI::KeyboardLayout::b->[0] || $self->charhex2key($UI::KeyboardLayout::a->[1]) cmp $self->charhex2key($UI::KeyboardLayout::b->[1])
l!l&&r!l&&!r
000
MC/DC0%0/2
$UI::KeyboardLayout::a->[0] <=> $UI::KeyboardLayout::b->[0] || $self->charhex2key($UI::KeyboardLayout::a->[1]) cmp $self->charhex2key($UI::KeyboardLayout::b->[1])
$UI::KeyboardLayout::a->[0] <=> $UI::KeyboardLayout::b->[0] $self->charhex2key($UI::KeyboardLayout::a->[1]) cmp $self->charhex2key($UI::KeyboardLayout::b->[1])
Truth table0%0/3
A || B
A= $UI::KeyboardLayout::a->[0] <=> $UI::KeyboardLayout::b->[0]B= $self->charhex2key($UI::KeyboardLayout::a->[1]) cmp $self->charhex2key($UI::KeyboardLayout::b->[1])
ABresult
1X1
011
000
12964 0 $h = \@a;
12965 }
12966 }
12967 0 \%into2, \%comp2, \%NM, \%BL, \%NS, $version
12968 }
12969
12970 0 ▶sub print_decompositions($;$) {
Subroutine print_decompositions: not called CC=5 SCAR=34.0
Pod undocumented
12971 0 my $self = shift;
12972 0 ▶ my $dec = @_ ? shift : do { my $f = $self->get_NamesList;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
12973 0 ▶ $self->load_compositions($f) if defined $f;
Branch: 1 branch
BranchTrueFalseTotal
if defined $f 0 0 0
12974 0 $self->{Decompositions}} ;
12975 0 for my $c (sort keys %$dec) {
12976 0 my $arr = $dec->{$c};
12977 0 ▶ my @out = map +($_->[0] ? '? ' : '= ') . "@$_[1,2]", @$arr;
Branch: 1 branch
BranchTrueFalseTotal
$_->[0] ? : 0 0 0
12978 0 print "$c\t->\t", join(",\t", @out), "\n";
12979 }
12980 }
12981
12982 0 ▶sub print_compositions_ch_filter($;$$) {
Subroutine print_compositions_ch_filter: not called CC=9 SCAR=45.0
Pod undocumented
12983 0 my $self = shift;
12984 0 ▶ my $filter = (@_ and shift);
Condition0%0/3
@_ && shift()
!ll&&!rl&&r
000
MC/DC0%0/2
@_ && shift()
@_ shift()
Truth table0%0/3
A && B
A= @_B= shift()
ABresult
0X0
100
111
12985 0 ▶ my $comp = @_ ? shift : do { my $f = $self->get_NamesList;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
12986 0 ▶ $self->load_compositions($f) if defined $f;
Branch: 1 branch
BranchTrueFalseTotal
if defined $f 0 0 0
12987 0 $self->{Compositions}} ;
12988 0 my %F = map +($_,1), @$filter;
12989 0 ▶ for my $c ($filter ? @$filter : sort keys %$comp) { # composing char
Branch: 1 branch
BranchTrueFalseTotal
$filter ? : 0 0 0
12990 0 ▶ warn("Unknown composition prefex: [[[$c]]]"), next unless exists $comp->{$c};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $comp->{$c} 0 0 0
12991 0 print "$c\n";
12992 0 for my $b (sort keys %{$comp->{$c}}) { # base char
12993 0 my $arr = $comp->{$c}{$b};
12994 0 ▶ my @out = map +($_->[0] ? '? ' : '= ') . $_->[1], @$arr;
Branch: 1 branch
BranchTrueFalseTotal
$_->[0] ? : 0 0 0
12995 0 print "\t$b\t->\t", join(",\t\t", @out), "\n";
12996 }
12997 }
12998 }
12999
13000 0 ▶sub print_compositions_ch($;$) {
Subroutine print_compositions_ch: not called CC=1 SCAR=6.9
Pod undocumented
13001 0 my $self = shift;
13002 0 $self->print_compositions_ch_filter(undef, @_);
13003 }
13004
13005 0 ▶sub print_compositions($;$) {
Subroutine print_compositions: not called CC=7 SCAR=40.3
Pod undocumented
13006 0 ▶ goto &print_compositions_ch if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 0 0 0
13007 0 my ($self, $comp) = (shift, shift);
13008 0 ▶ for my $c (sort {fromHEX $a <=> fromHEX $b or $a cmp $b} keys %$comp) { # composing char
Condition0%0/3
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
&fromHEX($a) <=> &fromHEX($b) $a cmp $b
Truth table0%0/3
A || B
A= &fromHEX($a) <=> &fromHEX($b)B= $a cmp $b
ABresult
1X1
011
000
13009 0 print "$c\n";
13010 0 ▶ for my $b (sort {fromHEX $a <=> fromHEX $b or $a cmp $b} keys %{$comp->{$c}}) { # base char
Condition0%0/3
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
&fromHEX($a) <=> &fromHEX($b) $a cmp $b
Truth table0%0/3
A || B
A= &fromHEX($a) <=> &fromHEX($b)B= $a cmp $b
ABresult
1X1
011
000
13011 0 my $arr = $comp->{$c}{$b};
13012 0 ▶ my @out = map +($_->[0] ? '?' : '=') . $_->[1], @$arr;
Branch: 1 branch
BranchTrueFalseTotal
$_->[0] ? : 0 0 0
13013 0 print "\t$b\t->\t", join(",\t\t", @out), "\n";
13014 }
13015 }
13016 }
13017
13018 0 ▶sub load_compositions($$) {
Subroutine load_compositions: not called CC=10 SCAR=47.0
Pod undocumented
13019 0 my ($self, $comp, @comb) = (shift, shift);
13020 0 ▶ return $self if $self->{Compositions};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"Compositions"} 0 0 0
13021 0 ▶ my %comp = %{ $self->{'[Substitutions]'} || {} };
Condition0%0/2
$self->{'[Substitutions]'} || {}
l!l
00
MC/DC0%0/1
$self->{'[Substitutions]'} || {}
$self->{'[Substitutions]'}
Truth table0%0/2
A
A= $self->{'[Substitutions]'}
Aresult
11
00
13022 0 ▶ open my $f, '<', $comp or die "Can't open $comp for read";
Branch: 1 branch
BranchTrueFalseTotal
open my $f, "<", $comp or die "Can't open $comp for read" 0 0 0
13023 0 ($self->{Decompositions}, $comp, $self->{UNames}, $self->{UBlock}, $self->{exComb}, $self->{uniVersion}) = $self->parse_NameList($f);
13024 0 ▶ close $f or die "Can't close $comp for read";
Branch: 1 branch
BranchTrueFalseTotal
close $f or die "Can't close $comp for read" 0 0 0
13025 #warn "(De)Compositions and UNames loaded";
13026 # Having hex as index is tricky: is it 4-digits or more? Is it in uppercase?
13027 0 ▶ for my $c (sort {fromHEX $a <=> fromHEX $b or $a cmp $b} keys %$comp) { # composing char
Condition0%0/3
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
&fromHEX($a) <=> &fromHEX($b) $a cmp $b
Truth table0%0/3
A || B
A= &fromHEX($a) <=> &fromHEX($b)B= $a cmp $b
ABresult
1X1
011
000
13028 0 ▶ for my $b (sort {fromHEX $a <=> fromHEX $b or $a cmp $b} keys %{$comp->{$c}}) { # base char
Condition0%0/3
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
l!l&&r!l&&!r
000
MC/DC0%0/2
&fromHEX($a) <=> &fromHEX($b) || $a cmp $b
&fromHEX($a) <=> &fromHEX($b) $a cmp $b
Truth table0%0/3
A || B
A= &fromHEX($a) <=> &fromHEX($b)B= $a cmp $b
ABresult
1X1
011
000
13029 0 my $arr = $comp->{$c}{$b};
13030 0 my @out = map [$self->charhex2key($_->[0]), $self->charhex2key($_->[1])], @$arr;
13031 0 $comp{$self->charhex2key($c)}{$self->charhex2key($b)} = \@out;
13032 }
13033 }
13034 0 $self->{Compositions} = \%comp;
13035 0 my $comb = join '', keys %{$self->{exComb}}; # should not have metachars here...
13036 0 ▶ $rxCombining = qr/\p{nonSpacingMark}|[$comb]/ if $comb;
Branch: 1 branch
BranchTrueFalseTotal
if $comb 0 0 0
13037 0 $self
13038 }
13039
13040 0 ▶sub load_uniage($$) {
Subroutine load_uniage: not called CC=3 SCAR=24.8
Pod undocumented
13041 0 my ($self, $fn) = (shift, shift);
13042 # get_AgeList
13043 0 ▶ open my $f, '<', $fn or die "Can't open `$fn' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $f, "<", $fn or die "Can't open `${fn}' for read: $!" 0 0 0
13044 0 local $/;
13045 0 my $s = <$f>;
13046 0 ▶ close $f or die "Can't close `$fn' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $f or die "Can't close `${fn}' for read: $!" 0 0 0
13047 0 $self->{Age} = $self->parse_derivedAge($s);
13048 0 $self
13049 }
13050
13051 0 ▶sub load_unidata($$) {
Subroutine load_unidata: not called CC=2 SCAR=17.9
Pod undocumented
13052 0 my ($self, $comp) = (shift, shift);
13053 0 $self->load_compositions($comp);
13054 0 ▶ return $self unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
13055 0 $self->load_uniage(shift);
13056 }
13057
13058 1 my(%charinfo, %UName_v); # Unicode::UCD::charinfo extremely slow
13059 0 ▶sub UName($$$;$) {
Subroutine UName: not called CC=22 SCAR=62.3
Pod undocumented
13060 0 my ($self, $c, $verbose, $vbell, $app, $n, $i, $A) = (shift, shift, shift, shift, '');
13061 0 $c = $self->charhex2key($c);
13062 0 ▶ return $UName_v{$c} if $verbose and exists $UName_v{$c} and ($vbell or 0x266a != ord $c);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose and exists $UName_v{$c} and $vbell || 9834 != ord $c 0 0 0
Condition0%0/9
$verbose and exists $UName_v{$c} and $vbell || 9834 != ord $c
!ll&&!rl&&r
000
$verbose and exists $UName_v{$c}
!ll&&!rl&&r
000
$vbell or 9834 != ord $c
l!l&&r!l&&!r
000
MC/DC0%0/4
$verbose and exists $UName_v{$c} and $vbell || 9834 != ord $c
$verbose exists $UName_v{$c} $vbell 9834 != ord $c
Truth table0%0/5
A and B and C or D
A= $verboseB= exists $UName_v{$c}C= $vbellD= 9834 != ord $c
ABCDresult
0XXX0
10XX0
11000
111X1
11011
13063 0 ▶ if (not exists $self->{UNames} or $verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $self->{"UNames"} or $verbose) 0 0 0
Condition0%0/3
not exists $self->{"UNames"} or $verbose
l!l&&r!l&&!r
000
MC/DC0%0/2
not exists $self->{"UNames"} or $verbose
not exists $self->{"UNames"} $verbose
Truth table0%0/3
not(A) or B
A= not exists $self->{"UNames"}B= $verbose
ABresult
1X1
011
000
13064 0 require Unicode::UCD;
13065 0 ▶ $i = ($charinfo{$c} ||= Unicode::UCD::charinfo(ord $c) || {});
Condition0%0/5
$charinfo{$c} ||= Unicode::UCD::charinfo(ord $c) || {}
l!l&&r!l&&!r
000
Unicode::UCD::charinfo(ord $c) || {}
l!l
00
MC/DC0%0/2
$charinfo{$c} ||= Unicode::UCD::charinfo(ord $c) || {}
$charinfo{$c} Unicode::UCD::charinfo(ord $c)
Truth table0%0/3
A ||= B
A= $charinfo{$c}B= Unicode::UCD::charinfo(ord $c)
ABresult
1X1
011
000
13066 0 $A = $self->{Age}{$c};
13067 0 ▶ $n = $self->{UNames}{$c} || ($i->{name}) || "<$c>";
Condition0%0/5
$self->{'UNames'}{$c} || $i->{'name'} || "<$c>"
l!l
00
$self->{"UNames"}{$c} or $i->{"name"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'UNames'}{$c} || $i->{'name'} || "<$c>"
$self->{"UNames"}{$c} $i->{"name"}
Truth table0%0/3
A or B
A= $self->{"UNames"}{$c}B= $i->{"name"}
ABresult
1X1
011
000
13068 0 ▶ if ($verbose and (%$i or $A)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($verbose and %$i || $A) 0 0 0
Condition0%0/6
$verbose and %$i || $A
!ll&&!rl&&r
000
%$i or $A
l!l&&r!l&&!r
000
MC/DC0%0/3
$verbose and %$i || $A
$verbose %$i $A
Truth table0%0/4
A and B or C
A= $verboseB= %$iC= $A
ABCresult
0XX0
1000
11X1
1011
13069 0 my $scr = $i->{script};
13070 0 my $bl = $i->{block};
13071 0 $scr = join '; ', grep defined, $scr, $bl, $A;
13072 0 ▶ $scr = "Com/MiscSym1.1" if $vbell and 0x266a == ord $c; # EIGHT NOTE: we use as "visual bell"
Branch: 1 branch
BranchTrueFalseTotal
if $vbell and 9834 == ord $c 0 0 0
Condition0%0/3
$vbell and 9834 == ord $c
!ll&&!rl&&r
000
MC/DC0%0/2
$vbell and 9834 == ord $c
$vbell 9834 == ord $c
Truth table0%0/3
A and B
A= $vbellB= 9834 == ord $c
ABresult
0X0
100
111
13073 0 ▶ $app = " [$scr]" if length $scr;
Branch: 1 branch
BranchTrueFalseTotal
if length $scr 0 0 0
13074 }
13075 0 ▶ return($UName_v{$c} = "$n$app") if $verbose and ($vbell or 0x266a != ord $c);
Branch: 1 branch
BranchTrueFalseTotal
if $verbose and $vbell || 9834 != ord $c 0 0 0
Condition0%0/6
$verbose and $vbell || 9834 != ord $c
!ll&&!rl&&r
000
$vbell or 9834 != ord $c
l!l&&r!l&&!r
000
MC/DC0%0/3
$verbose and $vbell || 9834 != ord $c
$verbose $vbell 9834 != ord $c
Truth table0%0/4
A and B or C
A= $verboseB= $vbellC= 9834 != ord $c
ABCresult
0XX0
1000
11X1
1011
13076 0 return "$n$app"
13077 }
13078 0 ▶ $self->{UNames}{$c} || ($c =~ /[\x{d800}-\x{dfff}\x00-\x1f\x7f-\xAF]/ ? '['.$self->key2hex($c).']' : "[$c]")
Branch: 2 branches
BranchTrueFalseTotal
$self->{"UNames"}{$c} or $c =~ /[\x{d800}-\x{dfff}\x00-\x1f\x7f-\xAF]/ ? '[' . $self->key2hex($c) . ']' : "[$c]" 0 0 0
$c =~ /[\x{d800}-\x{dfff}\x00-\x1f\x7f-\xAF]/ ? : 0 0 0
13079 }
13080
13081 0 ▶sub parse_derivedAge ($$) {
Subroutine parse_derivedAge: not called CC=6 SCAR=37.4
Pod undocumented
13082 0 my ($self, $s, %C) = (shift, shift);
13083 0 for my $l (split /\n/, $s) {
13084 0 ▶ next if $l =~ /^\s*(#|$)/;
Branch: 1 branch
BranchTrueFalseTotal
if $l =~ /^\s*(#|$)/ 0 0 0
13085 0 ▶ die "Unexpected line in DerivedAge: `$l'"
Branch: 1 branch
BranchTrueFalseTotal
unless $l =~ /^([0-9a-f]{4,})(?:\.\.([0-9a-f]{4,}))?\s*;\s*(\d\d?\.\d)\b/i 0 0 0
13086 unless $l =~ /^([0-9a-f]{4,})(?:\.\.([0-9a-f]{4,}))?\s*;\s*(\d\d?\.\d)\b/i;
13087 0 ▶ $C{chr $_} = $3 for (hex $1) .. hex($2 || $1);
Condition0%0/3
$2 || $1
l!l&&r!l&&!r
000
MC/DC0%0/2
$2 || $1
$2 $1
Truth table0%0/3
A || B
A= $2B= $1
ABresult
1X1
011
000
13088 }
13089 0 \%C;
13090 }
13091
13092 # use Dumpvalue;
13093 # my $first_time_dump;
13094 1 my %warned_decomposed;
13095 0 ▶sub get_compositions ($$$$;$) { # Now only the undo-brach is used...
Subroutine get_compositions: not called CC=26 SCAR=65.5
Pod undocumented
13096 0 my ($self, $m, $C, $undo, $unAltGr, @out) = (shift, shift, shift, shift, shift);
13097 # return unless defined $C and defined (my $r = $self->{Compositions}{$m}{$C});
13098 # Dumpvalue->new()->dumpValue($self->{Compositions}) unless $first_time_dump++;
13099 0 ▶ return undef unless defined $C;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $C 0 0 0
13100 0 ▶ $C = $C->[0] if 'ARRAY' eq ref $C; # Treat prefix keys as usual keys
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $C 0 0 0
13101 0 warn "doing <$C> <@$m>: undo=$undo C=", $self->key2hex($C), ", maps=", join ' ', map $self->key2hex($_), @$m if warnDO_COMPOSE; # if $m eq 'A';
13102 0 ▶ if ($undo) {
Branch: 1 branch
BranchTrueFalseTotal
if ($undo) 0 0 0
13103 0 ▶ return undef unless my $dec = $self->{Decompositions}{$C};
Branch: 1 branch
BranchTrueFalseTotal
unless my $dec = $self->{"Decompositions"}{$C} 0 0 0
13104 # order in @$m matters; so does one in Decompositions - but less so
13105 # Hence the external loop should be in @$m
13106 0 for my $M (@$m) {
13107 0 push @out, $_ for grep $M eq $_->[2], @$dec;
13108 0 ▶ if (@out) { # We took the first guy from $m which allows such decomposition
Branch: 1 branch
BranchTrueFalseTotal
if (@out) 0 0 0
13109 warn "Decomposing <$C> <$M>: multiple answers: <", (join '> <', map "@$_", @out), ">"
13110 0 ▶ if @out > 1 and not $warned_decomposed{$C,$M}++;
Branch: 1 branch
BranchTrueFalseTotal
if @out > 1 and not $warned_decomposed{join $;, $C, $M}++ 0 0 0
Condition0%0/3
@out > 1 and not $warned_decomposed{join $;, $C, $M}++
!ll&&!rl&&r
000
MC/DC0%0/2
@out > 1 and not $warned_decomposed{join $;, $C, $M}++
@out > 1 not $warned_decomposed{join $;, $C, $M}++
Truth table0%0/3
A and not(B)
A= @out > 1B= not $warned_decomposed{join $;, $C, $M}++
ABresult
0X0
100
111
13111 0 warn "done undo <$C> <@$m>: -> ", $self->array2string(\@out) if warnDO_COMPOSE; # if $m eq 'A';
13112 0 return $out[0][1]
13113 }
13114 }
13115 0 return undef;
13116 }
13117 0 ▶ if ($unAltGr) {{
Branch: 1 branch
BranchTrueFalseTotal
if ($unAltGr) 0 0 0
13118 0 ▶ last unless $unAltGr = $unAltGr->{$C};
Branch: 1 branch
BranchTrueFalseTotal
unless $unAltGr = $unAltGr->{$C} 0 0 0
13119 0 my(@seen, %seen);
13120 0 for my $comp ( @$m ) {
13121 0 my $a1 = $self->{Compositions}{$comp}{$unAltGr};;
13122 0 ▶ push @seen, $a1 if $a1 and not $seen{$a1->[0][1]}++;
Branch: 1 branch
BranchTrueFalseTotal
if $a1 and not $seen{$a1->[0][1]}++ 0 0 0
Condition0%0/3
$a1 and not $seen{$a1->[0][1]}++
!ll&&!rl&&r
000
MC/DC0%0/2
$a1 and not $seen{$a1->[0][1]}++
$a1 not $seen{$a1->[0][1]}++
Truth table0%0/3
A and not(B)
A= $a1B= not $seen{$a1->[0][1]}++
ABresult
0X0
100
111
13123 #warn "Second binding `$a1->[0][1]' for `$unAltGr' (on `$C') - after $seen[0][0][1]" if @seen == 2;
13124 0 ▶ next unless defined (my $a2 = $self->{Compositions}{$comp}{$C}) or @seen == 2;
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $a2 = $self->{"Compositions"}{$comp}{$C}) or @seen == 2 0 0 0
Condition0%0/3
defined(my $a2 = $self->{"Compositions"}{$comp}{$C}) or @seen == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
defined(my $a2 = $self->{"Compositions"}{$comp}{$C}) or @seen == 2
defined(my $a2 = $self->{"Compositions"}{$comp}{$C}) @seen == 2
Truth table0%0/3
A or B
A= defined(my $a2 = $self->{"Compositions"}{$comp}{$C})B= @seen == 2
ABresult
1X1
011
000
13125 #warn " --> AltGr-binding `$a2->[0][1]' (on `$C')" if @seen == 2 and defined $a2;
13126 0 ▶ warn "Conflict between the second binding `$a1->[0][1]' for `$unAltGr' and AltGr-binding `$a2->[0][1]' (on `$C')"
Branch: 1 branch
BranchTrueFalseTotal
if $a2 and $a1 and @seen == 2 and $a1->[0][1] ne $a2->[0][1] 0 0 0
Condition0%0/9
$a2 and $a1 and @seen == 2 and $a1->[0][1] ne $a2->[0][1]
!ll&&!rl&&r
000
$a2 and $a1 and @seen == 2
!ll&&!rl&&r
000
$a2 and $a1
!ll&&!rl&&r
000
MC/DC0%0/4
$a2 and $a1 and @seen == 2 and $a1->[0][1] ne $a2->[0][1]
$a2 $a1 @seen == 2 $a1->[0][1] ne $a2->[0][1]
Truth table0%0/5
A and B and C and D
A= $a2B= $a1C= @seen == 2D= $a1->[0][1] ne $a2->[0][1]
ABCDresult
0XXX0
10XX0
110X0
11100
11111
13127 if $a2 and $a1 and @seen == 2 and $a1->[0][1] ne $a2->[0][1];
13128 0 ▶ return ((@seen == 2 and $a1) or $a2)->[0][1];
Condition0%0/6
@seen == 2 && $a1 || $a2
l!l&&r!l&&!r
000
@seen == 2 and $a1
!ll&&!rl&&r
000
MC/DC0%0/3
@seen == 2 && $a1 || $a2
@seen == 2 $a1 $a2
Truth table0%0/5
A and B || C
A= @seen == 2B= $a1C= $a2
ABCresult
11X1
0X11
1011
0X00
1000
13129 }
13130 }}
13131 0 ▶ return undef unless my ($r) = grep defined, map $self->compound_composition($_,$C), @$m;
Branch: 1 branch
BranchTrueFalseTotal
unless my($r) = grep(defined($_), map($self->compound_composition($_, $C), @$m)) 0 0 0
13132 0 ▶ warn "Composing <$C> <@$m>: multiple answers: <", (join '> <', map "@$_", @$r), ">" unless @$r == 1 or $C eq ' ';
Branch: 1 branch
BranchTrueFalseTotal
unless @$r == 1 or $C eq " " 0 0 0
Condition0%0/3
@$r == 1 or $C eq " "
l!l&&r!l&&!r
000
MC/DC0%0/2
@$r == 1 or $C eq " "
@$r == 1 $C eq " "
Truth table0%0/3
A or B
A= @$r == 1B= $C eq " "
ABresult
1X1
011
000
13133 # warn("done <$C> <$m>: <$r->[0][1]>"); # if $m eq 'A';
13134 0 $r->[0][1]
13135 }
13136
13137 0 ▶sub compound_composition ($$$) {
Subroutine compound_composition: not called CC=21 SCAR=61.4
Pod undocumented
13138 0 my ($self, $M, $C, $doc, $doc1, @res, %seen) = (shift, shift, shift, '', '');
13139 0 ▶ return undef unless defined $C;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $C 0 0 0
13140 0 ▶ $doc1 = $C->[3] if 'ARRAY' eq ref $C and defined $C->[3]; # may be used via <reveal-substkey>, when $M is empty
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $C and defined $C->[3] 0 0 0
Condition0%0/3
"ARRAY" eq ref $C and defined $C->[3]
!ll&&!rl&&r
000
MC/DC0%0/2
"ARRAY" eq ref $C and defined $C->[3]
"ARRAY" eq ref $C defined $C->[3]
Truth table0%0/3
A and B
A= "ARRAY" eq ref $CB= defined $C->[3]
ABresult
0X0
100
111
13141 0 ▶ $doc = "$doc1 ⇒ " if length $doc1;
Branch: 1 branch
BranchTrueFalseTotal
if length $doc1 0 0 0
13142 0 ▶ $C = $C->[0] if 'ARRAY' eq ref $C;
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref $C 0 0 0
13143 0 warn "composing `$M' with base <$C>" if warnDO_COMPOSE;
13144 0 $C = [[0, $C, $doc1]]; # Emulate element of return of Compositions ("one translation, explicit")
13145 0 for my $m (reverse split /\+|-(?=-)/, $M) {
13146 0 my @res;
13147 0 ▶ if ($m =~ /^(?:-|(?:[ul]c(?:first)?|dectrl)$)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m =~ /^(?:-|(?:[ul]c(?:first)?|dectrl)$)/) { } 0 0 0
13148 0 ▶ if ($m =~ s/^-//) {
Branch: 5 branches
BranchTrueFalseTotal
if ($m =~ s/^-//) { } 0 0 0
elsif ($m eq 'lc') { } 0 0 0
elsif ($m eq 'uc') { } 0 0 0
elsif ($m eq 'ucfirst') { } 0 0 0
elsif ($m eq 'dectrl') { } 0 0 0
13149 0 @res = map $self->get_compositions([$m], $_->[1], 'undo'), @$C;
13150 0 @res = map [[0,$_]], grep defined, @res;
13151 } elsif ($m eq 'lc') {
13152 0 ▶ @res = map {($_->[1] eq lc($_->[1]) or 1 != length lc($_->[1])) ? () : [[0, lc $_->[1]]]} @$C
Branch: 1 branch
BranchTrueFalseTotal
$_->[1] eq &UI::KeyboardLayout::lc($_->[1]) || 1 != length &UI::KeyboardLayout::lc($_->[1]) ? : 0 0 0
Condition0%0/3
$_->[1] eq &UI::KeyboardLayout::lc($_->[1]) or 1 != length &UI::KeyboardLayout::lc($_->[1])
l!l&&r!l&&!r
000
MC/DC0%0/2
$_->[1] eq &UI::KeyboardLayout::lc($_->[1]) or 1 != length &UI::KeyboardLayout::lc($_->[1])
$_->[1] eq &UI::KeyboardLayout::lc($_->[1]) 1 != length &UI::KeyboardLayout::lc($_->[1])
Truth table0%0/3
A or B
A= $_->[1] eq &UI::KeyboardLayout::lc($_->[1])B= 1 != length &UI::KeyboardLayout::lc($_->[1])
ABresult
1X1
011
000
13153 } elsif ($m eq 'uc') {
13154 0 ▶ @res = map {($_->[1] eq uc($_->[1]) or 1 != length uc($_->[1])) ? () : [[0, uc $_->[1]]]} @$C
Branch: 1 branch
BranchTrueFalseTotal
$_->[1] eq &UI::KeyboardLayout::uc($_->[1]) || 1 != length &UI::KeyboardLayout::uc($_->[1]) ? : 0 0 0
Condition0%0/3
$_->[1] eq &UI::KeyboardLayout::uc($_->[1]) or 1 != length &UI::KeyboardLayout::uc($_->[1])
l!l&&r!l&&!r
000
MC/DC0%0/2
$_->[1] eq &UI::KeyboardLayout::uc($_->[1]) or 1 != length &UI::KeyboardLayout::uc($_->[1])
$_->[1] eq &UI::KeyboardLayout::uc($_->[1]) 1 != length &UI::KeyboardLayout::uc($_->[1])
Truth table0%0/3
A or B
A= $_->[1] eq &UI::KeyboardLayout::uc($_->[1])B= 1 != length &UI::KeyboardLayout::uc($_->[1])
ABresult
1X1
011
000
13155 } elsif ($m eq 'ucfirst') {
13156 0 ▶ @res = map {($_->[1] eq ucfirst($_->[1]) or 1 != length ucfirst($_->[1])) ? () : [[0, ucfirst $_->[1]]]} @$C
Branch: 1 branch
BranchTrueFalseTotal
$_->[1] eq &UI::KeyboardLayout::ucfirst($_->[1]) || 1 != length &UI::KeyboardLayout::ucfirst($_->[1]) ? : 0 0 0
Condition0%0/3
$_->[1] eq &UI::KeyboardLayout::ucfirst($_->[1]) or 1 != length &UI::KeyboardLayout::ucfirst($_->[1])
l!l&&r!l&&!r
000
MC/DC0%0/2
$_->[1] eq &UI::KeyboardLayout::ucfirst($_->[1]) or 1 != length &UI::KeyboardLayout::ucfirst($_->[1])
$_->[1] eq &UI::KeyboardLayout::ucfirst($_->[1]) 1 != length &UI::KeyboardLayout::ucfirst($_->[1])
Truth table0%0/3
A or B
A= $_->[1] eq &UI::KeyboardLayout::ucfirst($_->[1])B= 1 != length &UI::KeyboardLayout::ucfirst($_->[1])
ABresult
1X1
011
000
13157 } elsif ($m eq 'dectrl') {
13158 0 ▶ @res = map {(0x20 <= ord($_->[1])) ? () : [[0, chr(0x40 + ord $_->[1])]]} @$C
Branch: 1 branch
BranchTrueFalseTotal
32 <= ord $_->[1] ? : 0 0 0
13159 } else {
13160 0 die "Panic"
13161 }
13162 } else {
13163 #warn "compose `$m' with bases <", join('> <', map $_->[1], @$C), '>';
13164 # warn "composition <<<$m>>> unknown" unless keys %{ $self->{Compositions}{$m} } or $m eq '<reveal-substkey>';
13165 0 @res = map $self->{Compositions}{$m}{$_->[1]}, @$C;
13166 }
13167 0 @res = map @$_, grep defined, @res;
13168 0 ▶ return undef unless @res;
Branch: 1 branch
BranchTrueFalseTotal
unless @res 0 0 0
13169 0 $C = [map [$_->[0], $_->[1], "$doc$M"], @res];
13170 }
13171 $C
13172 0 }
13173
13174 0 ▶sub compound_composition_many ($$$$) { # As above, but takes an array of [char, docs]
Subroutine compound_composition_many: not called CC=10 SCAR=47.0
Pod undocumented
13175 0 my ($self, $M, $CC, $ini) = (shift, shift, shift, shift);
13176 0 ▶ return undef unless $CC;
Branch: 1 branch
BranchTrueFalseTotal
unless $CC 0 0 0
13177 0 ▶ my $doc = (($ini and ref $ini and defined $ini->[3]) ? "$ini->[3] ⇒ Subst{" : '');
Branch: 1 branch
BranchTrueFalseTotal
$ini && ref $ini && defined $ini->[3] ? : 0 0 0
Condition0%0/6
$ini and ref $ini and defined $ini->[3]
!ll&&!rl&&r
000
$ini and ref $ini
!ll&&!rl&&r
000
MC/DC0%0/3
$ini and ref $ini and defined $ini->[3]
$ini ref $ini defined $ini->[3]
Truth table0%0/4
A and B and C
A= $iniB= ref $iniC= defined $ini->[3]
ABCresult
0XX0
10X0
1100
1111
13178 0 ▶ my($doc1, @res) = $doc && '}';
Condition0%0/2
$doc && '}'
!ll
00
MC/DC0%0/1
$doc && '}'
$doc
Truth table0%0/2
A
A= $doc
Aresult
00
11
13179 0 for my $C (@$CC) {
13180 # $C = $C->[0] if 'ARRAY' eq ref $C;
13181 0 ▶ next unless defined $C;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $C 0 0 0
13182 0 my $in = $self->compound_composition($M, [$C->[0], undef, undef, "$doc$C->[1]$doc1"]);
13183 0 ▶ push @res, @$in if defined $in;
Branch: 1 branch
BranchTrueFalseTotal
if defined $in 0 0 0
13184 }
13185 0 ▶ return undef unless @res;
Branch: 1 branch
BranchTrueFalseTotal
unless @res 0 0 0
13186 \@res
13187 0 }
13188
13189 # Design goals: we assign several diacritics to a prefix key (possibly with
13190 # AltGr on the "Base key" and/or other "multiplexers" in between). We want:
13191 # *) a lc/uc paired result to sit on Shift-paired keypresses;
13192 # *) avoid duplication among multiplexers (a secondary goal);
13193 # *) allow some diacritics in the list to be prefered ("groups" below);
13194 # *) when there is a choice, prefer non-bizzare (read: with smaller Unicode
13195 # "Age" version) binding to be non-multiplexed.
13196 # We allow something which was not on AltGr to acquire AltGr when it gets a
13197 # diacritic.
13198
13199 # It MAY happen that an earlier binding has empty slots,
13200 # but a later binding exists (to preserve lc/uc pairing, and shift-state)
13201
13202 ### XXXX Unclear: how to catenate something in front of such a map...
13203 # we do $composition->[0][1], which means we ignore additional compositions! And we ignore HOW, instead of putting it into penalty
13204
13205 0 ▶sub sort_compositions ($$$$$;$) {
Subroutine sort_compositions: not called CC=77 SCAR=87.0
Pod undocumented
13206 0 my ($self, $m, $C, $Sub, $dupsOK, $w32OK, @res, %seen, %Penalize, %penalize, %OK, %ok, @C) = (shift, shift, shift, shift, shift, shift);
13207 0 warn "compounding ", $self->array2string($C) if warnSORTCOMPOSE;
13208 0 for my $c (@$C) {
13209 0 ▶ push @C, [map {($_ and 'ARRAY' eq ref $_) ? $_->[0] : $_} @$c]
Branch: 1 branch
BranchTrueFalseTotal
$_ && 'ARRAY' eq ref $_ ? : 0 0 0
Condition0%0/3
$_ and "ARRAY" eq ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and "ARRAY" eq ref $_
$_ "ARRAY" eq ref $_
Truth table0%0/3
A and B
A= $_B= "ARRAY" eq ref $_
ABresult
0X0
100
111
13210 }
13211 0 my $char = $C[0][0];
13212 0 ▶ $char = 'N/A' unless defined $char;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char 0 0 0
13213 0 for my $MM (@$m) { # |-groups
13214 0 my(%byPenalty, @byLayers);
13215 0 for my $M (@$MM) { # diacritic in a group; may flatten each layer, but do not flatten separately each shift state: need to pair uc/lc
13216 0 ▶ if ((my $P = $M) =~ s/^(!)?\\(\\)?//) {
Branch: 1 branch
BranchTrueFalseTotal
if ((my $P = $M) =~ s/^(!)?\\(\\)?//) 0 0 0
13217 0 my($neg, $strong) = ($1, $2);
13218 # warn "Penalize: <$P>"; # Actually, it is not enough to penalize; one should better put it in a different group...
13219 0 ▶ if ($P =~ s/\[(.*)\]$//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($P =~ s/\[(.*)\]$//) 0 0 0
13220 #$P = $self->stringHEX2string($P);
13221 0 my $match;
13222 0 ▶ $char eq $_ and $match++ for split //, $self->stringHEX2string("$1");
Branch: 1 branch
BranchTrueFalseTotal
$char eq $_ and ++$match 0 0 0
13223 0 ▶ next unless $match;
Branch: 1 branch
BranchTrueFalseTotal
unless $match 0 0 0
13224 }
13225 #$P = $self->stringHEX2string($P);
13226 0 ▶ if ($neg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($neg) { } 0 0 0
13227 0 ▶ $strong ? $OK{$_}++ : $ok{$_}++ for split //, $P;
Branch: 1 branch
BranchTrueFalseTotal
$strong ? : 0 0 0
13228 } else {
13229 0 ▶ $strong ? $Penalize{$_}++ : $penalize{$_}++ for split //, $P;
Branch: 1 branch
BranchTrueFalseTotal
$strong ? : 0 0 0
13230 }
13231 next
13232 0 }
13233 0 for my $L (0..$#C) { # Layer number; indexes a shift-pair
13234 # my @res2 = map {defined($_) ? $self->{Compositions}{$M}{$_} : undef } @{ $C[$L] };
13235 ### $M =~ s/^<reveal-(?:green|subst)key>$//; # Hack: the rule <reveal-substkey> ⇝ an empty rule — which always succeeds
13236 0 my @working_with = grep defined, @{ $C[$L] }; # ., KP_Decimal gives [. undef]
13237 0 my @Res2 = map $self->compound_composition($M, $_), @{ $C->[$L] }; # elt: [$synth, $char]
13238 0 warn "compound `$M' of [@working_with] -> ", $self->array2string(\@Res2) if warnSORTCOMPOSE;
13239 # Now retry with substituted keys $Sub; Hack: the rule <reveal-substkey> is unknown to the rest of this module,
13240 # so always fails if present in a chain, here we remove it — and an empty mogrifier list always succeeds
13241 0 (my $MMM = $M) =~ s/(^|\+)<reveal-(?:green|subst)key>$//; #
13242 my @Res3 = map $self->compound_composition_many($MMM, (defined() ? $Sub->{($_ and ref) ? $_->[0] : $_} : $_), $_),
13243 0 ▶ @{ $C->[$L] };
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 0 0 0
$_ && ref $_ ? : 0 0 0
Condition0%0/3
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
13244 0 warn "compound+ `$M' of [@working_with] -> ", $self->array2string(\@Res3) if warnSORTCOMPOSE;
13245 0 for my $shift (0..$#Res3) {
13246 0 ▶ if (defined $Res2[$shift]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Res2[$shift]) { } 0 0 0
13247 0 ▶ push @{ $Res2[$shift]}, @{$Res3[$shift]} if $Res3[$shift]
Branch: 1 branch
BranchTrueFalseTotal
if $Res3[$shift] 0 0 0
13248 } else {
13249 0 $Res2[$shift] = $Res3[$shift]
13250 }
13251 }
13252 # defined $Res2[$_] ? ($Res3[$_] and push @{$Res2[$_]}, @{$Res2[$_]}) : ($Res2[$_] = $Res3[$_]) for 0..$#Res3;
13253 0 @Res2 = $self->DEEP_COPY(@Res2);
13254 0 my ($ok, @ini_compat);
13255 0 ▶ do {{ # Run over found translations
Branch: 1 branch
BranchTrueFalseTotal
$ok and do { do { { my(@res2) = map({defined $_ ? $_->[0] : undef;} @Res2); defined $_ and shift @$_, @$_ || undef $_ foreach (@Res2); $ok = grep($_, @res2); @res2 = map({!defined($_) || !$dupsOK && $seen{$_->[1]}++ ? undef : $_;} @res2); my(@compat) = map({defined $_ ? $_->[0] : undef;} @res2); my(@_from_) = map({defined $_ ? $_->[2] : undef;} @res2); defined $_ and s/((?<![^+])|(?<=\x{21d2} ))Cached\d+=//g foreach (@_from_); @res2 = map({defined $_ ? $_->[1] : undef;} @res2); @res2 = map({65536 > ord($_ || 0) ? $_ : undef;} @res2) unless $w32OK; (defined $ini_compat[$_] or $ini_compat[$_] = $compat[$_]) foreach (0 .. $#compat); my(@extra_penalty) = map({not !$compat[$_] and $ini_compat[$_] < $compat[$_];} 0 .. $#compat); next unless my $cnt = grep(defined($_), @res2); () = [("zzz") x @res2]; defined $res2[$_] and $penalty->[$_] gt ($p = ($OK{$res2[$_]} ? "+" : "-") . ($self->{"Age"}{$res2[$_]} || "undef") . ($ok{$res2[$_]} ? "+" : "-") . "#$extra_penalty[$_]#" . ($self->{"UBlock"}{$res2[$_]} || "")) and $penalty->[$_] = $p foreach (0 .. $#res2); my $have1 = !(defined $res2[0] && defined $res2[1]); my $double_occupancy = $cnt == 2 && $res2[0] ne $res2[1] && &UI::KeyboardLayout::lc($res2[0]) eq &UI::KeyboardLayout::lc($res2[1]); '???'; next if $double_occupancy and grep {defined $_ and $Penalize{$_};} @res2; if ($double_occupancy and grep {defined $_ and $penalize{$_};} @res2) { defined $res2[$_] and $penalty->[$_] = "zzz$penalty->[$_]" foreach (0 .. $#res2); } else { defined $_ and $Penalize{$_} and --$cnt, $have1 = 1, undef $_ foreach (@res2); defined $res2[$_] and $penalize{$res2[$_]} and $penalty->[$_] = "zzz$penalty->[$_]" foreach (0 .. $#res2); } ; next unless $cnt; if (not $double_occupancy and $cnt == 2 and 1) { '???'; push @{$byPenalty{"$penalty->[0]1"}[0][$L];}, [[$res2[0], undef, undef, $_from_[0]]]; push @{$byPenalty{"$penalty->[1]1"}[0][$L];}, [undef, [$res2[1], undef, undef, $_from_[1]]]; next; } ; $p = defined $res2[0] ? $penalty->[0] : "zzz"; $p = $penalty->[1] if @$penalty > 1 and defined $res2[1] and $p gt $penalty->[1]; push @{$byPenalty{"$p$have1"}[$double_occupancy][$L];}, [map({defined $res2[$_] ? [$res2[$_], undef, undef, $_from_[$_]] : undef;} 0 .. $#res2)]; } } } 0 0 0
13256 0 ▶ my @res2 = map {defined() ? $_->[0] : undef} @Res2; # process next unprocessed translations
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
13257 0 ▶ defined and (shift(@$_), (@$_ or undef $_)) for @Res2; # remove what is being processed
Branch: 1 branch
BranchTrueFalseTotal
defined $_ and shift @$_, @$_ || undef $_ 0 0 0
Condition0%0/2
@$_ or undef $_
l!l
00
MC/DC0%0/1
@$_ or undef $_
@$_
Truth table0%0/2
A
A= @$_
Aresult
11
00
13258 0 $ok = grep $_, @res2;
13259 0 ▶ @res2 = map {(not defined() or (!$dupsOK and $seen{$_->[1]}++)) ? undef : $_} @res2; # remove duplicates
Branch: 1 branch
BranchTrueFalseTotal
!defined($_) || !$dupsOK && $seen{$_->[1]}++ ? : 0 0 0
Condition0%0/6
not defined $_ or not $dupsOK and $seen{$_->[1]}++
l!l&&r!l&&!r
000
not $dupsOK and $seen{$_->[1]}++
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $_ or not $dupsOK and $seen{$_->[1]}++
not defined $_ not $dupsOK $seen{$_->[1]}++
Truth table0%0/4
not(A) or not(B) and C
A= not defined $_B= not $dupsOKC= $seen{$_->[1]}++
ABCresult
1XX1
0111
00X0
0100
13260 0 ▶ my @compat = map {defined() ? $_->[0] : undef} @res2;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
13261 0 ▶ my @_from_ = map {defined() ? $_->[2] : undef} @res2;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
13262 0 ▶ defined and s/((?<![^+])|(?<=⇒ ))Cached\d+=//g for @_from_;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ and s/((?<![^+])|(?<=\x{21d2} ))Cached\d+=//g 0 0 0
13263 0 ▶ @res2 = map {defined() ? $_->[1] : undef} @res2;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
13264 0 ▶ @res2 = map {0x10000 > ord($_ || 0) ? $_ : undef} @res2 unless $w32OK; # remove those needing surrogates
Branch: 2 branches
BranchTrueFalseTotal
unless $w32OK 0 0 0
65536 > ord($_ || 0) ? : 0 0 0
Condition0%0/2
$_ || 0
l!l
00
MC/DC0%0/1
$_ || 0
$_
Truth table0%0/2
A
A= $_
Aresult
11
00
13265 0 ▶ defined $ini_compat[$_] or $ini_compat[$_] = $compat[$_] for 0..$#compat;
Branch: 1 branch
BranchTrueFalseTotal
defined $ini_compat[$_] or $ini_compat[$_] = $compat[$_] 0 0 0
13266 0 ▶ my @extra_penalty = map {!!$compat[$_] and $ini_compat[$_] < $compat[$_]} 0..$#compat;
Condition0%0/3
!!$compat[$_] && $ini_compat[$_] < $compat[$_]
!ll&&!rl&&r
000
MC/DC0%0/2
!!$compat[$_] && $ini_compat[$_] < $compat[$_]
!!$compat[$_] $ini_compat[$_] < $compat[$_]
Truth table0%0/3
A && B
A= !!$compat[$_]B= $ini_compat[$_] < $compat[$_]
ABresult
0X0
100
111
13267 0 ▶ next unless my $cnt = grep defined, @res2;
Branch: 1 branch
BranchTrueFalseTotal
unless my $cnt = grep(defined($_), @res2) 0 0 0
13268 0 my($penalty, $p) = [('zzz') x @res2]; # above any "5.1", "undef" ("unassigned"???)
13269 # Take into account the "compatibility", but give it lower precedence than the layer:
13270 # for no-compatibility: do not store the level;
13271 defined $res2[$_] and $penalty->[$_] gt ( $p = ($OK{$res2[$_]} ? '+' : '-') . ($self->{Age}{$res2[$_]} || 'undef') .
13272 ($ok{$res2[$_]} ? '+' : '-') . "#$extra_penalty[$_]#" . ($self->{UBlock}{$res2[$_]} || '') )
13273 0 ▶ and $penalty->[$_] = $p for 0..$#res2;
Branch: 3 branches
BranchTrueFalseTotal
defined $res2[$_] and $penalty->[$_] gt ($p = ($OK{$res2[$_]} ? "+" : "-") . ($self->{"Age"}{$res2[$_]} || "undef") . ($ok{$res2[$_]} ? "+" : "-") . "#$extra_penalty[$_]#" . ($self->{"UBlock"}{$res2[$_]} || "")) and $penalty->[$_] = $p 0 0 0
$OK{$res2[$_]} ? : 0 0 0
$ok{$res2[$_]} ? : 0 0 0
Condition0%0/7
defined $res2[$_] and $penalty->[$_] gt ($p = ($OK{$res2[$_]} ? "+" : "-") . ($self->{"Age"}{$res2[$_]} || "undef") . ($ok{$res2[$_]} ? "+" : "-") . "#$extra_penalty[$_]#" . ($self->{"UBlock"}{$res2[$_]} || ""))
!ll&&!rl&&r
000
$self->{'Age'}{$res2[$_]} || 'undef'
l!l
00
$self->{'UBlock'}{$res2[$_]} || ''
l!l
00
MC/DC0%0/2
defined $res2[$_] and $penalty->[$_] gt ($p = ($OK{$res2[$_]} ? "+" : "-") . ($self->{"Age"}{$res2[$_]} || "undef") . ($ok{$res2[$_]} ? "+" : "-") . "#$extra_penalty[$_]#" . ($self->{"UBlock"}{$res2[$_]} || ""))
defined $res2[$_] $penalty->[$_] gt ($p = ($OK{$res2[$_]} ? "+" : "-") . ($self->{"Age"}{$res2[$_]} || "undef") . ($ok{$res2[$_]} ? "+" : "-") . "#$extra_penalty[$_]#" . ($self->{"UBlock"}{$res2[$_]} || ""))
MC/DC0%0/1
$self->{'Age'}{$res2[$_]} || 'undef'
$self->{'Age'}{$res2[$_]}
MC/DC0%0/1
$self->{'UBlock'}{$res2[$_]} || ''
$self->{'UBlock'}{$res2[$_]}
Truth table0%0/3
A and B
A= defined $res2[$_]B= $penalty->[$_] gt ($p = ($OK{$res2[$_]} ? "+" : "-") . ($self->{"Age"}{$res2[$_]} || "undef") . ($ok{$res2[$_]} ? "+" : "-") . "#$extra_penalty[$_]#" . ($self->{"UBlock"}{$res2[$_]} || ""))
ABresult
0X0
100
111
Truth table0%0/2
A
A= $self->{'Age'}{$res2[$_]}
Aresult
11
00
Truth table0%0/2
A
A= $self->{'UBlock'}{$res2[$_]}
Aresult
11
00
13274 0 ▶ my $have1 = not (defined $res2[0] and defined $res2[1]); # Prefer those with both entries
Condition0%0/3
defined $res2[0] && defined $res2[1]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $res2[0] && defined $res2[1]
defined $res2[0] defined $res2[1]
Truth table0%0/3
A && B
A= defined $res2[0]B= defined $res2[1]
ABresult
0X0
100
111
13275 # Break a non-lc/uc paired translations into separate groups
13276 0 ▶ my $double_occupancy = ($cnt == 2 and $res2[0] ne $res2[1] and lc $res2[0] eq lc $res2[1]); # Case fold
Condition0%0/6
$cnt == 2 && $res2[0] ne $res2[1] && &UI::KeyboardLayout::lc($res2[0]) eq &UI::KeyboardLayout::lc($res2[1])
!ll&&!rl&&r
000
$cnt == 2 and $res2[0] ne $res2[1]
!ll&&!rl&&r
000
MC/DC0%0/3
$cnt == 2 && $res2[0] ne $res2[1] && &UI::KeyboardLayout::lc($res2[0]) eq &UI::KeyboardLayout::lc($res2[1])
$cnt == 2 $res2[0] ne $res2[1] &UI::KeyboardLayout::lc($res2[0]) eq &UI::KeyboardLayout::lc($res2[1])
Truth table0%0/4
A and B && C
A= $cnt == 2B= $res2[0] ne $res2[1]C= &UI::KeyboardLayout::lc($res2[0]) eq &UI::KeyboardLayout::lc($res2[1])
ABCresult
0XX0
10X0
1100
1111
13277 0 warn " seeing random-double, penalties <$penalty->[0]>, <$penalty->[1]>\n" if warnSORTCOMPOSE;
13278 0 ▶ next if $double_occupancy and grep {defined and $Penalize{$_}} @res2;
Branch: 1 branch
BranchTrueFalseTotal
if $double_occupancy and grep {defined $_ and $Penalize{$_};} @res2 0 0 0
Condition0%0/6
$double_occupancy and grep {defined $_ and $Penalize{$_};} @res2
!ll&&!rl&&r
000
defined $_ && $Penalize{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
$double_occupancy and grep {defined $_ and $Penalize{$_};} @res2
$double_occupancy grep {defined $_ and $Penalize{$_};} @res2
MC/DC0%0/2
defined $_ && $Penalize{$_}
defined $_ $Penalize{$_}
Truth table0%0/3
A and B
A= $double_occupancyB= grep {defined $_ and $Penalize{$_};} @res2
ABresult
0X0
100
111
Truth table0%0/3
A && B
A= defined $_B= $Penalize{$_}
ABresult
0X0
100
111
13279 0 ▶ if ($double_occupancy and grep {defined and $penalize{$_}} @res2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($double_occupancy and grep {defined $_ and $penalize{$_};} @res2) { } 0 0 0
Condition0%0/6
$double_occupancy and grep {defined $_ and $penalize{$_};} @res2
!ll&&!rl&&r
000
defined $_ && $penalize{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
$double_occupancy and grep {defined $_ and $penalize{$_};} @res2
$double_occupancy grep {defined $_ and $penalize{$_};} @res2
MC/DC0%0/2
defined $_ && $penalize{$_}
defined $_ $penalize{$_}
Truth table0%0/3
A and B
A= $double_occupancyB= grep {defined $_ and $penalize{$_};} @res2
ABresult
0X0
100
111
Truth table0%0/3
A && B
A= defined $_B= $penalize{$_}
ABresult
0X0
100
111
13280 0 ▶ defined $res2[$_] and $penalty->[$_] = "zzz$penalty->[$_]" for 0..$#res2;
Branch: 1 branch
BranchTrueFalseTotal
defined $res2[$_] and $penalty->[$_] = "zzz$penalty->[$_]" 0 0 0
13281 } else {
13282 0 ▶ defined and $Penalize{$_} and $cnt--, $have1=1, undef $_ for @res2;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ and $Penalize{$_} and --$cnt, $have1 = 1, undef $_ 0 0 0
Condition0%0/3
defined $_ and $Penalize{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ and $Penalize{$_}
defined $_ $Penalize{$_}
Truth table0%0/3
A and B
A= defined $_B= $Penalize{$_}
ABresult
0X0
100
111
13283 0 ▶ defined $res2[$_] and $penalize{$res2[$_]} and $penalty->[$_] = "zzz$penalty->[$_]" for 0..$#res2;
Branch: 1 branch
BranchTrueFalseTotal
defined $res2[$_] and $penalize{$res2[$_]} and $penalty->[$_] = "zzz$penalty->[$_]" 0 0 0
Condition0%0/3
defined $res2[$_] and $penalize{$res2[$_]}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $res2[$_] and $penalize{$res2[$_]}
defined $res2[$_] $penalize{$res2[$_]}
Truth table0%0/3
A and B
A= defined $res2[$_]B= $penalize{$res2[$_]}
ABresult
0X0
100
111
13284 }
13285 0 ▶ next unless $cnt;
Branch: 1 branch
BranchTrueFalseTotal
unless $cnt 0 0 0
13286 0 ▶ if (not $double_occupancy and $cnt == 2 and (1 or $penalty->[0] ne $penalty->[1])) { # Break (penalty here is not a good idea???)
Branch: 1 branch
BranchTrueFalseTotal
if (not $double_occupancy and $cnt == 2 and 1) 0 0 0
Condition0%0/5
not $double_occupancy and $cnt == 2 and 1
!ll
00
not $double_occupancy and $cnt == 2
!ll&&!rl&&r
000
MC/DC0%0/2
not $double_occupancy and $cnt == 2 and 1
not $double_occupancy $cnt == 2
Truth table0%0/3
not(A) and B
A= not $double_occupancyB= $cnt == 2
ABresult
0X0
100
111
13287 0 warn " breaking random-double, penalties <$penalty->[0]>, <$penalty->[1]>\n" if warnSORTCOMPOSE;
13288 0 push @{ $byPenalty{"$penalty->[0]1"}[0][$L] }, [ [$res2[0],undef,undef,$_from_[0]]];
13289 0 push @{ $byPenalty{"$penalty->[1]1"}[0][$L] }, [undef, [$res2[1],undef,undef,$_from_[1]]];
13290 0 next; # Now: $double_occupancy or $cnt == 1 or $penalty->[0] eq $penalty->[1]
13291 }
13292 0 ▶ $p = (defined $res2[0] ? $penalty->[0] : 'zzz'); # may have been undef()ed due to Penalty...
Branch: 1 branch
BranchTrueFalseTotal
defined $res2[0] ? : 0 0 0
13293 0 ▶ $p = $penalty->[1] if @$penalty > 1 and defined $res2[1] and $p gt $penalty->[1];
Branch: 1 branch
BranchTrueFalseTotal
if @$penalty > 1 and defined $res2[1] and $p gt $penalty->[1] 0 0 0
Condition0%0/6
@$penalty > 1 and defined $res2[1] and $p gt $penalty->[1]
!ll&&!rl&&r
000
@$penalty > 1 and defined $res2[1]
!ll&&!rl&&r
000
MC/DC0%0/3
@$penalty > 1 and defined $res2[1] and $p gt $penalty->[1]
@$penalty > 1 defined $res2[1] $p gt $penalty->[1]
Truth table0%0/4
A and B and C
A= @$penalty > 1B= defined $res2[1]C= $p gt $penalty->[1]
ABCresult
0XX0
10X0
1100
1111
13294 0 push @{ $byPenalty{"$p$have1"}[$double_occupancy][$L] },
13295 # [map {defined $res2[$_] ? $res2[$_] : undef} 0..$#res2];
13296 0 ▶ [map {defined $res2[$_] ? [$res2[$_],undef,undef,$_from_[$_]] : undef} 0..$#res2];
Branch: 1 branch
BranchTrueFalseTotal
defined $res2[$_] ? : 0 0 0
13297 }} while $ok;
13298 0 warn " --> combined of [@working_with] -> ", $self->array2string([\@res, %byPenalty]) if warnSORTCOMPOSE;
13299 }
13300 } # sorted bindings, per Layer
13301 0 push @res, [ @byPenalty{ sort keys %byPenalty } ]; # each elt is an array ref indexed by layer number; elt of this is [lc uc]
13302 }
13303 #warn 'Compositions: ', $self->array2string(\@res);
13304 \@res
13305 0 } # index as $res->[group][penalty_N][double_occ][layer][NN][shift]
13306
13307 0 ▶sub equalize_lengths ($$@) {
Subroutine equalize_lengths: not called CC=6 SCAR=37.4
Pod undocumented
13308 0 ▶ my ($self, $extra, $l) = (shift, shift || 0, 0);
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
13309 0 ▶ $l <= length and $l = length for @_;
Branch: 1 branch
BranchTrueFalseTotal
$l <= length $_ and $l = length $_ 0 0 0
13310 0 $l += $extra;
13311 0 ▶ $l > length and $_ .= ' ' x ($l - length) for @_;
Branch: 1 branch
BranchTrueFalseTotal
$l > length $_ and $_ .= " " x ($l - length($_)) 0 0 0
13312 }
13313
13314 0 ▶sub report_sorted_l ($$$;$$) { # 6 levels: |-group, priority, double-occupancy, layer, count, shift
Subroutine report_sorted_l: not called CC=28 SCAR=67.0
Pod undocumented
13315 0 my ($self, $k, $sorted, $bold, $bold1, $top2, %bold) = (shift, shift, shift, shift, shift);
13316 0 ▶ $k = $k->[0] if 'ARRAY' eq ref($k || 0);
Branch: 1 branch
BranchTrueFalseTotal
if "ARRAY" eq ref($k || 0) 0 0 0
Condition0%0/2
$k || 0
l!l
00
MC/DC0%0/1
$k || 0
$k
Truth table0%0/2
A
A= $k
Aresult
11
00
13317 0 ▶ $k = '<undef>' unless defined $k;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k 0 0 0
13318 0 ▶ $k = "<$k>" if defined $k and $k !~ /[^┃┋║│┆\s]/;
Branch: 1 branch
BranchTrueFalseTotal
if defined $k and not $k =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/ 0 0 0
Condition0%0/3
defined $k and not $k =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $k and not $k =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
defined $k not $k =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
Truth table0%0/3
A and not(B)
A= defined $kB= not $k =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
ABresult
0X0
100
111
13319 0 my @L = ($k, ''); # Up to 100 layers - an overkill, of course??? One extra level to store separators...
13320 0 ▶ $bold{$_} = '┋' for @{$bold1 || []};
Condition0%0/2
$bold1 || []
l!l
00
MC/DC0%0/1
$bold1 || []
$bold1
Truth table0%0/2
A
A= $bold1
Aresult
11
00
13321 0 ▶ $bold{$_} = '┃' for @{$bold || []};
Condition0%0/2
$bold || []
l!l
00
MC/DC0%0/1
$bold || []
$bold
Truth table0%0/2
A
A= $bold
Aresult
11
00
13322 0 for my $group (0..$#$sorted) { # Top level
13323 0 $self->equalize_lengths(0, @L);
13324 0 ▶ $_ .= ' ' . ($bold{$group} || '║') for @L;
Condition0%0/2
$bold{$group} || "\x{2551}"
l!l
00
MC/DC0%0/1
$bold{$group} || "\x{2551}"
$bold{$group}
Truth table0%0/2
A
A= $bold{$group}
Aresult
11
00
13325 0 my $prio2;
13326 0 for my $prio (@{ $sorted->[$group] }) {
13327 0 ▶ if ($prio2++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prio2++) 0 0 0
13328 0 $self->equalize_lengths(0, @L);
13329 0 $_ .= ' │' for @L;
13330 }
13331 0 my $double2;
13332 0 for my $double (reverse @$prio) {
13333 0 ▶ if ($double2++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($double2++) 0 0 0
13334 0 $self->equalize_lengths(0, @L);
13335 0 $_ .= ' ┆' for @L;
13336 }
13337 0 for my $layer (0..$#$double) {
13338 0 for my $set (@{$double->[$layer]}) {
13339 0 for my $shift (0,1) {
13340 0 ▶ next unless defined (my $k = $set->[$shift]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $k = $set->[$shift]) 0 0 0
13341 0 ▶ $k = $k->[0] if ref $k;
Branch: 1 branch
BranchTrueFalseTotal
if ref $k 0 0 0
13342 0 ▶ $k = " $k" if $k =~ /$rxCombining/;
Branch: 1 branch
BranchTrueFalseTotal
if $k =~ /$rxCombining/ 0 0 0
13343 0 ▶ if (2*$layer + $shift >= $#L) { # Keep last layer pristine for correct separators...
Branch: 1 branch
BranchTrueFalseTotal
if (2 * $layer + $shift >= $#L) 0 0 0
13344 0 my $add = 2*$layer + $shift - $#L + 1;
13345 0 push @L, ($L[-1]) x $add;
13346 }
13347 0 $L[ 2*$layer + $shift ] .= " $k";
13348 }
13349 }
13350 }
13351 }
13352 }
13353 }
13354 0 ▶ pop @L while @L and $L[-1] !~ /[^┃┋║│┆\s]/;
Branch: 1 branch
BranchTrueFalseTotal
@L and not $L[-1] =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/ and do { pop @L } 0 0 0
Condition0%0/3
@L and not $L[-1] =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
!ll&&!rl&&r
000
MC/DC0%0/2
@L and not $L[-1] =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
@L not $L[-1] =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
Truth table0%0/3
A and not(B)
A= @LB= not $L[-1] =~ /[^\x{2503}\x{250b}\x{2551}\x{2502}\x{2506}\s]/
ABresult
0X0
100
111
13355 0 join "\n", @L, '';
13356 }
13357
13358 0 ▶sub append_keys ($$$$;$) { # $KK is [[lc,uc], ...]; modifies $C in place
Subroutine append_keys: not called CC=25 SCAR=64.8
Pod undocumented
13359 0 my ($self, $C, $KK, $LL, $prepend, @KKK, $cnt) = (shift, shift, shift, shift, shift);
13360 0 for my $L (0..$#$KK) { # $LL contains info about from which layer the given binding was stolen
13361 0 my $k = $KK->[$L];
13362 0 ▶ next unless defined $k and (defined $k->[0] or defined $k->[1]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k and defined $k->[0] || defined $k->[1] 0 0 0
Condition0%0/6
defined $k and defined $k->[0] || defined $k->[1]
!ll&&!rl&&r
000
defined $k->[0] or defined $k->[1]
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $k and defined $k->[0] || defined $k->[1]
defined $k defined $k->[0] defined $k->[1]
Truth table0%0/4
A and B or C
A= defined $kB= defined $k->[0]C= defined $k->[1]
ABCresult
0XX0
1000
11X1
1011
13363 0 $cnt++;
13364 0 ▶ my @kk = map {$_ and ref $_ ? $_->[0] : $_} @$k;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
Condition0%0/3
$_ && (ref $_ ? $_->[0] : $_)
!ll&&!rl&&r
000
MC/DC0%0/2
$_ && (ref $_ ? $_->[0] : $_)
$_ (ref $_ ? $_->[0] : $_)
Truth table0%0/3
A && B
A= $_B= (ref $_ ? $_->[0] : $_)
ABresult
0X0
100
111
13365 0 ▶ my $paired = (@$k == 2 and defined $k->[0] and defined $k->[1] and $kk[0] ne $kk[1] and $kk[0] eq lc $kk[1]);
Condition0%0/12
@$k == 2 && defined $k->[0] && defined $k->[1] && $kk[0] ne $kk[1] && $kk[0] eq &UI::KeyboardLayout::lc($kk[1])
!ll&&!rl&&r
000
@$k == 2 and defined $k->[0] and defined $k->[1] and $kk[0] ne $kk[1]
!ll&&!rl&&r
000
@$k == 2 and defined $k->[0] and defined $k->[1]
!ll&&!rl&&r
000
@$k == 2 and defined $k->[0]
!ll&&!rl&&r
000
MC/DC0%0/5
@$k == 2 && defined $k->[0] && defined $k->[1] && $kk[0] ne $kk[1] && $kk[0] eq &UI::KeyboardLayout::lc($kk[1])
@$k == 2 defined $k->[0] defined $k->[1] $kk[0] ne $kk[1] $kk[0] eq &UI::KeyboardLayout::lc($kk[1])
Truth table0%0/6
A and B and C and D && E
A= @$k == 2B= defined $k->[0]C= defined $k->[1]D= $kk[0] ne $kk[1]E= $kk[0] eq &UI::KeyboardLayout::lc($kk[1])
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
13366 0 ▶ my @need_special = map { $LL and $L and defined $k->[$_] and defined $LL->[$L][$_] and 0 == $LL->[$L][$_]} 0..$#$k;
Condition0%0/12
$LL && $L && defined $k->[$_] && defined $LL->[$L][$_] && 0 == $LL->[$L][$_]
!ll&&!rl&&r
000
$LL and $L and defined $k->[$_] and defined $LL->[$L][$_]
!ll&&!rl&&r
000
$LL and $L and defined $k->[$_]
!ll&&!rl&&r
000
$LL and $L
!ll&&!rl&&r
000
MC/DC0%0/5
$LL && $L && defined $k->[$_] && defined $LL->[$L][$_] && 0 == $LL->[$L][$_]
$LL $L defined $k->[$_] defined $LL->[$L][$_] 0 == $LL->[$L][$_]
Truth table0%0/6
A and B and C and D && E
A= $LLB= $LC= defined $k->[$_]D= defined $LL->[$L][$_]E= 0 == $LL->[$L][$_]
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
13367 0 ▶ if (my $special = grep $_, @need_special) { # count
Branch: 1 branch
BranchTrueFalseTotal
if (my $special = grep($_, @need_special)) 0 0 0
13368 0 ▶ ($prepend ? push(@{ $KKK[$paired][0] }, $k) : unshift(@{ $KKK[$paired][0] }, $k)),
Branch: 2 branches
BranchTrueFalseTotal
if $special == grep(defined($_), @$k) 0 0 0
$prepend ? : 0 0 0
13369 next if $special == grep defined, @$k;
13370 0 $paired = 0;
13371 0 ▶ my $to_level0 = [map { $need_special[$_] ? $k->[$_] : undef} 0..$#$k];
Branch: 1 branch
BranchTrueFalseTotal
$need_special[$_] ? : 0 0 0
13372 0 ▶ $k = [map {!$need_special[$_] ? $k->[$_] : undef} 0..$#$k];
Branch: 1 branch
BranchTrueFalseTotal
!$need_special[$_] ? : 0 0 0
13373 0 ▶ $prepend ? push @{ $KKK[$paired][0] }, $to_level0 : unshift @{ $KKK[$paired][0] }, $to_level0;
Branch: 1 branch
BranchTrueFalseTotal
$prepend ? : 0 0 0
13374 }
13375 0 ▶ $prepend ? push @{ $KKK[$paired][$L] }, $k : unshift @{ $KKK[$paired][$L] }, $k; # 0: layer has only one slot
Branch: 1 branch
BranchTrueFalseTotal
$prepend ? : 0 0 0
13376 }
13377 #print "cnt=$cnt\n";
13378 0 ▶ return unless $cnt;
Branch: 1 branch
BranchTrueFalseTotal
unless $cnt 0 0 0
13379 0 ▶ push @$C, [[@KKK]] unless $prepend; # one group of one level of penalty
Branch: 1 branch
BranchTrueFalseTotal
unless $prepend 0 0 0
13380 0 ▶ unshift @$C, [[@KKK]] if $prepend; # one group of one level of penalty
Branch: 1 branch
BranchTrueFalseTotal
if $prepend 0 0 0
13381 0 1
13382 }
13383
13384 0 ▶sub shift_pop_compositions ($$$;$$$$) { # Limit is how many groups to process
Subroutine shift_pop_compositions: not called CC=49 SCAR=78.0
Pod undocumented
13385 0 ▶ my($self, $C, $L, $backwards, $omit, $limit, $ignore_groups, $store_level, $skip_lc, $skip_uc)
Condition0%0/6
shift() || 0
l!l
00
shift() || 1e+100
l!l
00
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
MC/DC0%0/1
shift() || 1e+100
shift()
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
13386 = (shift, shift, shift, shift, shift || 0, shift || 1e100, shift || 0, shift, shift, shift);
13387 0 my($do_lc, $do_uc) = (!$skip_lc, !$skip_uc);
13388 0 ▶ my($both, $first, $out_lc, $out_uc, @out, @out_levels, $have_out, $groupN) = ($do_lc and $do_uc);
Condition0%0/3
$do_lc && $do_uc
!ll&&!rl&&r
000
MC/DC0%0/2
$do_lc && $do_uc
$do_lc $do_uc
Truth table0%0/3
A && B
A= $do_lcB= $do_uc
ABresult
0X0
100
111
13389 0 ▶ my @G = $backwards ? reverse @$C : @$C;
Branch: 1 branch
BranchTrueFalseTotal
$backwards ? : 0 0 0
13390 0 for my $group (@G[$omit..$#G]) {
13391 0 ▶ last if --$limit < 0;
Branch: 1 branch
BranchTrueFalseTotal
if --$limit < 0 0 0 0
13392 0 $groupN++;
13393 0 for my $penalty_group (@$group) { # each $penalty_group is indexed by double_occupancy and layer
13394 # each layer in sorted; if $both, we prefer to extract a paired translation; so it is enough to check the first elt on each layer
13395 0 my $group_both = $both;
13396 0 ▶ if ($both) {
Branch: 1 branch
BranchTrueFalseTotal
if ($both) 0 0 0
13397 0 ▶ $group_both = 0 unless $penalty_group->[1] and @{ $penalty_group->[1][$L] || [] } or @{ $penalty_group->[1][0] || [] };
Branch: 1 branch
BranchTrueFalseTotal
unless $penalty_group->[1] and @{$penalty_group->[1][$L] or [];} or @{$penalty_group->[1][0] or [];} 0 0 0
Condition0%0/10
$penalty_group->[1] and @{$penalty_group->[1][$L] or [];} or @{$penalty_group->[1][0] or [];}
l!l&&r!l&&!r
000
$penalty_group->[1] and @{$penalty_group->[1][$L] or [];}
!ll&&!rl&&r
000
$penalty_group->[1][$L] || []
l!l
00
$penalty_group->[1][0] || []
l!l
00
MC/DC0%0/3
$penalty_group->[1] and @{$penalty_group->[1][$L] or [];} or @{$penalty_group->[1][0] or [];}
$penalty_group->[1] @{$penalty_group->[1][$L] or [];} @{$penalty_group->[1][0] or [];}
MC/DC0%0/1
$penalty_group->[1][$L] || []
$penalty_group->[1][$L]
MC/DC0%0/1
$penalty_group->[1][0] || []
$penalty_group->[1][0]
Truth table0%0/5
A and B or C
A= $penalty_group->[1]B= @{$penalty_group->[1][$L] or [];}C= @{$penalty_group->[1][0] or [];}
ABCresult
11X1
0X11
1011
0X00
1000
Truth table0%0/2
A
A= $penalty_group->[1][$L]
Aresult
11
00
Truth table0%0/2
A
A= $penalty_group->[1][0]
Aresult
11
00
13398 } # if $group_both == 0, and $both: double-group is empty, so we can look only in single/unrelated one.
13399 # if $both = $group_both == 0: may not look in double group, so can look only in single/unrelated one
13400 # if $both = $group_both == 1: must look in double-group only.
13401 0 ▶ for my $Set (($L ? [0, $penalty_group->[$group_both][0]] : ()), [$L, $penalty_group->[$group_both][$L]]) {
Branch: 1 branch
BranchTrueFalseTotal
$L ? : 0 0 0
13402 0 my $set = $Set->[1];
13403 0 ▶ next unless $set and @$set; # @$set consists of [unshifted, shifted] pairs
Branch: 1 branch
BranchTrueFalseTotal
unless $set and @$set 0 0 0
Condition0%0/3
$set and @$set
!ll&&!rl&&r
000
MC/DC0%0/2
$set and @$set
$set @$set
Truth table0%0/3
A and B
A= $setB= @$set
ABresult
0X0
100
111
13404 0 ▶ if ($group_both) { # we know we meet a double element at start of the group
Branch: 1 branch
BranchTrueFalseTotal
if ($group_both) 0 0 0
13405 0 ▶ my $OUT = $backwards ? pop @$set : shift @$set; # we know we meet a double element at start of the group
Branch: 1 branch
BranchTrueFalseTotal
$backwards ? : 0 0 0
13406 0 ▶ return [] if $groupN <= $ignore_groups;
Branch: 1 branch
BranchTrueFalseTotal
if $groupN <= $ignore_groups 0 0 0
13407 0 ▶ @$store_level = ($Set->[0]) x 2 if $store_level;
Branch: 1 branch
BranchTrueFalseTotal
if $store_level 0 0 0
13408 0 return $OUT;
13409 }
13410 ## or ($both and defined $elt->[0] and defined $elt->[1]);
13411 0 my $spliced = 0;
13412 0 ▶ for my $eltA ($backwards ? map($#$set - $_, 0..$#$set) : 0..$#$set) {
Branch: 1 branch
BranchTrueFalseTotal
$backwards ? : 0 0 0
13413 0 my $elt = $eltA - $spliced;
13414 0 ▶ my $lc_ok = ($do_lc and defined $set->[$elt][0]);
Condition0%0/3
$do_lc && defined $set->[$elt][0]
!ll&&!rl&&r
000
MC/DC0%0/2
$do_lc && defined $set->[$elt][0]
$do_lc defined $set->[$elt][0]
Truth table0%0/3
A && B
A= $do_lcB= defined $set->[$elt][0]
ABresult
0X0
100
111
13415 0 ▶ my $uc_ok = ($do_uc and defined $set->[$elt][1]);
Condition0%0/3
$do_uc && defined $set->[$elt][1]
!ll&&!rl&&r
000
MC/DC0%0/2
$do_uc && defined $set->[$elt][1]
$do_uc defined $set->[$elt][1]
Truth table0%0/3
A && B
A= $do_ucB= defined $set->[$elt][1]
ABresult
0X0
100
111
13416 0 ▶ next if not ($lc_ok or $uc_ok);
Branch: 1 branch
BranchTrueFalseTotal
unless $lc_ok or $uc_ok 0 0 0
Condition0%0/3
$lc_ok or $uc_ok
l!l&&r!l&&!r
000
MC/DC0%0/2
$lc_ok or $uc_ok
$lc_ok $uc_ok
Truth table0%0/3
A or B
A= $lc_okB= $uc_ok
ABresult
1X1
011
000
13417 0 ▶ my $have_both = (defined $set->[$elt][0] and defined $set->[$elt][1]);
Condition0%0/3
defined $set->[$elt][0] && defined $set->[$elt][1]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $set->[$elt][0] && defined $set->[$elt][1]
defined $set->[$elt][0] defined $set->[$elt][1]
Truth table0%0/3
A && B
A= defined $set->[$elt][0]B= defined $set->[$elt][1]
ABresult
0X0
100
111
13418 0 ▶ my $found_both = ($lc_ok and $uc_ok); # If defined $have_out, cannot have $found_both; moreover $have_out ne $uc_ok
Condition0%0/3
$lc_ok && $uc_ok
!ll&&!rl&&r
000
MC/DC0%0/2
$lc_ok && $uc_ok
$lc_ok $uc_ok
Truth table0%0/3
A && B
A= $lc_okB= $uc_ok
ABresult
0X0
100
111
13419 0 ▶ die "Panic!" if defined $have_out and ($found_both or $have_out eq $uc_ok);
Branch: 1 branch
BranchTrueFalseTotal
if defined $have_out and $found_both || $have_out eq $uc_ok 0 0 0
Condition0%0/6
defined $have_out and $found_both || $have_out eq $uc_ok
!ll&&!rl&&r
000
$found_both or $have_out eq $uc_ok
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $have_out and $found_both || $have_out eq $uc_ok
defined $have_out $found_both $have_out eq $uc_ok
Truth table0%0/4
A and B or C
A= defined $have_outB= $found_bothC= $have_out eq $uc_ok
ABCresult
0XX0
1000
11X1
1011
13420 # next if not $found_both and defined $have_out and $have_out eq $uc_ok;
13421 0 ▶ my $can_splice = $have_both ? $both : 1;
Branch: 1 branch
BranchTrueFalseTotal
$have_both ? : 0 0 0
13422 0 ▶ my $can_return = $both ? $have_both : 1;
Branch: 1 branch
BranchTrueFalseTotal
$both ? : 0 0 0
13423 0 my $OUT = my $out = $set->[$elt]; # Can't return yet: @out may contain a part of info...
13424 0 ▶ unless ($groupN <= $ignore_groups or defined $have_out and $have_out eq $uc_ok) { # In case !$do_return or $have_out
Branch: 1 branch
BranchTrueFalseTotal
unless ($groupN <= $ignore_groups or defined $have_out and $have_out eq $uc_ok) 0 0 0
Condition0%0/6
$groupN <= $ignore_groups or defined $have_out and $have_out eq $uc_ok
l!l&&r!l&&!r
000
defined $have_out and $have_out eq $uc_ok
!ll&&!rl&&r
000
MC/DC0%0/3
$groupN <= $ignore_groups or defined $have_out and $have_out eq $uc_ok
$groupN <= $ignore_groups defined $have_out $have_out eq $uc_ok
Truth table0%0/4
A or B and C
A= $groupN <= $ignore_groupsB= defined $have_outC= $have_out eq $uc_ok
ABCresult
1XX1
0111
00X0
0100
13425 0 $out[$uc_ok] = $out->[$uc_ok]; # In case !$do_return or $have_out
13426 0 $out_levels[$uc_ok] = $Set->[0];
13427 }
13428 #warn 'Doing <', join('> <', map {defined() ? $_ : 'undef'} @{ $set->[$elt] }), "> L=$L; splice=$can_splice; return=$can_return; lc=$lc_ok uc=$uc_ok";
13429 0 ▶ if ($can_splice) { # Now: $both and not $have_both; must edit in place
Branch: 1 branch
BranchTrueFalseTotal
if ($can_splice) { } 0 0 0
13430 0 splice @$set, $elt, 1;
13431 0 ▶ $spliced++ unless $backwards;
Branch: 1 branch
BranchTrueFalseTotal
unless $backwards 0 0 0
13432 } else { # Must edit in place
13433 0 $OUT = [@$out]; # Deep copy
13434 0 undef $out->[$uc_ok]; # only one matched...
13435 }
13436 0 ▶ $OUT = [] if $groupN <= $ignore_groups;
Branch: 1 branch
BranchTrueFalseTotal
if $groupN <= $ignore_groups 0 0 0
13437 0 ▶ if ($can_return) {
Branch: 1 branch
BranchTrueFalseTotal
if ($can_return) 0 0 0
13438 0 ▶ if ($found_both) {
Branch: 1 branch
BranchTrueFalseTotal
if ($found_both) { } 0 0 0
13439 0 ▶ @$store_level = map {$_ and $Set->[0]} @$OUT if $store_level;
Branch: 1 branch
BranchTrueFalseTotal
if $store_level 0 0 0
Condition0%0/3
$_ && $Set->[0]
!ll&&!rl&&r
000
MC/DC0%0/2
$_ && $Set->[0]
$_ $Set->[0]
Truth table0%0/3
A && B
A= $_B= $Set->[0]
ABresult
0X0
100
111
13440 0 return $OUT;
13441 } else {
13442 0 ▶ @$store_level = @out_levels if $store_level;
Branch: 1 branch
BranchTrueFalseTotal
if $store_level 0 0 0
13443 0 return \@out;
13444 }
13445 # return($found_both ? $OUT : \@out);
13446 } # Now: had $both and !$had_both; must condinue
13447 0 $have_out = $uc_ok;
13448 0 $both = 0; # $group_both is already FALSE
13449 0 ▶ ($lc_ok ? $do_lc : $do_uc) = 0;
Branch: 1 branch
BranchTrueFalseTotal
$lc_ok ? : 0 0 0
13450 #warn "lc/uc: $do_lc/$do_uc";
13451 }
13452 }
13453 }
13454 }
13455 0 ▶ @$store_level = @out_levels if $store_level;
Branch: 1 branch
BranchTrueFalseTotal
if $store_level 0 0 0
13456 return \@out
13457 0 }
13458
13459 1 my ($rebuild_fake, $rebuild_style) = ("\n\t\t\t/* To be auto-generated */\n", <<'EOR');
13460
13461 .klayout span, .klayout-wrapper .over-shift {
13462 font-size: 29pt ;
13463 font-weight: bolder;
13464 text-wrap: none;
13465 white-space: nowrap;
13466 }
13467 .klayout kbd, .asSpan { display: inline-block; }
13468 .asSpan2 { display: inline-table; }
13469
13470 /* Not used; allows /-diagonals to be highlighted with nth-last-of-type() */
13471 .klayout kbd.hidden-align { display: none; }
13472
13473 kbd span.lc, kbd span.uc { display: inline; }
13474
13475 /* Hide lc only if in .uc or hovering over -uc and not inside; similarly for uc */
13476 /* States: .klayout-wrapper:not(:hover) | .klayout.uclc:hover NORMAL = UCLC
13477 .klayout-uc:hover .klayout:not(:hover) UC
13478 .klayout-wrapper:hover .klayout-uc:not(:hover) LC */
13479 .klayout.lc kbd span.uc, .klayout.uc kbd span.lc,
13480 .klayout-uc:hover:not(:active) .klayout:not(.lc):not(:hover) kbd span.lc,
13481 .klayout-uc:hover:active .klayout:not(.uc):not(:hover) kbd span.uc,
13482 .klayout-wrapper:hover:not(:active) .klayout-uc:not(:hover) .klayout:not(.uc) kbd span.uc,
13483 .klayout-wrapper:hover:active .klayout-uc:not(:hover) .klayout:not(.lc) kbd span.lc { display: none; }
13484
13485 /* These should be active unless hovering over wrapper, and not internal .klayout */
13486 .klayout.uclc:hover kbd span.uc, .klayout.uclc:hover kbd span.lc,
13487 .klayout.uclc.force kbd span.uc, .klayout.uclc.force kbd span.lc,
13488 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc:not(.do-alt) kbd span.uc,
13489 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc:not(.do-alt) kbd span.lc {
13490 font-size: 70%;
13491 }
13492 .klayout.uclc:hover kbd span.uc, .klayout.uclc:hover kbd span.lc,
13493 .klayout.uclc:not(.in-wrapper) kbd span.uc, .klayout.uclc:not(.in-wrapper) kbd span.lc,
13494 .klayout.uclc.force kbd span.uc, .klayout.uclc.force kbd span.lc,
13495 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc.do-alt kbd span.uc,
13496 .klayout.uclc.do-alt:hover kbd span.uc,
13497 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc.do-alt kbd span.lc,
13498 .klayout.uclc.do-alt:hover kbd span.lc,
13499 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc:not(.do-alt) kbd span.uc,
13500 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc:not(.do-alt) kbd span.lc {
13501 position: absolute;
13502 z-index: 10;
13503 border: 1px dotted green;
13504 line-height: 0.8em; /* decreasing this moves up; should be changed with padding-bottom */
13505 }
13506 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc kbd span.uc,
13507 .klayout-wrapper .klayout-uc .klayout.uclc:hover kbd span.uc,
13508 .klayout.uclc kbd span.uc {
13509 right: 0.2em;
13510 top: -0.05em;
13511 padding-bottom: 0.15em; /* Less makes _ not fit inside border... */
13512 }
13513 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc kbd span.lc,
13514 .klayout-wrapper .klayout-uc .klayout.uclc:hover kbd span.lc,
13515 .klayout.uclc kbd span.lc {
13516 left: 0.2em;
13517 bottom: 0em;
13518 }
13519 /* Same for left/right placement */
13520 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc kbd span.uc.on-left,
13521 .klayout-wrapper .klayout-uc .klayout.uclc:hover kbd span.uc.on-left,
13522 .klayout.uclc:not(.in-wrapper) kbd span.uc.uc.on-left { /* repeat is needed to protect against :not(.base) about 25lines below */
13523 left: 0.35em;
13524 right: auto;
13525 }
13526 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc kbd span.lc.on-left,
13527 .klayout-wrapper .klayout-uc .klayout.uclc:hover kbd span.lc.on-left,
13528 .klayout.uclc:not(.in-wrapper) kbd span.lc.lc.on-left {
13529 left: 0.0em;
13530 }
13531 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc kbd span.uc.on-right,
13532 .klayout-wrapper .klayout-uc .klayout.uclc:hover kbd span.uc.on-right,
13533 .klayout.uclc:not(.in-wrapper) kbd span.uc.uc.on-right {
13534 right: 0.0em;
13535 }
13536 .klayout-wrapper:not(:hover) .klayout-uc .klayout.uclc kbd span.lc.on-right,
13537 .klayout-wrapper .klayout-uc .klayout.uclc:hover kbd span.lc.on-right,
13538 .klayout.uclc:not(.in-wrapper) kbd span.lc.lc.on-right {
13539 left: auto;
13540 right: 0.35em;
13541 }
13542 .klayout kbd span:not(.base):not(.base-uc):not(.base-lc).on-right
13543 { left: auto; right: 0.0em; position: absolute; }
13544 .klayout kbd span:not(.base):not(.base-uc):not(.base-lc).on-left
13545 { left: 0.0em; right: auto; position: absolute; }
13546 .klayout kbd .on-right:not(.prefix), .on-right-ex { color: firebrick; }
13547 .klayout kbd .on-right:not(.prefix).vbell { color: Coral; }
13548 .klayout kbd .on-left { z-index: 10; }
13549 .klayout kbd .on-right { z-index: 9; }
13550
13551 .klayout-wrapper:hover .klayout.uclc:not(:hover) kbd.shift {outline: 6px dotted green;}
13552
13553 kbd span, kbd div { vertical-align: bottom; } /* no effect ???!!! */
13554
13555 kbd {
13556 color: #444;
13557 /* line-height: 1.6em; */
13558 width: 1.4em; /* +0.24em border +0.08em margin; total 1.72em */
13559
13560 /* +0.3em border; */
13561 min-height: 0.83em; /* These two should be changed together to get uc letters centered... */
13562 line-height: 0.75em; /* Increasing by the same amount works fine??? */
13563 /* One also needs to change the vertical offsets of arrows from_*, and System-key icon */
13564
13565 text-align: center;
13566 cursor: pointer;
13567 padding: 0.0em 0.0em 0.0em 0.0em;
13568 margin: 0.04em;
13569 white-space: nowrap;
13570 vertical-align: top;
13571 position: relative;
13572
13573 background-color: #FFFFFF;
13574
13575 background-image: -moz-linear-gradient(left, rgba(0,0,0,0.2), rgba(64,64,64,0.2), rgba(64,64,64,0.2), rgba(128,128,128,0.2));
13576 background-image: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(0,0,0,0.2)), color-stop(33%,rgba(64,64,64,0.2)), color-stop(66%,rgba(64,64,64,0.2)), color-stop(100%,rgba(128,128,128,0.2)));
13577 background-image: -webkit-linear-gradient(left, rgba(0,0,0,0.2) 0%, rgba(64,64,64,0.2) 33%, rgba(64,64,64,0.2) 66%, rgba(128,128,128,0.2) 100%);
13578 background-image: -o-linear-gradient(left, rgba(0,0,0,0.2) 0%, rgba(64,64,64,0.2) 33%, rgba(64,64,64,0.2) 66%, rgba(128,128,128,0.2) 100%);
13579 background-image: -ms-linear-gradient(left, rgba(0,0,0,0.2) 0%, rgba(64,64,64,0.2) 33%, rgba(64,64,64,0.2) 66%, rgba(128,128,128,0.2) 100%);
13580 background-image: linear-gradient(0deg, rgba(0,0,0,0.2) 0%, rgba(64,64,64,0.2) 33%, rgba(64,64,64,0.2) 66%, rgba(128,128,128,0.2) 100%);
13581 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dddddd', endColorstr='#e5e5e5',GradientType=1 );
13582
13583 border-top: solid 0.1em #CCC;
13584 border-right: solid 0.12em #AAA;
13585 border-bottom: solid 0.2em #999;
13586 border-left: solid 0.12em #BBB;
13587 -webkit-border-radius: 0.22em;
13588 -moz-border-radius: 0.22em;
13589 border-radius: 0.22em;
13590 z-index: 0;
13591
13592 -webkit-box-shadow:
13593 0.03em 0.1em 0.1em 0.06em #888,
13594 0.05em 0.1em 0.06em 0.06em #aaa;
13595 -moz-box-shadow:
13596 0.03em 0.1em 0.1em 0.06em #888,
13597 0.05em 0.1em 0.06em 0.06em #aaa;
13598 box-shadow:
13599 0.03em 0.1em 0.1em 0.00em #888 ,
13600 0.05em 0.1em 0.06em 0.0em #aaa ;
13601 }
13602
13603 kbd:hover, .klayout-wrapper:hover .klayout:not(:hover) kbd.shift {
13604 color: #222;
13605 background-image: -moz-linear-gradient(left, rgba(128,128,128,0.2), rgba(192,192,192,0.2), rgba(192,192,192,0.2), rgba(255,255,255,0.2));
13606 background-image: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(128,128,128,0.2)), color-stop(33%,rgba(192,192,192,0.2)), color-stop(66%,rgba(192,192,192,0.2)), color-stop(100%,rgba(255,255,255,0.2)));
13607 background-image: -webkit-linear-gradient(left, rgba(128,128,128,0.2) 0%, rgba(192,192,192,0.2) 33%, rgba(192,192,192,0.2) 66%, rgba(255,255,255,0.2) 100%);
13608 background-image: -o-linear-gradient(left, rgba(128,128,128,0.2) 0%, rgba(192,192,192,0.2) 33%, rgba(192,192,192,0.2) 66%, rgba(255,255,255,0.2) 100%);
13609 background-image: -ms-linear-gradient(left, rgba(128,128,128,0.2) 0%, rgba(192,192,192,0.2) 33%, rgba(192,192,192,0.2) 66%, rgba(255,255,255,0.2) 100%);
13610 background-image: linear-gradient(0deg, rgba(128,128,128,0.2) 0%, rgba(192,192,192,0.2) 33%, rgba(192,192,192,0.2) 66%, rgba(255,255,255,0.2) 100%);
13611 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e5e5e5', endColorstr='#ffffff',GradientType=1 );
13612 }
13613 kbd:active, kbd.selected, .klayout-uc:hover:not(:active) .klayout:not(:hover) kbd.shift, .klayout-wrapper:active .klayout-uc:not(:hover) kbd.shift {
13614 margin-top: 0.14em; /* This variant is with "solid" buttons, the commented one is with "rubber" ones */
13615 border-top: solid 0.10em #CCC;
13616 border-right: solid 0.12em #9a9a9a; /* Make right/bottom a tiny way darker */
13617 border-bottom: solid 0.1em #8a8a8a;
13618 border-left: solid 0.12em #BBB;
13619 /* margin-top: 0.11em;
13620 border-top: solid 0.13em #999;
13621 border-right: solid 0.12em #BBB;
13622 border-bottom: solid 0.1em #CCC;
13623 border-left: solid 0.12em #AAA; */
13624 padding: 0.0em 0.0em 0.0em 0.0em;
13625
13626 -webkit-box-shadow:
13627 0.05em 0.03em 0.1em 0.1em #aaa;
13628 -moz-box-shadow:
13629 0.05em 0.03em 0.1em 0.1em #aaa;
13630 box-shadow:
13631 0.05em 0.03em 0.1em 0em #aaa;
13632
13633 }
13634 kbd img {
13635 padding-left: 0.25em;
13636 vertical-align: middle;
13637 height: 22px; width: 22px;
13638 opacity: 0.8;
13639 }
13640 kbd:hover img {
13641 opacity: 1;
13642 }
13643 kbd span.shrink {
13644 font-size: 85%;
13645 }
13646 .klayout.do-altgr kbd span.shrink.altgr {
13647 font-size: 72%;
13648 }
13649 kbd .small {
13650 font-size: 62%;
13651 }
13652 kbd .vsmall {
13653 font-size: 39%;
13654 }
13655
13656 kbd .base, kbd .base-lc, kbd .base-uc {
13657 -webkit-touch-callout: none;
13658 -webkit-user-select: none;
13659 -khtml-user-select: none;
13660 -moz-user-select: none;
13661 -ms-user-select: none;
13662 -o-user-select: none;
13663 user-select: none;
13664 }
13665
13666 /* Special rules for do-alt-display. Without alt2, places the base on left and right;
13667 with alt2, places base on the left (unless base-right is present) */
13668
13669 /* .klayout.do-alt.uclc kbd span.lc, .klayout.do-alt.uclc kbd span.uc { */
13670 .klayout.do-alt.uclc:not(.in-wrapper) kbd span.uc, .klayout.do-alt.uclc:not(.in-wrapper) kbd span.lc,
13671 .klayout.do-alt.uclc:hover kbd span.uc, .klayout.do-alt.uclc:hover kbd span.lc,
13672 .klayout.do-alt.uclc.force kbd span.uc, .klayout.do-alt.uclc.force kbd span.lc,
13673 .klayout-wrapper:not(:hover) .klayout-uc .klayout.do-alt.uclc kbd span.uc,
13674 .klayout-wrapper:not(:hover) .klayout-uc .klayout.do-alt.uclc kbd span.lc {
13675 font-size: 85%;
13676 }
13677
13678 .klayout.do-alt.sz125 kbd span.uc, .klayout.do-alt.sz125 kbd span.lc, /* exclude below: too specific otherwise */
13679 .klayout.do-alt.sz125 kbd span:not(.lc):not(.uc):not(.base):not(.base-uc):not(.base-lc):not(.shrink):not(.small):not(.vsmall) {
13680 font-size: 125%;
13681 line-height: 0.98em; /* decreasing this moves up; should be changed with padding-bottom */
13682 /* padding-bottom: 0.1em; */ /* Less makes _ not fit inside border... */
13683 }
13684 .klayout.do-alt.sz120 kbd span.uc, .klayout.do-alt.sz120 kbd span.lc, /* exclude below: too specific otherwise */
13685 .klayout.do-alt.sz120 kbd span:not(.lc):not(.uc):not(.base):not(.base-uc):not(.base-lc):not(.shrink):not(.small):not(.vsmall) {
13686 font-size: 120%;
13687 line-height: 1.02em; /* decreasing this moves up; should be changed with padding-bottom */
13688 /* padding-bottom: 0.1em; */ /* Less makes _ not fit inside border... */
13689 }
13690 .klayout.do-alt kbd span.uc, .klayout.do-alt kbd span.lc, /* exclude below: too specific otherwise */
13691 .klayout.do-alt.sz115 kbd span.uc, .klayout.do-alt.sz115 kbd span.lc,
13692 .klayout.do-alt kbd span:not(.lc):not(.uc):not(.base):not(.base-uc):not(.base-lc):not(.shrink):not(.small):not(.vsmall),
13693 .klayout.do-alt.sz115 kbd span:not(.lc):not(.uc):not(.base):not(.base-uc):not(.base-lc):not(.shrink):not(.small):not(.vsmall) {
13694 font-size: 115%;
13695 line-height: 1.05em; /* decreasing this moves up; should be changed with padding-bottom */
13696 /* padding-bottom: 0.1em; */ /* Less makes _ not fit inside border... */
13697 }
13698 .klayout.do-alt.sz110 kbd span.uc, .klayout.do-alt.sz110 kbd span.lc, /* exclude below: too specific otherwise */
13699 .klayout.do-alt.sz110 kbd span:not(.lc):not(.uc):not(.base):not(.base-uc):not(.base-lc):not(.shrink):not(.small):not(.vsmall) {
13700 font-size: 110%;
13701 line-height: 1.12em; /* decreasing this moves up; should be changed with padding-bottom */
13702 /* padding-bottom: 0.1em; */ /* Less makes _ not fit inside border... */
13703 }
13704 .klayout.do-alt.sz100 kbd span.uc, .klayout.do-alt.sz100 kbd span.lc, /* exclude below: too specific otherwise */
13705 .klayout.do-alt.sz100 kbd span:not(.lc):not(.uc):not(.base):not(.base-uc):not(.base-lc):not(.shrink):not(.small):not(.vsmall) {
13706 line-height: 1.2em; /* decreasing this moves up; should be changed with padding-bottom */
13707 /* padding-bottom: 0.1em; */ /* Less makes _ not fit inside border... */
13708 }
13709
13710 .klayout.do-alt kbd span.base-lc, .klayout.do-alt kbd span.base-uc {
13711 font-size: 90%;
13712 }
13713 .klayout.do-alt.alt2 kbd span.base-lc, .klayout.do-alt.alt2 kbd span.base-uc {
13714 font-size: 80%;
13715 }
13716
13717 .klayout.do-alt kbd span.base-uc {
13718 right: 15%;
13719 top: 35%; /* Combine rel-parent and rel-us offsets : */
13720 }
13721 .klayout.do-alt kbd span.base-lc {
13722 left: 15%;
13723 bottom: 25%; /* Combine rel-parent and rel-us offsets : */
13724 }
13725 .klayout.do-alt.alt2 kbd span.base-uc {
13726 left: 35%;
13727 top: 30%; /* Combine rel-parent and rel-us offsets : */
13728 }
13729 .klayout.do-alt.alt2 kbd span.base-lc {
13730 left: 15%;
13731 bottom: 25%; /* Combine rel-parent and rel-us offsets : */
13732 }
13733 .klayout.do-alt.alt2.base-right kbd span.base-uc {
13734 right: 15%;
13735 left: auto; /* Combine rel-parent and rel-us offsets : */
13736 }
13737 .klayout.do-alt.alt2.base-right kbd span.base-lc {
13738 right: 35%;
13739 left: auto; /* Combine rel-parent and rel-us offsets : */
13740 }
13741 .klayout.do-alt.alt2.base-center kbd span.base-uc {
13742 left: 60%; /* Combine rel-parent and rel-us offsets : */
13743 }
13744 .klayout.do-alt.alt2.base-center kbd span.base-lc {
13745 left: 40%; /* Combine rel-parent and rel-us offsets : */
13746 }
13747
13748 .klayout.do-alt kbd span.base {
13749 font-size: 120%;
13750 left: 25%;
13751 top: 65%; /* Combine rel-parent and rel-us offsets : */
13752 }
13753 .klayout.do-alt.large-base.large-base kbd span.base { /* Make .large-base override .alt2 */
13754 font-size: 200%;
13755 left: 50%;
13756 top: 50%; /* Combine rel-parent and rel-us offsets : */
13757 }
13758 .klayout.do-alt.alt2 kbd span.base {
13759 font-size: 110%;
13760 left: 25%;
13761 top: 75%; /* Combine rel-parent and rel-us offsets : */
13762 }
13763 .klayout.do-alt.alt2.base-right kbd span.base {
13764 right: 25%;
13765 left: auto; /* Combine rel-parent and rel-us offsets : */
13766 }
13767 .klayout.do-alt.alt2.base-center kbd span.base {
13768 left: 50%; /* Combine rel-parent and rel-us offsets : */
13769 }
13770 .klayout.do-alt kbd span.base, .klayout.do-alt kbd span.base-lc, .klayout.do-alt kbd span.base-uc {
13771 position: absolute;
13772 z-index: -1;
13773
13774 opacity: 0.25;
13775 filter: alpha(opacity=25); /* IE6-IE8 */
13776
13777 color: blue;
13778 line-height: 1em; /* Tight-fitting box */
13779 height: 1em;
13780 width: 1em;
13781 margin: -0.5em -0.5em -0.5em -0.5em; /* -0.5em is the geometric center */
13782 }
13783 .klayout.do-alt kbd {
13784 min-height: 1.2em; /* Should be changed together to get uc letters centered... */
13785 line-height: 1.2em; /* Increasing by the same amount works fine??? */
13786 }
13787 .klayout.do-altgr span.altgr {outline: 9px dotted green;}
13788
13789 kbd.with_x-NONONO:before {
13790 position: absolute;
13791 z-index: -10;
13792
13793 opacity: 0.25;
13794 filter: alpha(opacity=25); /* IE6-IE8 */
13795
13796 content: "✖";
13797 color: red;
13798 font-size: 120%;
13799
13800 line-height: 1em; /* Tight-fitting box */
13801 height: 1em;
13802 width: 1em;
13803
13804 top: 50%; /* Combine rel-parent and rel-us offsets : */
13805 left: 50%;
13806 margin: -0.43em 0 0 -0.5em; /* -0.5em is the geometric center; but it is not in the center of ✖...*/
13807 }
13808 kbd.from_sw:after, kbd.from_ne:after, kbd.from_nw:after, kbd.to_ne:after, kbd.to_nw:before, kbd.to_w:after, kbd.from_w:after {
13809 position: absolute;
13810 z-index: 1;
13811 font-size: 80%;
13812 color: red;
13813 text-shadow: 1px 1px #ffff88, -1px -1px #ffff88, -1px 1px #ffff88, 1px -1px #ffff88;
13814 text-shadow: 1px 1px rgba(255,255,0,0.3), -1px -1px rgba(255,255,0,0.3), -1px 1px rgba(255,255,0,0.3), 1px -1px rgba(255,255,0,0.3);
13815 }
13816 kbd.from_sw.grn:after, kbd.from_ne.grn:after, kbd.from_nw.grn:after, kbd.to_ne.grn:after, kbd.to_nw.grn:before, kbd.to_w.grn:after, kbd.from_w.grn:after {
13817 color: green;
13818 }
13819 kbd.from_sw.blu:after, kbd.from_ne.blu:after, kbd.from_nw.blu:after, kbd.to_ne.blu:after, kbd.to_nw.blu:before, kbd.to_w.blu:after, kbd.from_w.blu:after {
13820 color: blue;
13821 }
13822 kbd.from_sw.ylw:after, kbd.from_ne.ylw:after, kbd.from_nw.ylw:after, kbd.to_ne.ylw:after, kbd.to_nw.ylw:before, kbd.to_w.ylw:after, kbd.from_w.ylw:after {
13823 color: #FFB400;
13824 }
13825 kbd.from_sw:not(.pure), kbd.xfrom_sw, kbd.from_ne:not(.pure), kbd.from_nw:not(.pure), kbd.to_ne:not(.pure), kbd.to_nw:not(.pure) {
13826 text-shadow: 1px 1px yellow, -1px -1px yellow, -1px 1px yellow, 1px -1px yellow;
13827 }
13828 kbd.from_sw:after {
13829 left: -0.0em;
13830 bottom: -0.65em;
13831 }
13832 kbd.from_sw:after, kbd.to_ne:after {
13833 content: "⇗";
13834 }
13835 kbd.from_se:after, kbd.to_nw:before {
13836 content: "⇖";
13837 }
13838 kbd.from_ne:after, kbd.from_nw:after {
13839 top: -0.55em;
13840 }
13841 kbd.to_ne:after, kbd.to_nw:before { top: -0.85em;}
13842 kbd.to_nw:before { left: 0.01em;}
13843 kbd.from_ne:after { content: "⇙"; }
13844 kbd.from_ne:after, kbd.to_ne:after { right: -0.0em; }
13845 kbd.from_nw:after { content: "⇘"; left: -0.0em; }
13846 kbd.to_w:after, kbd.from_w:after {
13847 top: 45%;
13848 left: -0.7em;
13849 }
13850 kbd.to_w.high:after, kbd.from_w.high:after {
13851 top: -15%;
13852 left: -0.5em;
13853 }
13854 kbd.to_w:after { content: "⇐"; }
13855 kbd.from_w:after { content: "⇒"; }
13856
13857 /* Compensate for higher keys */
13858 .klayout.do-alt kbd.from_sw:after {
13859 bottom: -0.90em;
13860 }
13861 .klayout.do-alt kbd.from_ne:after, .klayout.do-alt kbd.from_nw:after {
13862 top: -0.85em;
13863 }
13864
13865 span.prefix {
13866 color: yellow;
13867 text-shadow: 1px 1px black, -1px -1px black, -1px 1px black, 1px -1px black;
13868 }
13869 span.prefix.prefix2 {
13870 text-shadow: 1px 1px black, -1px -1px black, -1px 1px black, 1px -1px black,
13871 3px 0px firebrick, -3px 0px firebrick, 0px 3px firebrick, 0px -3px firebrick;
13872 }
13873 span.very-special {
13874 text-shadow: 1px 1px lime, -1px -1px lime, -1px 1px lime, 1px -1px lime;
13875 }
13876 span.special {
13877 text-shadow: 2px 2px dodgerblue, -2px -2px dodgerblue, -2px 2px dodgerblue, 2px -2px dodgerblue;
13878 }
13879 .thinspecial span.special {
13880 text-shadow: 1px 1px dodgerblue, -1px -1px dodgerblue, -1px 1px dodgerblue, 1px -1px dodgerblue;
13881 }
13882 span.not-surr:not(.prefix) {
13883 text-shadow: 2px 2px white, -2px -2px white, -2px 2px white, 2px -2px white;
13884 }
13885 span.need-learn {
13886 text-shadow: 1px 1px coral, -1px -1px coral, -1px 1px coral, 1px -1px coral;
13887 }
13888 span.need-learn.on-right {
13889 text-shadow: 1px 1px black, -1px -1px black, -1px 1px black, 1px -1px black,
13890 2px 2px coral, -2px -2px coral, -2px 2px coral, 2px -2px coral;
13891 }
13892 span.may-guess {
13893 text-shadow: 1px 1px yellow, -1px -1px yellow, -1px 1px yellow, 1px -1px yellow;
13894 }
13895
13896 kbd.win_logo.ubuntu:before {
13897 content: url(http://linux.bihlman.com/wp-content/plugins/wp-useragent/img/24/os/ubuntu-2.png);
13898 }
13899 kbd.win_logo:before {
13900 position: absolute;
13901 z-index: -10;
13902
13903 content: url(40px-computer_glenn_rolla_01.svg.med.png);
13904 height: 100%;
13905 width: 100%;
13906
13907 top: 0%; /* Combine rel-parent and rel-us offsets : */
13908 left: 0%;
13909 /* margin: -0.5em -0.5em -0.5em -0.5em; */ /* -0.5em is the geometric center */
13910 }
13911 .do-alt kbd.win_logo:before { /* How to vcenter automatically??? */
13912 top: 20%;
13913 }
13914
13915 /* Mark vowel's diagonals (for layout of diacritics) */
13916 .ddiag .arow > kbd:nth-of-type(2), .ddiag .arow > kbd:nth-last-of-type(7),
13917 .diag .arow > kbd:nth-of-type(2), .diag .arow > kbd:nth-of-type(7),
13918 .diag .drow > kbd:nth-of-type(2), .diag .drow > kbd:nth-of-type(7),
13919 .diag .arow > kbd:nth-of-type(10), .diag .drow > kbd:nth-of-type(10), kbd.red-bg
13920 { background-color: #ffcccc; }
13921 .ddiag .arow > kbd:nth-last-of-type(6), .ddiag .arow > kbd:nth-of-type(4),
13922 .diag .arow > kbd:nth-of-type(8), .diag .arow > kbd:nth-of-type(3),
13923 .diag .drow > kbd:nth-of-type(8), .diag .drow > kbd:nth-of-type(3), kbd.green-bg
13924 { background-color: #ccffcc; }
13925 .ddiag .arow > kbd:nth-last-of-type(8), .ddiag .arow > kbd:nth-last-of-type(5),
13926 .diag .arow > kbd:nth-of-type(9), .diag .arow > kbd:nth-of-type(4),
13927 .diag .drow > kbd:nth-of-type(9), .diag .drow > kbd:nth-of-type(4), kbd.blue-bg
13928 { background-color: #ccccff; }
13929
13930 /* Mark non-vowel's diagonals (for layout of diacritics) */
13931 .hide45end .arow > kbd:nth-of-type(5), .hide45end .arow > kbd:nth-of-type(6),
13932 .hide45end .arow > kbd:nth-of-type(11),
13933 .hide45end .drow > kbd:nth-of-type(5), .hide45end .drow > kbd:nth-of-type(6),
13934 .hide45end .drow > kbd:nth-of-type(11), kbd.semi-hidden
13935 { opacity: 0.45; }
13936
13937 span.vbell { color: SandyBrown; }
13938 span.three-cases { outline: 3px dotted yellow; }
13939 span.three-cases-long { outline: 3px dotted MediumSpringGreen; }
13940
13941 span.withSubst { outline: 1px dotted blue; outline-offset: -1px; }
13942 span.isSubst { outline: 1px solid blue; outline-offset: -1px; }
13943
13944 .use-operator span.operator { background-color: rgb(255,192,203) /*pink*/; }
13945 span.relation { background-color: rgb(255,160,122) /*lightsalmon*/; }
13946 span.ipa { background-color: rgb(173,255,47) /*greenyellow*/; }
13947 span.nAry { background-color: rgb(144,238,144) /*lightgreen*/; }
13948 span.paleo { background-color: rgb(240,230,140) /*Khaki*/; }
13949 .use-viet span.viet { background-color: rgb(220,220,220) /*Gainsboro*/; }
13950 div:not(.no-doubleaccent) span.doubleaccent { background-color: rgb(255,228,196) /*Bisque*/; }
13951 span.ZW { background-color: rgb(220,20,60) /*crimson*/; }
13952 span.WS { background-color: rgb(128,0,0) /*maroon*/; }
13953
13954 .use-operator span.operator { background-color: rgba(255,192,203,0.5) /*pink*/; }
13955 span.relation { background-color: rgba(255,160,122,0.5) /*lightsalmon*/; }
13956 span.ipa { background-color: rgba(173,255,47,0.5) /*greenyellow*/; }
13957 span.nAry { background-color: rgba(144,238,144,0.5) /*lightgreen*/; }
13958 span.paleo { background-color: rgba(240,230,140,0.5) /*Khaki*/; }
13959 .use-viet span.viet { background-color: rgba(220,220,220,0.5) /*Gainsboro*/; }
13960 div:not(.no-doubleaccent) span.doubleaccent { background-color: rgba(255,228,196,0.5) /*Bisque*/; }
13961 span.ZW { background-color: rgba(220,20,60,0.5) /*crimson*/; }
13962 span.WS { background-color: rgba(128,0,0,0.5) /*maroon*/; }
13963
13964 span.lFILL[convention]:before { content: attr(convention);
13965 color: white;
13966 font-size: 50%; }
13967
13968 span.lFILL:not([convention]) { margin: 0ex 0.35ex; }
13969 span.l-NONONO { margin: 0ex 0.06ex; }
13970 span.yyy { padding: 0px !important; }
13971
13972 div.rtl-hover:hover div:not(:hover) kbd span:not(.no-mirror-rtl):not(.base):not(.base-uc):not(.base-lc) { direction: rtl; }
13973
13974 div.zero { position: relative;}
13975 div.zero div.over-shift { position: absolute; height: 1.13em; z-order: 999;}
13976 /* div.zero div.over-shift { outline: 3px dotted yellow;} */
13977 .do-alt + div.zero div.over-shift { height: 1.5em; }
13978 div.zero.l div.over-shift { left: 0.04pt; width: 4.24em;}
13979 div.zero.r div.over-shift { left: 21.12em; width: 3.56em;} /* (1.72em - 0.04em) × 10 + 4.24em + 0.08 */
13980 div.zero.tp div.over-shift { top: 7.8em;}
13981 .over-shift-outline div.zero.btm div.over-shift { outline: 3px dotted blue;}
13982 div.zero.btm div.over-shift { bottom: 1.13em;}
13983 .do-alt + div.zero.btm div.over-shift { bottom: 1.5em;}
13984 /* div.zero:hover { outline: 6px dotted yellow;} */
13985
13986 EOR
13987
13988 0 ▶sub apply_filter_div ($$;$) {
Subroutine apply_filter_div: not called CC=3 SCAR=24.8
Pod undocumented
13989 0 ▶ my($self, $txt, $opt) = (shift, shift, shift || {});
Condition0%0/2
shift() || {}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
13990 0 $txt =~ s(^(<div\b[^>]*\skbd_rebuild="([^""]*?)"[^'">]*>).*?^(</div)\b)
13991 0 ▶ ( $1 . ($opt->{fake} ? $rebuild_fake : $self->html_keyboard_diagram("$2", $opt)) . $3 )msge;
Branch: 1 branch
BranchTrueFalseTotal
$opt->{'fake'} ? : 0 0 0
13992 0 $txt;
13993 }
13994 0 ▶sub apply_filter_style ($$;$) {
Subroutine apply_filter_style: not called CC=3 SCAR=24.8
Pod undocumented
13995 0 ▶ my($self, $txt, $opt) = (shift, shift, shift || {});
Condition0%0/2
shift() || {}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
13996 0 $txt =~ s(^(\s*/\*\s*START\s+auto-generated\s+style\s*\*/).*?(/\*\s*END\s+auto-generated\s+style\s*\*/))
13997 0 ▶ ( $1 . ($opt->{fake} ? $rebuild_fake : $rebuild_style) . $2 )msge;
Branch: 1 branch
BranchTrueFalseTotal
$opt->{'fake'} ? : 0 0 0
13998 0 $txt;
13999 }
14000
14001 1 my @HTML_KBD_FIXED = ('
14002
14003 <span class=drow>',
14004 '<kbd style="width: 2.4em"><span class=vsmall>Backspace</span></kbd><kbd class=hidden-align></kbd></span>
14005
14006 <br><span class=arow><kbd style="width: 2.4em">Tab</kbd>',
14007 '</span>
14008
14009 <br><span class=arow><kbd style="width: 3em"><span class=small>CapsLock</span></kbd>',
14010 '<kbd style="width: 2.52em"><span class=shrink>Enter</span></kbd></span>
14011
14012 <br><span class=arow><kbd style="width: 4em" class="shift">Shift</kbd>',
14013 '<kbd style="width: 3.24em" class="shift">Shift</kbd></span>
14014
14015 <br><span class=srow><kbd style="width: 2.5em">Ctrl</kbd><kbd class=win_logo></kbd><kbd style="width: 2em">Alt</kbd>',
14016 '<kbd style="width: 7.68em"></kbd><kbd style="width: 2.4em"><span class="shrink altgr">AltGr</span></kbd><kbd style="width: 2.5em">Menu</kbd><kbd style="width: 2.5em">Ctrl</kbd></span>
14017
14018 ');
14019
14020 0 ▶sub classes_by_chars ($$$$$$$$$$) {
Subroutine classes_by_chars: not called CC=10 SCAR=47.0
Pod undocumented
14021 0 my ($self, $h_classes, $opt, $layer, $lc0, $uc0, $lc, $uc, $k_base, $k, %cl) =
14022 (shift, shift, shift, shift, shift, shift, shift, shift, shift, shift);
14023 0 for my $L ('', $layer) {
14024 0 for my $c (grep defined, $lc0, $uc0) {
14025 0 $cl{$_}++ for @{ $h_classes->{"$k_base$L"}{$c} }; # k for key-based-on-background char
14026 0 for my $o (@$opt) {
14027 0 $cl{$_}++ for @{ $h_classes->{"$k_base$L=$o"}{$c} } # k=opt for key-based-on-background char
14028 }
14029 }
14030 0 for my $c (grep defined, $lc, $uc) {
14031 0 $cl{$_}++ for @{ $h_classes->{"$k$L"}{$c} }; # K for key-based-on-foreground char
14032 0 for my $o (@$opt) {
14033 0 $cl{$_}++ for @{ $h_classes->{"$k$L=$o"}{$c} } # K=opt for key-based-on-background char
14034 }
14035 }
14036 }
14037 0 keys %cl;
14038 }
14039
14040 0 ▶sub apply_kmap($$$) {
Subroutine apply_kmap: not called CC=5 SCAR=34.0
Pod undocumented
14041 0 my ($self, $kmap, $c) = (shift, shift, shift);
14042 0 ▶ return $c unless $kmap;
Branch: 1 branch
BranchTrueFalseTotal
unless $kmap 0 0 0
14043 0 ▶ $c = $c->[0] if ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c 0 0 0
14044 0 ▶ return $c unless defined ($c = $kmap->{$self->key2hex($c)});
Branch: 1 branch
BranchTrueFalseTotal
unless defined($c = $$kmap{$self->key2hex($c)}) 0 0 0
14045 0 ▶ return chr hex $c unless ref $c;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $c 0 0 0
14046 0 $c = [@$c]; # deep copy
14047 0 $c->[0] = chr hex $c->[0];
14048 0 $c;
14049 }
14050
14051 0 ▶sub do_keys ($$$@) { # calculate classes related to the “whole key”, and emit the “content” of the key
Subroutine do_keys: not called CC=10 SCAR=47.0
Pod undocumented
14052 0 my ($self, $opt, $base, $out, $lc0, $uc0, %c_classes) = (shift, shift, 1, '');
14053 0 for my $in (@_) {
14054 0 my ($lc, $uc, $f, $kmap, $layerN, $h_classes, $name, @classes) = @$in;
14055 0 ▶ $kmap and $_ = $self->apply_kmap($kmap, $_) for ($lc, $uc);
Branch: 1 branch
BranchTrueFalseTotal
$kmap and $_ = $self->apply_kmap($kmap, $_) 0 0 0
14056 0 ▶ ref and $_ = $_->[0] for $lc, $uc;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ and $_ = $_->[0] 0 0 0
14057 0 ▶ ($lc0, $uc0) = ($lc, $uc), $base = 0 if $base;
Branch: 1 branch
BranchTrueFalseTotal
if $base 0 0 0
14058 # k/K for key-based-on-(background/foreground) char; k=opt/K=opt likewise
14059 0 $c_classes{$_}++ for $self->classes_by_chars($h_classes, $opt, $layerN, $lc0, $uc0, $lc, $uc, 'k', 'K');
14060 }
14061 0 my @extra = sort keys %c_classes;
14062 0 ▶ my $q = ("@extra" =~ /\s/ ? '"' : '');
Branch: 1 branch
BranchTrueFalseTotal
join($", @extra) =~ /\s/ ? : 0 0 0
14063 0 ▶ my $cl = @extra ? " class=$q@extra$q" : '';
Branch: 1 branch
BranchTrueFalseTotal
@extra ? : 0 0 0
14064 # push @extra, 'from_se' if $k[0][0] =~ /---/i; # lc, uc, $h_classes, name, classes:
14065 0 join '', $out, "<kbd$cl>", (map $self->a_pair($opt, $lc0, $uc0, $self->apply_kmap($_->[3], $_->[0]),
14066 $self->apply_kmap($_->[3], $_->[1]),
14067 $_->[2], $_->[4], $_->[5], $_->[6], [@$_[7..$#$_]]), @_), '</kbd>'
14068 }
14069
14070 0 ▶sub h($) { (my $c = shift) =~ s/([&<>])/$html_esc{$1}/g; $c }
Subroutine h: not called CC=1 SCAR=6.9
Pod undocumented
14071 0 ▶sub tags_by_rx {
Subroutine tags_by_rx: not called CC=4 SCAR=30.0
Pod undocumented
14072 0 my ($c, @o) = shift;
14073 0 ▶ die "Need odd number of arguments" if @_ & 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ & 1 0 0 0
14074 0 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
14075 0 my $tag = shift;
14076 0 ▶ push @o, $tag if $c =~ shift;
Branch: 1 branch
BranchTrueFalseTotal
if $c =~ (shift()) 0 0 0
14077 }
14078 0 return @o;
14079 }
14080
14081 0 ▶sub a_pair ($$$$$$$$$$;@) {
Subroutine a_pair: not called CC=52 SCAR=79.2
Pod undocumented
14082 0 ▶ my($self, $opts, $lc0, $uc0, $LC, $UC, $F, $layerN, $h_classes, $name, $extra) =
Condition0%0/2
shift() || []
l!l
00
MC/DC0%0/1
shift() || []
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
14083 (shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift || []);
14084 # warn "See lc prefix $LC->[0] " if ref $LC and $LC->[2];
14085 0 ▶ my ($lc1, $uc1) = map {(defined and ref()) ? $_->[0] : $_} $LC, $UC;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ && ref $_ ? : 0 0 0
Condition0%0/3
defined $_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ and ref $_
defined $_ ref $_
Truth table0%0/3
A and B
A= defined $_B= ref $_
ABresult
0X0
100
111
14086
14087 0 $extra = [@$extra];
14088 0 my $e = @$extra;
14089
14090 0 ▶ my ($lc, $uc) = map {defined() ? $_ : '♪'} $lc1, $uc1;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
14091 # return join '', map {defined() ? $_ : ''} $lc, $uc;
14092
14093 0 my $opt = { map {($_, 1)} @$opts };
14094 0 ▶ my $base = (($name || '') eq 'base');
Condition0%0/2
$name || ''
l!l
00
MC/DC0%0/1
$name || ''
$name
Truth table0%0/2
A
A= $name
Aresult
11
00
14095 0 ▶ my $prefix2 = (ref($LC) and ref($UC) and $LC->[2] and $UC->[2] && $uc eq $lc);
Condition0%0/12
ref $LC && ref $UC && $LC->[2] && ($UC->[2] && $uc eq $lc)
!ll&&!rl&&r
000
ref $LC and ref $UC and $LC->[2]
!ll&&!rl&&r
000
ref $LC and ref $UC
!ll&&!rl&&r
000
$UC->[2] and $uc eq $lc
!ll&&!rl&&r
000
MC/DC0%0/5
ref $LC && ref $UC && $LC->[2] && ($UC->[2] && $uc eq $lc)
ref $LC ref $UC $LC->[2] $UC->[2] $uc eq $lc
Truth table0%0/6
A and B and C && D and E
A= ref $LCB= ref $UCC= $LC->[2]D= $UC->[2]E= $uc eq $lc
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
14096 0 ▶ if ($prefix2 or ($uc eq ucfirst $lc and $lc eq lc $uc and $lc ne 'ß' and defined($lc1) == defined($uc1))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prefix2 or $uc eq &UI::KeyboardLayout::ucfirst($lc) and $lc eq &UI::KeyboardLayout::lc($uc) and $lc ne "\337" and defined $lc1 == defined $uc1) { } 0 0 0
Condition0%0/12
$prefix2 or $uc eq &UI::KeyboardLayout::ucfirst($lc) and $lc eq &UI::KeyboardLayout::lc($uc) and $lc ne "\x{df}" and defined $lc1 == defined $uc1
l!l&&r!l&&!r
000
$uc eq &UI::KeyboardLayout::ucfirst($lc) and $lc eq &UI::KeyboardLayout::lc($uc) and $lc ne "\x{df}" and defined $lc1 == defined $uc1
!ll&&!rl&&r
000
$uc eq &UI::KeyboardLayout::ucfirst($lc) and $lc eq &UI::KeyboardLayout::lc($uc) and $lc ne "\x{df}"
!ll&&!rl&&r
000
$uc eq &UI::KeyboardLayout::ucfirst($lc) and $lc eq &UI::KeyboardLayout::lc($uc)
!ll&&!rl&&r
000
MC/DC0%0/5
$prefix2 or $uc eq &UI::KeyboardLayout::ucfirst($lc) and $lc eq &UI::KeyboardLayout::lc($uc) and $lc ne "\x{df}" and defined $lc1 == defined $uc1
$prefix2 $uc eq &UI::KeyboardLayout::ucfirst($lc) $lc eq &UI::KeyboardLayout::lc($uc) $lc ne "\x{df}" defined $lc1 == defined $uc1
Truth table0%0/6
A or B and C and D and E
A= $prefix2B= $uc eq &UI::KeyboardLayout::ucfirst($lc)C= $lc eq &UI::KeyboardLayout::lc($uc)D= $lc ne "\x{df}"E= defined $lc1 == defined $uc1
ABCDEresult
1XXXX1
011111
00XXX0
010XX0
0110X0
011100
14097 0 ▶ if ($uc ne $lc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $lc) 0 0 0
14098 0 ▶ ref and $_->[2] and die "Do not expect a character `$_->[0]' to be a deadkey..." for $LC, $UC;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ and $_->[2] and die "Do not expect a character `$_->[0]' to be a deadkey..." 0 0 0
Condition0%0/3
ref $_ and $_->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $_ and $_->[2]
ref $_ $_->[2]
Truth table0%0/3
A and B
A= ref $_B= $_->[2]
ABresult
0X0
100
111
14099 }
14100 0 ▶ my @pref_i = map { ref $_ and (3 == ($_->[2] || 0) or (3 << 3) == ($_->[2] || 0)) } $LC, $UC;
Condition0%0/10
ref $_ && (3 == ($_->[2] || 0) || 24 == ($_->[2] || 0))
!ll&&!rl&&r
000
3 == ($_->[2] || 0) or 24 == ($_->[2] || 0)
l!l&&r!l&&!r
000
$_->[2] || 0
l!l
00
$_->[2] || 0
l!l
00
MC/DC0%0/3
ref $_ && (3 == ($_->[2] || 0) || 24 == ($_->[2] || 0))
ref $_ 3 == ($_->[2] || 0) 24 == ($_->[2] || 0)
MC/DC0%0/1
$_->[2] || 0
$_->[2]
MC/DC0%0/1
$_->[2] || 0
$_->[2]
Truth table0%0/4
A && B or C
A= ref $_B= 3 == ($_->[2] || 0)C= 24 == ($_->[2] || 0)
ABCresult
0XX0
1000
11X1
1011
Truth table0%0/2
A
A= $_->[2]
Aresult
11
00
Truth table0%0/2
A
A= $_->[2]
Aresult
11
00
14101 0 ▶ $prefix2 and $pref_i[1] and not $pref_i[0] and unshift @$extra, 'prefix2';
Branch: 1 branch
BranchTrueFalseTotal
$prefix2 and $pref_i[1] and not $pref_i[0] and unshift @$extra, "prefix2" 0 0 0
Condition0%0/6
$prefix2 and $pref_i[1] and not $pref_i[0]
!ll&&!rl&&r
000
$prefix2 and $pref_i[1]
!ll&&!rl&&r
000
MC/DC0%0/3
$prefix2 and $pref_i[1] and not $pref_i[0]
$prefix2 $pref_i[1] not $pref_i[0]
Truth table0%0/4
A and B and not(C)
A= $prefix2B= $pref_i[1]C= not $pref_i[0]
ABCresult
0XX0
10X0
1100
1111
14102 0 ▶ $LC and ref $LC and $LC->[2] and unshift @$extra, 'prefix';
Branch: 1 branch
BranchTrueFalseTotal
$LC and ref $LC and $LC->[2] and unshift @$extra, "prefix" 0 0 0
Condition0%0/6
$LC and ref $LC and $LC->[2]
!ll&&!rl&&r
000
$LC and ref $LC
!ll&&!rl&&r
000
MC/DC0%0/3
$LC and ref $LC and $LC->[2]
$LC ref $LC $LC->[2]
Truth table0%0/4
A and B and C
A= $LCB= ref $LCC= $LC->[2]
ABCresult
0XX0
10X0
1100
1111
14103 0 push @$extra, $self->classes_by_chars($h_classes, $opts, $layerN, $lc0, undef, $lc1, undef, 'c', 'C');
14104 # unshift @$extra, tags_by_rx $lc, 'need-learn' => ($opt->{cyr} ? qr/N-A/i : qr/[ϝϙϲͻϿϾͲ℧ϗ]N-A/i);
14105 # push @$extra, 'vbell' unless defined $lc1;
14106 0 ▶ push @$extra, (1 < length uc $lc1 ? 'three-cases-long' : 'three-cases')
Branch: 2 branches
BranchTrueFalseTotal
if defined $lc1 and &UI::KeyboardLayout::uc($lc1) ne &UI::KeyboardLayout::ucfirst($lc1) 0 0 0
1 < length &UI::KeyboardLayout::uc($lc1) ? : 0 0 0
Condition0%0/3
defined $lc1 and &UI::KeyboardLayout::uc($lc1) ne &UI::KeyboardLayout::ucfirst($lc1)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $lc1 and &UI::KeyboardLayout::uc($lc1) ne &UI::KeyboardLayout::ucfirst($lc1)
defined $lc1 &UI::KeyboardLayout::uc($lc1) ne &UI::KeyboardLayout::ucfirst($lc1)
Truth table0%0/3
A and B
A= defined $lc1B= &UI::KeyboardLayout::uc($lc1) ne &UI::KeyboardLayout::ucfirst($lc1)
ABresult
0X0
100
111
14107 if defined $lc1 and uc $lc1 ne ucfirst $lc1;
14108 0 ▶ push @$extra, $name if $name;
Branch: 1 branch
BranchTrueFalseTotal
if $name 0 0 0
14109 0 ▶ my $q = ("@$extra" =~ /\s/ ? '"' : '');
Branch: 1 branch
BranchTrueFalseTotal
join($", @$extra) =~ /\s/ ? : 0 0 0
14110 0 @$extra = sort @$extra;
14111 0 ▶ my $cl = @$extra ? " class=$q@$extra$q" : '';
Branch: 1 branch
BranchTrueFalseTotal
@$extra ? : 0 0 0
14112 0 ▶ $base ? "<span$cl>" . h($uc) . "</span>" : $self->char_2_html_span(undef, $UC, $uc, $F, {}, @$extra)
Branch: 1 branch
BranchTrueFalseTotal
$base ? : 0 0 0
14113 # "<span$cl>" . $out . "</span>";
14114 } else {
14115 0 my (@e_lc, @e_uc);
14116 0 my @do = ([$lc, [], 'lc', $LC, $lc0, $lc1], [$uc, [], 'uc', $UC, $uc0, $uc1]);
14117 # warn "See lc prefix $LC->[0] " if ref $LC and $LC->[2];
14118 0 ▶ $_->[3] and ref $_->[3] and $_->[3][2] and push @{$_->[1]}, 'prefix' for @do;
Branch: 1 branch
BranchTrueFalseTotal
$_->[3] and ref $_->[3] and $_->[3][2] and push @{$$_[1];}, "prefix" 0 0 0
Condition0%0/6
$_->[3] and ref $_->[3] and $_->[3][2]
!ll&&!rl&&r
000
$_->[3] and ref $_->[3]
!ll&&!rl&&r
000
MC/DC0%0/3
$_->[3] and ref $_->[3] and $_->[3][2]
$_->[3] ref $_->[3] $_->[3][2]
Truth table0%0/4
A and B and C
A= $_->[3]B= ref $_->[3]C= $_->[3][2]
ABCresult
0XX0
10X0
1100
1111
14119 0 ▶ $_->[3] and ref $_->[3] and (3 == ($_->[3][2] || 0) or (3 << 3) == ($_->[3][2] || 0)) and push @{$_->[1]}, 'prefix2' for @do;
Branch: 1 branch
BranchTrueFalseTotal
$_->[3] and ref $_->[3] and 3 == ($_->[3][2] || 0) || 24 == ($_->[3][2] || 0) and push @{$$_[1];}, "prefix2" 0 0 0
Condition0%0/13
$_->[3] and ref $_->[3] and 3 == ($_->[3][2] || 0) || 24 == ($_->[3][2] || 0)
!ll&&!rl&&r
000
$_->[3] and ref $_->[3]
!ll&&!rl&&r
000
3 == ($_->[3][2] || 0) or 24 == ($_->[3][2] || 0)
l!l&&r!l&&!r
000
$_->[3][2] || 0
l!l
00
$_->[3][2] || 0
l!l
00
MC/DC0%0/4
$_->[3] and ref $_->[3] and 3 == ($_->[3][2] || 0) || 24 == ($_->[3][2] || 0)
$_->[3] ref $_->[3] 3 == ($_->[3][2] || 0) 24 == ($_->[3][2] || 0)
MC/DC0%0/1
$_->[3][2] || 0
$_->[3][2]
MC/DC0%0/1
$_->[3][2] || 0
$_->[3][2]
Truth table0%0/5
A and B and C or D
A= $_->[3]B= ref $_->[3]C= 3 == ($_->[3][2] || 0)D= 24 == ($_->[3][2] || 0)
ABCDresult
0XXX0
10XX0
11000
111X1
11011
Truth table0%0/2
A
A= $_->[3][2]
Aresult
11
00
Truth table0%0/2
A
A= $_->[3][2]
Aresult
11
00
14120 0 push @{$_->[1]}, $self->classes_by_chars($h_classes, $opts, $layerN, $_->[4], undef, $_->[5], undef, 'c', 'C'),
14121 tags_by_rx $_->[0], 'not-surr' => qr/[„‚“‘”’«‹»›‐–—―‒‑‵‶‷′″‴⁗〃´]/i # white
14122 0 for @do;
14123 0 push @{$_->[1]}, 'vbell' for grep !defined $_->[5], @do;
14124 join '', map {
14125 0 ▶ push @{$_->[1]}, ($name ? "$name-$_->[2]" : $_->[2]);
Branch: 1 branch
BranchTrueFalseTotal
$name ? : 0 0 0
14126 0 my $ee = [sort @$extra, @{$_->[1]}];
14127 0 ▶ my $q = ("@$ee" =~ /\s/) ? '"' : '';
Branch: 1 branch
BranchTrueFalseTotal
join($", @$ee) =~ /\s/ ? : 0 0 0
14128 0 ▶ my $o = ($base ? "<span class=$q@$ee$q>" . h($_->[0]) . "</span>"
Branch: 1 branch
BranchTrueFalseTotal
$base ? : 0 0 0
14129 : $self->char_2_html_span(undef, $_->[3], $_->[0], $F, {}, @$ee));
14130 # "<span class=$q@$e$j$_->[2]$q>$o</span>";
14131 } @do;
14132 }
14133 }
14134
14135 1 my $kbdrow = 0;
14136 0 ▶sub keys2html_diagram ($$$$@) {
Subroutine keys2html_diagram: not called CC=12 SCAR=50.5
Pod undocumented
14137 0 my ($self, $opts, $cnt, $new_row) = (shift, shift, shift, shift);
14138 0 ▶ my %opts = map { /^\w+=/ ? split /=/, $_, 2 : ($_, 1)} @$opts;
Branch: 1 branch
BranchTrueFalseTotal
/^\w+=/ ? : 0 0 0
14139 0 ▶ my $off = (($opts{oneRow} && $kbdrow++) || 0) % 3;
Condition0%0/5
$opts{'oneRow'} && $kbdrow++ || 0
l!l
00
$opts{"oneRow"} and $kbdrow++
!ll&&!rl&&r
000
MC/DC0%0/2
$opts{'oneRow'} && $kbdrow++ || 0
$opts{"oneRow"} $kbdrow++
Truth table0%0/3
A and B
A= $opts{"oneRow"}B= $kbdrow++
ABresult
111
0X0
100
14140 0 $off = "\xA0" x (2*$off);
14141 0 ▶ my @fixed = ($opts{oneRow} ? ("<span class=arow>$off") : @HTML_KBD_FIXED);
Branch: 1 branch
BranchTrueFalseTotal
$opts{'oneRow'} ? : 0 0 0
14142 0 my $out = shift @fixed;
14143 # $cnt = $#{$layers_info->[0]} if $cnt > $#{$layers_info->[0]};
14144 0 my @keys = (0..($cnt-1));
14145 0 ▶ my $start = ($opts{startKey} || 0) % $cnt;
Condition0%0/2
$opts{'startKey'} || 0
l!l
00
MC/DC0%0/1
$opts{'startKey'} || 0
$opts{'startKey'}
Truth table0%0/2
A
A= $opts{'startKey'}
Aresult
11
00
14146 0 ▶ my $CNT = $opts{cntKeys} || $cnt;
Condition0%0/3
$opts{'cntKeys'} || $cnt
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{'cntKeys'} || $cnt
$opts{'cntKeys'} $cnt
Truth table0%0/3
A || B
A= $opts{'cntKeys'}B= $cnt
ABresult
1X1
011
000
14147 0 @keys = (@keys) x ( 1 + int( ($start+$CNT-1)/$cnt ) );
14148 0 @keys = @keys[$start .. ($start + $CNT - 1)];
14149 KEY:
14150 0 for my $kn (@keys) { # Ordinal of keyboard's key
14151 0 ▶ $out .= (shift(@fixed) || '') if $new_row->{$kn};
Branch: 1 branch
BranchTrueFalseTotal
if $new_row->{$kn} 0 0 0
Condition0%0/2
shift @fixed || ''
l!l
00
MC/DC0%0/1
shift @fixed || ''
shift @fixed
Truth table0%0/2
A
A= shift @fixed
Aresult
11
00
14152 0 my ($symb, @keys, $last) = 0;
14153 0 for my $KK (@_) { # Layers
14154 0 my($layer, @rest) = @$KK; # rest = face, kmap, layerN, class_hash, name, classes
14155 0 push @keys, [@{$layer->[$kn]}[0,1], @rest];
14156 }
14157 0 $out .= $self->do_keys($opts, @keys);
14158 }
14159 0 $out .= join '', @fixed;
14160 0 ▶ $out .= "</span\n>" if $opts{oneRow};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"oneRow"} 0 0 0
14161 0 $out
14162 }
14163
14164 0 ▶sub html_keyboard_diagram ($$$) {
Subroutine html_keyboard_diagram: not called CC=23 SCAR=63.1
Pod undocumented
14165 0 my($self, $OPT, $global_opt, @opt, @layers, $face0, $is_layer) = (shift, shift, shift);
14166 0 my %tr = qw(l 0 c 1 h 2);
14167 0 for my $arg (split /\s+/, $OPT) {
14168 0 ▶ push(@opt, $arg), next if $arg =~ s(^/opt=)(); # BELOW: `base' becomes NAME, `on-right' becomes CLASSES
Branch: 1 branch
BranchTrueFalseTotal
if $arg =~ s[^/opt=][] 0 0 0
14169 0 ▶ die "unrecognized `rebuild' option: `$arg'" # +=l,0,0 +base=l,0,0 +=l,0,1 +=l,ƒ,0 on-right+=c,0,1
Branch: 1 branch
BranchTrueFalseTotal
unless () = $arg =~ /^((?:[-\w]+(?:,[-\w]+)*)?)\+([-\w]*)=(\w+),([\da-f]{4}|[^\x20-\x7e][^,]*|[02]?),(\d+|-)$/i 0 0 0
14170 unless my($classes, $name, $f, $prefix, $which) = ( $arg =~ m{^((?:[-\w]+(?:,[-\w]+)*)?)\+([-\w]*)=(\w+),([\da-f]{4}|[^\x20-\x7e][^,]*|[02]?),(\d+|-)$}i );
14171 0 ▶ $f = $self->{face_shortcuts}{$f} if exists $self->{face_shortcuts}{$f};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"face_shortcuts"}{$f} 0 0 0
14172 0 ▶ $face0 ||= $f unless $which eq '-';
Branch: 1 branch
BranchTrueFalseTotal
unless $which eq "-" 0 0 0
Condition0%0/3
$face0 ||= $f
l!l&&r!l&&!r
000
MC/DC0%0/2
$face0 ||= $f
$face0 $f
Truth table0%0/3
A ||= B
A= $face0B= $f
ABresult
1X1
011
000
14173 0 $prefix =~ s/◌(?=\p{NonspacingMark})//g;
14174 0 $prefix = $self->charhex2key($prefix);
14175 0 ▶ my $L = ($which eq '-' and $which = 0, [$f]);
Condition0%0/3
$which eq '-' && ($which = 0, [$f])
!ll&&!rl&&r
000
MC/DC0%0/2
$which eq '-' && ($which = 0, [$f])
$which eq '-' ($which = 0, [$f])
Truth table0%0/3
A && B
A= $which eq '-'B= ($which = 0, [$f])
ABresult
0X0
100
111
14176 0 ▶ warn "unknown layer $L->[0]" if $L and not $self->{layers}{$L->[$which]};
Branch: 1 branch
BranchTrueFalseTotal
if $L and not $self->{"layers"}{$L->[$which]} 0 0 0
Condition0%0/3
$L and not $self->{"layers"}{$L->[$which]}
!ll&&!rl&&r
000
MC/DC0%0/2
$L and not $self->{"layers"}{$L->[$which]}
$L not $self->{"layers"}{$L->[$which]}
Truth table0%0/3
A and not(B)
A= $LB= not $self->{"layers"}{$L->[$which]}
ABresult
0X0
100
111
14177 die "html_keyboard_diagram(): unknown face `$f'"
14178 0 ▶ unless $L ||= ($self->{faces}{$f}{layers} or $self->export_layers($f, $f));
Branch: 1 branch
BranchTrueFalseTotal
unless $L ||= $self->{"faces"}{$f}{"layers"} || $self->export_layers($f, $f) 0 0 0
Condition0%0/6
$L ||= $self->{"faces"}{$f}{"layers"} || $self->export_layers($f, $f)
l!l&&r!l&&!r
000
$self->{'faces'}{$f}{'layers'} || $self->export_layers($f, $f)
l!l&&r!l&&!r
000
MC/DC0%0/3
$L ||= $self->{"faces"}{$f}{"layers"} || $self->export_layers($f, $f)
$L $self->{'faces'}{$f}{'layers'} $self->export_layers($f, $f)
Truth table0%0/4
A ||= B || C
A= $LB= $self->{'faces'}{$f}{'layers'}C= $self->export_layers($f, $f)
ABCresult
1XX1
01X1
0011
0000
14179 0 ▶ my $kmap = $self->{faces}{$f}{'[deadkeyFaceHexMap]'}{$self->key2hex($prefix)}
Branch: 1 branch
BranchTrueFalseTotal
my $kmap = $self->{"faces"}{$f}{"[deadkeyFaceHexMap]"}{$self->key2hex($prefix)} or not length $prefix or die "output_html_keyboard_diagram(): Unknown prefix key `${prefix}' for face $f" 0 0 0
Condition0%0/3
my $kmap = $self->{"faces"}{$f}{"[deadkeyFaceHexMap]"}{$self->key2hex($prefix)} or not length $prefix
l!l&&r!l&&!r
000
MC/DC0%0/2
my $kmap = $self->{"faces"}{$f}{"[deadkeyFaceHexMap]"}{$self->key2hex($prefix)} or not length $prefix
my $kmap = $self->{"faces"}{$f}{"[deadkeyFaceHexMap]"}{$self->key2hex($prefix)} not length $prefix
Truth table0%0/3
A or not(B)
A= my $kmap = $self->{"faces"}{$f}{"[deadkeyFaceHexMap]"}{$self->key2hex($prefix)}B= not length $prefix
ABresult
1X1
011
000
14180 or not length $prefix or die "output_html_keyboard_diagram(): Unknown prefix key `$prefix' for face $f";
14181 # create_composite_layers() translates 0000 key to ''
14182 # warn "I see HTML_classes for face=$f, prefix=`$prefix'" if $self->{faces}{$f}{'[HTML_classes]'}{length $prefix ? $self->key2hex($prefix) : ''};
14183 0 ▶ my $h_classes = $self->{faces}{$f}{'[HTML_classes]'}{length $prefix ? $self->key2hex($prefix) : ''} || {};
Branch: 1 branch
BranchTrueFalseTotal
length $prefix ? : 0 0 0
Condition0%0/2
$self->{'faces'}{$f}{'[HTML_classes]'}{length $prefix ? $self->key2hex($prefix) : ''} || {}
l!l
00
MC/DC0%0/1
$self->{'faces'}{$f}{'[HTML_classes]'}{length $prefix ? $self->key2hex($prefix) : ''} || {}
$self->{'faces'}{$f}{'[HTML_classes]'}{length $prefix ? $self->key2hex($prefix) : ''}
Truth table0%0/2
A
A= $self->{'faces'}{$f}{'[HTML_classes]'}{length $prefix ? $self->key2hex($prefix) : ''}
Aresult
11
00
14184 0 push(@layers, [$self->{layers}{$L->[$which]}, $f, $kmap, $which, $h_classes, $name, split /,/, $classes]);
14185 }
14186 0 ▶ die "there must be exactly one /opt= argument in <<$OPT>>" unless @opt == 1;
Branch: 1 branch
BranchTrueFalseTotal
unless @opt == 1 0 0 0
14187 0 my $opt = [split /,/, $opt[0], -1];
14188 0 ▶ my ($cnt, @g, %new_row) = (0, @{ $self->{faces}{$face0}{'[geometry]'} || [] }); # keep only 1 from the last row
Condition0%0/2
$self->{'faces'}{$face0}{'[geometry]'} || []
l!l
00
MC/DC0%0/1
$self->{'faces'}{$face0}{'[geometry]'} || []
$self->{'faces'}{$face0}{'[geometry]'}
Truth table0%0/2
A
A= $self->{'faces'}{$face0}{'[geometry]'}
Aresult
11
00
14189 0 ▶ @g or die "Face `$face0' has no associated layer with geometry info; did you set geometry_via_layer?";
Branch: 1 branch
BranchTrueFalseTotal
@g or die "Face `${face0}' has no associated layer with geometry info; did you set geometry_via_layer?" 0 0 0
14190 0 pop @g;
14191 0 $new_row{ $cnt += $_ }++ for @g;
14192 0 my ($pre, $post) = ('', '');
14193 0 ▶ ($pre, $post) = ("\n<div>", "</div>\nHover mouse here to see how characters look in RTL context.\n")
Branch: 1 branch
BranchTrueFalseTotal
if grep /^rtl-hover(-Trivia)?$/, @$opt 0 0 0
14194 if grep /^rtl-hover(-Trivia)?$/, @$opt;
14195 0 ▶ $post .= " <b>Trivia:</b> note <a href=http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Bidirectional_Neutral_Formatting>mirroring</a> of <code>&lt;{[()]}&gt;</code>." if grep /^rtl-hover-Trivia$/, @$opt;
Branch: 1 branch
BranchTrueFalseTotal
if grep /^rtl-hover-Trivia$/, @$opt 0 0 0
14196 0 $pre . $self->keys2html_diagram($opt, $cnt+1, \%new_row, @layers) . $post;
14197 }
14198
14199
14200 # These preloaded symbols are enough to cover single-UTF-16 bindings in .Compose (except circled katakana/hangul)
14201 1 my @enc_dotcompose; # Have many-to-1, inverting hash would lose info; Do not distinguish Left/leftarrow etc.
14202 1 ▶{ no warnings 'qw';
Subroutine BEGIN: called CC=1 SCAR=0.0
14203 @enc_dotcompose = (qw#
14204 ` grave
14205 ' apostrophe
14206 " quotedbl
14207 ~ asciitilde
14208 ! exclam
14209 ? question
14210 @ at
14211 #, # `
14212 qw!
14213 # numbersign
14214 $ dollar
14215 % percent
14216 ^ asciicircum
14217 & ampersand
14218 * asterisk
14219 ( parenleft
14220 ) parenright
14221 [ bracketleft
14222 ] bracketright
14223 { braceleft
14224 } braceright
14225 - minus
14226 + plus
14227 = equal
14228 _ underscore
14229 < less
14230 > greater
14231 \ backslash
14232 / slash
14233 | bar
14234 , comma
14235 . period
14236 : colon
14237 ; semicolon
14238 _bar underbar
14239
14240
14241 ¡ exclamdown
14242 ¢ cent
14243 £ sterling
14244 ¤ currency
14245 ¥ yen
14246 ¦ brokenbar
14247 § section
14248 ¨ diaeresis
14249 © copyright
14250 ª ordfeminine
14251 « guillemotleft
14252 ¬ notsign
14253 ­ hyphen
14254 ® registered
14255 ¯ macron
14256 ° degree
14257 ± plusminus
14258 ² twosuperior
14259 ³ threesuperior
14260 ´ acute
14261 µ mu
14262 ¶ paragraph
14263 · periodcentered
14264 ¸ cedilla
14265 ¹ onesuperior
14266 º masculine
14267 » guillemotright
14268 ¼ onequarter
14269 ½ onehalf
14270 ¾ threequarters
14271 ¿ questiondown
14272 À Agrave
14273 Á Aacute
14274 Â Acircumflex
14275 Ã Atilde
14276 Ä Adiaeresis
14277 Å Aring
14278 Æ AE
14279 Ç Ccedilla
14280 È Egrave
14281 É Eacute
14282 Ê Ecircumflex
14283 Ë Ediaeresis
14284 Ì Igrave
14285 Í Iacute
14286 Î Icircumflex
14287 Ï Idiaeresis
14288 Ð ETH
14289 Ð Eth
14290 Ñ Ntilde
14291 Ò Ograve
14292 Ó Oacute
14293 Ô Ocircumflex
14294 Õ Otilde
14295 Ö Odiaeresis
14296 × multiply
14297 Ø Oslash
14298 Ø Ooblique
14299 Ù Ugrave
14300 Ú Uacute
14301 Û Ucircumflex
14302 Ü Udiaeresis
14303 Ý Yacute
14304 Þ THORN
14305 Þ Thorn
14306 ß ssharp
14307 à agrave
14308 á aacute
14309 â acircumflex
14310 ã atilde
14311 ä adiaeresis
14312 å aring
14313 æ ae
14314 ç ccedilla
14315 è egrave
14316 é eacute
14317 ê ecircumflex
14318 ë ediaeresis
14319 ì igrave
14320 í iacute
14321 î icircumflex
14322 ï idiaeresis
14323 ð eth
14324 ñ ntilde
14325 ò ograve
14326 ó oacute
14327 ô ocircumflex
14328 õ otilde
14329 ö odiaeresis
14330 ÷ division
14331 ø oslash
14332 ø ooblique
14333 ù ugrave
14334 ú uacute
14335 û ucircumflex
14336 ü udiaeresis
14337 ý yacute
14338 þ thorn
14339 ÿ ydiaeresis
14340
14341 Cyr_ђ Serbian_dje
14342 ѓ Macedonia_gje
14343 є Ukrainian_ie
14344 Cyr_ѕ Macedonia_dse
14345 Cyr_і Ukrainian_i
14346 Cyr_ї Ukrainian_yi
14347 Cyr_ћ Serbian_tshe
14348 Cyr_ќ Macedonia_kje
14349 ґ Ukrainian_ghe_with_upturn
14350 Cyr_ў Byelorussian_shortu
14351 № numerosign
14352 Cyr_Ђ Serbian_DJE
14353 Ѓ Macedonia_GJE
14354 Є Ukrainian_IE
14355 Cyr_Ѕ Macedonia_DSE
14356 Cyr_І Ukrainian_I
14357 Cyr_Ї Ukrainian_YI
14358 Cyr_Ћ Serbian_TSHE
14359 Cyr_Ќ Macedonia_KJE
14360 Ґ Ukrainian_GHE_WITH_UPTURN
14361 Cyr_Ў Byelorussian_SHORTU
14362
14363 ’sq rightsinglequotemark
14364 ‘sq leftsinglequotemark
14365 • enfilledcircbullet
14366 ♀ femalesymbol
14367 ♂ malesymbol
14368 NBSP nobreakspace
14369 … ellipsis
14370 ∩# intersection
14371 ∫ integral
14372 ≤ lessthanequal
14373 ≥ greaterthanequal
14374
14375 d` dead_grave
14376 d' dead_acute
14377 d^ dead_circumflex
14378 d~ dead_tilde
14379 d¯ dead_macron
14380 dd# dead_breve----
14381 d^. dead_abovedot
14382 d" dead_diaeresis
14383 d^° dead_abovering
14384 d'' dead_doubleacute
14385 d^v dead_caron
14386 d, dead_cedilla
14387 dd# dead_ogonek---
14388 d_ι dead_iota
14389 d_voiced dead_voiced_sound
14390 d_½voiced dead_semivoiced_sound
14391 d. dead_belowdot
14392 dd# dead_hook---
14393 dd# dead_horn---
14394 d/ dead_stroke
14395 d^, dead_abovecomma
14396 dd# dead_abovereversedcomma---
14397 d`` dead_doublegrave
14398 d``# dead_double_grave
14399 d_° dead_belowring
14400 d__ dead_belowmacron
14401 dd# dead_belowcircumflex---
14402 d_~ dead_belowtilde
14403 dd# dead_belowbreve---
14404 d_" dead_belowdiaeresis
14405 d_invbrev dead_invertedbreve
14406 d_inv_brev dead_inverted_breve
14407 d_, dead_belowcomma
14408 dd# dead_currency
14409
14410 d^( dead_dasia
14411 d^) dead_psili
14412
14413 Ś Sacute
14414 Š Scaron
14415 Ş Scedilla
14416 Ť Tcaron
14417 Ź Zacute
14418 Ž Zcaron
14419 Ż Zabovedot
14420 ą aogonek
14421 ˛ ogonek
14422 ł lstroke
14423 ľ lcaron
14424 ś sacute
14425 ˇ caron
14426 š scaron
14427 ş scedilla
14428 ť tcaron
14429 ź zacute
14430 ˝ doubleacute
14431 ž zcaron
14432 ż zabovedot
14433 Ŕ Racute
14434 Ă Abreve
14435 Ĺ Lacute
14436 Ć Cacute
14437 Č Ccaron
14438 Ę Eogonek
14439 Ě Ecaron
14440 Ď Dcaron
14441 Đ Dstroke
14442 Ń Nacute
14443 Ň Ncaron
14444 Ő Odoubleacute
14445 Ř Rcaron
14446 Ů Uring
14447 Ű Udoubleacute
14448 Ţ Tcedilla
14449 ŕ racute
14450 ă abreve
14451 ĺ lacute
14452 ć cacute
14453 č ccaron
14454 ę eogonek
14455 ě ecaron
14456 ď dcaron
14457 đ dstroke
14458 ń nacute
14459 ň ncaron
14460 ő odoubleacute
14461 ř rcaron
14462 ů uring
14463 ű udoubleacute
14464 ţ tcedilla
14465 ˙ abovedot
14466
14467 Ŗ Rcedilla
14468 Ĩ Itilde
14469 Ļ Lcedilla
14470 Ē Emacron
14471 Ģ Gcedilla
14472 Ŧ Tslash
14473 ŗ rcedilla
14474 ĩ itilde
14475 ļ lcedilla
14476 ē emacron
14477 ģ gcedilla
14478 ŧ tslash
14479 Ŋ ENG
14480 ŋ eng
14481 Ā Amacron
14482 Į Iogonek
14483 Ė Eabovedot
14484 Ī Imacron
14485 Ņ Ncedilla
14486 Ō Omacron
14487 Ķ Kcedilla
14488 Ų Uogonek
14489 Ũ Utilde
14490 Ū Umacron
14491 ā amacron
14492 į iogonek
14493 ė eabovedot
14494 ī imacron
14495 ņ ncedilla
14496 ō omacron
14497 ķ kcedilla
14498 ų uogonek
14499 ũ utilde
14500 ū umacron
14501
14502 Ơ Ohorn
14503 ơ ohorn
14504 Ư Uhorn
14505 ư uhorn
14506
14507 < leftcaret
14508 > rightcaret
14509 ∨ downcaret
14510 ∧ upcaret
14511 ¯ overbar
14512 ⊤ downtack
14513 ∩ upshoe
14514 ⌊ downstile
14515 _ underbar
14516 ∘ jot
14517 ⎕ quad
14518 ⊥ uptack
14519 ○ circle
14520 ⌈ upstile
14521 ∪ downshoe
14522 ⊃ rightshoe
14523 ⊂ leftshoe
14524 ⊣ lefttack
14525 ⊢ righttack
14526
14527 ≤ lessthanequal
14528 ≠ notequal
14529 ≥ greaterthanequal
14530 ∫ integral
14531 ∴ therefore
14532 ∝ variation
14533 ∞ infinity
14534 ∇ nabla
14535 ∼ approximate
14536 ≃ similarequal
14537 ⇔ ifonlyif
14538 ⇒ implies
14539 ≡ identical
14540 √ radical
14541 ⊂ includedin
14542 ⊃ includes
14543 ∩ intersection
14544 ∪ union
14545 ∧ logicaland
14546 ∨ logicalor
14547 ∂ partialderivative
14548 ƒ function
14549 ← leftarrow
14550 ↑ uparrow
14551 → rightarrow
14552 ↓ downarrow
14553 ◆ soliddiamond
14554 ▒ checkerboard
14555
14556 CP Multi_key
14557
14558 +# KP_Add
14559 -# KP_Subtract
14560 *# KP_Multiply
14561 /# KP_Divide
14562 .# KP_Decimal
14563 =# KP_Equal
14564 SPC# KP_Space
14565
14566 ← Left → Right ↑ Up ↓ Down
14567 1 !, map {("$_#", "KP_$_")} 0..9);
14568 } # `
14569
14570 1 my %dec_dotcompose = reverse @enc_dotcompose;
14571 # perl -C31 -wne "/^(.)\tCyrillic_(\w+)/ and print qq($2 $1 )" oooo3 >oooo-cyr
14572 # perl -C31 -wne "/^(.)\thebrew_(\w+)/ and print qq($2 $1 )" oooo3 >oooo-heb
14573 1 my %cyr = qw( GHE_bar Ғ ghe_bar ғ ZHE_descender Җ zhe_descender җ KA_descender Қ ka_descender қ KA_vertstroke Ҝ ka_vertstroke ҝ
14574 EN_descender Ң en_descender ң U_straight Ү u_straight ү U_straight_bar Ұ u_straight_bar ұ HA_descender Ҳ
14575 ha_descender ҳ CHE_descender Ҷ che_descender ҷ CHE_vertstroke Ҹ che_vertstroke ҹ SHHA Һ shha һ SCHWA Ә schwa ә
14576 I_macron Ӣ i_macron ӣ O_bar Ө o_bar ө U_macron Ӯ u_macron ӯ io ё je ј lje љ nje њ dzhe џ IO Ё JE Ј LJE Љ NJE Њ
14577 DZHE Џ yu ю a а be б tse ц de д ie е ef ф ghe г ha х i и shorti й ka к el л em м en н o о pe п ya я er р es с te т
14578 u у zhe ж ve в softsign ь yeru ы ze з sha ш e э shcha щ che ч hardsign ъ YU Ю A А BE Б TSE Ц DE Д IE Е EF Ф GHE Г
14579 HA Х I И SHORTI Й KA К EL Л EM М EN Н O О PE П YA Я ER Р ES С TE Т U У ZHE Ж VE В SOFTSIGN Ь YERU Ы ZE З SHA Ш E Э
14580 SHCHA Щ CHE Ч HARDSIGN Ъ );
14581 1 my %heb = qw( doublelowline ‗ aleph א bet ב gimel ג dalet ד he ה waw ו zain ז chet ח tet ט yod י finalkaph ך kaph כ lamed ל
14582 finalmem ם mem מ finalnun ן nun נ samech ס ayin ע finalpe ף pe פ finalzade ץ zade צ qoph ק resh ר shin ש taw ת
14583 beth ב gimmel ג daleth ד samekh ס zayin ז het ח teth ט zadi צ kuf ק taf ת );
14584 1 my %grk = qw( ALPHAaccent Ά EPSILONaccent Έ ETAaccent Ή IOTAaccent Ί IOTAdieresis Ϊ OMICRONaccent Ό UPSILONaccent Ύ
14585 UPSILONdieresis Ϋ OMEGAaccent Ώ accentdieresis ΅ horizbar ― alphaaccent ά epsilonaccent έ etaaccent ή iotaaccent ί
14586 iotadieresis ϊ iotaaccentdieresis ΐ omicronaccent ό upsilonaccent ύ upsilondieresis ϋ upsilonaccentdieresis ΰ
14587 omegaaccent ώ ALPHA Α BETA Β GAMMA Γ DELTA Δ EPSILON Ε ZETA Ζ ETA Η THETA Θ IOTA Ι KAPPA Κ LAMDA Λ LAMBDA Λ MU Μ
14588 NU Ν XI Ξ OMICRON Ο PI Π RHO Ρ SIGMA Σ TAU Τ UPSILON Υ PHI Φ CHI Χ PSI Ψ OMEGA Ω alpha α beta β gamma γ delta δ
14589 epsilon ε zeta ζ eta η theta θ iota ι kappa κ lamda λ lambda λ mu μ nu ν xi ξ omicron ο pi π rho ρ sigma σ
14590 finalsmallsigma ς tau τ upsilon υ phi φ chi χ psi ψ omega ω );
14591 1 $dec_dotcompose{"Cyrillic_$_"} = "Cyr_$cyr{$_}" for keys %cyr;
14592 1 $dec_dotcompose{"hebrew_$_"} = "heb_$heb{$_}" for keys %heb;
14593 1 $dec_dotcompose{"Greek_$_"} = "Gr_$grk{$_}" for keys %grk;
14594
14595 0 ▶sub shorten_dotcompose ($$;$) { # Shorten but leave readable disambiguous (to allow more concise printout)
Subroutine shorten_dotcompose: not called CC=2 SCAR=17.9
Pod undocumented
14596 0 shift; # self [Later we massage out Cyr_ Gr_ uni_ prefixes
14597 0 (my $in = shift) =~ s/\b(Cyr|Ukr|Gr|heb|Ar)[a-z]+(?=_)/$1/;
14598 0 $in =~ s/\b(dead)(?=_)/d/;
14599 0 $in =~ s/\b(Gr_\w+dier|d_diaer)esis/$1/;
14600 0 ▶ $in =~ s/^U([a-fA-F\d]{4,6})$/ 'uni_' . chr hex $1 /e if shift;
Branch: 1 branch
BranchTrueFalseTotal
if shift() 0 0 0
14601 0 $in
14602 }
14603
14604 0 ▶sub dec_dotcompose ($$;$) {
Subroutine dec_dotcompose: not called CC=6 SCAR=37.4
Pod undocumented
14605 0 my($self, $in, $dec_U) = (shift, shift, shift);
14606 0 my($pre, $post) = split /:/, $in, 2;
14607 0 ▶ $post or warn("Can't parse <<$in>>"), return;
Branch: 1 branch
BranchTrueFalseTotal
$post or warn("Can't parse <<$in>>"), return 0 0 0
14608 0 ▶ my @pre = ($pre =~ /<(\w+)>/g) or warn("Unknown format of IN in <<$in>>"), return;
Branch: 1 branch
BranchTrueFalseTotal
my(@pre) = $pre =~ /<(\w+)>/g or warn("Unknown format of IN in <<$in>>"), return 0 0 0
14609 0 ▶ my($p) = ($post =~ /"(.+?)"/) or warn("Unknown format of OUT in <<$in>>"), return;
Branch: 1 branch
BranchTrueFalseTotal
my($p) = $post =~ /"(.+?)"/ or warn("Unknown format of OUT in <<$in>>"), return 0 0 0
14610 0 @pre = map { exists $KeySyms{$_}
14611 ? $KeySyms{$_}
14612 0 ▶ : ( exists $dec_dotcompose{$_} ? $dec_dotcompose{$_} : $self->shorten_dotcompose($_, $dec_U) ) } @pre;
Branch: 2 branches
BranchTrueFalseTotal
exists $KeySyms{$_} ? : 0 0 0
exists $dec_dotcompose{$_} ? : 0 0 0
14613 0 (@pre, $p)
14614 }
14615
14616 # Stats: about 250 in: egrep "CP.*d_|d_.*CP" o-std
14617 0 ▶sub process_dotcompose ($$$;$) {
Subroutine process_dotcompose: not called CC=5 SCAR=34.0
Pod undocumented
14618 0 my($self, $fh, $sub, $dec_U) = (shift, shift, shift, shift);
14619 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
14620 0 ▶ next if /^\s*(#|include\b)/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s*(#|include\b)/ 0 0 0
14621 0 ▶ next unless /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless /\S/ 0 0 0
14622 0 ▶ next unless my @in = $self->dec_dotcompose($_, $dec_U);
Branch: 1 branch
BranchTrueFalseTotal
unless my(@in) = $self->dec_dotcompose($_, $dec_U) 0 0 0
14623 0 $sub->($self, $in[-1], @in[0..$#in-1]);
14624 }
14625 }
14626
14627 0 ▶sub filter_dotcompose ($;$) {
Subroutine filter_dotcompose: not called CC=2 SCAR=17.9
Pod undocumented
14628 0 ▶ my ($self, $fh) = (shift, shift || \*ARGV);
Condition0%0/2
shift() || \*ARGV
l!l
00
MC/DC0%0/1
shift() || \*ARGV
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
14629 0 ▶ $self->process_dotcompose($fh, sub ($$@) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
14630 0 my($self, $out) = (shift, shift);
14631 0 print "@_ $out\n"; # Two spaces to allow for combining marks
14632 0 });
14633 }
14634
14635 0 ▶sub put_val_deep ($$$$@) {
Subroutine put_val_deep: not called CC=9 SCAR=45.0
Pod undocumented
14636 0 my($self, $h, $term, $val, $k) = (shift, shift, shift, shift, shift);
14637 # die "No key(s) in put_val_deep()" unless @_; # It is OK to have an empty list
14638 0 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
14639 0 my $oh = $h;
14640 0 ▶ $h->{$k} = {} unless defined $h->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $h->{$k} 0 0 0
14641 0 $h = $h->{$k};
14642 0 ▶ if ('HASH' ne ref $h) {
Branch: 1 branch
BranchTrueFalseTotal
if ("HASH" ne ref $h) 0 0 0
14643 0 ▶ die "Encountered non-HASH in put_val_deep(): <$k>" unless $term;
Branch: 1 branch
BranchTrueFalseTotal
unless $term 0 0 0
14644 0 my $ov = $h;
14645 0 $h = $oh->{$k} = { $term => $ov };
14646 }
14647 0 $k = shift;
14648 }
14649 0 ▶ if (exists $h->{$k}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $h->{$k}) { } 0 0 0
14650 0 ▶ if (not ref $h->{$k}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not ref $h->{$k}) { } 0 0 0
elsif ($term and 'HASH' eq ref $h) { } 0 0 0
14651 0 $h->{$k} = $val; # later rule wins
14652 ▶ } elsif ($term and 'HASH' eq ref $h) {
Condition0%0/3
$term and "HASH" eq ref $h
!ll&&!rl&&r
000
MC/DC0%0/2
$term and "HASH" eq ref $h
$term "HASH" eq ref $h
Truth table0%0/3
A and B
A= $termB= "HASH" eq ref $h
ABresult
0X0
100
111
14653 0 $h->{$k}{$term} = $val;
14654 } else {
14655 0 die "Encountered non-HASH in put_val_deep(): <$k>";
14656 }
14657 } else {
14658 0 $h->{$k} = $val; # later rule wins
14659 }
14660 }
14661
14662 0 ▶sub compose_array_2_hash ($$$) { # Assumes that below, @in is non-empty
Subroutine compose_array_2_hash: not called CC=11 SCAR=48.8
Pod undocumented
14663 0 my($self, $a, $opt) = (@_);
14664 0 my($h, @root) = {};
14665 0 for my $l (@$a) {
14666 0 my($out, $term, @in) = @$l;
14667 0 ▶ my $Term = (ref $term ? $term->{term} : $term) ;
Branch: 1 branch
BranchTrueFalseTotal
ref $term ? : 0 0 0
14668 0 ▶ my $pre = (($out eq "\x00" and ref $term and $term->{zeroOK}) ? '00' : ''); # protect against '0000' warning
Branch: 1 branch
BranchTrueFalseTotal
$out eq "\000" && ref $term && $term->{'zeroOK'} ? : 0 0 0
Condition0%0/6
$out eq "\0" and ref $term and $term->{"zeroOK"}
!ll&&!rl&&r
000
$out eq "\0" and ref $term
!ll&&!rl&&r
000
MC/DC0%0/3
$out eq "\0" and ref $term and $term->{"zeroOK"}
$out eq "\0" ref $term $term->{"zeroOK"}
Truth table0%0/4
A and B and C
A= $out eq "\0"B= ref $termC= $term->{"zeroOK"}
ABCresult
0XX0
10X0
1100
1111
14669 0 ▶ if (@in) {
Branch: 2 branches
BranchTrueFalseTotal
if (@in) { } 0 0 0
elsif (not @root) { } 0 0 0
14670 0 $self->put_val_deep( $h, $term, $pre . $self->key2hex($out), map $self->key2hex($_), @in);
14671 } elsif (not @root) {
14672 0 @root = $pre . $self->key2hex($out);
14673 } else {
14674 0 die "Two empty bindings in compose_array_2_hash(): <<<@root>>> and <<<", $pre . $self->key2hex($out), '>>>';
14675 }
14676 0 ▶ $self->put_val_deep( $opt, $term, $term, map $self->key2hex($_), @in) if ref $term;
Branch: 1 branch
BranchTrueFalseTotal
if ref $term 0 0 0
14677 }
14678 0 ▶ if (@root) {
Branch: 1 branch
BranchTrueFalseTotal
if (@root) 0 0 0
14679 0 ▶ die "an empty binding combined with others" if keys %$h;
Branch: 1 branch
BranchTrueFalseTotal
if keys %$h 0 0 0
14680 0 return shift @root;
14681 }
14682 $h
14683 0 }
14684
14685 0 ▶sub compose_line_2_array ($$$$$@) {
Subroutine compose_line_2_array: not called CC=9 SCAR=45.0
Pod undocumented
14686 0 my($self, $a, $out, $massage, $term, @in) = (@_);
14687 0 ▶ if ($massage) {
Branch: 1 branch
BranchTrueFalseTotal
if ($massage) 0 0 0
14688 0 s/^(uni|Gr|Cyr|heb)_(?![\x00-\x7e])(?=.$)//, s/^space$/ / for @in; # copy
14689 #warn "compose: @in $out";
14690 0 ▶ return unless $in[0] eq 'CP';
Branch: 1 branch
BranchTrueFalseTotal
unless $in[0] eq "CP" 0 0 0
14691 0 shift @in;
14692 }
14693 # Filter warnings via: egrep -v " d[^ ]|#" 00b | egrep -- "^---CP:" >00b2
14694 (printSkippedComposeKey and warn("---CP: @in $out")), # The last make sense only in the context of keysymbol operations???
14695 return if 1 != length $out or 0x10000 <= ord $out
14696 0 ▶ or grep {1 != length or 0x10000 <= ord} @in or grep $out eq $_, @in; # Allow for one char only
Branch: 1 branch
BranchTrueFalseTotal
if 1 != length $out or 65536 <= ord $out or grep {1 != length $_ or 65536 <= ord $_;} @in or grep(($out eq $_), @in) 0 0 0
Condition0%0/12
1 != length $out or 65536 <= ord $out or grep {1 != length $_ or 65536 <= ord $_;} @in or grep(($out eq $_), @in)
l!l&&r!l&&!r
000
1 != length $out or 65536 <= ord $out or grep {1 != length $_ or 65536 <= ord $_;} @in
l!l&&r!l&&!r
000
1 != length $out or 65536 <= ord $out
l!l&&r!l&&!r
000
1 != length $_ || 65536 <= ord $_
l!l&&r!l&&!r
000
MC/DC0%0/4
1 != length $out or 65536 <= ord $out or grep {1 != length $_ or 65536 <= ord $_;} @in or grep(($out eq $_), @in)
1 != length $out 65536 <= ord $out grep {1 != length $_ or 65536 <= ord $_;} @in grep(($out eq $_), @in)
MC/DC0%0/2
1 != length $_ || 65536 <= ord $_
1 != length $_ 65536 <= ord $_
Truth table0%0/5
A or B or C or D
A= 1 != length $outB= 65536 <= ord $outC= grep {1 != length $_ or 65536 <= ord $_;} @inD= grep(($out eq $_), @in)
ABCDresult
1XXX1
01XX1
001X1
00011
00000
Truth table0%0/3
A || B
A= 1 != length $_B= 65536 <= ord $_
ABresult
1X1
011
000
14697 #warn "CP: @in $out";
14698 0 push @$a, [$out, $term, @in];
14699 }
14700
14701 0 ▶sub compose_2_array ($$$$@) {
Subroutine compose_2_array: not called CC=16 SCAR=56.1
Pod undocumented
14702 0 my($self, $method, $fh, $a) = (shift, shift, shift, shift);
14703
14704 0 ▶ if ($method eq 'dotcompose') {
Branch: 3 branches
BranchTrueFalseTotal
if ($method eq 'dotcompose') { } 0 0 0
elsif ($method eq 'entity') { } 0 0 0
elsif ($method eq 'rfc1345') { } 0 0 0
14705 0 ▶ $self->process_dotcompose($fh, sub ($$@) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
14706 0 my($self, $out) = (shift, shift);
14707 0 $self->compose_line_2_array($a, $out, 'massage', !!'terminate', @_);
14708 0 }, 'decode U');
14709 } elsif ($method eq 'entity') {
14710 0 ▶ while (my $line = <$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 0 0 0
14711 0 ▶ next unless $line =~ /^\s*<a\s+name="U0([a-fA-F\d]{4})"[^,]*,[^,]*,\s*(.*)/; # Two commas between OUT and IN
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /^\s*<a\s+name="U0([a-fA-F\d]{4})"[^,]*,[^,]*,\s*(.*)/ 0 0 0
14712 0 my($out, @in) = (chr hex "$1", split /\s*,\s*/, "$2");
14713 0 $in[0] =~ s/\s+$//;
14714 0 @in = split /\s*,\s*/, $in[0];
14715 0 @in = sort {length($a) <=> length($b)} @in;
14716 0 for my $in (@in) { # Avoid entries more than 2x longer than the shortest possible
14717 0 ▶ next if length($in) > $avoid_overlong_synonims_Entity*length $in[0] or length($in) > $maxEntityLen;
Branch: 1 branch
BranchTrueFalseTotal
if length $in > $avoid_overlong_synonims_Entity * length($in[0]) or length $in > $maxEntityLen 0 0 0
Condition0%0/3
length $in > $avoid_overlong_synonims_Entity * length($in[0]) or length $in > $maxEntityLen
l!l&&r!l&&!r
000
MC/DC0%0/2
length $in > $avoid_overlong_synonims_Entity * length($in[0]) or length $in > $maxEntityLen
length $in > $avoid_overlong_synonims_Entity * length($in[0]) length $in > $maxEntityLen
Truth table0%0/3
A or B
A= length $in > $avoid_overlong_synonims_Entity * length($in[0])B= length $in > $maxEntityLen
ABresult
1X1
011
000
14718 0 my @IN = split //, $in;
14719 0 $self->compose_line_2_array($a, $out, !'massage', $self->key2hex(' '), @IN);
14720 }
14721 }
14722 } elsif ($method eq 'rfc1345') { # http://tools.ietf.org/html/rfc1345
14723 0 my %cvt = qw(gt > lt < amp &);
14724 0 ▶ while (my $line = <$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 0 0 0
14725 0 ▶ next unless ($line =~ /^\s+SP\s+0020\s+SPACE\s*$/) .. ($line =~ /^<span\s.*\bCHARSETS\s*<\/span/);
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /^\s+SP\s+0020\s+SPACE\s*$/ .. $line =~ m[^<span\s.*\bCHARSETS\s*</span] 0 0 0
14726 0 ▶ next unless $line =~ /^\s+(\S+)\s+([a-fA-F\d]{4})\s/;
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /^\s+(\S+)\s+([a-fA-F\d]{4})\s/ 0 0 0
14727 0 my($out, $in) = (chr hex "$2", "$1");
14728 0 ▶ next if "$2" =~ /^e0/i; # Skip private parts
Branch: 1 branch
BranchTrueFalseTotal
if "$2" =~ /^e0/i 0 0 0
14729 0 $in =~ s/&([lg]t|amp);/$cvt{$1}/g;
14730 0 ▶ next if 1 == length $in;
Branch: 1 branch
BranchTrueFalseTotal
if 1 == length $in 0 0 0
14731 0 my @IN = split //, $in;
14732 0 my $term = $self->key2hex(' ');
14733 0 ▶ $term = {term => $term, zeroOK => 1} if $out eq "\x00" and $in eq "NU"; # avoid '0000' warning
Branch: 1 branch
BranchTrueFalseTotal
if $out eq "\0" and $in eq "NU" 0 0 0
Condition0%0/3
$out eq "\0" and $in eq "NU"
!ll&&!rl&&r
000
MC/DC0%0/2
$out eq "\0" and $in eq "NU"
$out eq "\0" $in eq "NU"
Truth table0%0/3
A and B
A= $out eq "\0"B= $in eq "NU"
ABresult
0X0
100
111
14734 0 $self->compose_line_2_array($a, $out, !'massage', $term, @IN);
14735 }
14736 0 $self->compose_line_2_array($a, '€', !'massage', $self->key2hex(' '), 'E', 'u'); # http://en.wikipedia.org/wiki/Unicode_input#Character_mnemonics
14737 } else {
14738 0 die "Unknown compose parser: $method";
14739 }
14740 }
14741
14742 0 ▶sub composefile_2_array ($$$$@) {
Subroutine composefile_2_array: not called CC=3 SCAR=24.8
Pod undocumented
14743 0 my($self, $method, $fn, $a) = (shift, shift, shift, shift);
14744 0 ▶ open my $fh, '< :encoding(utf8)', $fn or die "Can't open `$fn' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "< :encoding(utf8)", $fn or die "Can't open `${fn}' for read: $!" 0 0 0
14745 0 $self->compose_2_array($method, $fh, $a);
14746 0 ▶ close $fh or die "Can't close `$fn' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die "Can't close `${fn}' for read: $!" 0 0 0
14747 }
14748
14749 0 ▶sub merge_hash_to ($$$) { # We do NOT do deep copy
Subroutine merge_hash_to: not called CC=5 SCAR=34.0
Pod undocumented
14750 0 my($self, $from, $to) = (shift, shift, shift);
14751 0 for my $k (keys %$from) { # ignore if the existing value is not hash
14752 0 ▶ next if 'HASH' ne ref($to->{$k} || {}); # existing non-hash (terminator) wins over a terminator or a longer binding
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" ne ref($to->{$k} || {}) 0 0 0
Condition0%0/2
$to->{$k} || {}
l!l
00
MC/DC0%0/1
$to->{$k} || {}
$to->{$k}
Truth table0%0/2
A
A= $to->{$k}
Aresult
11
00
14753 0 ▶ $to->{$k} = $from->{$k}, next unless exists $to->{$k}; # existing hash wins over new terminator.
Branch: 1 branch
BranchTrueFalseTotal
unless exists $to->{$k} 0 0 0
14754 0 $self->merge_hash_to($from->{$k}, $to->{$k});
14755 }
14756 }
14757
14758 0 ▶sub create_composeArray ($$$) {
Subroutine create_composeArray: not called CC=6 SCAR=37.4
Pod undocumented
14759 0 my ($self, $key, $method) = (shift, shift, shift);
14760 0 ▶ if ($method eq 'literal') {
Branch: 1 branch
BranchTrueFalseTotal
if ($method eq "literal") 0 0 0
14761 0 my $a = [];
14762 0 for my $entry (split /\|\|\|/, $key) {
14763 0 ▶ die "unexpected format of the argument to ComposeKey/literal: <<<$key>>>" unless $key =~ /^(.)=(.*)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $key =~ /^(.)=(.*)/ 0 0 0
14764 0 my($out, @in) = ($1, split //, "$2");
14765 0 $self->compose_line_2_array($a, $out, !'massage', $self->key2hex(' '), @in);
14766 }
14767 0 return [$a];
14768 }
14769 0 ▶ my $names = $self->get__value($key) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $names = $self->get__value($key) or return 0 0 0
14770 0 my @A; # my $H;
14771 0 for my $fn (@$names) {
14772 0 $self->composefile_2_array($method, $fn, my $a = []);
14773 0 push @A, $a;
14774 ## $self->compose_array_2_hash($a, my $h = {});
14775 #### $self->merge_hash_to($h, $H);
14776 ## warn "$fn: CP<\n" if printSkippedComposeKey;
14777 ## warn "CP< ", join ', ', keys %$h if printSkippedComposeKey;
14778 }
14779 # warn "CP= ", join ', ', keys %$H if printSkippedComposeKey;
14780 0 \@A;
14781 }
14782
14783 0 ▶sub compose_Array_2_hash ($$$) {
Subroutine compose_Array_2_hash: not called CC=4 SCAR=30.0
Pod undocumented
14784 0 my ($self, $A, $OPT) = (shift, shift, shift);
14785 0 my $H = {}; # indexed by HEX
14786 0 for my $a (@$A) {
14787 0 my $h = $self->compose_array_2_hash($a, my $opt = {});
14788 0 ▶ if (ref $h) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $h) { } 0 0 0
elsif (not keys %$H) { } 0 0 0
14789 0 $self->merge_hash_to($h, $H);
14790 } elsif (not keys %$H) {
14791 0 $H = $h;
14792 } else {
14793 0 die "Cannot merge a non-hash to a hash";
14794 }
14795 0 $self->merge_hash_to($opt, $OPT);
14796 # warn "CP< ", join ', ', keys %$h;
14797 }
14798 # warn "CP= ", join ', ', keys %$H;
14799 0 $H;
14800 }
14801
14802 0 ▶sub composehash_2_prefix ($$$$$$$$) {
Subroutine composehash_2_prefix: not called CC=16 SCAR=56.1
Pod undocumented
14803 0 my($self, $F, $prefix, $h, $n, $prefixCompose, $show, $comp_show) = (shift, shift, shift, shift, shift, shift, shift, shift);
14804 0 ▶ my($H, $mirror) = ($self->{faces}{$F}, $h->{'[Mirror]'} || {}); # Some of character mirror binding of other characters
Condition0%0/2
$h->{'[Mirror]'} || {}
l!l
00
MC/DC0%0/1
$h->{'[Mirror]'} || {}
$h->{'[Mirror]'}
Truth table0%0/2
A
A= $h->{'[Mirror]'}
Aresult
11
00
14805 0 my(%map, %seen);
14806 # First, non-mirroring; then mirroring in the order of mirrored
14807 0 ▶ for my $c (sort {($mirror->{$a} || '') cmp ($mirror->{$b} || '') or $a cmp $b} keys %$h) { # order affects the order of auto-prefixes
Condition0%0/7
($mirror->{$a} || '') cmp ($mirror->{$b} || '') || $a cmp $b
l!l&&r!l&&!r
000
$mirror->{$a} || ''
l!l
00
$mirror->{$b} || ''
l!l
00
MC/DC0%0/2
($mirror->{$a} || '') cmp ($mirror->{$b} || '') || $a cmp $b
$mirror->{$a} $a cmp $b
MC/DC0%0/1
$mirror->{$b} || ''
$mirror->{$b}
Truth table0%0/3
A || B
A= $mirror->{$a}B= $a cmp $b
ABresult
1X1
011
000
Truth table0%0/2
A
A= $mirror->{$b}
Aresult
11
00
14808 0 ▶ next if $c =~ /^\[(G?Prefix(_Show)?|Mirror|Opt)\]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $c =~ /^\[(G?Prefix(_Show)?|Mirror|Opt)\]$/ 0 0 0
14809 0 my $v = $h->{$c};
14810 0 ▶ if (ref $v and $seen{"$v"}) { # reuse the old value for ARRAYs (mirrored values refer to the same subhash)
Branch: 2 branches
BranchTrueFalseTotal
if (ref $v and $seen{"$v"}) { } 0 0 0
elsif (ref $v) { } 0 0 0
Condition0%0/3
ref $v and $seen{"$v"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $v and $seen{"$v"}
ref $v $seen{"$v"}
Truth table0%0/3
A and B
A= ref $vB= $seen{"$v"}
ABresult
0X0
100
111
14811 0 $v = $seen{"$v"};
14812 } elsif (ref $v) {
14813 0 ▶ my $p = $v->{'[Prefix]'} || $self->key2hex($self->next_auto_dead($H));
Condition0%0/3
$v->{'[Prefix]'} || $self->key2hex($self->next_auto_dead($H))
l!l&&r!l&&!r
000
MC/DC0%0/2
$v->{'[Prefix]'} || $self->key2hex($self->next_auto_dead($H))
$v->{'[Prefix]'} $self->key2hex($self->next_auto_dead($H))
Truth table0%0/3
A || B
A= $v->{'[Prefix]'}B= $self->key2hex($self->next_auto_dead($H))
ABresult
1X1
011
000
14814 0 my $cc = $c; # Name should not reflect linking
14815 # warn(" [@$n] $cc => $mirror->{$c}"),
14816 0 ▶ $cc = $mirror->{$c} if exists $mirror->{$c};
Branch: 1 branch
BranchTrueFalseTotal
if exists $mirror->{$c} 0 0 0
14817 0 my $name_append = my $name_show = chr hex $cc;
14818 0 ▶ $name_append = 'Compose' if $name_append eq $self->charhex2key($prefixCompose);
Branch: 1 branch
BranchTrueFalseTotal
if $name_append eq $self->charhex2key($prefixCompose) 0 0 0
14819 0 ▶ $name_show = '⎄' if $name_show eq $self->charhex2key($prefixCompose);
Branch: 1 branch
BranchTrueFalseTotal
if $name_show eq $self->charhex2key($prefixCompose) 0 0 0
14820 0 ▶ $name_append = $self->key2hex($name_append) if $name_append =~ /\s/;
Branch: 1 branch
BranchTrueFalseTotal
if $name_append =~ /\s/ 0 0 0
14821 # $name_show = $self->key2hex($name_show) if $name_show =~ /\s/ and $name_show ne ' ';
14822 0 my $c;
14823 0 ($name_show = "$show$name_show")
14824 0 =~ s[^((⎄[₁₂₃₄₅₆₇₈₉]?|\Q$comp_show\E){2,})][ $2 . (($c = length($1)/length($2)) =~ tr/0-9/⁰¹²³⁴⁵⁶⁷⁸⁹/, $c) ]e;
14825 0 ▶ $name_show = $v->{'[Prefix_Show]'} if defined $v->{'[Prefix_Show]'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $v->{"[Prefix_Show]"} 0 0 0
14826 0 $self->composehash_2_prefix($F, $p, $v, my $nn = [@$n, $name_append], $prefixCompose, $name_show, $comp_show);
14827 0 $self->{faces}{$F}{'[prefixDocs]'}{$p} = "@$nn";
14828 0 $self->{faces}{$F}{'[Show]'}{$p} = $name_show;
14829 0 $v = $seen{"$v"} = [$p, undef, 1];
14830 } else {
14831 0 $H->{'[inCompose]'}{$self->charhex2key($v)}++;
14832 0 $v = [$v];
14833 }
14834 0 $map{$c} = $v;
14835 }
14836 0 $H->{'[deadkeyFaceHexMap]'}{$prefix} = \%map;
14837 }
14838
14839 # On non-Latin layout, one needs to substitute the Latin chars by the layout char on this key
14840 0 ▶sub composehash_add_linked ($$$$) {
Subroutine composehash_add_linked: not called CC=19 SCAR=59.4
Pod undocumented
14841 0 my($self, $hexH, $charH, $prefCharH, $delay, %add, %ADD, %cnt) = (shift, shift, shift, shift, {});
14842 #warn "0: Mismatch E/Е: $hexH->{'0045'}///$hexH->{'0415'}" if $hexH->{'0045'} and $hexH->{'0415'} and $hexH->{'0045'} ne $hexH->{'0415'};
14843 0 ▶ return unless ref $hexH;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $hexH 0 0 0
14844 0 for my $h (sort keys %$hexH) { # Make order predictable: when a char is present in more than 2 places, it matters
14845 0 ▶ next if $h =~ /^\[(G?Prefix(_Show)?|Mirror|Opt)\]$/;
Branch: 1 branch
BranchTrueFalseTotal
if $h =~ /^\[(G?Prefix(_Show)?|Mirror|Opt)\]$/ 0 0 0
14846 0 ▶ $self->composehash_add_linked($hexH->{$h}, $charH, $prefCharH) if ref $hexH->{$h};
Branch: 1 branch
BranchTrueFalseTotal
if ref $hexH->{$h} 0 0 0
14847 0 ▶ next unless defined (my $to = $charH->{my $c = chr hex $h});
Branch: 1 branch
BranchTrueFalseTotal
unless defined(my $to = $$charH{my $c = &UI::KeyboardLayout::chr(hex $h)}) 0 0 0
14848 0 ▶ $to = $to->[0] if ref $to; # the corresponding char of layout
Branch: 1 branch
BranchTrueFalseTotal
if ref $to 0 0 0
14849 0 my $toC = $self->charhex2key($to);
14850 0 ▶ next if exists $hexH->{$to = $self->key2hex($to)}; # There is already a binding for the char of layout
Branch: 1 branch
BranchTrueFalseTotal
if exists $$hexH{$to = $self->key2hex($to)} 0 0 0
14851 0 my $back = $prefCharH->{$toC};
14852 0 ▶ $back = $back->[0] if ref $back; # roundtrip back to the “Latin”
Branch: 1 branch
BranchTrueFalseTotal
if ref $back 0 0 0
14853 0 my $now = $h eq $self->key2hex($back); # when a char is at several positions on layout (e.g., Slovak/my-Hebrew), prefer the main one
14854 # warn " ... link $c to $toC (now=$now, back = $prefCharH->{$toC}) @{$prefCharH->{$toC}||[]})";
14855 # warn " ... link $c to $toC (now=$now, back = $back)";
14856 0 $add{$to} = $h; # mark as “mirroring” (for visualization of prefixes on OS X)
14857 0 ▶ $ADD{$to} = $h if $now;
Branch: 1 branch
BranchTrueFalseTotal
if $now 0 0 0
14858 0 $cnt{$to}++;
14859 0 ▶ ($now ? $hexH : $delay)->{$to} = $hexH->{$h};
Branch: 1 branch
BranchTrueFalseTotal
$now ? : 0 0 0
14860 }
14861 0 ▶ %add = (%add, %ADD) if %ADD;
Branch: 1 branch
BranchTrueFalseTotal
if %ADD 0 0 0
14862 0 ▶ $hexH->{'[Mirror]'} = \%add if %add;
Branch: 1 branch
BranchTrueFalseTotal
if %add 0 0 0
14863 # warn " ... almost done";
14864 #warn "1: Mismatch E/Е: $hexH->{'0045'}///$hexH->{'0415'}" if $hexH->{'0045'} and $hexH->{'0415'} and $hexH->{'0045'} ne $hexH->{'0415'};
14865 0 ▶ %$hexH = (%$delay, %$hexH) if keys %$delay;
Branch: 1 branch
BranchTrueFalseTotal
if keys %$delay 0 0 0
14866 #warn "2: Mismatch E/Е: $hexH->{'0045'}///$hexH->{'0415'}" if $hexH->{'0045'} and $hexH->{'0415'} and $hexH->{'0045'} ne $hexH->{'0415'};
14867 0 my %del;
14868 0 for my $k (keys %ADD) { # Have “directly” mirrored data
14869 0 ▶ next unless $cnt{$k} == 1; # Is it 1-to-1?
Branch: 1 branch
BranchTrueFalseTotal
unless $cnt{$k} == 1 0 0 0
14870 0 ▶ warn('panic'), next unless $hexH->{$k} eq $hexH->{my $mir = $ADD{$k}};
Branch: 1 branch
BranchTrueFalseTotal
unless $hexH->{$k} eq $$hexH{my $mir = $ADD{$k}} 0 0 0
14871 # warn(" ??? $mir/$k => 00cb/0401 $hexH->{'0045'}///$hexH->{'0415'} $hexH->{$mir}///$hexH->{$k}")
14872 # if $mir eq '0045' and $hexH->{'0045'} and $hexH->{'0415'} and $hexH->{'0045'} ne $hexH->{'0415'};;
14873 0 ▶ next if exists $ADD{$mir}; # Do not touch mirroring bindings
Branch: 1 branch
BranchTrueFalseTotal
if exists $ADD{$mir} 0 0 0
14874 0 $del{$mir}++; # Just in case (???), postpone editing until the end of pass
14875 }
14876 0 delete $hexH->{$_} for keys %del; # Delete successively mirrored
14877 # warn "3: Mismatch E/Е: $hexH->{'0045'}///$hexH->{'0415'}" if $hexH->{'0045'} and $hexH->{'0415'} and $hexH->{'0045'} ne $hexH->{'0415'};
14878 }
14879
14880 0 ▶sub create_composekey ($$$) {
Subroutine create_composekey: not called CC=42 SCAR=75.0
Pod undocumented
14881 0 my($self, $F, $descrip, @DESCRIP) = (shift, shift, shift);
14882 0 my $linkedF = $self->{faces}{$F}{LinkFace};
14883 0 ▶ my $linked = $linkedF && $self->{faces}{$linkedF}{Face_link_map}{$F};
Condition0%0/3
$linkedF && $self->{'faces'}{$linkedF}{'Face_link_map'}{$F}
!ll&&!rl&&r
000
MC/DC0%0/2
$linkedF && $self->{'faces'}{$linkedF}{'Face_link_map'}{$F}
$linkedF $self->{'faces'}{$linkedF}{'Face_link_map'}{$F}
Truth table0%0/3
A && B
A= $linkedFB= $self->{'faces'}{$linkedF}{'Face_link_map'}{$F}
ABresult
0X0
100
111
14884 0 ▶ $linked &&= {map {ref($_ || 0) ? $_->[0] : $_} %$linked};
Branch: 1 branch
BranchTrueFalseTotal
ref($_ || 0) ? : 0 0 0
Condition0%0/4
$linked &&= {map({ref($_ || 0) ? $_->[0] : $_;} %$linked)}
!ll
00
$_ || 0
l!l
00
MC/DC0%0/1
$linked &&= {map({ref($_ || 0) ? $_->[0] : $_;} %$linked)}
$linked
MC/DC0%0/1
$_ || 0
$_
Truth table0%0/2
A
A= $linked
Aresult
00
11
Truth table0%0/2
A
A= $_
Aresult
11
00
14885 0 ▶ my $rlinked = $linked && $self->{faces}{$F}{Face_link_map}{$linkedF};
Condition0%0/3
$linked && $self->{'faces'}{$F}{'Face_link_map'}{$linkedF}
!ll&&!rl&&r
000
MC/DC0%0/2
$linked && $self->{'faces'}{$F}{'Face_link_map'}{$linkedF}
$linked $self->{'faces'}{$F}{'Face_link_map'}{$linkedF}
Truth table0%0/3
A && B
A= $linkedB= $self->{'faces'}{$F}{'Face_link_map'}{$linkedF}
ABresult
0X0
100
111
14886 # $linked ||= {};
14887 # warn " Compose: $F: F linked to $linked->{F}" if $linked and $linked->{F};
14888 # $F eq 'Latin' and
14889 # warn " Compose: $F: ", join ', ', sort keys %{$self->{faces}{$linkedF}{Face_link_map}{$F}}
14890 # if $self->{faces}{$linkedF}{Face_link_map}{$F};
14891 0 ▶ if ($descrip and ref $descrip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($descrip and ref $descrip) { } 0 0 0
Condition0%0/3
$descrip and ref $descrip
!ll&&!rl&&r
000
MC/DC0%0/2
$descrip and ref $descrip
$descrip ref $descrip
Truth table0%0/3
A and B
A= $descripB= ref $descrip
ABresult
0X0
100
111
14892 0 @DESCRIP = map { my @a = split /,/;
14893 0 ▶ defined $a[$_] and length $a[$_] and $a[$_] = $self->key2hex($self->charhex2key($a[$_])) for 3,4;
Branch: 1 branch
BranchTrueFalseTotal
defined $a[$_] and length $a[$_] and $a[$_] = $self->key2hex($self->charhex2key($a[$_])) 0 0 0
Condition0%0/3
defined $a[$_] and length $a[$_]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $a[$_] and length $a[$_]
defined $a[$_] length $a[$_]
Truth table0%0/3
A and B
A= defined $a[$_]B= length $a[$_]
ABresult
0X0
100
111
14894 0 [@a]} @$descrip;
14895 } else {
14896 0 $descrip = $self->key2hex($self->charhex2key($descrip));
14897 0 @DESCRIP = ( ['ComposeFiles', 'dotcompose', 'warn', $descrip, ''],
14898 ['EntityFiles', 'entity', 'warn', '', $descrip],
14899 ['rfc1345Files', 'rfc1345', 'warn', '', $descrip]);
14900 }
14901 0 $self->load_KeySyms;
14902 0 my $p0 = my $first_prefix = $DESCRIP[0][3]; # use for first found map
14903 0 $self->{faces}{$F}{'[mainComposeKeyHex]'} = $p0;
14904 0 my @Hashes;
14905 0 ▶ my @Arrays = @{ $self->{'[ComposeArrays]'} || [] };
Condition0%0/2
$self->{'[ComposeArrays]'} || []
l!l
00
MC/DC0%0/1
$self->{'[ComposeArrays]'} || []
$self->{'[ComposeArrays]'}
Truth table0%0/2
A
A= $self->{'[ComposeArrays]'}
Aresult
11
00
14906 0 ▶ unless (@Arrays) { # Shared between faces
Branch: 1 branch
BranchTrueFalseTotal
unless (@Arrays) 0 0 0
14907 0 my @Show;
14908 0 for my $i (0..$#DESCRIP) { # FileList, type, OK_to_miss, prefix, prefix-in-last ... prefix-in-pre-last ...
14909 0 my $descr = $DESCRIP[$i];
14910 0 my $arr;
14911 0 ▶ unless ($arr = $self->create_composeArray($descr->[0], $descr->[1]) and @$arr) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($arr = $self->create_composeArray($descr->[0], $descr->[1]) and @$arr) 0 0 0
Condition0%0/3
$arr = $self->create_composeArray($descr->[0], $descr->[1]) and @$arr
!ll&&!rl&&r
000
MC/DC0%0/2
$arr = $self->create_composeArray($descr->[0], $descr->[1]) and @$arr
$arr = $self->create_composeArray($descr->[0], $descr->[1]) @$arr
Truth table0%0/3
A and B
A= $arr = $self->create_composeArray($descr->[0], $descr->[1])B= @$arr
ABresult
0X0
100
111
14912 0 ▶ warn "Compose list of type $descr->[1] could not be created from FileList variable $descr->[0]" if $descr->[2];
Branch: 1 branch
BranchTrueFalseTotal
if $descr->[2] 0 0 0
14913 0 next;
14914 }
14915 0 push @Arrays, [$arr, $descr];
14916 0 push @Show, $i;
14917 }
14918 0 $self->{'[ComposeArrays]'} = \@Arrays;
14919 0 $self->{'[ComposeShowIdx]'} = \@Show;
14920 }
14921 0 my($v, $vv) = map $self->{faces}{$F}{$_}, qw( [coverage0oneUTF16hash] [coverageExtra] );
14922 # warn "Filter hashes $F ", scalar keys %$v, ' ', scalar keys %$vv, ' ', scalar @{$self->{faces}{$F}{'[coverage0oneUTF16]'}};
14923 0 for my $A (@Arrays) { # one per type
14924 0 my($arr, $descr) = @$A;
14925 0 my @NN;
14926 0 for my $a (@$arr) { # $a one per input file
14927 0 my @N;
14928 0 for my $l (@$a) { # One per line
14929 0 my($out, $term, @in) = @$l;
14930 0 ▶ next if grep {not ($v->{$_} or $vv->{$_} or $linked and $linked->{$_})} @in;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not $v->{$_} || $vv->{$_} || $linked && $linked->{$_};} @in 0 0 0
Condition0%0/9
$v->{$_} || $vv->{$_} || $linked && $linked->{$_}
l!l&&r!l&&!r
000
$v->{$_} or $vv->{$_}
l!l&&r!l&&!r
000
$linked and $linked->{$_}
!ll&&!rl&&r
000
MC/DC0%0/4
$v->{$_} || $vv->{$_} || $linked && $linked->{$_}
$v->{$_} $vv->{$_} $linked $linked->{$_}
Truth table0%0/5
A or B || C and D
A= $v->{$_}B= $vv->{$_}C= $linkedD= $linked->{$_}
ABCDresult
1XXX1
01XX1
00111
000X0
00100
14931 # my $c;
14932 # warn "in=<@in>, k=$c, 00=", !!$v->{$c}, " Extra=", !!$vv->{$c} if ($c) = grep {ord() <= 0x30ff and ord >= 0x30f0} @in;
14933 0 push @N, $l;
14934 }
14935 0 push @NN, \@N;
14936 }
14937 # warn "Compose face=$F: keys <@$arr> @$descr";
14938 # warn "Compose face=$F: keys ", join ' ', map scalar @$_, @$arr;
14939 0 my $opt = {};
14940 0 push @Hashes, [$self->compose_Array_2_hash(\@NN, $opt), $descr, $opt];
14941 }
14942 0 my @hashes;
14943 0 my $Comp_show = $self->{faces}{$F}{'[ComposeKey_Show]'};
14944 0 my $IDX = $self->{'[ComposeShowIdx]'};
14945 0 for my $i (0..$#Hashes) { # Now process separately for every personality
14946 0 my $H = $Hashes[$i];
14947 0 my($chained, $hash, $pref, $opt) = ('G', @$H); # Global; $opt not used yet
14948 0 $hash = $self->deep_copy($hash); # Per-personality copy
14949 0 ▶ $self->composehash_add_linked($hash, $linked, $rlinked) if $linked;
Branch: 1 branch
BranchTrueFalseTotal
if $linked 0 0 0
14950 0 my $pref0 = $pref->[3];
14951 0 my $prefix_repeat;
14952 0 ▶ if (@hashes and defined $pref->[4] and length $pref->[4]) {
Branch: 2 branches
BranchTrueFalseTotal
if (@hashes and defined $pref->[4] and length $pref->[4]) { } 0 0 0
elsif ($first_prefix) { } 0 0 0
Condition0%0/6
@hashes and defined $pref->[4] and length $pref->[4]
!ll&&!rl&&r
000
@hashes and defined $pref->[4]
!ll&&!rl&&r
000
MC/DC0%0/3
@hashes and defined $pref->[4] and length $pref->[4]
@hashes defined $pref->[4] length $pref->[4]
Truth table0%0/4
A and B and C
A= @hashesB= defined $pref->[4]C= length $pref->[4]
ABCresult
0XX0
10X0
1100
1111
14953 0 die "Chain-ComposeKey $pref->[4] already bound in the previous ComposeHash, keys = ", join ', ', keys %{$hashes[-1]{$pref->[4]}}
14954 0 ▶ if $hashes[-1]{$pref->[4]};
Branch: 1 branch
BranchTrueFalseTotal
if $hashes[-1]{$pref->[4]} 0 0 0
14955 0 $hashes[-1]{$pref->[4]} = $hash; # Bind to double/etc press
14956 0 $chained = '';
14957 } elsif ($first_prefix) { # The previous type could be not found; use the first defined accessor
14958 0 $pref0 = $first_prefix;
14959 0 undef $first_prefix;
14960 } else {
14961 0 warn "Hanging ComposeHash (no access prefix key) for ", join('///', @$pref);
14962 }
14963 0 push @hashes, $hash;
14964 0 ▶ $hash->{"[${chained}Prefix]"} = $pref0 if length $pref0;
Branch: 1 branch
BranchTrueFalseTotal
if length $pref0 0 0 0
14965 0 ▶ $hash->{"[Prefix_Show]"} = $Comp_show->[$IDX->[$i]] if ref $Comp_show and length $Comp_show->[$IDX->[$i]];
Branch: 1 branch
BranchTrueFalseTotal
if ref $Comp_show and length $$Comp_show[$IDX->[$i]] 0 0 0
Condition0%0/3
ref $Comp_show and length $$Comp_show[$IDX->[$i]]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $Comp_show and length $$Comp_show[$IDX->[$i]]
ref $Comp_show length $$Comp_show[$IDX->[$i]]
Truth table0%0/3
A and B
A= ref $Comp_showB= length $$Comp_show[$IDX->[$i]]
ABresult
0X0
100
111
14966 }
14967 0 ▶ return unless @hashes;
Branch: 1 branch
BranchTrueFalseTotal
unless @hashes 0 0 0
14968 # my @idx = split //, '₁₂₃₄₅₆₇₈₉';
14969 0 my $c = 0;
14970 0 for my $i ( 0..$#hashes ) {
14971 0 my $h = $hashes[$i];
14972 0 my $I = $IDX->[$i];
14973 0 ▶ next unless ref $h and my $p = $h->{'[GPrefix]'}; # Not chained (chained are processed as subhashes by composehash_2_prefix()
Branch: 1 branch
BranchTrueFalseTotal
unless ref $h and my $p = $h->{"[GPrefix]"} 0 0 0
Condition0%0/3
ref $h and my $p = $h->{"[GPrefix]"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $h and my $p = $h->{"[GPrefix]"}
ref $h my $p = $h->{"[GPrefix]"}
Truth table0%0/3
A and B
A= ref $hB= my $p = $h->{"[GPrefix]"}
ABresult
0X0
100
111
14974 0 ▶ my $post = ($c ? "[$c]" : '');
Branch: 1 branch
BranchTrueFalseTotal
$c ? : 0 0 0
14975 0 my $comp_show = $h->{'[Prefix_Show]'};
14976 0 ▶ unless (defined $comp_show) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $comp_show) 0 0 0
14977 0 my $c1;
14978 0 ▶ my $spost = ($c ? (($c1 = $c) =~ tr/0-9/₀₁₂₃₄₅₆₇₈₉/, $c1) : '');
Branch: 1 branch
BranchTrueFalseTotal
$c ? : 0 0 0
14979 0 ▶ if (ref $Comp_show) { # Elt0 has a sane default
Branch: 1 branch
BranchTrueFalseTotal
if (ref $Comp_show) { } 0 0 0
14980 0 $comp_show = "$Comp_show->[0]$spost";
14981 } else {
14982 0 $comp_show = "$Comp_show$spost";
14983 }
14984 }
14985 0 $self->{faces}{$F}{'[Show]'}{$p} = $comp_show;
14986 # push @Show, (ref $comp_show ? $comp_show->[$i] : $comp_show);
14987 0 $self->composehash_2_prefix($F, $p, $h, ["Compose$post"], $p0, $comp_show, $comp_show);
14988 0 $self->{faces}{$F}{'[prefixDocs]'}{$p} = "Compose$post key";
14989 0 ++$c;
14990 }
14991 }
14992
14993 0 ▶sub XKB_key ($$$;$$$$) { # unfinished ( ##### is for Apple parts needing work)
Subroutine XKB_key: not called CC=43 SCAR=75.5
Pod undocumented
14994 0 ▶ my($self, $K, $i, $use_base, $dd, $map, $override) =
Condition0%0/6
shift() || {}
l!l
00
shift() || {}
l!l
00
shift() || {'dup', {}}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
MC/DC0%0/1
shift() || {}
shift()
MC/DC0%0/1
shift() || {'dup', {}}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
14995 (shift, shift, shift, shift, shift || {}, shift || {}, shift || {dup => {}});
14996 0 my($sh, $caps, $l); ##### were needed on Apple
14997 0 my $A2l; ##### = [ @{ $self->AppleMap_Base($K) } ]; # Deep copy
14998 0 my $dup = $override->{dup};
14999 0 for my $from (keys %$dup) {
15000 0 $A2l->[$from] = $A2l->[$dup->{$from}];
15001 }
15002 0 my $F = $self->get_deep($self, @$K); # Presumably a face hash, as in $K = [qw(faces US)]
15003 0 my $L = [map $self->{layers}{$_}, @{$F->{layers}}];
15004 0 $L = $L->[$l];
15005 0 ▶ my $B = $use_base && $self->Base_VK_names($K); # Partially implemented: use Base_VK_names instead of the real $F (VK_ code)
Condition0%0/3
$use_base && $self->Base_VK_names($K)
!ll&&!rl&&r
000
MC/DC0%0/2
$use_base && $self->Base_VK_names($K)
$use_base $self->Base_VK_names($K)
Truth table0%0/3
A && B
A= $use_baseB= $self->Base_VK_names($K)
ABresult
0X0
100
111
15006 0 ▶ $B = [map {defined() && /^\w$/ ? lc $_ : $_} @$B] if ($use_base || 0) > 0;
Branch: 2 branches
BranchTrueFalseTotal
if ($use_base || 0) > 0 0 0 0
defined $_ && /^\w$/ ? : 0 0 0
Condition0%0/5
$use_base || 0
l!l
00
defined $_ and /^\w$/
!ll&&!rl&&r
000
MC/DC0%0/1
$use_base || 0
$use_base
MC/DC0%0/2
defined $_ and /^\w$/
defined $_ /^\w$/
Truth table0%0/2
A
A= $use_base
Aresult
11
00
Truth table0%0/3
A and B
A= defined $_B= /^\w$/
ABresult
0X0
100
111
15007 0 my @AppleMap; ##### = _AppleMap unless @AppleMap;
15008 0 ▶ warn 'AppleMap too long' if $#AppleMap >= 127;
Branch: 1 branch
BranchTrueFalseTotal
if $#AppleMap >= 127 0 0 0
15009 0 my($I, $d, $c, $force_o) = ($A2l->[$i], 0); # offset inside the layout array
15010 0 ▶ $c = $override->{"$l-$sh-$caps-vk=$i"} || $override->{"$l-$sh--vk=$i"} unless $use_base; # $caps is 0 or 1
Branch: 1 branch
BranchTrueFalseTotal
unless $use_base 0 0 0
Condition0%0/3
$$override{"$l-$sh-$caps-vk=$i"} || $$override{"$l-$sh--vk=$i"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$$override{"$l-$sh-$caps-vk=$i"} || $$override{"$l-$sh--vk=$i"}
$$override{"$l-$sh-$caps-vk=$i"} $$override{"$l-$sh--vk=$i"}
Truth table0%0/3
A || B
A= $$override{"$l-$sh-$caps-vk=$i"}B= $$override{"$l-$sh--vk=$i"}
ABresult
1X1
011
000
15011 # $force_o++ if defined $use_base and $use_base eq '0';
15012 0 ▶ $c = $use_base ? $B->[$I] : $L->[$I][$sh] if not defined $c and defined $I;
Branch: 2 branches
BranchTrueFalseTotal
if not defined $c and defined $I 0 0 0
$use_base ? : 0 0 0
Condition0%0/3
not defined $c and defined $I
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $c and defined $I
not defined $c defined $I
Truth table0%0/3
not(A) and B
A= not defined $cB= defined $I
ABresult
0X0
100
111
15013 0 ▶ if (($use_base || 0) < 0) { # Control
Branch: 2 branches
BranchTrueFalseTotal
if (($use_base || 0) < 0) { } 0 0 0
elsif ($use_base) { } 0 0 0
Condition0%0/2
$use_base || 0
l!l
00
MC/DC0%0/1
$use_base || 0
$use_base
Truth table0%0/2
A
A= $use_base
Aresult
11
00
15014 0 $force_o++;
15015 0 ▶ if (!defined $c) { # ignore
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $c) { } 0 0 0
elsif ($c =~ /^[A-Z]$/) { } 0 0 0
elsif (not $c =~ m[^[-0-9=.*/+]$]) { } 0 0 0
15016 } elsif ($c =~ /^[A-Z]$/) {
15017 0 $c = chr( 1 + ord($c) - ord 'A');
15018 } elsif ($c !~ /^[-0-9=.*\/+]$/) {
15019 ##### $c = $OEM2ctrl{$c}; # mostly undef
15020 }
15021 } elsif ($use_base) {
15022 0 my $tr;
15023 0 ▶ if (!defined $c) { # ignore
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $c) { } 0 0 0
elsif (defined($tr = $oem_control{$c})) { } 0 0 0
15024 ##### } elsif (defined($tr = $OEM2cmd{$c})) {
15025 ##### $c = $tr;
15026 } elsif (defined($tr = $oem_control{$c})) {
15027 0 $tr =~ s/(?<=.).*//;
15028 0 $c = $tr;
15029 } else {
15030 0 undef $c;
15031 }
15032 }
15033 0 ▶ $c = $AppleMap[$i] unless defined $c; # Fallback to US (apparently, there is no unbound "ASCII" keys in maps???); dbg to "\xffff" #
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
15034
15035 ##### $o .= <<EOK, next unless defined $c;
15036 ##### <!-- gap, $i -->
15037 #####EOK
15038 0 ▶ $d = $c->[2] || 0 if ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c 0 0 0
Condition0%0/2
$c->[2] || 0
l!l
00
MC/DC0%0/1
$c->[2] || 0
$c->[2]
Truth table0%0/2
A
A= $c->[2]
Aresult
11
00
15039 0 ▶ $c = $c->[0] if ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c 0 0 0
15040 # On windows, CapsLock flips the case; on Mac, it upcases
15041 # ($c) = grep {$_ ne $c} uc $c, ucfirst lc $c, lc $c if !$d and $caps and (lc $c ne uc $c or lc $c ne ucfirst lc $c);
15042 0 ▶ $c = uc $c if !$d and $caps;
Branch: 1 branch
BranchTrueFalseTotal
if not $d and $caps 0 0 0
Condition0%0/3
not $d and $caps
!ll&&!rl&&r
000
MC/DC0%0/2
not $d and $caps
not $d $caps
Truth table0%0/3
not(A) and B
A= not $dB= $caps
ABresult
0X0
100
111
15043 0 ▶ $dd->{$c}[1]++ if $d > 0; # 0 for normal char, 1 for base prefix; not for hex4/hex6
Branch: 1 branch
BranchTrueFalseTotal
if $d > 0 0 0 0
15044 0 ▶ $override->{extra_actions}{$c}++ if $d < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $d < 0 0 0 0
15045 0 ▶ my $M = (!$force_o and $d >= 0 and $map->{$self->keys2hex($c)});
Condition0%0/6
!$force_o && $d >= 0 && $$map{$self->keys2hex($c)}
!ll&&!rl&&r
000
not $force_o and $d >= 0
!ll&&!rl&&r
000
MC/DC0%0/3
!$force_o && $d >= 0 && $$map{$self->keys2hex($c)}
not $force_o $d >= 0 $$map{$self->keys2hex($c)}
Truth table0%0/4
not(A) and B && C
A= not $force_oB= $d >= 0C= $$map{$self->keys2hex($c)}
ABCresult
0XX0
10X0
1100
1111
15046 0 ▶ my $pr = $M ? 'a_' : '';
Branch: 1 branch
BranchTrueFalseTotal
$M ? : 0 0 0
15047 0 ▶ $dd->{$c}[0] = $c if $M or $d > 0; # 0 for normal char, 1 for base prefix
Branch: 1 branch
BranchTrueFalseTotal
if $M or $d > 0 0 0 0
Condition0%0/3
$M or $d > 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$M or $d > 0
$M $d > 0
Truth table0%0/3
A or B
A= $MB= $d > 0
ABresult
1X1
011
000
15048 0 ▶ my($how, $pref) = ($d || $M) ? ('action', ($M ? 'a_' : '') . ($d > 0 ? 'pr_' : (!$d && '_'))) : ('output', '');
Branch: 3 branches
BranchTrueFalseTotal
$d || $M ? : 0 0 0
$M ? : 0 0 0
$d > 0 ? : 0 0 0
Condition0%0/5
$d or $M
l!l&&r!l&&!r
000
not $d and "_"
!ll
00
MC/DC0%0/2
$d or $M
$d $M
MC/DC0%0/1
not $d and "_"
not $d
Truth table0%0/3
A or B
A= $dB= $M
ABresult
1X1
011
000
Truth table0%0/2
not(A)
A= not $d
Aresult
00
11
15049 0 ▶ ($how eq 'output') ? XML_format_UTF_16 $c : XML_format $c;
Branch: 1 branch
BranchTrueFalseTotal
$how eq 'output' ? : 0 0 0
15050 0 return <<EOK;
15051 <key code="$i" $how="$pref$c" />
15052 EOK
15053 }
15054
15055 1 my %CapsTypes = qw(
15056 0 TWO_LEVEL 1 ALPHABETIC
15057 00 FOUR_LEVEL 10 FOUR_LEVEL_SEMIALPHABETIC
15058 01 FOUR_LEVEL_ANTISEMIALPHABETIC 11 FOUR_LEVEL_ALPHABETIC
15059 );
15060
15061 # Some untested:
15062 1 my %XKB_map = (qw( ` TLDE \ BKSL OEM_102 LSGT ABNT_C1 AE13
15063 SPACE SPCE ESCAPE ESC PRSC PRSC SCLK SCLK PAUS PAUS
15064 DECIMAL KODL ABNT_C2 KPPT APP MENU RETURN RTRN
15065 DIVIDE KPDV MULTIPLY KPMU SUBTRACT KPSU ADD KPAD
15066 #RETURN KPEN #DELETE KPDE
15067 ), ' ' => 'SPCE'); # `
15068 1 ▶sub XKB_map () { # Only the main island
Subroutine XKB_map: called CC=7 SCAR=19.5
Pod undocumented
15069 1 my $r = 4;
15070 1 for my $row (qw( 1234567890-= qwertyuiop[] asdfghjkl;' zxcvbnm,./ )) { # '
15071 4 my $c = chr($r + ord 'A');
15072 4 my @C = split //, $row;
15073 4 $XKB_map{uc $C[$_]} = sprintf "A$c%02d", $_ + 1 for 0 .. $#C;
15074 4 $r--;
15075 }
15076 1 $XKB_map{"F$_"} = sprintf 'FK%02d', $_ for 1..24; # Mac Aluminium has F19
15077 1 $XKB_map{"NUMPAD$_"} = "KO$_" for 0..9;
15078 1 my @kp = qw(INSERT END DOWN NEXT LEFT CLEAR RIGHT HOME UP PRIOR DELETE);
15079 1 my @kpX = qw(INS END DOWN PGDN LEFT KP5 RGHT HOME UP PGUP DELE);
15080 1 $XKB_map{"#$kp[$_]"} = "KP$_" for 0..9; # XXX ??? Not supported yet
15081 1 $XKB_map{$kp[$_]} = $kpX[$_] for 0..10;
15082 }
15083 1 XKB_map;
15084
15085 0 ▶sub output_unit_XKB ($$$$$$$$) {
Subroutine output_unit_XKB: not called CC=33 SCAR=70.2
Pod undocumented
15086 0 my ($self, $face, $N, $k, $kraw, $decimal, $Used, $pre) = (shift, shift, shift, shift, shift, shift, shift, shift);
15087 0 ▶ return unless defined $k or defined $kraw;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k or defined $kraw 0 0 0
Condition0%0/3
defined $k or defined $kraw
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $k or defined $kraw
defined $k defined $kraw
Truth table0%0/3
A or B
A= defined $kB= defined $kraw
ABresult
1X1
011
000
15088 0 ▶ my $sc = ($XKB_map{$k} or $XKB_map{$kraw} or warn("Can't find the scancode for the key `$k', kraw=`$kraw'"), "k=$k");
Condition0%0/6
$XKB_map{$k} || $XKB_map{$kraw} || (warn("Can't find the scancode for the key `${k}', kraw=`${kraw}'"), "k=$k")
l!l&&r!l&&!r
000
$XKB_map{$k} or $XKB_map{$kraw}
l!l&&r!l&&!r
000
MC/DC0%0/3
$XKB_map{$k} || $XKB_map{$kraw} || (warn("Can't find the scancode for the key `${k}', kraw=`${kraw}'"), "k=$k")
$XKB_map{$k} $XKB_map{$kraw} (warn("Can't find the scancode for the key `${k}', kraw=`${kraw}'"), "k=$k")
Truth table0%0/4
A or B || C
A= $XKB_map{$k}B= $XKB_map{$kraw}C= (warn("Can't find the scancode for the key `${k}', kraw=`${kraw}'"), "k=$k")
ABCresult
1XX1
01X1
0011
0000
15089 my $flat = $self->flatten_unit($face, $N,
15090 0 ▶ $self->{faces}{$face}{'[output_layers_XKB]'} || $self->{faces}{$face}{'[output_layers]'})
Branch: 1 branch
BranchTrueFalseTotal
my $flat = $self->flatten_unit($face, $N, $self->{"faces"}{$face}{"[output_layers_XKB]"} || $self->{"faces"}{$face}{"[output_layers]"}) or return 0 0 0
Condition0%0/3
$self->{'faces'}{$face}{'[output_layers_XKB]'} || $self->{'faces'}{$face}{'[output_layers]'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'faces'}{$face}{'[output_layers_XKB]'} || $self->{'faces'}{$face}{'[output_layers]'}
$self->{'faces'}{$face}{'[output_layers_XKB]'} $self->{'faces'}{$face}{'[output_layers]'}
Truth table0%0/3
A || B
A= $self->{'faces'}{$face}{'[output_layers_XKB]'}B= $self->{'faces'}{$face}{'[output_layers]'}
ABresult
1X1
011
000
15091 or return;
15092 0 my @KK = @$flat;
15093 0 my $CL;
15094 0 ▶ if (my $Caps = $self->{faces}{$face}{'[CapsLOCKlayers]'} and defined $N) { # $N not supported on VK...
Branch: 1 branch
BranchTrueFalseTotal
if (my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} and defined $N) 0 0 0
Condition0%0/3
my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} and defined $N
!ll&&!rl&&r
000
MC/DC0%0/2
my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} and defined $N
my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"} defined $N
Truth table0%0/3
A and B
A= my $Caps = $self->{"faces"}{$face}{"[CapsLOCKlayers]"}B= defined $N
ABresult
0X0
100
111
15095 0 $CL = [map $self->{layers}{$_}[$N], @$Caps];
15096 # warn "See CapsLock layers: <<<", join('>>> <<<', @$Caps), ">>>";
15097 }
15098 0 if ( 0 and # Not appropriate for XKB
15099 # $skippable and
15100 not defined $KK[0][0] and not defined $KK[1][0]) {
15101 for my $shft (0,1) {
15102 $KK[$shft] = [$default_bind{$k}[0][$shft], 0] if defined $default_bind{$k}[0][$shft];
15103 ### $KK[$shft] = [$decimal[$shft], 0] if $k eq 'DECIMAL' and @decimal;
15104 }
15105 }
15106
15107 0 ▶ if ($k eq 'DECIMAL') { # may be described both via visual maps and NUMPAD
Branch: 1 branch
BranchTrueFalseTotal
if ($k eq "DECIMAL") 0 0 0
15108 0 ▶ my @d = @{ $decimal->[1] || [] };
Condition0%0/2
$decimal->[1] || []
l!l
00
MC/DC0%0/1
$decimal->[1] || []
$decimal->[1]
Truth table0%0/2
A
A= $decimal->[1]
Aresult
11
00
15109 0 my $finalize = $decimal->[2];
15110 0 ▶ defined $KK[$_][0] or $KK[$_] = $d[$_] for 0..$#d; # fill on the second round
Branch: 1 branch
BranchTrueFalseTotal
defined $KK[$_][0] or $KK[$_] = $d[$_] 0 0 0
15111 0 ▶ @$decimal = ([$N], [@KK]), return unless $finalize;
Branch: 1 branch
BranchTrueFalseTotal
unless $finalize 0 0 0
15112 }
15113 # warn "Undefined \$N ==> <<<", join '>>> <<<', map $_->[0], @KK unless defined $N; # SPACE and ABNT_C1 ???
15114 ##### $self->output_unit_KK($k, $u, $sc, $Used, $CL, @KK);
15115 ##### }
15116 #####
15117 ##### sub output_unit_KK($$@) {
15118 ##### my ($self, $k, $u, $sc, $Used, $CL, @KK) = @_;
15119 0 ▶ if ($pre) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pre) 0 0 0
15120 0 ▶ map $self->format_key_XKB($face, $_->[0], $_->[2], !'guess', $Used->[$_->[1] || 0]), @KK; # prefill base prefixes
Condition0%0/2
$_->[1] || 0
l!l
00
MC/DC0%0/1
$_->[1] || 0
$_->[1]
Truth table0%0/2
A
A= $_->[1]
Aresult
11
00
15121 return
15122 0 }
15123 0 ▶ my @K = map $self->format_key_XKB($face, $_->[0], $_->[2], 'guess', $Used->[$_->[1] || 0]), @KK;
Condition0%0/2
$_->[1] || 0
l!l
00
MC/DC0%0/1
$_->[1] || 0
$_->[1]
Truth table0%0/2
A
A= $_->[1]
Aresult
11
00
15124 #warn "keys with ligatures: <@K>" if grep $K[$_] eq '%%', 0..$#K;
15125 ##### push @ligatures, map [$k, $_, $KK[$_][0]], grep $K[$_] eq '%%', 0..$#K;
15126 0 my $keys = join ",\t", @K;
15127 0 my @kk = map $_->[0], @KK;
15128 # Separate CL chars not easily supported on XKB ??? Need up to 8 keysyms per entry?
15129 0 my $u = [[@KK[0,1]], [@KK[2,3]]];
15130 0 my $cl_idx = join '', map $self->auto_capslock($_), @$u;
15131 0 ▶ my $cl_type = $CapsTypes{$cl_idx} or die "Unknown CapsLock mask: $cl_idx";
Branch: 1 branch
BranchTrueFalseTotal
my $cl_type = $CapsTypes{$cl_idx} or die "Unknown CapsLock mask: $cl_idx" 0 0 0
15132 # return ($sc, $cl_type, $keys);
15133 0 return qq( key $sc\t{ type="$cl_type",\t[ $keys ] };\n);
15134
15135 0 ▶ my($CL0, $Extra) = ($CL and $CL->[0]);
Condition0%0/3
$CL && $CL->[0]
!ll&&!rl&&r
000
MC/DC0%0/2
$CL && $CL->[0]
$CL $CL->[0]
Truth table0%0/3
A && B
A= $CLB= $CL->[0]
ABresult
0X0
100
111
15136 0 ▶ undef $CL0 unless $CL0 and @$CL0 and grep defined, map { ($_ and ref $_) ? $_->[0] : $_ } @$CL0;
Branch: 2 branches
BranchTrueFalseTotal
unless $CL0 and @$CL0 and grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0) 0 0 0
$_ && ref $_ ? : 0 0 0
Condition0%0/9
$CL0 and @$CL0 and grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
!ll&&!rl&&r
000
$CL0 and @$CL0
!ll&&!rl&&r
000
$_ and ref $_
!ll&&!rl&&r
000
MC/DC0%0/3
$CL0 and @$CL0 and grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
$CL0 @$CL0 grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
MC/DC0%0/2
$_ and ref $_
$_ ref $_
Truth table0%0/4
A and B and C
A= $CL0B= @$CL0C= grep defined($_), map({$_ && ref $_ ? $_->[0] : $_;} @$CL0)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/3
A and B
A= $_B= ref $_
ABresult
0X0
100
111
15137 0 ▶ my $capslock = (defined $CL0 ? 2 : $self->auto_capslock($u->[0]));
Branch: 1 branch
BranchTrueFalseTotal
defined $CL0 ? : 0 0 0
15138 0 $capslock |= (($self->auto_capslock($u->[1])) << 2);
15139 0 ▶ $capslock = 'SGCap' if $capslock == 2; # Not clear if we can combine a string SGCap with 0x4 in a .klc file
Branch: 1 branch
BranchTrueFalseTotal
if $capslock == 2 0 0 0
15140 0 ▶ if ($CL0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CL0) 0 0 0
15141 0 my $a_cl = $self->auto_capslock($u->[0]);
15142 0 ▶ my @KKK = @KK[$a_cl ? (1,0) : (0,1)];
Branch: 1 branch
BranchTrueFalseTotal
$a_cl ? : 0 0 0
15143 0 ▶ defined(($CL0->[$_] and ref $CL0->[$_]) ? $CL0->[$_][0] : $CL0->[$_]) and $KKK[$_] = $CL0->[$_] for 0, 1;
Branch: 2 branches
BranchTrueFalseTotal
defined($CL0->[$_] && ref $CL0->[$_] ? $CL0->[$_][0] : $CL0->[$_]) and $KKK[$_] = $CL0->[$_] 0 0 0
$CL0->[$_] && ref $CL0->[$_] ? : 0 0 0
Condition0%0/3
$CL0->[$_] and ref $CL0->[$_]
!ll&&!rl&&r
000
MC/DC0%0/2
$CL0->[$_] and ref $CL0->[$_]
$CL0->[$_] ref $CL0->[$_]
Truth table0%0/3
A and B
A= $CL0->[$_]B= ref $CL0->[$_]
ABresult
0X0
100
111
15144 # my @c = map { ($_ and ref $_) ? $_->[0] : $_ } @$CL0;
15145 # my @d = map { ($_ and ref $_) ? $_->[2] : {} } @$CL0; # dead
15146 # my @f = map $self->format_key($c[$_], $d[$_], ), 0 .. $#$CL0;
15147 # $Extra = [@f];
15148 0 ▶ $Extra = [map $self->format_key_XKB($face, $_->[0], $_->[2], $Used->[$_->[1] || 0]), @KKK];
Condition0%0/2
$_->[1] || 0
l!l
00
MC/DC0%0/1
$_->[1] || 0
$_->[1]
Truth table0%0/2
A
A= $_->[1]
Aresult
11
00
15149 }
15150 # ($sc, $capslock, $keys, $Extra);
15151 0 "$sc,\t$capslock,\t$keys,\t$Extra\n";
15152 }
15153
15154 0 ▶sub output_layout_XKB ($$) {
Subroutine output_layout_XKB: not called CC=5 SCAR=34.0
Pod undocumented
15155 0 my ($self, $k) = (shift, shift, shift, shift);
15156 0 $self->reset_units;
15157 0 my $B = $self->Base_VK_names($k);
15158 # Dumpvalue->new()->dumpValue($self);
15159 # warn "Translate: ", %h;
15160 0 my $F = $self->get_deep($self, @$k); # Presumably a face hash, as in $k = [qw(faces US)]
15161 0 $F->{'[dead-usedX]'} = [map {}, @{$F->{layers}}]; # Which of deadkeys are reachable on the keyboard
15162 0 my $BB = $F->{baseKeysRaw};
15163 # die "Count of non-VK entries mismatched: $cnt vs ", scalar @{$self->{layers}{$layers->[0]}}
15164 # unless $cnt <= scalar @{$self->{layers}{$layers->[0]}};
15165 0 my $face = join '/', @$k[1..$#$k];
15166 0 my $decimal = [];
15167 0 ▶ if (my $c = $self->{faces}{$face}{'[Flip_AltGr_Key]'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $c = $self->{"faces"}{$face}{"[Flip_AltGr_Key]"}) 0 0 0
15168 0 $self->{faces}{$face}{"[dead_X11symbol]"}{$c} = 'ISO_Level3_Latch';
15169 }
15170 0 ▶ if (my $c = $self->{faces}{$face}{'[mainComposeKeyHex]'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $c = $self->{"faces"}{$face}{"[mainComposeKeyHex]"}) 0 0 0
15171 0 $self->{faces}{$face}{"[dead_X11symbol]"}{$c} = 'Multi_key';
15172 }
15173 0 map $self->output_unit_XKB($face, $_, $B->[$_], $BB->[$_], $decimal, $F->{'[dead-usedX]'}, 'pre'), 0..$#$B; # calc base prefixes
15174 0 my @o = map $self->output_unit_XKB($face, $_, $B->[$_], $BB->[$_], $decimal, $F->{'[dead-usedX]'}, !'pre'), 0..$#$B;
15175 push @o, $self->output_unit_XKB($face, $decimal->[0][0], $B->[$decimal->[0][0]], $BB->[$decimal->[0][0]],
15176 0 ▶ $decimal, $F->{'[dead-usedX]'})
Branch: 1 branch
BranchTrueFalseTotal
if @$decimal and ++$decimal->[2] 0 0 0
Condition0%0/3
@$decimal and ++$decimal->[2]
!ll&&!rl&&r
000
MC/DC0%0/2
@$decimal and ++$decimal->[2]
@$decimal ++$decimal->[2]
Truth table0%0/3
A and B
A= @$decimalB= ++$decimal->[2]
ABresult
0X0
100
111
15177 if @$decimal and ++$decimal->[2];
15178 0 join '', @o;
15179 }
15180
15181 1 my(@AppleSym, %AppleSym);
15182 0 ▶sub _AppleMap () { # http://forums.macrumors.com/archive/index.php/t-780577.html
Subroutine _AppleMap: not called CC=14 SCAR=53.5
15183 # https://github.com/tekezo/Karabiner/blob/version_10.7.0/src/bridge/generator/keycode/data/KeyCode.data
15184 # It has a definition of 0x34; moreover, it also defines some keys above 0x80 (including ≤ 0x80 on some German keyboard???)
15185 0 chomp(my $lst = <<'EOF'); # 0..50; 65..92; 93..95 ↱KEYPAD; · = special ↱JIS (≥93=0x5d)
15186 asdfhgzxcv§bqweryt123465=97-80]ou[ip·lj'k;\,/nm.· `··············.·*·+·····/··-··=01234567·89¥_,
15187 EOF
15188 # ' # KEYPAD above starts on 65=0x41
15189 0 my @lst = split //, $lst;
15190 0 my $last = $#lst;
15191 # in addition to US Extended, we defined 64, 73 (BR), 102, 104 (hex 40 49 66 68) and 93-95 from JIS
15192 0 my @kVK_ = split /\n/, <<EOF; # Codes 0x34 0x42 0x46 0x4D taken from US Extended; + is 0x10
15193 24 Return 0d
15194 30 Tab 09
15195 ####31 Space
15196 33 Delete 08
15197 34 Enter_PowerBook 03 # Same as KeypadEnter
15198 35 Escape 1b
15199 37 Command
15200 38 Shift
15201 39 CapsLock
15202 3A Option
15203 3B Control
15204 3C RightShift
15205 3D RightOption
15206 3E RightControl
15207 3F Function
15208 40 F17 +
15209 42 ????????????? 1d # Same as RightArrow
15210 46 ?????????????? 1c # Same as LeftArrow
15211 47 ANSI_KeypadClear 1b # ??? Same as Escape
15212 48 VolumeUp 1f # ??? Same as DownArrow
15213 49 VolumeDown + # C1 of ABNT: /
15214 4A Mute
15215 ###4B ANSI_KeypadDivide /
15216 4C ANSI_KeypadEnter 03
15217 4D ??????? 1e # Same as UpArrow
15218 4F F18 +
15219 50 F19 +
15220 5A F20
15221 60 F5 +
15222 61 F6 +
15223 62 F7 +
15224 63 F3 +
15225 64 F8 +
15226 65 F9 +
15227 67 F11 +
15228 69 F13 +
15229 6A F16 +
15230 6B F14 +
15231 6D F10 +
15232 6E __PC__Menu +
15233 6F F12 +
15234 71 F15 +
15235 72 Help 05
15236 73 Home 01
15237 74 PageUp 0b
15238 75 ForwardDelete 7f
15239 76 F4 +
15240 77 End 04
15241 78 F2 +
15242 79 PageDown 0c
15243 7A F1 +
15244 7B LeftArrow 1c
15245 7C RightArrow 1d
15246 7D DownArrow 1f
15247 7E UpArrow 1e
15248 # ISO keyboards only
15249 ####0A ISO_Section §
15250 # JIS keyboards only
15251 ####5D JIS_Yen ¥
15252 ####5E JIS_Underscore _
15253 ####5F JIS_KeypadComma ,
15254 66 JIS_Eisu SPACE # Left of space (On CapsLock on Windows; compare http://commons.wikimedia.org/wiki/File:MacBookProJISKeyboard-1.jpg with http://en.wikipedia.org/wiki/Keyboard_layout#Japanese)
15255 68 JIS_Kana SPACE # Right of space (as on Windows, but without intervening key)
15256 # Defined in US Extended:
15257 6C ?????? +
15258 70 ?????? +
15259 # ?????
15260 ###BRIGHTNESS_DOWN 0x91
15261 ###BRIGHTNESS_UP 0x90
15262 ###DASHBOARD 0x82
15263 ###EXPOSE_ALL 0xa0
15264 ###LAUNCHPAD 0x83
15265 ###MISSION_CONTROL 0xa0
15266 #
15267 ###GERMAN_PC_LESS_THAN 0x80
15268 ###PC_POWER 0x7f
15269 EOF
15270 0 my %seen;
15271 0 for my $i (0..$#lst) {
15272 0 ▶ if ($lst[$i] eq '·') {
Branch: 1 branch
BranchTrueFalseTotal
if ($lst[$i] eq "\267") { } 0 0 0
15273 0 undef $lst[$i];
15274 } else {
15275 0 ▶ my $pref = (defined $AppleSym{$lst[$i]} and '#');
Condition0%0/2
defined $AppleSym{$lst[$i]} && '#'
!ll
00
MC/DC0%0/1
defined $AppleSym{$lst[$i]} && '#'
defined $AppleSym{$lst[$i]}
Truth table0%0/2
A
A= defined $AppleSym{$lst[$i]}
Aresult
00
11
15276 0 $AppleSym{"$pref$lst[$i]"} = $i;
15277 }
15278 }
15279 # $AppleSym{'#'} = $AppleSym{' '}; # Space is in a table as #
15280 0 my %map = ('+' => "\x10", 'SPACE' => ' ');
15281 0 for my $kVK (@kVK_) {
15282 0 ▶ warn ("unexpected OSX scan: <<$kVK>>"), next unless $kVK =~ /^\s*(#)|([A-F\d]{2})\s+(\?+|\w+)\s*(.*)/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $kVK =~ /^\s*(#)|([A-F\d]{2})\s+(\?+|\w+)\s*(.*)/i 0 0 0
15283 0 ▶ next if $1;
Branch: 1 branch
BranchTrueFalseTotal
if $1 0 0 0
15284 0 my($hex, $name, $rest, $comment) = ($2, $3, $4);
15285 0 $AppleSym[hex $hex] = $name;
15286 0 $AppleSym{$name} = hex $hex;
15287 0 ▶ if (length $rest) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $rest) 0 0 0
15288 0 ▶ warn ("unexpected OSX scan expansion in $hex/$name: <<$rest>>"), next
Branch: 1 branch
BranchTrueFalseTotal
unless () = $rest =~ /^(?:(?:([A-F\d]{2})|([^\w\s+])|(SPACE|\+))\s*)?(?:#\s*(.*))?$/i 0 0 0
15289 unless ( my($HEX,$lit,$sp), $comment) = ( $rest =~ /^(?:(?:([A-F\d]{2})|([^\w\s+])|(SPACE|\+))\s*)?(?:#\s*(.*))?$/i );
15290 0 ▶ if ($sp) {
Branch: 2 branches
BranchTrueFalseTotal
if ($sp) { } 0 0 0
elsif ($HEX) { } 0 0 0
15291 0 ▶ $rest = $map{$sp} or warn "Bad map in OSX basemap"
Branch: 1 branch
BranchTrueFalseTotal
$rest = $map{$sp} or warn "Bad map in OSX basemap" 0 0 0
15292 } elsif ($HEX) {
15293 0 $rest = chr hex $HEX;
15294 } else {
15295 0 $rest = $lit;
15296 }
15297 0 my $idx = hex $hex;
15298 0 ▶ $idx > $last or not defined $lst[$idx] or warn "Non-special <<$lst[$idx]>> when overriding offset=$idx=hex($hex) in OSX basemap";
Branch: 1 branch
BranchTrueFalseTotal
$idx > $last or not defined $lst[$idx] or warn "Non-special <<$lst[$idx]>> when overriding offset=$idx=hex($hex) in OSX basemap" 0 0 0
Condition0%0/3
$idx > $last or not defined $lst[$idx]
l!l&&r!l&&!r
000
MC/DC0%0/2
$idx > $last or not defined $lst[$idx]
$idx > $last not defined $lst[$idx]
Truth table0%0/3
A or not(B)
A= $idx > $lastB= not defined $lst[$idx]
ABresult
1X1
011
000
15299 0 $lst[$idx] = $rest;
15300 }
15301 }
15302 @lst
15303 0 }
15304
15305 1 my @AppleMap;
15306
15307 # Extra keys on Windows side: INSERT, and duplication-by-NumLock of the keypad.
15308 # Extra keys on Apple side: CLEAR on the KP, and KP-Equal.
15309
15310 # Current solution: merge win-KP_Clear with apple-KP_CLear (1st in the center, 2nd in the ul-corner!)
15311 # merge INSERT with KP=
15312
15313 # How to work with NumLock-modifications? There are 3 states: NumLock-, Base-, Shift.
15314
15315 # Not in Apple maps:
15316 # F21-F24 HOME UP PRIOR DIVIDE LEFT CLEAR RIGHT MULTIPLY END DOWN NEXT SUBTRACT INSERT DELETE RETURN ADD NUMPAD0-NUMPAD9
15317 1 my %Apple_recode;
15318 1 ▶{ no warnings 'qw';
Subroutine BEGIN: called CC=1 SCAR=0.0
15319 1 %Apple_recode = (qw(
15320 DIVIDE #/ MULTIPLY * SUBTRACT #- ADD + DECIMAL #.
15321 RETURN ANSI_KeypadEnter DELETE ForwardDelete #\ § OEM_102 §
15322 PRIOR PageUp CLEAR ANSI_KeypadClear NEXT PageDown INSERT #=
15323 ABNT_C1 VolumeDown APP __PC__Menu
15324 ), SPACE => ' ', map +("NUMPAD$_", "#$_"), 0..9);
15325 }
15326 1 my %Apple_skip = map +($_, 1), (map "F$_", 21..24); #, (map "NUMPAD$_", 0..9);
15327 # ==> HOME UP PRIOR LEFT CLEAR RIGHT END DOWN NEXT INSERT DELETE RETURN
15328 # ==> PRIOR CLEAR NEXT INSERT
15329
15330 0 ▶sub AppleMap_Base ($$) {
Subroutine AppleMap_Base: not called CC=29 SCAR=67.7
Pod undocumented
15331 0 my($self, $K) = (shift, shift);
15332 0 my $F = $self->get_deep($self, @$K); # Presumably a face hash, as in $K = [qw(faces US)]
15333 0 ▶ return $F->{Apple2layout} if $F->{Apple2layout};
Branch: 1 branch
BranchTrueFalseTotal
if $F->{"Apple2layout"} 0 0 0
15334 0 ▶ @AppleMap = _AppleMap unless @AppleMap;
Branch: 1 branch
BranchTrueFalseTotal
unless @AppleMap 0 0 0
15335 0 ▶ warn 'AppleMap too long' if $#AppleMap >= 127;
Branch: 1 branch
BranchTrueFalseTotal
if $#AppleMap >= 127 0 0 0
15336 0 $self->reset_units;
15337 0 my $BB = $self->Base_VK_names($K); # VK per position (except via-VK keys)
15338 0 my $B = $F->{baseKeysRaw}; # chars on key (if the first occurence???) OR VK
15339 0 my(@o, @A, @AA); # A: kbdd --> Apple; AA: Apple --> kbdd
15340 0 $_ = [@$_] for $B, $BB; # 1-level deep copy
15341 0 my $o = $F->{'[VK_off]'};
15342 0 for my $b (()) { # Explicitly add via-VK keys
15343 0 for my $vk (keys %$o) {
15344 0 ▶ warn "[@$K]: $vk defined on \@$o->{$vk} as $b->[$o->{$vk}]" if defined $b->[$o->{$vk}];
Branch: 1 branch
BranchTrueFalseTotal
if defined $$b[$o->{$vk}] 0 0 0
15345 0 ▶ $b->[$o->{$vk}] = $vk unless defined $b->[$o->{$vk}];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$b[$o->{$vk}] 0 0 0
15346 # warn "[@$K]: $vk \@ $o->{$vk}"; # SPACE @ 116 (on izKeys)
15347 }
15348 }
15349 # warn "[[@$K]] @$B\n\t@$BB\n";
15350 # warn "\t", !(grep $_ eq ' ', @$B), "\t", !(grep $_ eq ' ', @$BB), "\n";
15351 0 for my $i (0..$#$B) { # Primary mappings
15352 0 my $k = $B->[$i];
15353 0 my $kk = $BB->[$i];
15354 0 ▶ next unless defined $k;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $k 0 0 0
15355 0 ▶ $A[$i] = $AppleSym{$kk}, next if exists $AppleSym{$kk};
Branch: 1 branch
BranchTrueFalseTotal
if exists $AppleSym{$kk} 0 0 0
15356 0 ▶ $A[$i] = $AppleSym{$Apple_recode{$kk}}, next if exists $AppleSym{$Apple_recode{$kk} || 123};
Branch: 1 branch
BranchTrueFalseTotal
if exists $AppleSym{$Apple_recode{$kk} or 123} 0 0 0
Condition0%0/2
$Apple_recode{$kk} || 123
l!l
00
MC/DC0%0/1
$Apple_recode{$kk} || 123
$Apple_recode{$kk}
Truth table0%0/2
A
A= $Apple_recode{$kk}
Aresult
11
00
15357 0 ▶ $A[$i] = $AppleSym{$k}, next if exists $AppleSym{$k};
Branch: 1 branch
BranchTrueFalseTotal
if exists $AppleSym{$k} 0 0 0
15358 0 ▶ $A[$i] = $AppleSym{$Apple_recode{$k}}, next if exists $AppleSym{$Apple_recode{$k} || 123};
Branch: 1 branch
BranchTrueFalseTotal
if exists $AppleSym{$Apple_recode{$k} or 123} 0 0 0
Condition0%0/2
$Apple_recode{$k} || 123
l!l
00
MC/DC0%0/1
$Apple_recode{$k} || 123
$Apple_recode{$k}
Truth table0%0/2
A
A= $Apple_recode{$k}
Aresult
11
00
15359 0 ▶ $A[$i] = "\u\L$k" . 'Arrow', next if exists $AppleSym{"\u\L$k" . 'Arrow'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $AppleSym{CORE::ucfirst(CORE::lc $k) . 'Arrow'} 0 0 0
15360 0 ▶ $A[$i] = "\u\L$k", next if exists $AppleSym{"\u\L$k"};
Branch: 1 branch
BranchTrueFalseTotal
if exists $AppleSym{CORE::ucfirst CORE::lc $k} 0 0 0
15361 0 ▶ next if $Apple_skip{$k};
Branch: 1 branch
BranchTrueFalseTotal
if $Apple_skip{$k} 0 0 0
15362 0 push @o, $k;
15363 }
15364 0 for my $i (0..126) { # Primary backwards mappings
15365 0 ▶ next unless defined $A[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $A[$i] 0 0 0
15366 0 ▶ warn "Duplicate backward Apple mapping: old=$AA[$A[$i]] --> $A[$i] <-- $i=new" if defined $AA[$A[$i]];
Branch: 1 branch
BranchTrueFalseTotal
if defined $AA[$A[$i]] 0 0 0
15367 0 $AA[$A[$i]] = $i;
15368 }
15369 0 for my $i (0..126) { # Secondary backwards mappings
15370 0 ▶ next if defined $AA[$i] or ($AppleSym[$i] || '') !~ /^#(.)$/ or not defined $AA[$AppleSym{$1}];
Branch: 1 branch
BranchTrueFalseTotal
if defined $AA[$i] or not +($AppleSym[$i] || "") =~ /^#(.)$/ or not defined $AA[$AppleSym{$1}] 0 0 0
Condition0%0/8
defined $AA[$i] or not +($AppleSym[$i] || "") =~ /^#(.)$/ or not defined $AA[$AppleSym{$1}]
l!l&&r!l&&!r
000
defined $AA[$i] or not +($AppleSym[$i] || "") =~ /^#(.)$/
l!l&&r!l&&!r
000
$AppleSym[$i] || ''
l!l
00
MC/DC0%0/3
defined $AA[$i] or not +($AppleSym[$i] || "") =~ /^#(.)$/ or not defined $AA[$AppleSym{$1}]
defined $AA[$i] $AppleSym[$i] not defined $AA[$AppleSym{$1}]
Truth table0%0/4
A or not(B) or not(C)
A= defined $AA[$i]B= $AppleSym[$i]C= not defined $AA[$AppleSym{$1}]
ABCresult
1XX1
00X1
0111
0100
15371 0 $AA[$i] = $AA[$AppleSym{$1}]
15372 }
15373 0 ▶ warn "Not in Apple maps: @o" if @o;
Branch: 1 branch
BranchTrueFalseTotal
if @o 0 0 0
15374 0 $F->{layout2Apple} = \@A;
15375 0 $F->{Apple2layout} = \@AA;
15376 }
15377
15378 # fake is needed (apparently, the compiler does not allocate the named states smartly???)
15379 1 my @state_cnt = qw( 4of4 4096 3of4 256 2of4 16 1of4 0 0of4 0
15380 1of6 0 2of6 2 3of6 16 4of6 256 0of6 0
15381 );
15382 1 my @state_cnt_a = (@state_cnt, qw(
15383 5of6 4 6of6 64
15384 )); # At end, so may be skipped via merge_states_6_and_4
15385 1 my @state_cnt_b = (@state_cnt, qw(
15386 5of6 64 6of6 64
15387 ));
15388 1 my $in_group_4of6_plan_c = 2;
15389 1 my @state_cnt_c = (@state_cnt, '5of6' => 16 * $in_group_4of6_plan_c, '6of6' => 64);
15390 1 my $use_plan_b; # unimplemented
15391 1 my $use_plan_c = 1; # untested
15392
15393 0 ▶sub alloc_slots ($$) {
Subroutine alloc_slots: not called CC=2 SCAR=17.9
Pod undocumented
15394 0 my($tot, $a, %start) = (shift, shift);
15395 0 my @a = @$a; # deep copy
15396 0 ▶ while (@a) {
Branch: 1 branch
BranchTrueFalseTotal
if (@a) 0 0 0
15397 0 my($how, $c) = splice @a, 0, 2;
15398 0 $start{$how} = [$tot, $tot+$c-1];
15399 0 $tot += $c;
15400 }
15401 0 \%start;
15402 }
15403
15404 0 ▶sub output_state_range ($$$$$$) { # Apparently, only ranges up to 256 states are supported.
Subroutine output_state_range: not called CC=8 SCAR=42.8
Pod undocumented
15405 0 my($self, $from, $to, $mult, $next, $out, $o) = (shift, shift, shift, shift, shift, shift, ''); # $out is the ord(OUTPUT)
15406 0 ▶ $o .= "\t\t\t<!-- Cannot have more than 256 in one range; subdividing $from ... $to -->\n" if $to - $from > 255;
Branch: 1 branch
BranchTrueFalseTotal
if $to - $from > 255 0 0 0
15407 0 ▶ while ($to - $from > 255) {
Branch: 1 branch
BranchTrueFalseTotal
if ($to - $from > 255) 0 0 0
15408 0 $o .= $self->output_state_range($from, $from+255, $mult, $next, $out);
15409 0 $from += 256;
15410 0 ▶ $out += 256*$mult if defined $out;
Branch: 1 branch
BranchTrueFalseTotal
if defined $out 0 0 0
15411 0 ▶ $next += 256*$mult if defined $next;
Branch: 1 branch
BranchTrueFalseTotal
if defined $next 0 0 0
15412 }
15413 0 ▶ XML_format($out = chr $out) if defined $out;
Branch: 1 branch
BranchTrueFalseTotal
if defined $out 0 0 0
15414 0 my @out;
15415 0 ▶ push @out, qq(next="$next") if defined $next;
Branch: 1 branch
BranchTrueFalseTotal
if defined $next 0 0 0
15416 0 ▶ push @out, qq(output="$out") if defined $out ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $out 0 0 0
15417 0 $o .= <<EOS;
15418 <when state="$from" through="$to" multiplier="$mult" @out />
15419 EOS
15420 0 $o
15421 }
15422
15423 1 my $merge_states_6_and_4 = 1;
15424 1 my $do_hex5 = 0; # Won’t install with this… (Even with $merge_states_6_and_4)
15425
15426 0 ▶sub output_hex_input ($$$) { # above 4-hex-digits input often overloads stack of Apple’s programs. At start state in $states{'1of4'}[0].
Subroutine output_hex_input: not called CC=31 SCAR=69.0
Pod undocumented
15427 0 my($self, $states, $HEX, $o) = (shift, shift, shift, ''); # $HEX one of "-u\x20_+=0-9a-f"
15428 0 ▶ unless ($HEX =~ /[0-9a-f]/i) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($HEX =~ /[0-9a-f]/i) 0 0 0
15429 0 ▶ return $do_hex5 ? <<EOS : <<EOS;
Branch: 1 branch
BranchTrueFalseTotal
$do_hex5 ? : 0 0 0
15430 <!-- switch 4-to-5-to-6-digit-HEX input -->
15431 <when state="hex4" next="hex5" />
15432 <when state="hex5" next="hex6" />
15433 EOS
15434 <!-- switch 4-to-6-digit-HEX input -->
15435 <when state="hex4" next="hex6" />
15436 EOS
15437 }
15438 0 my $i = hex $HEX;
15439 0 my @O = map { [$states->{($_+1).'of4'}[0] + $i] } 0..3;
15440 0 $O[4] = [undef, $i];
15441 # $O[4] = qq(output="&#x002$HEX;");
15442 # $O[4] = qq(next="5000");
15443 0 $o .= <<EOS;
15444 <!-- 4-digit-HEX input -->
15445 <when state="hex4" next="$O[1][0]" />
15446 EOS
15447 # <when state="0" through="4095" multiplier="16" output="&#x0000;" />
15448 # <when state="4096" through="4351" multiplier="16" next="0"] />
15449 # <when state="4352" through="4367" multiplier="16" next="4096"] />
15450 # <when state="4368" multiplier="16" next="4352"] />
15451 $o .= <<EOS . $self->output_state_range($states->{"${_}of4"}[0], $states->{"${_}of4"}[1], 16, $O[$_][0], $O[$_][1])
15452 <!-- hex digit No. $_ of 4 -->
15453 EOS
15454 0 for 2..4; # ($HEX eq '9' ? 4 : 3); # 2..4; bisect installation problems here
15455
15456 # return $o unless 15 >= hex $HEX; # debugging only
15457
15458 0 @O = map { [$states->{($_+1).'of6'}[0] + $i] } 0..5;
15459 0 $O[2][0]--; # We start with U+01..., not U+00....
15460 0 $O[6] = [undef, 0xDC00 + $i];
15461 0 ▶ $o .= $do_hex5 ? <<EOS : <<EOS; # Special-case input of the first two hex digits:
Branch: 1 branch
BranchTrueFalseTotal
$do_hex5 ? : 0 0 0
15462 <!-- 5/6-digit-HEX input -->
15463 EOS
15464 <!-- 6-digit-HEX input -->
15465 EOS
15466 # $states->{"2of6"}[0] is U+0xxxxx=hex5 hex5 and hex6 differs only in treatment of 0, and of 1 0
15467 # $states->{"2of6"}[1] is U+1xxxxx hex5: 1 0 —→ U+010xxx
15468 # $states->{"3of6"}[0] is U+01xxxx hex6: 1 0 —→ U+10xxxx
15469 # $states->{"3of6"}[1] is U+10xxxx hex5: 0 —→ hex4, 1 —→ U+01xxxx, rest X —→ U+0Xxxx
15470 # hex6: 0 —→ hex5, 1 —→ U+1xxxxx, rest X —→ U+0Xxxx
15471 0 ▶ $o .= <<EOS if $HEX =~ /[01]/;
Branch: 1 branch
BranchTrueFalseTotal
if $HEX =~ /[01]/ 0 0 0
15472 <when state="hex6" next="$O[1][0]" />
15473 EOS
15474 # What follows is a complete mess, since with $do_hex5 the resulting layout won’t install
15475 0 ▶ $o .= <<EOS if $do_hex5 and not $HEX =~ /[01]/; # hex6 same as after 0
Branch: 1 branch
BranchTrueFalseTotal
if $do_hex5 and not $HEX =~ /[01]/ 0 0 0
Condition0%0/3
$do_hex5 and not $HEX =~ /[01]/
!ll&&!rl&&r
000
MC/DC0%0/2
$do_hex5 and not $HEX =~ /[01]/
$do_hex5 not $HEX =~ /[01]/
Truth table0%0/3
A and not(B)
A= $do_hex5B= not $HEX =~ /[01]/
ABresult
0X0
100
111
15476 <when state="hex5" next="$O[2][0]" />
15477 <when state="$states->{"2of6"}[0]" next="$O[2][0]" />
15478 <when state="hex6" next="$O[2][0]" />
15479 EOS
15480 0 ▶ $o .= <<EOS if $do_hex5 and $HEX =~ /1/; # 0 after (U+)0, proceed as in hex4; after (U+)1, process only 0 as hex6
Branch: 1 branch
BranchTrueFalseTotal
if $do_hex5 and $HEX =~ /1/ 0 0 0
Condition0%0/3
$do_hex5 and $HEX =~ /1/
!ll&&!rl&&r
000
MC/DC0%0/2
$do_hex5 and $HEX =~ /1/
$do_hex5 $HEX =~ /1/
Truth table0%0/3
A and B
A= $do_hex5B= $HEX =~ /1/
ABresult
0X0
100
111
15481 <when state="hex5" next="$O[2][0]" />
15482 EOS
15483 0 ▶ $o .= <<EOS if $do_hex5 and $HEX =~ /0/; # 0 after (U+)0, proceed as in hex4; after (U+)1, process only 0 as hex6
Branch: 1 branch
BranchTrueFalseTotal
if $do_hex5 and $HEX =~ /0/ 0 0 0
Condition0%0/3
$do_hex5 and $HEX =~ /0/
!ll&&!rl&&r
000
MC/DC0%0/2
$do_hex5 and $HEX =~ /0/
$do_hex5 $HEX =~ /0/
Truth table0%0/3
A and B
A= $do_hex5B= $HEX =~ /0/
ABresult
0X0
100
111
15484 <when state="hex5" next="hex4" />
15485 EOS
15486 0 ▶ $o .= <<EOS if $HEX =~ /0/; # 0 after (U+)0, proceed as in hex4; after (U+)1, process only 0 as hex6
Branch: 1 branch
BranchTrueFalseTotal
if $HEX =~ /0/ 0 0 0
15487 <!-- 2nd digit of U+00xxxx -->
15488 <when state="$states->{"2of6"}[0]" next="hex4" />
15489 <!-- 2nd digit of U+10xxxx -->
15490 <when state="$states->{"2of6"}[1]" next="$states->{"3of6"}[1]" />
15491 EOS
15492 0 ▶ $o .= <<EOS unless $HEX =~ /0/; # After (U+)0, normal: after (U+)1, process as hex5 (as if all is preceeded by 0)
Branch: 1 branch
BranchTrueFalseTotal
unless $HEX =~ /0/ 0 0 0
15493 <!-- 2nd digit x of U+0xyyyy -->
15494 <when state="$states->{"2of6"}[0]" next="$O[2][0]" />
15495 EOS
15496 0 ▶ $o .= <<EOS if $do_hex5 and not $HEX =~ /0/; # After (U+)0, normal: after (U+)1, process as hex5 (as if all is preceeded by 0)
Branch: 1 branch
BranchTrueFalseTotal
if $do_hex5 and not $HEX =~ /0/ 0 0 0
Condition0%0/3
$do_hex5 and not $HEX =~ /0/
!ll&&!rl&&r
000
MC/DC0%0/2
$do_hex5 and not $HEX =~ /0/
$do_hex5 not $HEX =~ /0/
Truth table0%0/3
A and not(B)
A= $do_hex5B= not $HEX =~ /0/
ABresult
0X0
100
111
15497 <when state="$states->{"2of6"}[1]" next="$O[3][0]" />
15498 EOS
15499 $o .= <<EOS . $self->output_state_range($states->{"${_}of6"}[0], $states->{"${_}of6"}[1], 16, $O[$_][0], $O[$_][1])
15500 <!-- hex digit No. $_ of 6 -->
15501 EOS
15502 0 for 3; # ($HEX eq '9' ? 4 : 3); # 2..4; bisect installation problems here
15503 # VARIANT (A): for every one of 256 states, individually emit a surrogate (with multiplier 4), and set the next state (in B..B+3)
15504 # VARIANT (C): for every $in_group of 256 states, emit its surrogate (with multiplier 4).
15505 # This creates a spread of "next states" of size M-3, with M = 4*$in_group.
15506 # Create next state in ranges (B .. B+M-3) (B+M .. B+2M-3) (B+2M .. B+3M-3) (B+3M .. B+4M-3)
15507 # depending on ($i & 3). [Later, we should process every range with multiplier=0.]
15508 0 ▶ my $next_base = ($merge_states_6_and_4 and not $use_plan_c) ? $states->{"3of4"}[0] + 0xDC : $states->{"5of6"}[0];
Branch: 1 branch
BranchTrueFalseTotal
$merge_states_6_and_4 && !$use_plan_c ? : 0 0 0
Condition0%0/3
$merge_states_6_and_4 and not $use_plan_c
!ll&&!rl&&r
000
MC/DC0%0/2
$merge_states_6_and_4 and not $use_plan_c
$merge_states_6_and_4 not $use_plan_c
Truth table0%0/3
A and not(B)
A= $merge_states_6_and_4B= not $use_plan_c
ABresult
0X0
100
111
15509 0 ▶ my $in_group = $use_plan_c ? $in_group_4of6_plan_c : 1;
Branch: 1 branch
BranchTrueFalseTotal
$use_plan_c ? : 0 0 0
15510 0 ▶ my $spread_next = $use_plan_c ? 4*$in_group_4of6_plan_c - 3 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$use_plan_c ? : 0 0 0
15511 0 ▶ $o .= $use_plan_c ? <<EOS : <<EOS;
Branch: 1 branch
BranchTrueFalseTotal
$use_plan_c ? : 0 0 0
15512 <!-- hex digit No. 4 of 6;
15513 treat possible states (of 256) in groups of $in_group_4of6_plan_c;
15514 this creates a correct "output", but proliferates
15515 the number of states from 4 to 4*$in_group_4of6_plan_c -->
15516 EOS
15517 <!-- hex digit No. 4 of 6; treat every possible state (of 256) individually -->
15518 EOS
15519 0 for my $j (0 .. ((0x100/$in_group)-1)) {
15520 0 my($J, $n, $O) = ($states->{"4of6"}[0] + $j*$in_group, $next_base + ($i & 0x3)*$spread_next, 0xD800 + 4*$j*$in_group + ($i>>2));
15521 0 XML_format($O = chr $O);
15522 0 ▶ if ($use_plan_c) {
Branch: 1 branch
BranchTrueFalseTotal
if ($use_plan_c) { } 0 0 0
15523 0 my $T = $J + $in_group_4of6_plan_c -1;
15524 0 $o .= <<EOS;
15525 <when state="$J" through="$T" multiplier="4" next="$n" output="$O" />
15526 EOS
15527 } else {
15528 0 $o .= <<EOS;
15529 <when state="$J" next="$n" output="$O" />
15530 EOS
15531 # ($HEX eq '9' ? 4 : 3); # 2..4; bisect installation problems here
15532 }
15533 }
15534 0 ▶ if ($use_plan_c) {
Branch: 1 branch
BranchTrueFalseTotal
if ($use_plan_c) 0 0 0
15535 0 ▶ my $doc = $merge_states_6_and_4 ? '; redirect to low surrogates' : '';
Branch: 1 branch
BranchTrueFalseTotal
$merge_states_6_and_4 ? : 0 0 0
15536 0 $o .= <<EOS;
15537 <!-- hex digit No. 5 of 6$doc.
15538 Every of 4 needed states is actually repeated
15539 $in_group_4of6_plan_c times (with step 4). -->
15540 EOS
15541 0 for my $k (1 .. $in_group_4of6_plan_c) {
15542 # for my $j (0 .. 3) {
15543 0 my $n = $next_base + ($k-1)*4;
15544 0 my $T = $n + 3;
15545 0 ▶ my $next = ($merge_states_6_and_4 ? $states->{"4of4"}[0] + 0xDC0 + $i: $O[5][0]);
Branch: 1 branch
BranchTrueFalseTotal
$merge_states_6_and_4 ? : 0 0 0
15546 0 $o .= <<EOS;
15547 <when state="$n" through="$T" multiplier="16" next="$next" />
15548 EOS
15549 }
15550 }
15551
15552 0 ▶ unless ($merge_states_6_and_4) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($merge_states_6_and_4) 0 0 0
15553 $o .= $self->output_state_range($states->{"${_}of6"}[0], $states->{"${_}of6"}[1], 16, $O[$_][0], $O[$_][1])
15554 0 ▶ for ($use_plan_c ? 6 : 5) .. 6; # ($HEX eq '9' ? 4 : 3); # 2..4; bisect installation problems here
Branch: 1 branch
BranchTrueFalseTotal
$use_plan_c ? : 0 0 0
15555 }
15556 $o
15557 0 }
15558
15559 0 ▶sub output_hex_term ($$) { # only 4-hex-digits input supported now. First state in $states{'1of4'}[0].
Subroutine output_hex_term: not called CC=6 SCAR=37.4
Pod undocumented
15560 0 my($self, $states) = (shift, shift);
15561 0 my $o = <<EOS;
15562 <!-- 4-digit-HEX input -->
15563 <when state="hex4" output="U-" />
15564 EOS
15565 0 my @hd = (0..9, 'A'..'F');
15566 0 for my $n (1 .. 3) {
15567 0 for my $i (0 .. ((16**$n)-1)) {
15568 0 my $N = $n + 1;
15569 0 my $I = $states->{"${N}of4"}[0] + $i;
15570 0 my $hex = sprintf "%0${n}X", $i;
15571 0 $o .= <<EOS;
15572 <when state="$I" output="U-$hex" />
15573 EOS
15574 }
15575 }
15576 0 ▶ $o .= $do_hex5 ? <<EOS : <<EOS;
Branch: 1 branch
BranchTrueFalseTotal
$do_hex5 ? : 0 0 0
15577 <!-- 5/6-digit-HEX input -->
15578 <when state="hex5" output="U+0" />
15579 <when state="hex6" output="U+" />
15580 EOS
15581 <!-- 6-digit-HEX input -->
15582 <when state="hex6" output="U+" />
15583 EOS
15584
15585 0 return $o; # the rest creates problems: see iz-Latin-hex6-vis3a.keylayout
15586
15587 0 $o .= <<EOS;
15588 <when state="$states->{"2of6"}[0]" output="U+0" />
15589 <when state="$states->{"2of6"}[1]" output="U+1" />
15590 EOS
15591 0 for my $n (2 .. 3) {
15592 0 for my $i (0 .. ((16**($n-1))-1)) {
15593 0 my $N = $n + 1;
15594 0 my $I = $states->{"${N}of6"}[0] + $i;
15595 0 my $hex = sprintf "%0${n}X", $i + 16**($n-2);
15596 0 $o .= <<EOS;
15597 <when state="$I" output="U+$hex" />
15598 EOS
15599 }
15600 }
15601 $o
15602 0 }
15603
15604 1 my $junkHEX = <<EOJ;
15605 After +0yz or +10z (16*16 states); instead of 4434 should put 4434 + 0..3
15606 <when state="4438" through="4701" multiplier="16" next="4434" output="&#xD800;"] />
15607
15608 WRONG!!! Need different multipliers for next and for output; so need 256 individual declarations
15609 Instead: use multiplier="4" (so that the output char is correct; next state takes 4K values, out of which we
15610 need only last two bits (manually inserted via next="" above); so we need 1K declarations for per-ultimate???
15611
15612 So: maybe have 16 declarations for "After +0yz or +10z"; this way, next state takes 64 values, of which
15613 we may make account for by 16 declarations. (32 total per 22 chars 0-9a-fA-F.)
15614
15615 Or: maybe have 16 declarations for "After +0yz or +10z"; each creates a range of 64 possible "next" states;
15616 but we create 4 groups of such states. So we may make account for by 4 declarations. (20 total per 22 chars 0-9a-fA-F.)
15617 EOJ
15618
15619 #sub XML_format ($) { $_[0] =~ s/([&""''\x00-\x1f\x7f-\x9f\s<>]|$rxCombining|$rxZW)/ sprintf '&#x%04X;', ord $1 /ego;
15620 # # Avoid "Malformed UTF-8 character (fatal)" by not puting in a REx
15621 # $_[0] =~ s/(.)/ sprintf '&#x%04X;', ord $1 /ego if length $_[0] eq 1 and 0xd000 <= ord $_[0] and 0xdfff >= ord $_[0]}
15622 0 ▶sub XML_format ($) {
Subroutine XML_format: not called CC=4 SCAR=30.0
Pod undocumented
15623 0 my @c = split //, $_[0];
15624 0 for my $c (@c) {
15625 0 ▶ if (0xd000 <= ord $c and 0xdfff >= ord $c) {
Branch: 1 branch
BranchTrueFalseTotal
if (53248 <= ord $c and 57343 >= ord $c) { } 0 0 0
Condition0%0/3
53248 <= ord $c and 57343 >= ord $c
!ll&&!rl&&r
000
MC/DC0%0/2
53248 <= ord $c and 57343 >= ord $c
53248 <= ord $c 57343 >= ord $c
Truth table0%0/3
A and B
A= 53248 <= ord $cB= 57343 >= ord $c
ABresult
0X0
100
111
15626 0 $c = sprintf '&#x%04X;', ord $c;
15627 } else {
15628 0 $c =~ s/([&""''\x00-\x1f\x7f-\x9f\s<>]|$rxCombining|$rxZW)/ sprintf '&#x%04X;', ord $1 /ego;
15629 }
15630 }
15631 0 $_[0] = join '', @c;
15632 }
15633 0 ▶sub XML_format_UTF_16 ($) {
Subroutine XML_format_UTF_16: not called CC=1 SCAR=6.9
Pod undocumented
15634 0 $_[0] = to_UTF16LE_units $_[0];
15635 0 XML_format $_[0];
15636 }
15637
15638 1 my %OEM2ctrl = (qw( OEM_102 0 OEM_MINUS), "\x1f", OEM_4 => "\x1b", OEM_5 => "\x1c", OEM_6 => "\x1d",
15639 CLEAR => "\x1b"); # [, \, ]
15640 1 my %OEM2cmd = (qw( OEM_102 § OEM_MINUS - ));
15641 0 ▶sub AppleMap_i_j ($$$$$;$$$$) { # http://forums.macrumors.com/archive/index.php/t-780577.html
Subroutine AppleMap_i_j: not called CC=48 SCAR=77.6
Pod undocumented
15642 0 ▶ my($self, $K, $l, $sh, $caps, $use_base, $dd, $map, $override) =
Condition0%0/6
shift() || {}
l!l
00
shift() || {}
l!l
00
shift() || {'dup', {}}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
MC/DC0%0/1
shift() || {}
shift()
MC/DC0%0/1
shift() || {'dup', {}}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
15643 (shift, shift, shift, shift, shift, shift, shift || {}, shift || {}, shift || {dup => {}});
15644 0 my $A2l = [ @{ $self->AppleMap_Base($K) } ]; # Deep copy
15645 0 my $dup = $override->{dup};
15646 0 for my $from (keys %$dup) {
15647 0 $A2l->[$from] = $A2l->[$dup->{$from}];
15648 }
15649 0 my $F = $self->get_deep($self, @$K); # Presumably a face hash, as in $K = [qw(faces US)]
15650 0 my $L = [map $self->{layers}{$_}, @{$F->{layers}}];
15651 0 $L = $L->[$l];
15652 0 ▶ my $B = $use_base && $self->Base_VK_names($K); # Partially implemented: use Base_VK_names instead of the real $F (VK_ code)
Condition0%0/3
$use_base && $self->Base_VK_names($K)
!ll&&!rl&&r
000
MC/DC0%0/2
$use_base && $self->Base_VK_names($K)
$use_base $self->Base_VK_names($K)
Truth table0%0/3
A && B
A= $use_baseB= $self->Base_VK_names($K)
ABresult
0X0
100
111
15653 0 ▶ $B = [map {defined() && /^\w$/ ? lc $_ : $_} @$B] if ($use_base || 0) > 0;
Branch: 2 branches
BranchTrueFalseTotal
if ($use_base || 0) > 0 0 0 0
defined $_ && /^\w$/ ? : 0 0 0
Condition0%0/5
$use_base || 0
l!l
00
defined $_ and /^\w$/
!ll&&!rl&&r
000
MC/DC0%0/1
$use_base || 0
$use_base
MC/DC0%0/2
defined $_ and /^\w$/
defined $_ /^\w$/
Truth table0%0/2
A
A= $use_base
Aresult
11
00
Truth table0%0/3
A and B
A= defined $_B= /^\w$/
ABresult
0X0
100
111
15654 0 ▶ @AppleMap = _AppleMap unless @AppleMap;
Branch: 1 branch
BranchTrueFalseTotal
unless @AppleMap 0 0 0
15655 0 ▶ warn 'AppleMap too long' if $#AppleMap >= 127;
Branch: 1 branch
BranchTrueFalseTotal
if $#AppleMap >= 127 0 0 0
15656 0 my $o = '';
15657 0 for my $i (0..127) {
15658 0 my($I, $d, $c, $force_o) = ($A2l->[$i], 0); # offset inside the layout array
15659 0 ▶ $c = $override->{"$l-$sh-$caps-vk=$i"} || $override->{"$l-$sh--vk=$i"} unless $use_base; # $caps is 0 or 1
Branch: 1 branch
BranchTrueFalseTotal
unless $use_base 0 0 0
Condition0%0/3
$$override{"$l-$sh-$caps-vk=$i"} || $$override{"$l-$sh--vk=$i"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$$override{"$l-$sh-$caps-vk=$i"} || $$override{"$l-$sh--vk=$i"}
$$override{"$l-$sh-$caps-vk=$i"} $$override{"$l-$sh--vk=$i"}
Truth table0%0/3
A || B
A= $$override{"$l-$sh-$caps-vk=$i"}B= $$override{"$l-$sh--vk=$i"}
ABresult
1X1
011
000
15660 # $force_o++ if defined $use_base and $use_base eq '0';
15661 0 ▶ $c = $use_base ? $B->[$I] : $L->[$I][$sh] if not defined $c and defined $I;
Branch: 2 branches
BranchTrueFalseTotal
if not defined $c and defined $I 0 0 0
$use_base ? : 0 0 0
Condition0%0/3
not defined $c and defined $I
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $c and defined $I
not defined $c defined $I
Truth table0%0/3
not(A) and B
A= not defined $cB= defined $I
ABresult
0X0
100
111
15662 0 ▶ if (($use_base || 0) < 0) { # Control
Branch: 2 branches
BranchTrueFalseTotal
if (($use_base || 0) < 0) { } 0 0 0
elsif ($use_base) { } 0 0 0
Condition0%0/2
$use_base || 0
l!l
00
MC/DC0%0/1
$use_base || 0
$use_base
Truth table0%0/2
A
A= $use_base
Aresult
11
00
15663 0 $force_o++;
15664 0 ▶ if (!defined $c) { # ignore
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $c) { } 0 0 0
elsif ($c =~ /^[A-Z]$/) { } 0 0 0
elsif (not $c =~ m[^[-0-9=.*/+]$]) { } 0 0 0
15665 } elsif ($c =~ /^[A-Z]$/) {
15666 0 $c = chr( 1 + ord($c) - ord 'A');
15667 } elsif ($c !~ /^[-0-9=.*\/+]$/) {
15668 0 $c = $OEM2ctrl{$c}; # mostly undef
15669 }
15670 } elsif ($use_base) {
15671 # warn "COMMAND-SPACE: c=<$c> OEM=<$OEM2cmd{$c}> ctrl=$oem_control{$c}" if 49 == $i;
15672 0 my $tr;
15673 0 ▶ if (!defined $c) { # ignore
Branch: 4 branches
BranchTrueFalseTotal
if (not defined $c) { } 0 0 0
elsif (defined($tr = $OEM2cmd{$c})) { } 0 0 0
elsif ($c eq 'SPACE') { } 0 0 0
elsif (defined($tr = $oem_control{$c})) { } 0 0 0
15674 } elsif (defined($tr = $OEM2cmd{$c})) {
15675 0 $c = $tr;
15676 } elsif ($c eq 'SPACE') { # %oem_control does follow the pattern below
15677 0 $c = ' ';
15678 } elsif (defined($tr = $oem_control{$c})) {
15679 0 $tr =~ s/(?<=.).*//;
15680 0 $c = $tr;
15681 } else {
15682 0 undef $c;
15683 }
15684 }
15685 0 ▶ $c = $AppleMap[$i] unless defined $c; # Fallback to US (apparently, there is no unbound "ASCII" keys in maps???); dbg to "\xffff" #
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
15686
15687 0 ▶ $o .= <<EOK, next unless defined $c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
15688 <!-- gap, $i -->
15689 EOK
15690 0 ▶ $d = $c->[2] || 0 if ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c 0 0 0
Condition0%0/2
$c->[2] || 0
l!l
00
MC/DC0%0/1
$c->[2] || 0
$c->[2]
Truth table0%0/2
A
A= $c->[2]
Aresult
11
00
15691 0 ▶ $c = $c->[0] if ref $c;
Branch: 1 branch
BranchTrueFalseTotal
if ref $c 0 0 0
15692 # On windows, CapsLock flips the case; on Mac, it upcases
15693 # ($c) = grep {$_ ne $c} uc $c, ucfirst lc $c, lc $c if !$d and $caps and (lc $c ne uc $c or lc $c ne ucfirst lc $c);
15694 0 ▶ $c = uc $c if !$d and $caps;
Branch: 1 branch
BranchTrueFalseTotal
if not $d and $caps 0 0 0
Condition0%0/3
not $d and $caps
!ll&&!rl&&r
000
MC/DC0%0/2
not $d and $caps
not $d $caps
Truth table0%0/3
not(A) and B
A= not $dB= $caps
ABresult
0X0
100
111
15695 0 ▶ $dd->{$c}[1]++ if $d > 0; # 0 for normal char, 1 for base prefix; not for hex4/hex6
Branch: 1 branch
BranchTrueFalseTotal
if $d > 0 0 0 0
15696 0 ▶ $override->{extra_actions}{$c}++ if $d < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $d < 0 0 0 0
15697 0 ▶ my $M = (!$force_o and $d >= 0 and $map->{$self->keys2hex($c)});
Condition0%0/6
!$force_o && $d >= 0 && $$map{$self->keys2hex($c)}
!ll&&!rl&&r
000
not $force_o and $d >= 0
!ll&&!rl&&r
000
MC/DC0%0/3
!$force_o && $d >= 0 && $$map{$self->keys2hex($c)}
not $force_o $d >= 0 $$map{$self->keys2hex($c)}
Truth table0%0/4
not(A) and B && C
A= not $force_oB= $d >= 0C= $$map{$self->keys2hex($c)}
ABCresult
0XX0
10X0
1100
1111
15698 0 ▶ my $pr = $M ? 'a_' : '';
Branch: 1 branch
BranchTrueFalseTotal
$M ? : 0 0 0
15699 0 ▶ $dd->{$c}[0] = $c if $M or $d > 0; # 0 for normal char, 1 for base prefix
Branch: 1 branch
BranchTrueFalseTotal
if $M or $d > 0 0 0 0
Condition0%0/3
$M or $d > 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$M or $d > 0
$M $d > 0
Truth table0%0/3
A or B
A= $MB= $d > 0
ABresult
1X1
011
000
15700 0 ▶ my($how, $pref) = ($d || $M) ? ('action', ($M ? 'a_' : '') . ($d > 0 ? 'pr_' : (!$d && '_'))) : ('output', '');
Branch: 3 branches
BranchTrueFalseTotal
$d || $M ? : 0 0 0
$M ? : 0 0 0
$d > 0 ? : 0 0 0
Condition0%0/5
$d or $M
l!l&&r!l&&!r
000
not $d and "_"
!ll
00
MC/DC0%0/2
$d or $M
$d $M
MC/DC0%0/1
not $d and "_"
not $d
Truth table0%0/3
A or B
A= $dB= $M
ABresult
1X1
011
000
Truth table0%0/2
not(A)
A= not $d
Aresult
00
11
15701 0 ▶ ($how eq 'output') ? XML_format_UTF_16 $c : XML_format $c;
Branch: 1 branch
BranchTrueFalseTotal
$how eq 'output' ? : 0 0 0
15702 0 $o .= <<EOK;
15703 <key code="$i" $how="$pref$c" />
15704 EOK
15705 }
15706 $o
15707 0 }
15708
15709 1 my $hex_states;
15710 0 ▶sub AppleMap_prefix_map ($$$$$;$$) {
Subroutine AppleMap_prefix_map: not called CC=18 SCAR=58.3
Pod undocumented
15711 0 ▶ my($o, $self, $kk, $pref, $M, $v, $doHEX, $override) = ('', shift, shift, shift, shift || {}, shift, shift, shift || {});
Condition0%0/4
shift() || {}
l!l
00
shift() || {}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
15712 0 XML_format (my $k = $kk);
15713 0 ▶ my $pr = $M ? 'a_' : '';
Branch: 1 branch
BranchTrueFalseTotal
$M ? : 0 0 0
15714 0 ▶ my $prefix = $pref ? 'pr_' : '_';
Branch: 1 branch
BranchTrueFalseTotal
$pref ? : 0 0 0
15715 0 $o .= <<EOK;
15716 <action id="$pr$prefix$k">
15717 EOK
15718 # A character and a prefix key with the same ordinal differ only in this:
15719 0 XML_format (my $oo = $v->[0]);
15720 0 ▶ my $todo = $pref ? qq(next="st_$oo") : qq(output="$oo");
Branch: 1 branch
BranchTrueFalseTotal
$pref ? : 0 0 0
15721 0 $o .= <<EOK;
15722 <when state="none" $todo />
15723 EOK
15724 0 ▶ for my $st (sort keys %{$M || {}}) {
Condition0%0/2
$M || {}
l!l
00
MC/DC0%0/1
$M || {}
$M
Truth table0%0/2
A
A= $M
Aresult
11
00
15725 0 my $v0 = $M->{$st};
15726 0 XML_format ($st = my $st0 = chr hex $st);
15727 0 my $KK = $self->key2hex($kk);
15728 0 my $ST0 = $self->key2hex($st0);
15729 my $v = $override->{"+$st0+$kk"} || $override->{"+$ST0+$kk"}
15730 0 ▶ || $override->{"+$st0+$KK"} || $override->{"+$ST0+$KK"} || $v0;
Condition0%0/12
$$override{"+$st0+$kk"} || $$override{"+$ST0+$kk"} || $$override{"+$st0+$KK"} || $$override{"+$ST0+$KK"} || $v0
l!l&&r!l&&!r
000
$$override{"+$st0+$kk"} or $$override{"+$ST0+$kk"} or $$override{"+$st0+$KK"} or $$override{"+$ST0+$KK"}
l!l&&r!l&&!r
000
$$override{"+$st0+$kk"} or $$override{"+$ST0+$kk"} or $$override{"+$st0+$KK"}
l!l&&r!l&&!r
000
$$override{"+$st0+$kk"} or $$override{"+$ST0+$kk"}
l!l&&r!l&&!r
000
MC/DC0%0/5
$$override{"+$st0+$kk"} || $$override{"+$ST0+$kk"} || $$override{"+$st0+$KK"} || $$override{"+$ST0+$KK"} || $v0
$$override{"+$st0+$kk"} $$override{"+$ST0+$kk"} $$override{"+$st0+$KK"} $$override{"+$ST0+$KK"} $v0
Truth table0%0/6
A or B or C or D || E
A= $$override{"+$st0+$kk"}B= $$override{"+$ST0+$kk"}C= $$override{"+$st0+$KK"}D= $$override{"+$ST0+$KK"}E= $v0
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
15731 0 ▶ my($d, $T) = $v->[2] || 0;
Condition0%0/2
$v->[2] || 0
l!l
00
MC/DC0%0/1
$v->[2] || 0
$v->[2]
Truth table0%0/2
A
A= $v->[2]
Aresult
11
00
15732 0 ▶ $T = chr hex $v->[0] if $d >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $d >= 0 0 0 0
15733 0 ▶ if ($d > 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($d > 0) { } 0 0 0
elsif ($d < 0) { } 0 0 0
15734 0 XML_format $T;
15735 0 $T = qq(next="st_$T");
15736 } elsif ($d < 0) { # Literal state
15737 0 $T = qq(next="$v->[0]");
15738 } else {
15739 0 XML_format_UTF_16 $T;
15740 0 $T = qq(output="$T");
15741 }
15742 0 $o .= <<EOK;
15743 <when state="st_$st" $T />
15744 EOK
15745 }
15746 0 ▶ $o .= $self->output_hex_input($hex_states, $v->[0]) if $doHEX and $v->[0] =~ /^[-u\x20_+=0-9a-f]\z/i;
Branch: 1 branch
BranchTrueFalseTotal
if $doHEX and $v->[0] =~ /^[-u\x20_+=0-9a-f]\z/i 0 0 0
Condition0%0/3
$doHEX and $v->[0] =~ /^[-u\x20_+=0-9a-f]\z/i
!ll&&!rl&&r
000
MC/DC0%0/2
$doHEX and $v->[0] =~ /^[-u\x20_+=0-9a-f]\z/i
$doHEX $v->[0] =~ /^[-u\x20_+=0-9a-f]\z/i
Truth table0%0/3
A and B
A= $doHEXB= $v->[0] =~ /^[-u\x20_+=0-9a-f]\z/i
ABresult
0X0
100
111
15747 0 $o .= <<EOK;
15748 </action>
15749 EOK
15750 0 $o;
15751 }
15752
15753 0 ▶sub AppleMap_prefix ($$;$$$$$$) { # http://forums.macrumors.com/archive/index.php/t-780577.html
Subroutine AppleMap_prefix: not called CC=28 SCAR=67.0
Pod undocumented
15754 0 ▶ my($self, $dd, $do_initing, $term, $map, $show, $override, $act) = (shift, shift, shift, shift, shift || {}, shift, shift, shift);
Condition0%0/2
shift() || {}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
15755 0 my $o = '';
15756
15757 0 ▶ my %e = %{ $override->{extra_actions} || {}}; # Deep copy
Condition0%0/2
$override->{'extra_actions'} || {}
l!l
00
MC/DC0%0/1
$override->{'extra_actions'} || {}
$override->{'extra_actions'}
Truth table0%0/2
A
A= $override->{'extra_actions'}
Aresult
11
00
15758 0 ▶ ($do_hex5 and $e{hex5}++), $e{hex6}++ if $e{hex4};
Branch: 1 branch
BranchTrueFalseTotal
if $e{"hex4"} 0 0 0
Condition0%0/3
$do_hex5 and ++$e{"hex5"}
!ll&&!rl&&r
000
MC/DC0%0/2
$do_hex5 and ++$e{"hex5"}
$do_hex5 ++$e{"hex5"}
Truth table0%0/3
A and B
A= $do_hex5B= ++$e{"hex5"}
ABresult
0X0
100
111
15759 0 my @o = @$override{grep /^\+/, keys %$override}; # honest bindings, not extra_actions/etc
15760 0 @o = map chr hex $_->[0], grep $_->[2] > 0, @o; # dead keys
15761 0 ▶ unless (%$act) { # Treat states created by the actions only
Branch: 1 branch
BranchTrueFalseTotal
unless (%$act) 0 0 0
15762 0 my %states;
15763 0 $states{$_}++ for keys(%e), @o, grep $dd->{$_}[1], keys %$dd;
15764 0 for my $v (values %$map) { # hash indexed by the prefix key
15765 0 for my $out (values %$v) {
15766 0 ▶ next if not $out->[2];
Branch: 1 branch
BranchTrueFalseTotal
unless $out->[2] 0 0 0
15767 0 my $k = $self->charhex2key($out->[0]);
15768 0 $states{$k}++;
15769 0 my $v;
15770 0 ▶ $act->{$k} = [$k] unless $v = $dd->{$k} and $v->[1]; # Skip if terminator was already created; do not create fake values
Branch: 1 branch
BranchTrueFalseTotal
unless $v = $dd->{$k} and $v->[1] 0 0 0
Condition0%0/3
$v = $dd->{$k} and $v->[1]
!ll&&!rl&&r
000
MC/DC0%0/2
$v = $dd->{$k} and $v->[1]
$v = $dd->{$k} $v->[1]
Truth table0%0/3
A and B
A= $v = $dd->{$k}B= $v->[1]
ABresult
0X0
100
111
15771 }
15772 }
15773 0 my $states = 10 + keys(%states); # Was 4100; 10: "just in case"
15774 0 ▶ $hex_states = alloc_slots( $states, $use_plan_c ? \@state_cnt_c : ($use_plan_b ? \@state_cnt_b : \@state_cnt_a));
Branch: 2 branches
BranchTrueFalseTotal
$use_plan_c ? : 0 0 0
$use_plan_b ? : 0 0 0
15775 }
15776
15777 0 ▶ if ($term and not $do_initing) { # Treat states created by the actions only
Branch: 1 branch
BranchTrueFalseTotal
if ($term and not $do_initing) 0 0 0
Condition0%0/3
$term and not $do_initing
!ll&&!rl&&r
000
MC/DC0%0/2
$term and not $do_initing
$term not $do_initing
Truth table0%0/3
A and not(B)
A= $termB= not $do_initing
ABresult
0X0
100
111
15778 0 $dd = $act; # A terminator MUST be created for every state
15779 }
15780
15781 0 my $doHEX = grep $e{"hex$_"}, 4,5,6;
15782 0 for my $kk (sort keys %$dd) {
15783 0 my $v = $dd->{$kk};
15784 0 XML_format (my $k = $kk);
15785 0 ▶ next if !!$do_initing != !!$v->[1];
Branch: 1 branch
BranchTrueFalseTotal
if !!$do_initing != !!$v->[1] 0 0 0
15786
15787 0 ▶ if ($term) {
Branch: 1 branch
BranchTrueFalseTotal
if ($term) 0 0 0
15788 0 my $Show = $show->{$self->key2hex($kk)};
15789 0 ▶ $Show = $kk unless defined $Show;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Show 0 0 0
15790 0 $Show =~ s/^(?=$rxCombining)/ /;
15791 0 XML_format $Show;
15792 0 $o .= qq(\t<when state="st_$k" output="$Show" />\n);
15793 0 next;
15794 }
15795
15796 0 my $M = $map->{$self->keys2hex($kk)};
15797 0 $o .= $self->AppleMap_prefix_map($kk, $do_initing, $M, $v, $doHEX, $override);
15798 }
15799 0 ▶ for my $a ( ($do_initing and not $term) ? sort keys %e : () ) {
Branch: 1 branch
BranchTrueFalseTotal
$do_initing && !$term ? : 0 0 0
Condition0%0/3
$do_initing and not $term
!ll&&!rl&&r
000
MC/DC0%0/2
$do_initing and not $term
$do_initing not $term
Truth table0%0/3
A and not(B)
A= $do_initingB= not $term
ABresult
0X0
100
111
15800 0 ▶ my $add = ($a =~ /^hex4\z/ and ($do_hex5 ? <<EOS : <<EOS));
Branch: 1 branch
BranchTrueFalseTotal
$do_hex5 ? : 0 0 0
Condition0%0/3
$a =~ /^hex4\z/ && ($do_hex5 ? qq[\t <when state="hex4" next="hex5" />\n\t <when state="hex5" next="hex6" />\n] : qq[\t <when state="hex4" next="hex6" />\n])
!ll&&!rl&&r
000
MC/DC0%0/2
$a =~ /^hex4\z/ && ($do_hex5 ? qq[\t <when state="hex4" next="hex5" />\n\t <when state="hex5" next="hex6" />\n] : qq[\t <when state="hex4" next="hex6" />\n])
$a =~ /^hex4\z/ ($do_hex5 ? qq[\t <when state="hex4" next="hex5" />\n\t <when state="hex5" next="hex6" />\n] : qq[\t <when state="hex4" next="hex6" />\n])
Truth table0%0/3
A && B
A= $a =~ /^hex4\z/B= ($do_hex5 ? qq[\t <when state="hex4" next="hex5" />\n\t <when state="hex5" next="hex6" />\n] : qq[\t <when state="hex4" next="hex6" />\n])
ABresult
0X0
100
111
15801 <when state="hex4" next="hex5" />
15802 <when state="hex5" next="hex6" />
15803 EOS
15804 <when state="hex4" next="hex6" />
15805 EOS
15806 0 $o .= <<EOS; # Allow similar specifications of bindings of base map and deadkey maps
15807 <action id="$a">
15808 <when state="none" next="$a" />
15809 $add </action>
15810 EOS
15811 }
15812 0 ▶ $o .= $self->output_hex_term($hex_states) if $term and $doHEX and not $do_initing; # Do only once, at the end
Branch: 1 branch
BranchTrueFalseTotal
if $term and $doHEX and not $do_initing 0 0 0
Condition0%0/6
$term and $doHEX and not $do_initing
!ll&&!rl&&r
000
$term and $doHEX
!ll&&!rl&&r
000
MC/DC0%0/3
$term and $doHEX and not $do_initing
$term $doHEX not $do_initing
Truth table0%0/4
A and B and not(C)
A= $termB= $doHEXC= not $do_initing
ABCresult
0XX0
10X0
1100
1111
15813 0 $o
15814 }
15815
15816 1 1;
15817
15818 __END__
↑ Summary