- if(exists $data{$c} && exists $data{$c}->{casefold}) {
- my $s = join(",",
- (map(hex($_), split(/\s+/, $data{$c}->{casefold})), 0));
- if(!exists $cfnums{$s}) {
- out(",\n") if $cfnum != 0;
- out("cf$cfnum\[]={$s}");
- $cfnums{$s} = $cfnum++;
+ if(exists $data{$c} && exists $data{$c}->{decomp}) {
+ $data{$c}->{decompsym} = dedupe(@{$data{$c}->{decomp}}, 0);
+ }
+}
+
+print STDERR "> composition mappings\n";
+# First we must generate the mapping of each code point to possible
+# compositions.
+for(my $c = 0; $c <= $max; ++$c) {
+ if(exists $data{$c}
+ && exists $data{$c}->{decomp}
+ && !exists $data{$c}->{compat}
+ && !$data{$c}->{Full_Composition_Exclusion}) {
+ # $c has a non-excluded canonical decomposition, i.e. it is
+ # a primary composite. Find the first code point of the decomposition
+ my $first = ${$data{$c}->{decomp}}[0];
+ if(!exists $data{$first}->{compose}) {
+ $data{$first}->{compose} = [$c];